/**
 * Fabric Modal for WooCommerce - Enhanced Frontend Styles
 */

/* Reset and Base Styles */
.fabric-modal-container * {
    box-sizing: border-box;
}

.fabric-modal-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
}

/* Fabric Selection Button */
.fabric-selection-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    margin: 15px 0;
}

.fabric-selection-trigger:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
    color: white;
    text-decoration: none;
}

.fabric-selection-trigger:before {
    content: "🧵";
    font-size: 18px;
}

/* Modal Overlay */
.fabric-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 999999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.fabric-modal-overlay.active {
    display: flex;
    opacity: 1;
    align-items: center;
    justify-content: center;
}

/* Modal Container */
.fabric-modal {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 1200px;
    width: 95%;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.8);
    transition: transform 0.3s ease;
    position: relative;
}

.fabric-modal-overlay.active .fabric-modal {
    transform: scale(1);
}

/* Modal Header */
.fabric-modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.fabric-modal-title {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

.fabric-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    transition: background 0.2s ease;
}

.fabric-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Modal Body */
.fabric-modal-body {
    padding: 0;
    max-height: calc(90vh - 80px);
    overflow-y: auto;
}

/* Search and Filters Section */
.fabric-search-section {
    padding: 25px 30px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.fabric-search-row {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.fabric-search-input {
    flex: 1;
    min-width: 200px;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.fabric-search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.fabric-category-filter,
.fabric-sort-select {
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    min-width: 150px;
}

.fabric-comparison-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fabric-comparison-toggle:hover {
    border-color: #667eea;
}

.fabric-comparison-toggle input {
    margin: 0;
}

/* Fabric Grid */
.fabric-grid-container {
    padding: 30px;
}

.fabric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

/* Fabric Card */
.fabric-card {
    background: white;
    border: 2px solid #f0f0f0;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.fabric-card:hover {
    border-color: #667eea;
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.fabric-card.selected {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.fabric-card-image {
    position: relative;
    height: 200px;
    overflow: hidden;
    background: #f8f9fa;
}

.fabric-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.fabric-card:hover .fabric-card-image img {
    transform: scale(1.05);
}

.fabric-card-badges {
    position: absolute;
    top: 12px;
    left: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.fabric-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.fabric-badge.featured {
    background: linear-gradient(135deg, #ff6b6b, #feca57);
    color: white;
}

.fabric-badge.eco-friendly {
    background: linear-gradient(135deg, #26de81, #20bf6b);
    color: white;
}

.fabric-card-content {
    padding: 20px;
}

.fabric-card-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: #333;
}

.fabric-card-category {
    color: #666;
    font-size: 14px;
    margin-bottom: 12px;
}

.fabric-card-specs {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.fabric-spec {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 8px;
    flex: 1;
}

.fabric-spec-label {
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
    font-weight: 600;
}

.fabric-spec-value {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-top: 2px;
}

.fabric-card-pricing {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
}

.fabric-price {
    font-size: 18px;
    font-weight: 600;
    color: #667eea;
}

.fabric-price-unit {
    font-size: 12px;
    color: #666;
    font-weight: normal;
}

.fabric-add-to-compare {
    background: transparent;
    border: 2px solid #e0e0e0;
    color: #666;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fabric-add-to-compare:hover {
    border-color: #667eea;
    color: #667eea;
}

.fabric-add-to-compare.active {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

/* Fabric Details Panel */
.fabric-details-panel {
    position: fixed;
    right: -400px;
    top: 0;
    width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.1);
    z-index: 1000000;
    transition: right 0.3s ease;
    overflow-y: auto;
}

.fabric-details-panel.active {
    right: 0;
}

.fabric-details-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    position: sticky;
    top: 0;
    z-index: 1;
}

.fabric-details-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    float: right;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.fabric-details-content {
    padding: 25px;
}

.fabric-details-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 20px;
}

.fabric-details-title {
    font-size: 22px;
    font-weight: 600;
    margin: 0 0 10px 0;
}

.fabric-details-description {
    color: #666;
    margin-bottom: 20px;
    line-height: 1.6;
}

/* Width and Quantity Selection */
.fabric-selection-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
}

.fabric-selection-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
}

.fabric-width-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.fabric-width-option {
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

.fabric-width-option:hover {
    border-color: #667eea;
}

.fabric-width-option.selected {
    border-color: #667eea;
    background: #667eea;
    color: white;
}

.fabric-width-value {
    font-size: 16px;
    font-weight: 600;
}

.fabric-width-label {
    font-size: 12px;
    opacity: 0.8;
}

.fabric-quantity-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    margin-bottom: 15px;
}

/* Pricing Display */
.fabric-pricing-display {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 2px solid #e9ecef;
}

.fabric-pricing-breakdown {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.fabric-total-price {
    font-size: 24px;
    font-weight: 600;
    color: #667eea;
    text-align: center;
    margin: 15px 0;
}

.fabric-tier-info {
    background: #e7f3ff;
    padding: 10px;
    border-radius: 6px;
    font-size: 12px;
    color: #0066cc;
    margin-top: 10px;
}

/* Product Options */
.fabric-product-options {
    margin: 25px 0;
}

.fabric-option-group {
    margin-bottom: 20px;
}

.fabric-option-label {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    display: block;
}

.fabric-option-required {
    color: #e74c3c;
}

.fabric-option-description {
    font-size: 12px;
    color: #666;
    margin-bottom: 10px;
}

/* Option Display Types */
.fabric-option-dropdown {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
}

.fabric-option-radio {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fabric-option-radio label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.fabric-option-radio label:hover {
    background: #f8f9fa;
}

.fabric-option-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.fabric-swatch {
    width: 40px;
    height: 40px;
    border: 3px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.fabric-swatch:hover {
    border-color: #667eea;
    transform: scale(1.1);
}

.fabric-swatch.selected {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.3);
}

.fabric-swatch img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Comparison Feature */
.fabric-comparison-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 3px solid #667eea;
    padding: 15px 30px;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.1);
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 1000000;
}

.fabric-comparison-bar.active {
    transform: translateY(0);
}

.fabric-comparison-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
}

.fabric-comparison-items {
    display: flex;
    gap: 15px;
    flex: 1;
}

.fabric-comparison-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 6px;
}

.fabric-comparison-thumbnail {
    width: 30px;
    height: 30px;
    border-radius: 4px;
    object-fit: cover;
}

.fabric-comparison-remove {
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    cursor: pointer;
}

.fabric-comparison-actions {
    display: flex;
    gap: 10px;
}

.fabric-compare-btn,
.fabric-clear-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fabric-compare-btn {
    background: #667eea;
    color: white;
}

.fabric-clear-btn {
    background: #6c757d;
    color: white;
}

/* Action Buttons */
.fabric-modal-actions {
    padding: 25px 30px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}

.fabric-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.fabric-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.fabric-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.fabric-btn-secondary {
    background: white;
    color: #333;
    border: 2px solid #e0e0e0;
}

.fabric-btn-secondary:hover {
    border-color: #999;
}

/* Loading States */
.fabric-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: #666;
}

.fabric-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Pagination */
.fabric-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 30px;
}

