/* ==========================================
   MODAL STYLES
   ========================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 16px;
    overflow-y: auto;
    transition: all 0.3s ease-in-out;
}

.modal-overlay.active {
    display: flex !important;
    animation: fadeIn 0.2s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* ========================================
   LARGE MODAL OVERLAY (Steps 1 & 6)
   Base layer - z-index: 10000
   ======================================== */
.modal-overlay-large {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.modal-overlay-large.active {
    display: flex !important;
    opacity: 1;
    animation: fadeIn 0.2s ease-in-out;
}

/* Blur effect when small modal is on top */
.modal-overlay-large.blurred .modal-content {
    filter: blur(3px);
    pointer-events: none;
}

/* Large modal content - Default 50vw (Step 1 - Find Company) */
.modal-content.modal-lg {
    max-width: 50vw;
    width: 50vw;
    max-height: 90vh;
    background: var(--color-white);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-xl);
    overflow-y: auto;
    position: relative;
    animation: scaleIn 0.3s ease-in-out;
}

/* Checkout modal - Full width (Step 6 - Complete Your Order) */
.modal-content.modal-checkout {
    max-width: 90vw;
    width: 90vw;
    max-height: 90vh;
    background: var(--color-white);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-xl);
    overflow-y: auto;
    position: relative;
    animation: scaleIn 0.3s ease-in-out;
}

/* Mobile responsive */
@media (max-width: 768px) {

    .modal-content.modal-lg,
    .modal-content.modal-checkout {
        max-width: 95vw;
        width: 95vw;
        max-height: 95vh;
        padding: 10px;
    }
}

@media (max-width: 480px) {

    .modal-content.modal-lg,
    .modal-content.modal-checkout {
        max-width: 90vw;
        width: 90vw;
        max-height: 95vh;
        border-radius: 10;
        padding: 10px;
    }
}

/* ========================================
   SMALL MODAL OVERLAY (Steps 2-5)
   Top layer - z-index: 20000
   ======================================== */
.modal-overlay-small {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    z-index: 20000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    overflow-y: auto;
}

.modal-overlay-small.active {
    display: flex !important;
    opacity: 1;
    animation: fadeIn 0.2s ease-in-out;
}

/* Small modal content (600px max-width) */
.modal-overlay-small .modal-content {
    max-width: 600px;
    gap: 10px;
    width: 100%;
    max-height: 90vh;
    background: var(--color-white);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-xl);
    overflow-y: auto;
    position: relative;
    animation: scaleIn 0.3s ease-in-out;
    padding: 10px !important;
}

/* OLD STYLES - Keep for backward compatibility if needed */
.modal-content {
    background: var(--color-white);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-xl);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: scaleIn 0.3s ease-in-out;
}

.modal-header {
    position: relative;
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-back-btn {
    position: absolute;
    left: 24px;
    top: 24px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.15s ease-in-out;
    border-radius: 8px;
}

.modal-back-btn:hover {
    background: var(--color-gray-100);
    color: var(--text-primary);
}

.modal-back-btn svg {
    width: 20px;
    height: 20px;
}

.modal-close-btn {
    position: absolute;
    right: 5px;
    top: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.15s ease-in-out;
    border-radius: 8px;
}

.modal-close-btn:hover {
    background: var(--color-gray-100);
    color: var(--text-primary);
}

.modal-close-btn svg {
    width: 20px;
    height: 20px;
}

.modal-title {
    text-align: center;
    font-size: var(--font-size-2xl);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 auto;
}

.modal-body {
    padding: 0 32px 32px;
}

.modal-footer {
    padding: var(--spacing-lg) var(--spacing-xl);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: var(--spacing-md);
    justify-content: flex-end;
}

.modal-btn {
    padding: var(--spacing-md) var(--spacing-lg);
    border: none;
    border-radius: var(--border-radius-md);
    font-size: var(--font-size-base);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
}

.modal-btn-primary {
    background: var(--color-primary);
    color: var(--color-white);
}

.modal-btn-primary:hover {
    background: var(--color-primary-hover);
}

.modal-btn-secondary {
    background: transparent;
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
}

.modal-btn-secondary:hover {
    background: var(--color-primary);
    color: var(--color-white);
}

.error-message {
    padding: var(--spacing-md);
    background: var(--color-error-light);
    border: 1px solid var(--color-error);
    border-radius: var(--border-radius-md);
    color: var(--color-error);
    font-size: var(--font-size-sm);
    margin-bottom: var(--spacing-md);
}

.success-message {
    padding: var(--spacing-md);
    /* background: var(--color-primary-light); */
    /* border: 1px solid var(--color-primary); */
    border-radius: var(--border-radius-md);
    color: var(--color-primary);
    font-size: var(--font-size-sm);
    margin-bottom: var(--spacing-md);
}

@media (max-width: 480px) {
    .modal {
        width: 95%;
        margin: var(--spacing-md);
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 0px !important;
    }

    .modal-footer {
        flex-direction: column;
        gap: var(--spacing-sm);
    }
    .modal-close-btn {
    position: absolute;
    right: -10px;
    top: -10px;
}
}