/* ============================================
   Product Customization Wizard - The Magic Wizard
   ============================================ */

/* Root Variables for Wizad */
:root {
    --wizard-primary: #125439;
    --wizard-secondary: #406757;
    --wizard-accent: #d4af37; /* Gold accent */
    --wizard-bg-light: rgba(255, 255, 255, 0.95);
    --wizard-bg-glass: rgba(255, 255, 255, 0.85);
    --wizard-border: rgba(18, 84, 57, 0.15);
    --wizard-shadow: 0 8px 32px rgba(18, 84, 57, 0.1);
    --wizard-transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Modal Content Override for Wizard */
.customization-modal .customization-modal-content {
    background: linear-gradient(135deg, #fdfbf7 0%, #f4f9f6 100%);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.8);
    overflow: hidden;
    max-width: 900px;
    width: 95%;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

/* Header - Progress Orb System */
.customization-modal-header {
    background: transparent;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--wizard-border);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
    z-index: 10;
}

.modal-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.modal-header-title h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--wizard-primary);
    margin: 0;
    font-family: 'Cairo', sans-serif;
}

.modal-header-title p {
    margin: 0.25rem 0 0;
    color: var(--wizard-secondary);
    font-size: 0.9rem;
    opacity: 0.8;
}

.modal-close-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(18, 84, 57, 0.05);
    border: none;
    color: var(--wizard-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--wizard-transition);
}

.modal-close-btn:hover {
    background: rgba(18, 84, 57, 0.1);
    transform: rotate(90deg);
}

/* Wizard Steps Progress */
.wizard-progress-container {
    padding: 0 1rem;
    position: relative;
}

.wizard-progress-track {
    height: 4px;
    background: rgba(18, 84, 57, 0.1);
    border-radius: 4px;
    position: relative;
    top: 20px; /* Align with center of orbs */
    z-index: 1;
    width: 100%;
}

.wizard-progress-fill {
    height: 100%;
    background: var(--wizard-primary);
    border-radius: 4px;
    width: 0%;
    transition: width 0.5s ease;
}

.wizard-steps {
    display: flex;
    justify-content: space-between;
    position: relative;
    z-index: 2;
}

.wizard-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    width: 80px;
    cursor: pointer;
    opacity: 0.6;
    transition: var(--wizard-transition);
}

.wizard-step.active, .wizard-step.completed {
    opacity: 1;
}

.step-orb {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    border: 2px solid rgba(18, 84, 57, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--wizard-secondary);
    transition: var(--wizard-transition);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.wizard-step.active .step-orb {
    background: var(--wizard-primary);
    border-color: var(--wizard-primary);
    color: white;
    transform: scale(1.1);
    box-shadow: 0 0 0 4px rgba(18, 84, 57, 0.15);
}

.wizard-step.completed .step-orb {
    background: var(--wizard-primary);
    border-color: var(--wizard-primary);
    color: white;
}

.step-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--wizard-secondary);
}

/* Wizard Body - Floating Content */
.customization-modal-body {
    padding: 0;
    flex: 1;
    overflow-y: auto;
    position: relative;
    background: transparent;
    display: flex;
}

.wizard-content-wrapper {
    width: 100%;
    position: relative;
    padding: 2rem;
    overflow-x: hidden;
}

