/* ── David & Sons.co — Premium Auth UI ────────────────────────── */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(15, 17, 26, 0.8) 0%, rgba(5, 5, 10, 0.95) 100%);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.01) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 32px 64px -16px rgba(0, 0, 0, 0.8),
        inset 0 0 32px rgba(255, 255, 255, 0.02);
    border-radius: 24px;
    width: 90%;
    max-width: 480px;
    padding: 48px;
    position: relative;
    transform: scale(0.9) translateY(30px);
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    /* Responsiveness enhancements */
    max-height: 90vh;
    overflow-y: auto;
}

/* Custom Scrollbar */
.modal-card::-webkit-scrollbar {
    width: 6px;
}

.modal-card::-webkit-scrollbar-track {
    background: transparent;
}

.modal-card::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.modal-overlay.active .modal-card {
    transform: scale(1) translateY(0);
}

.modal-close {
    position: absolute;
    top: 24px;
    right: 24px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.2);
    transform: rotate(90deg);
}

.modal-tabs {
    display: flex;
    gap: 32px;
    margin-bottom: 40px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.modal-tab {
    background: none;
    border: none;
    color: #64748b;
    padding-bottom: 16px;
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: 0.02em;
    cursor: pointer;
    position: relative;
    transition: all 0.3s;
}

.modal-tab:hover {
    color: #cbd5e1;
}

.modal-tab.active {
    color: #ffffff;
}

.modal-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    border-radius: 3px;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
}

/* ── Form Styling ─────────────────────────────────────────── */

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
    animation: authSlideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    color: #94a3b8;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    background: rgba(15, 23, 42, 0.7) !important;
    /* Deep dark background for clear contrast */
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 12px;
    padding: 14px 18px;
    color: #f8fafc !important;
    font-size: 1rem;
    transition: all 0.3s ease;
}

/* Fix: Explicitly style dropdown options to prevent white-on-white issues in some browsers */
.form-group select option {
    background-color: #1e293b !important;
    color: #f1f5f9 !important;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    background: rgba(15, 23, 42, 0.9);
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

/* Password Toggle Wrapper */
.pass-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.toggle-pass {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.toggle-pass:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}

.auth-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: -8px;
    margin-bottom: 32px;
    font-size: 0.9rem;
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #94a3b8;
    cursor: pointer;
    user-select: none;
}

.checkbox-container input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.forgot-link {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s;
}

.forgot-link:hover {
    text-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

.signup-note {
    font-size: 0.8rem;
    color: #64748b;
    text-align: center;
    margin: 20px 0;
    line-height: 1.5;
}

.btn-block {
    width: 100%;
    padding: 16px !important;
    font-size: 1.1rem !important;
    letter-spacing: 0.03em;
    border-radius: 12px !important;
    box-shadow: 0 10px 20px -5px rgba(59, 130, 246, 0.3);
}

/* ── Animations ──────────────────────────────────────────── */

@keyframes authSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Browser Autofill Fix */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus {
    -webkit-text-fill-color: #f1f5f9 !important;
    -webkit-box-shadow: 0 0 0px 1000px #0f172a inset !important;
    transition: background-color 5000s ease-in-out 0s !important;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .modal-card {
        padding: 32px 24px !important;
        border-radius: 20px !important;
        width: 95% !important;
    }

    .modal-tabs {
        gap: 16px !important;
        margin-bottom: 30px !important;
    }

    .modal-tab {
        font-size: 0.95rem !important;
    }

    .form-group {
        margin-bottom: 18px !important;
    }

    .form-group input,
    .form-group select {
        padding: 12px 14px !important;
        font-size: 0.9rem !important;
    }

    .btn-block {
        padding: 14px !important;
        font-size: 1rem !important;
    }
}


.eye-icon {
    pointer-events: none;
}

/* TOTP 6-Box Styling */
.totp-container {
    display: flex;
    gap: 8px;
    justify-content: space-between;
    margin-top: 8px;
}

.totp-box {
    width: 45px !important;
    height: 50px;
    text-align: center;
    font-size: 1.5rem !important;
    padding: 0 !important;
    font-family: monospace;
    font-weight: bold;
    letter-spacing: normal;
    background: rgba(15, 23, 42, 0.7) !important;
    color: #f8fafc !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 8px !important;
    transition: all 0.3s ease;
}

.totp-box:focus {
    outline: none;
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2) !important;
    background: rgba(15, 23, 42, 0.9) !important;
    transform: translateY(-2px);
}