.fabric-pagination-btn {
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    background: white;
    color: #333;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fabric-pagination-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

.fabric-pagination-btn.active {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

.fabric-pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive Design */
@media (max-width: 768px) {
    .fabric-modal {
        width: 100%;
        height: 100vh;
        border-radius: 0;
        max-height: 100vh;
    }
    
    .fabric-search-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .fabric-grid {
        grid-template-columns: 1fr;
    }
    
    .fabric-details-panel {
        width: 100%;
        right: -100%;
    }
    
    .fabric-modal-actions {
        flex-direction: column;
    }
    
    .fabric-comparison-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .fabric-comparison-items {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .fabric-modal-header,
    .fabric-grid-container,
    .fabric-modal-actions {
        padding: 20px;
    }
    
    .fabric-search-section {
        padding: 20px;
    }
    
    .fabric-card-content {
        padding: 15px;
    }
    
    .fabric-card-specs {
        flex-direction: column;
        gap: 8px;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.fabric-card {
    animation: slideInUp 0.3s ease forwards;
}

.fabric-card:nth-child(2) { animation-delay: 0.1s; }
.fabric-card:nth-child(3) { animation-delay: 0.2s; }
.fabric-card:nth-child(4) { animation-delay: 0.3s; }

/* Notifications */
.fabric-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    z-index: 1000001;
    transform: translateX(400px);
    transition: transform 0.3s ease;
}

.fabric-notification.show {
    transform: translateX(0);
}

.fabric-notification.success {
    border-left: 4px solid #28a745;
}

.fabric-notification.error {
    border-left: 4px solid #dc3545;
}

.fabric-notification.warning {
    border-left: 4px solid #ffc107;
}