/**
 * LinenSuit Customizer Styles
 * ===========================
 * Consolidated CSS for product customization
 * Prepared for future multi-step implementation
 *
 * @version 1.0.0
 * @date 2025-09-29
 */

/* ========================================
   Base Customizer Styles
   ======================================== */

.customizer-container {
    min-height: 600px;
    position: relative;
}

/* Size Selection Styles */
.size-box-gradient {
    background: linear-gradient(135deg, #8B7355 0%, #D4A574 50%, #8B7355 100%);
    animation: gradient-shift 3s ease infinite;
    position: relative;
    overflow: hidden;
}

.size-box-gradient::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(135deg, #FFD700, #DAA520, #B8860B, #DAA520, #FFD700);
    border-radius: inherit;
    opacity: 0;
    z-index: -1;
    animation: shimmer 3s ease infinite;
}

@keyframes gradient-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes shimmer {
    0%, 100% { opacity: 0; }
    50% { opacity: 0.5; }
}

@keyframes gradient-flow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Custom Size Modal Styles */
.custom-size-modal {
    max-height: 70vh;
    overflow-y: auto;
}

.custom-size-modal input[type="number"] {
    -moz-appearance: textfield;
}

.custom-size-modal input[type="number"]::-webkit-outer-spin-button,
.custom-size-modal input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Customization Option Cards */
.customization-option {
    cursor: pointer;
}

.customization-option.selected {
    border-color: #8B7355;
    background-color: #F9F5F1;
}

/* Image Gallery Styles */
.product-gallery {
    position: sticky;
    top: 80px;
}

.thumbnail-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.thumbnail-button {
    aspect-ratio: 4/5;
    overflow: hidden;
    border-radius: 0.25rem;
    border: 2px solid transparent;
    transition: border-color 0.3s ease;
}

.thumbnail-button:hover,
.thumbnail-button:focus {
    border-color: #8B7355;
}

.thumbnail-button.active {
    border-color: #8B7355;
}

/* Form Validation Styles */
.field-error {
    border-color: #EF4444 !important;
    background-color: #FEE2E2 !important;
}

.error-message {
    color: #DC2626;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Loading States */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: #8B7355;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========================================
   Multi-Step Styles
   ======================================== */

/* Modern Step Progress Bar with Line Through Circles */
.step-progress-container {
    display: block;
    margin: 2rem 0;
    padding: 1rem 0;
}

.step-indicators {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    margin: 0 auto;
    max-width: 600px; /* Increased from 400px to fit more steps */
}

/* Background line connecting all steps */
.step-indicators::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 3px;
    background: #E5E7EB;
    z-index: 1;
    border-radius: 2px;
}

/* Progress line that fills as user advances */
.step-indicators::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    height: 3px;
    background: linear-gradient(135deg, #635BFF, #4F46E5, #06B6D4, #10B981, #06B6D4, #4F46E5, #635BFF);
    background-size: 400% 400%;
    z-index: 2;
    border-radius: 2px;
    transition: width 0.4s ease;
    width: var(--progress-width, 0%);
    animation: gradient-flow 4s ease-in-out infinite;
}

.step-indicator {
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.step-number {
    width: 13.5px;
    height: 13.5px;
    border-radius: 50%;
    background: #F3F4F6;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.375rem;
    color: #9CA3AF;
    transition: all 0.3s ease;
    position: relative;
}

/* Larger dots on tablet and desktop */
@media (min-width: 768px) {
    .step-number {
        width: 24px;
        height: 24px;
        font-size: 0.688rem;
    }
}

/* Scale down circles when there are 10+ steps to prevent crowding */
.step-indicators:has(.step-indicator:nth-child(n+10)) .step-number {
    width: 10px;
    height: 10px;
    font-size: 0.3rem;
}

@media (min-width: 768px) {
    .step-indicators:has(.step-indicator:nth-child(n+10)) .step-number {
        width: 18px;
        height: 18px;
        font-size: 0.5rem;
    }
}

.step-number:hover {
    background: linear-gradient(135deg, #F9F5F1, #FBF7F2);
    transform: scale(1.05);
    box-shadow: 0 2px 4px rgba(139, 115, 85, 0.1);
}

/* Active step styling */
.step-indicator.active .step-number {
    background: linear-gradient(135deg, #635BFF, #4F46E5, #06B6D4, #10B981, #06B6D4, #4F46E5, #635BFF);
    background-size: 400% 400%;
    color: white;
    transform: scale(1.1);
    animation: gradient-flow 4s ease-in-out infinite;
}

/* Completed step styling */
.step-indicator.completed .step-number {
    background: linear-gradient(135deg, #635BFF, #4F46E5, #06B6D4, #10B981, #06B6D4, #4F46E5, #635BFF);
    background-size: 400% 400%;
    color: white;
    animation: gradient-flow 4s ease-in-out infinite;
}

/* Checkmark for completed steps */
.step-indicator.completed .step-number::after {
    content: '✓';
    position: absolute;
    font-size: 0.75rem;
    font-weight: 700;
    color: white; /* Ensure checkmark is visible on gradient background */
}

/* Smaller checkmark for 10+ steps */
.step-indicators:has(.step-indicator:nth-child(n+10)) .step-indicator.completed .step-number::after {
    font-size: 0.5rem;
    color: white; /* Ensure checkmark stays visible */
}

@media (min-width: 768px) {
    .step-indicators:has(.step-indicator:nth-child(n+10)) .step-indicator.completed .step-number::after {
        font-size: 0.65rem;
        color: white; /* Ensure checkmark stays visible */
    }
}

/* Hide number when showing checkmark - use color instead of font-size for better compatibility */
.step-indicator.completed .step-number {
    font-size: 0 !important; /* Override any size rules */
    color: transparent;
}

/* Step Content */
.step-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.step-content.active {
    display: block;
}

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

/* Step Navigation */
.step-navigation {
    display: block; /* Enabled for multi-step */
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #E5E7EB;
}

.step-nav-buttons {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: center;
    min-height: 2.5rem;
}

.step-nav-button {
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.05rem;
    color: #3B82F6;
    text-decoration: underline;
    padding: 0.6rem;
}

.step-nav-button:hover {
    color: #2563EB;
}

.step-nav-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Review Step Styles */
.review-section {
    background: #F9F5F1;
    padding: 1.5rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.review-section-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #1F2937;
}

.review-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #E5E7EB;
}

.review-item:last-child {
    border-bottom: none;
}

.review-item-label {
    color: #6B7280;
    font-size: 0.875rem;
}

.review-item-value {
    color: #1F2937;
    font-weight: 500;
}

.review-edit-button {
    color: #8B7355;
    font-size: 0.875rem;
    text-decoration: underline;
    cursor: pointer;
}

.review-edit-button:hover {
    color: #6B5A45;
}

/* ========================================
   Mobile Responsive Styles
   ======================================== */

@media (max-width: 768px) {
    .thumbnail-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .customization-option {
        padding: 0.75rem;
    }

    /* Multi-step mobile adjustments */
    .step-progress-container {
        margin: 1rem 0;
        padding: 0.5rem 0;
    }

    .step-indicators {
        max-width: 100%;
        margin: 0 1rem;
    }

    .step-number {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }

    .step-indicator.active .step-number {
        transform: scale(1.05); /* Smaller scale on mobile */
    }


    .review-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
}

@media (max-width: 640px) {
    .thumbnail-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ========================================
   Utility Classes
   ======================================== */

.transition-all {
    transition: all 0.3s ease;
}

.no-scroll {
    overflow: hidden;
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

.fade-out {
    animation: fadeOut 0.3s ease;
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
    .step-navigation,
    .step-progress-container,
    .thumbnail-grid,
    button {
        display: none !important;
    }

    .step-content {
        display: block !important;
    }
}