/* ================================================================
   AapkaLove — Premium Authentication Overlay / Modal System
   Refined, modern, compact SaaS aesthetics
   ================================================================ */

/* ── Prevent background scroll shift ── */
body.auth-overlay-locked {
    position: fixed !important;
    width: 100% !important;
    left: 0 !important;
    right: 0 !important;
    overflow: hidden !important;
}

/* ── Fullscreen Overlay Viewport Container ── */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    box-sizing: border-box;
    overflow-x: hidden;
    overflow-y: auto;
    
    /* Invisible scrollbar on overlay viewport */
    scrollbar-width: none;
    -ms-overflow-style: none;
    
    /* Visibility & Animation initial state */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-overlay::-webkit-scrollbar {
    display: none;
}

/* Open state */
.auth-overlay.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* ── Backdrop ── */
.auth-overlay-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 12, 18, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1;
    cursor: pointer;
}

/* ── Authentication Card ── */
.auth-card {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 420px;
    background: #ffffff;
    border-radius: 18px;
    border: 1px solid rgba(226, 232, 240, 0.85);
    box-shadow: 0 20px 45px -12px rgba(15, 23, 42, 0.18),
                0 0 0 1px rgba(15, 23, 42, 0.04);
    padding: 24px 28px 26px 28px;
    box-sizing: border-box;
    margin: auto;
    
    /* Entrance Animation */
    transform: scale(0.96) translateY(8px);
    opacity: 0;
    transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    
    /* Invisible scrollbar */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.auth-card::-webkit-scrollbar {
    display: none;
}

.auth-overlay.is-open .auth-card {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* SignUp card can be slightly wider for comfortable 2-column fields */
.auth-card.auth-card-wide {
    max-width: 480px;
}

/* ── Compact Close Button ── */
.auth-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 10;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f1f5f9;
    border: 1px solid transparent;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: all 0.18s ease;
}

.auth-close-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
    transform: scale(1.05);
}

.auth-close-btn:focus-visible {
    outline: 2px solid var(--al-accent, #E0217A);
    outline-offset: 2px;
}

.auth-close-btn svg {
    width: 16px;
    height: 16px;
    stroke-width: 2.2;
}

/* ── Header Branding & Titles ── */
.auth-header {
    text-align: center;
    margin-bottom: 18px;
}

.auth-brand-logo {
    display: inline-block;
    font-family: var(--al-font-display, 'Sora', -apple-system, sans-serif);
    font-weight: 800;
    font-size: 1.35rem;
    color: #0f172a;
    text-decoration: none;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
    transition: opacity 0.15s ease;
}

.auth-brand-logo:hover {
    opacity: 0.9;
}

.auth-brand-logo span {
    color: var(--al-accent, #E0217A);
}

.auth-title {
    font-family: var(--al-font-display, 'Sora', -apple-system, sans-serif);
    font-weight: 700;
    font-size: 1.25rem;
    color: #0f172a;
    margin: 0 0 4px 0;
    letter-spacing: -0.015em;
    line-height: 1.25;
}

.auth-subtitle {
    font-family: var(--al-font-sans, 'Inter', -apple-system, sans-serif);
    font-size: 0.8125rem;
    color: #64748b;
    margin: 0;
    line-height: 1.4;
}

/* ── Alert Notices ── */
.auth-alert-container {
    margin-bottom: 14px;
}

.auth-alert-container .alert {
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.8125rem;
    margin-bottom: 0;
    border: none;
    line-height: 1.4;
}

.auth-alert-container .alert-danger {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fee2e2;
}

.auth-alert-container .alert-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #dcfce7;
}

.auth-alert-container .alert-info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #dbeafe;
}

/* ── Segmented Navigation Tabs ── */
.auth-tabs-segmented {
    display: flex;
    background: #f1f5f9;
    padding: 3px;
    border-radius: 10px;
    gap: 3px;
    margin-bottom: 16px;
}

