/**
 * Checkout Modal Styles
 *
 * Multi-step checkout modal for collecting shipping info
 *
 * @version 1.0.0
 */

/* ============================================
   Modal Overlay & Container
   ============================================ */

.checkout-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.checkout-modal.active {
    display: flex;
}

.checkout-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.checkout-modal-content {
    position: relative;
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   Modal Header
   ============================================ */

.checkout-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.checkout-modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

.checkout-modal-close {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    color: #6b7280;
    cursor: pointer;
    border-radius: 0.375rem;
    transition: all 0.2s;
}

.checkout-modal-close:hover {
    background: #f3f4f6;
    color: #111827;
}

.checkout-modal-close svg {
    width: 1.25rem;
    height: 1.25rem;
}

/* ============================================
   Modal Body
   ============================================ */

.checkout-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

/* ============================================
   Modal Footer
   ============================================ */

.checkout-modal-footer {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding: 1.5rem;
    border-top: 1px solid #e5e7eb;
}

.checkout-modal-footer button {
    min-width: 120px;
}

/* ============================================
   Progress Steps
   ============================================ */

.checkout-progress {
    margin-bottom: 2rem;
}

.checkout-progress-steps {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.checkout-progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.checkout-progress-number {
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #e5e7eb;
    color: #6b7280;
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    transition: all 0.3s;
}

.checkout-progress-step.active .checkout-progress-number {
    background: #383B3B;
    color: white;
    transform: scale(1.1);
}

.checkout-progress-step.completed .checkout-progress-number {
    background: #16a34a;
    color: white;
}

.checkout-progress-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
    text-align: center;
    transition: color 0.3s;
}

.checkout-progress-step.active .checkout-progress-label {
    color: #111827;
    font-weight: 600;
}

.checkout-progress-divider {
    flex: 1;
    height: 2px;
    background: #e5e7eb;
    margin: 0 0.5rem;
    margin-bottom: 2rem;
    transition: background 0.3s;
}

.checkout-progress-divider.completed {
    background: #16a34a;
}

/* ============================================
   Mobile Progress (Step X of Y)
   ============================================ */

.checkout-progress-mobile {
    display: none; /* Hidden by default, shown on mobile */
}

.checkout-progress-current {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.checkout-progress-step-number {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.checkout-progress-step-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #111827;
}

.checkout-progress-bar {
    width: 100%;
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
}

.checkout-progress-bar-fill {
    height: 100%;
    background: #383B3B;
    border-radius: 2px;
    transition: width 0.3s ease-out;
}

/* ============================================
   Step Content
   ============================================ */

.checkout-step {
    animation: stepFadeIn 0.3s ease-out;
}

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

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

.checkout-step-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.5rem;
}

.checkout-step-description {
    color: #6b7280;
    margin-bottom: 1.5rem;
}

/* ============================================
   Review Section
   ============================================ */

.checkout-review-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.checkout-review-section:last-of-type {
    border-bottom: none;
}

.checkout-review-section h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 0.75rem;
}

.checkout-review-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    color: #374151;
    font-size: 0.875rem;
}

.checkout-review-total {
    background: #f9fafb;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-top: 1.5rem;
}

.checkout-review-total-line {
    padding-top: 0.75rem;
    margin-top: 0.75rem;
    border-top: 2px solid #e5e7eb;
    font-size: 1.125rem;
}

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

@media (max-width: 768px) {
    .checkout-modal-content {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
        margin: 0;
    }

    .checkout-modal {
        padding: 0;
    }

    /* Hide desktop progress steps on mobile */
    .checkout-progress-desktop {
        display: none !important;
    }

    /* Show mobile progress on mobile */
    .checkout-progress-mobile {
        display: block !important;
    }

    .checkout-modal-footer {
        flex-direction: column-reverse;
    }

    .checkout-modal-footer button {
        width: 100%;
    }
}

/* ============================================
   Shipping Rates in Modal
   ============================================ */

#shipping-rates-container {
    margin-top: 1rem;
}

#shipping-rates-container .shipping-rate-option {
    margin-bottom: 0.75rem;
}

#shipping-rates-container .shipping-rate-option:last-child {
    margin-bottom: 0;
}