.step-content {
    display: none;
    animation: fadeIn 0.4s ease;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

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

/* Animations */
@keyframes slideInRight {
    from { opacity: 0; transform: translateX(50px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideOutLeft {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(-50px); }
}

.step-enter-active {
    animation: slideInRight 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.step-leave-active {
    animation: slideOutLeft 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Form Fields Styling */
.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--wizard-secondary);
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 1rem 1.25rem;
    border: 2px solid rgba(18, 84, 57, 0.1);
    border-radius: 12px;
    font-size: 1rem;
    background: white;
    transition: var(--wizard-transition);
    color: #333;
}

.form-control:focus {
    border-color: var(--wizard-primary);
    box-shadow: 0 0 0 4px rgba(18, 84, 57, 0.1);
    outline: none;
    background: white;
}

.form-control.valid {
    border-color: #28a745;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2328a745'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 12px center;
    background-size: 20px;
}

.form-control.invalid {
    border-color: #dc3545;
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Custom Select Styling */
select.form-control {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23125439' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 1rem center;
    background-size: 12px;
    padding-left: 2.5rem; /* Space for arrow */
}

/* Select Box as Cards (for Grade/Options) */
.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
}

.option-card {
    background: white;
    border: 2px solid rgba(18, 84, 57, 0.1);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: var(--wizard-transition);
    position: relative;
}

.option-card:hover {
    border-color: var(--wizard-primary);
    background: rgba(18, 84, 57, 0.05);
}

.option-card.selected {
    border-color: var(--wizard-primary);
    background: rgba(18, 84, 57, 0.1);
    font-weight: 700;
    color: var(--wizard-primary);
}

.option-card.selected::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: -10px;
    right: -10px;
    width: 24px;
    height: 24px;
    background: var(--wizard-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

/* Footer Actions */
.customization-modal-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--wizard-border);
    display: flex;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
}

.btn-wizard {
    padding: 0.8rem 2rem;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: var(--wizard-transition);
    cursor: pointer;
    border: none;
}

.btn-wizard-next {
    background: var(--wizard-primary);
    color: white;
    box-shadow: 0 4px 15px rgba(18, 84, 57, 0.3);
}

.btn-wizard-next:hover {
    background: var(--wizard-secondary);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(18, 84, 57, 0.4);
}

.btn-wizard-prev {
    background: transparent;
    color: var(--wizard-secondary);
    border: 2px solid rgba(18, 84, 57, 0.1);
}

.btn-wizard-prev:hover {
    background: rgba(18, 84, 57, 0.05);
    border-color: var(--wizard-primary);
}

/* Live Preview Side (Hidden on Mobile initially) */
.live-preview-sidebar {
    width: 320px;
    background: #f8f9fa;
    border-right: 1px solid rgba(0,0,0,0.05); /* Right border for RTL? No, checks needed. CSS is LTR usually but content RTL. Let's assume LTR layout for structure */
    /* actually for RTL layout, border-right might be on the wrong side if flex direction is row. */
    padding: 1.5rem;
    display: none; /* Shown via Media Query */
    flex-direction: column;
    justify-content: center;
}

.preview-card {
    background: white;
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.08);
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.05);
    height: fit-content;
    position: sticky;
    top: 20px;
}

.preview-header {
    background: linear-gradient(135deg, var(--wizard-primary), var(--wizard-secondary));
    padding: 1rem 1.5rem;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.preview-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

.preview-body {
    padding: 1.5rem;
    min-height: 200px;
    font-size: 0.9rem;
    color: #555;
    background: #fff;
    background-image: radial-gradient(#f0f0f0 1px, transparent 1px);
    background-size: 10px 10px;
}

.preview-item {
    margin-bottom: 0.75rem;
    border-bottom: 1px dashed #eee;
    padding-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
}

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

.preview-item .label {
    font-weight: 600;
    color: #888;
}

.preview-item .value {
    font-weight: 700;
    color: var(--wizard-primary);
}

.preview-placeholder {
    color: #aaa;
    font-style: italic;
    text-align: center;
    margin-top: 2rem;
}

.preview-footer {
    background: #f9f9f9;
    padding: 1rem;
    text-align: center;
    border-top: 1px solid #eee;
    font-weight: 700;
    color: var(--wizard-secondary);
}

/* Review Step Card */
.review-ticket {

    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.review-ticket::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: repeating-linear-gradient(45deg, var(--wizard-primary), var(--wizard-primary) 10px, transparent 10px, transparent 20px);
}

.review-row {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px dashed rgba(0,0,0,0.1);
}

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

.review-label {
    color: #666;
    font-size: 0.95rem;
}

.review-value {
    font-weight: 700;
    color: #333;
}

/* Tablet and Desktop */
@media (min-width: 992px) {
    .customization-modal-body {
        flex-direction: row; /* Sidebar on right/left? Assuming RTL page */
    }
    
    .live-preview-sidebar {
        display: flex;
        /* Border Logic for RTL */
        border-right: none;
        border-left: 1px solid rgba(0,0,0,0.05); 
    }
}

/* Mobile Responsive */
@media (max-width: 991px) {
    .customization-modal-content {
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    /* Compress Header */
    .customization-modal-header {
        padding: 1rem 1.5rem;
        gap: 1rem;
    }

    .modal-header-title h2 {
        font-size: 1.2rem;
    }

    .wizard-steps {
        justify-content: space-around;
        padding-top: 0.5rem;
    }

    .step-label {
        display: none; /* Hide labels on mobile */
    }

    .step-orb {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }

    .wizard-progress-track {
        top: 16px;
    }

    /* Full Content Width */
    .customization-modal-body {
        padding: 1rem;
    }
    
    .wizard-content-wrapper {
        padding: 0;
    }

    .step-content {
        padding: 0.5rem;
    }

    /* Thumb Friendly Footer */
    .customization-modal-footer {
        flex-direction: column-reverse; /* Next button on top */
        gap: 0.75rem;
        padding: 1rem;
    }

    .btn-wizard {
        width: 100%;
        justify-content: center;
        padding: 1rem;
    }
    
    /* Bottom Sheet Style Select Options */
    .options-grid {
        grid-template-columns: 1fr; /* Stack options */
    }
    
    .option-card {
        text-align: right;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 1.25rem;
    }
}