.auth-tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 10px;
    font-size: 0.775rem;
    font-weight: 600;
    font-family: var(--al-font-sans, 'Inter', -apple-system, sans-serif);
    color: #64748b;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
}

.auth-tab-btn svg {
    width: 14px;
    height: 14px;
    stroke-width: 2;
}

.auth-tab-btn:hover {
    color: #0f172a;
}

.auth-tab-btn.is-active {
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08),
                0 1px 2px rgba(0, 0, 0, 0.04);
}

.auth-tab-panel {
    display: none;
}

.auth-tab-panel.is-active {
    display: block;
}

/* ── Form Groups & Input Fields ── */
.auth-form-group {
    margin-bottom: 13px;
    text-align: left;
}

.auth-form-row {
    display: flex;
    gap: 12px;
}

.auth-form-row .auth-form-group {
    flex: 1;
    min-width: 0;
}

.auth-label {
    display: block;
    font-size: 0.775rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 5px;
    letter-spacing: -0.01em;
}

.auth-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.auth-input-icon {
    position: absolute;
    left: 12px;
    color: #94a3b8;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.auth-input-icon svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}

.auth-input {
    width: 100%;
    height: 42px;
    padding: 0 12px 0 38px;
    font-size: 0.85rem;
    font-family: var(--al-font-sans, 'Inter', -apple-system, sans-serif);
    color: #0f172a;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 9px;
    box-sizing: border-box;
    transition: all 0.18s ease;
}

.auth-input::placeholder {
    color: #94a3b8;
}

.auth-input:hover {
    border-color: #cbd5e1;
    background: #ffffff;
}

.auth-input:focus {
    background: #ffffff;
    border-color: var(--al-accent, #E0217A);
    box-shadow: 0 0 0 3px rgba(224, 33, 122, 0.12);
    outline: none;
}

.auth-input.has-toggle {
    padding-right: 40px;
}

.auth-toggle-pwd {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    padding: 6px;
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: color 0.15s ease;
    z-index: 2;
}

.auth-toggle-pwd:hover {
    color: #475569;
}

.auth-toggle-pwd svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}

/* Select input styling */
select.auth-input {
    padding-left: 12px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

/* ── Actions Row (Remember Me & Forgot Password) ── */
.auth-actions-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 4px 0 14px 0;
    font-size: 0.8rem;
}

.auth-checkbox-label {
    display: flex;
    align-items: center;
    gap: 7px;
    color: #475569;
    cursor: pointer;
    user-select: none;
    font-weight: 500;
}

.auth-checkbox-label input[type="checkbox"] {
    width: 15px;
    height: 15px;
    border-radius: 4px;
    accent-color: var(--al-accent, #E0217A);
    cursor: pointer;
    margin: 0;
}

.auth-link-forgot {
    color: #64748b;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s ease;
}

.auth-link-forgot:hover {
    color: var(--al-accent, #E0217A);
    text-decoration: underline;
}

/* ── Primary Submit Button ── */
.auth-btn-primary {
    width: 100%;
    height: 42px;
    background: var(--al-accent, #E0217A);
    color: #ffffff;
    border: none;
    border-radius: 9px;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: var(--al-font-sans, 'Inter', -apple-system, sans-serif);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(224, 33, 122, 0.28);
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-btn-primary:hover {
    background: var(--al-accent-hover, #B81761);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(224, 33, 122, 0.35);
}

.auth-btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(224, 33, 122, 0.2);
}

.auth-btn-primary:disabled,
.auth-btn-primary.is-loading {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ── Subtle Divider ── */
.auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 14px 0;
    color: #94a3b8;
    font-size: 0.725rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #e2e8f0;
}

.auth-divider::before {
    margin-right: 12px;
}

.auth-divider::after {
    margin-left: 12px;
}

/* ── Secondary Social Button (Google) ── */
.auth-btn-google {
    width: 100%;
    height: 40px;
    background: #ffffff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-radius: 9px;
    font-size: 0.825rem;
    font-weight: 600;
    font-family: var(--al-font-sans, 'Inter', -apple-system, sans-serif);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    text-decoration: none;
    transition: all 0.18s ease;
    box-sizing: border-box;
}

.auth-btn-google:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #0f172a;
    text-decoration: none;
}

.auth-btn-google:active {
    background: #f1f5f9;
}

.auth-btn-google img,
.auth-btn-google svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ── Footer Switch Row ── */
.auth-footer-switch {
    text-align: center;
    margin-top: 14px;
    font-size: 0.8125rem;
    color: #64748b;
}

.auth-link-switch {
    color: var(--al-accent, #E0217A);
    font-weight: 600;
    text-decoration: none;
    margin-left: 3px;
    cursor: pointer;
    transition: color 0.15s ease;
}

.auth-link-switch:hover {
    color: var(--al-accent-hover, #B81761);
    text-decoration: underline;
}

/* ── OTP Verification Extra Details ── */
.auth-otp-timer {
    font-size: 0.775rem;
    color: #64748b;
    margin-top: 6px;
    font-weight: 500;
}

.auth-otp-change-link {
    display: inline-block;
    margin-top: 12px;
    font-size: 0.8rem;
    color: #64748b;
    text-decoration: underline;
    cursor: pointer;
}

.auth-otp-change-link:hover {
    color: var(--al-accent, #E0217A);
}

/* ── Terms & Conditions Checkbox (Sign Up) ── */
.auth-terms-text {
    font-size: 0.75rem;
    color: #64748b;
    line-height: 1.4;
    margin-top: 4px;
    margin-bottom: 12px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.auth-terms-text input[type="checkbox"] {
    margin-top: 2px;
    accent-color: var(--al-accent, #E0217A);
    flex-shrink: 0;
}

.auth-terms-text a {
    color: var(--al-accent, #E0217A);
    text-decoration: none;
}

.auth-terms-text a:hover {
    text-decoration: underline;
}

/* ── Password Strength Meter (Live Validation) ── */
.pwd-strength-container {
    margin-top: 6px;
    margin-bottom: 8px;
}
.pwd-strength-bars {
    display: flex;
    gap: 4px;
    height: 4px;
    margin-bottom: 4px;
}
.pwd-strength-bar {
    flex: 1;
    height: 100%;
    background: #e2e8f0;
    border-radius: 999px;
    transition: background-color 0.25s ease;
}
.pwd-strength-text {
    font-size: 0.72rem;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #64748b;
}

/* Strength states */
.strength-weak .pwd-strength-bar:nth-child(1) { background: #ef4444; }
.strength-weak .pwd-strength-text { color: #ef4444; }

.strength-medium .pwd-strength-bar:nth-child(1),
.strength-medium .pwd-strength-bar:nth-child(2) { background: #f59e0b; }
.strength-medium .pwd-strength-text { color: #d97706; }

.strength-strong .pwd-strength-bar:nth-child(1),
.strength-strong .pwd-strength-bar:nth-child(2),
.strength-strong .pwd-strength-bar:nth-child(3),
.strength-strong .pwd-strength-bar:nth-child(4) { background: #10b981; }
.strength-strong .pwd-strength-text { color: #059669; }

/* ── Trust Badge Footer ── */
.auth-trust-badge {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.725rem;
    color: #8a8aa3;
    font-weight: 500;
}
.auth-trust-badge svg {
    width: 13px;
    height: 13px;
    stroke: #10b981;
    stroke-width: 2.2;
}

/* ── Responsive adjustments ── */
@media (max-width: 520px) {
    .auth-card {
        padding: 20px 18px 22px 18px;
        border-radius: 16px;
    }
    
    .auth-close-btn {
        top: 12px;
        right: 12px;
    }
    
    .auth-form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .auth-title {
        font-size: 1.15rem;
    }
}
