﻿/* =========================================================
   AUTH + HEADER ACCOUNT – login popup, login card, user menu
   Bootstrap ki zaroorat nahi. layout.css ke baad load karein.
   Prefix: au- (login)  fn- (header user menu)
   ========================================================= */
body.au-lock {
    overflow: hidden;
}

/* =========================================================
   LOGIN POPUP
   ========================================================= */
.au {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

    .au.is-open {
        display: flex;
    }

.au-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .6);
    backdrop-filter: blur(2px);
    animation: auFade .2s ease;
}

.au-dialog {
    position: relative;
    width: min(430px, 100%);
    max-height: calc(100vh - 20px);
    max-height: calc(100dvh - 20px);
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #fff;
    border-radius: 16px;
    padding: clamp(16px, 4vw, 26px);
    box-shadow: 0 24px 60px rgba(15, 23, 42, .35);
    animation: auPop .25s ease;
}

.au-x {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: #f1f5f9;
    color: var(--fn-ink, #0f172a);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    transition: .2s;
    z-index: 2;
}

    .au-x:hover {
        background: var(--fn-primary, #4f46e5);
        color: #fff;
    }

@keyframes auFade {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes auPop {
    from {
        opacity: 0;
        transform: translateY(14px) scale(.97);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* ---------- full-page wrapper ---------- */
.au-page {
    padding: clamp(14px, 4vw, 40px) var(--fn-gutter, 12px);
}

.au-page-in {
    width: 100%;
    max-width: 430px;
    margin-inline: auto;
}

.au-card {
    background: #fff;
    border: 1px solid var(--fn-line, #e2e8f0);
    border-radius: 16px;
    padding: clamp(16px, 4vw, 26px);
    box-shadow: 0 10px 30px rgba(15, 23, 42, .08);
}

/* ---------- form content (popup + page) ---------- */
.au-head {
    text-align: center;
    margin-bottom: 14px;
}

.au-logo {
    height: 40px;
    width: auto;
    max-width: 160px;
    margin: 0 auto 8px;
    object-fit: contain;
    display: block;
}

.au-title {
    margin: 0;
    font-size: clamp(1.15rem, 3vw, 1.4rem);
    font-weight: 800;
    color: var(--fn-ink, #0f172a);
}

.au-sub {
    margin: 2px 0 0;
    font-size: .86rem;
    color: var(--fn-muted, #64748b);
}

.au-alert {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 12px;
    padding: 9px 12px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 10px;
    color: #b91c1c;
    font-size: .84rem;
    font-weight: 600;
}

    .au-alert i {
        margin-top: 2px;
    }

.au-form {
    display: grid;
    gap: 12px;
    margin: 0;
}

.au-field {
    display: grid;
    gap: 4px;
}

    .au-field label {
        font-size: .78rem;
        font-weight: 700;
        color: var(--fn-ink, #0f172a);
        text-transform: uppercase;
        letter-spacing: .04em;
        margin: 0;
    }

.au-input {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    background: var(--fn-bg, #f8fafc);
    border: 1.5px solid var(--fn-line, #e2e8f0);
    border-radius: 12px;
    transition: border-color .2s, box-shadow .2s, background .2s;
}

    .au-input:focus-within {
        background: #fff;
        border-color: var(--fn-primary, #4f46e5);
        box-shadow: 0 0 0 4px rgba(79, 70, 229, .12);
    }

    .au-input > i {
        color: var(--fn-muted, #64748b);
        font-size: .9rem;
        width: 16px;
        text-align: center;
    }

    .au-input input {
        flex: 1;
        min-width: 0;
        border: 0;
        outline: 0;
        background: transparent;
        padding: 11px 0;
        font-size: 16px; /* iOS zoom roke */
        color: var(--fn-ink, #0f172a);
    }

.au-field.has-error .au-input {
    border-color: #ef4444;
    background: #fff5f5;
}

.au-error {
    color: #dc2626;
    font-size: .76rem;
    font-weight: 600;
}

    .au-error[hidden] {
        display: none;
    }

.au-eye {
    border: 0;
    background: none;
    color: var(--fn-muted, #64748b);
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
}

    .au-eye:hover {
        color: var(--fn-primary, #4f46e5);
        background: #eef2ff;
    }

.au-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.au-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: .84rem;
    color: var(--fn-ink, #0f172a);
    cursor: pointer;
    margin: 0;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 500;
}

    .au-check input {
        position: absolute;
        opacity: 0;
        pointer-events: none;
    }

.au-box {
    width: 17px;
    height: 17px;
    border: 1.5px solid #cbd5e1;
    border-radius: 5px;
    background: #fff;
    display: grid;
    place-items: center;
    transition: .15s;
}

.au-check input:checked + .au-box {
    background: var(--fn-primary, #4f46e5);
    border-color: var(--fn-primary, #4f46e5);
}

    .au-check input:checked + .au-box::after {
        content: "";
        width: 4px;
        height: 8px;
        border: solid #fff;
        border-width: 0 2px 2px 0;
        transform: rotate(45deg) translate(-1px, -1px);
    }

.au-check input:focus-visible + .au-box {
    outline: 2px solid var(--fn-primary, #4f46e5);
    outline-offset: 2px;
}

.au-link {
    color: var(--fn-primary, #4f46e5);
    font-weight: 600;
    font-size: .84rem;
    text-decoration: none;
}

    .au-link:hover {
        text-decoration: underline;
    }

.au-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 18px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--fn-primary, #4f46e5), #7c3aed);
    color: #fff;
    font-size: .95rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform .15s, box-shadow .2s, filter .2s;
}

    .au-btn:hover {
        filter: brightness(1.08);
        box-shadow: 0 8px 20px rgba(79, 70, 229, .3);
        transform: translateY(-1px);
    }

    .au-btn.is-loading {
        pointer-events: none;
        opacity: .75;
    }

        .au-btn.is-loading i {
            animation: auSpin .8s linear infinite;
        }

@keyframes auSpin {
    to {
        transform: rotate(360deg);
    }
}

.au-or {
    position: relative;
    text-align: center;
    margin: 14px 0 10px;
    font-size: .78rem;
    color: var(--fn-muted, #64748b);
}

    .au-or::before {
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        top: 50%;
        height: 1px;
        background: var(--fn-line, #e2e8f0);
    }

    .au-or span {
        position: relative;
        background: #fff;
        padding: 0 10px;
    }

.au-social {
    display: grid;
    gap: 8px;
}

    .au-social a {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 10px 14px;
        border: 1.5px solid var(--fn-line, #e2e8f0);
        border-radius: 12px;
        background: #fff;
        color: var(--fn-ink, #0f172a);
        font-weight: 600;
        font-size: .88rem;
        text-decoration: none;
        transition: .2s;
    }

        .au-social a:hover {
            border-color: #ea4335;
            color: #ea4335;
            background: #fff5f4;
        }

.au-foot {
    margin: 14px 0 0;
    text-align: center;
    font-size: .86rem;
    color: var(--fn-muted, #64748b);
}

/* =========================================================
   HEADER: logged-in user + dropdown
   ========================================================= */
.fn-user {
    position: relative;
}

.fn-user-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    border: 0;
    background: none;
    cursor: pointer;
    font: inherit;
    font-size: .78em;
    font-weight: 600;
    color: var(--fn-ink, #0f172a);
    padding: 4px clamp(6px, 1vw, 12px);
    border-radius: 10px;
    transition: background .2s, color .2s;
}

    .fn-user-btn:hover, .fn-user.open .fn-user-btn {
        background: #eef2ff;
        color: var(--fn-primary, #4f46e5);
    }

.fn-avatar {
    width: calc(var(--fn-icon, 20px) + 6px);
    height: calc(var(--fn-icon, 20px) + 6px);
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--fn-primary, #4f46e5), #7c3aed);
    color: #fff;
    font-size: .8rem;
    font-weight: 800;
    line-height: 1;
    flex: none;
}

.fn-avatar-lg {
    width: 42px;
    height: 42px;
    font-size: 1.05rem;
}

.fn-user-name {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 90px;
    white-space: nowrap;
}

    .fn-user-name i {
        font-size: .6rem;
        transition: transform .2s;
    }

.fn-user.open .fn-user-name i {
    transform: rotate(180deg);
}

.fn-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 1150;
    width: min(270px, 92vw);
    background: #fff;
    border: 1px solid var(--fn-line, #e2e8f0);
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, .18);
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity .18s, transform .18s, visibility .18s;
}

.fn-user.open .fn-menu {
    opacity: 1;
    visibility: visible;
    transform: none;
}

.fn-menu-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    margin-bottom: 4px;
    background: var(--fn-bg, #f8fafc);
    border-radius: 10px;
}

    .fn-menu-head b {
        display: block;
        font-size: .92rem;
        color: var(--fn-ink, #0f172a);
        word-break: break-word;
    }

    .fn-menu-head small {
        display: block;
        font-size: .74rem;
        color: var(--fn-muted, #64748b);
        word-break: break-all;
    }

/* .fn-actions a ke vertical style ko menu ke liye override */
.fn-actions .fn-menu a, .fn-menu-logout button {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 10px;
    border: 0;
    border-radius: 9px;
    background: none;
    font: inherit;
    font-size: .88rem;
    font-weight: 600;
    color: var(--fn-ink, #0f172a);
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s, color .15s;
}

    .fn-actions .fn-menu a span, .fn-menu-logout button span {
        display: inline;
    }

    .fn-actions .fn-menu a i, .fn-menu-logout button i {
        width: 18px;
        text-align: center;
        font-size: .9rem;
        color: var(--fn-primary, #4f46e5);
    }

    .fn-actions .fn-menu a:hover {
        background: #eef2ff;
        color: var(--fn-primary, #4f46e5);
    }

.fn-menu-logout {
    margin: 4px 0 0;
    padding-top: 4px;
    border-top: 1px solid var(--fn-line, #e2e8f0);
}

    .fn-menu-logout button {
        color: #dc2626;
    }

        .fn-menu-logout button i {
            color: #dc2626;
        }

        .fn-menu-logout button:hover {
            background: #fef2f2;
        }

/* mobile panel: user card + logout */
.fn-mobile-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    margin-bottom: 6px;
    background: var(--fn-bg, #f8fafc);
    border-radius: 12px;
}

    .fn-mobile-user b {
        display: block;
        font-size: .95rem;
        color: var(--fn-ink, #0f172a);
    }

    .fn-mobile-user small {
        display: block;
        font-size: .76rem;
        color: var(--fn-muted, #64748b);
        word-break: break-all;
    }

.fn-mobile-logout {
    margin: 6px 0 0;
    padding-top: 6px;
    border-top: 1px solid var(--fn-line, #e2e8f0);
}

    .fn-mobile-logout button {
        display: flex;
        align-items: center;
        gap: 10px;
        width: 100%;
        padding: 10px;
        border: 0;
        border-radius: 10px;
        background: none;
        font: inherit;
        font-size: 15px;
        font-weight: 600;
        color: #dc2626;
        cursor: pointer;
    }

        .fn-mobile-logout button i {
            width: 20px;
            text-align: center;
        }

        .fn-mobile-logout button:hover {
            background: #fef2f2;
        }

.fn-mobile-panel > a.js-login {
    color: var(--fn-primary, #4f46e5);
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 991px) {
    .fn-user-name {
        display: none;
    }
    /* tablet/mobile: sirf avatar */
    .fn-user-btn {
        padding: 6px;
    }

    .fn-menu {
        position: fixed;
        top: 64px;
        right: 8px;
    }
}

@media (max-width: 479px) {
    .au {
        align-items: flex-end;
        padding: 0;
    }
    /* mobile: bottom sheet */
    .au-dialog {
        width: 100%;
        border-radius: 18px 18px 0 0;
        max-height: 94dvh;
        animation: auSheet .28s ease;
    }

    @keyframes auSheet {
        from {
            transform: translateY(100%);
        }

        to {
            transform: none;
        }
    }
}

@media (prefers-reduced-motion: reduce) {
    .au-backdrop, .au-dialog {
        animation: none;
    }

    .fn-menu {
        transition: none;
    }
}

/* =========================================================
   REGISTER + FORGOT PASSWORD  (login popup ke saath wahi panels)
   ========================================================= */
.au-panel[hidden] {
    display: none;
}

.au-panel {
    animation: auFade .2s ease;
}

.au-page-in {
    max-width: 460px;
}

.au-form-tight {
    gap: 10px;
}

.au-ok {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #047857;
}

/* password strength */
.au-meter {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}

    .au-meter i {
        flex: 1;
        height: 4px;
        border-radius: 99px;
        background: var(--fn-line, #e2e8f0);
        transition: background .2s;
    }

    .au-meter small {
        margin-left: 6px;
        min-width: 48px;
        font-size: .72rem;
        font-weight: 700;
        color: var(--fn-muted, #64748b);
    }

    .au-meter[data-s="1"] i:nth-child(-n+1) {
        background: #ef4444;
    }

    .au-meter[data-s="1"] small {
        color: #ef4444;
    }

    .au-meter[data-s="2"] i:nth-child(-n+2) {
        background: #f59e0b;
    }

    .au-meter[data-s="2"] small {
        color: #d97706;
    }

    .au-meter[data-s="3"] i:nth-child(-n+3) {
        background: #3b82f6;
    }

    .au-meter[data-s="3"] small {
        color: #2563eb;
    }

    .au-meter[data-s="4"] i:nth-child(-n+4) {
        background: #10b981;
    }

    .au-meter[data-s="4"] small {
        color: #059669;
    }

/* terms checkbox (text me links) */
.au-terms {
    align-items: flex-start;
    line-height: 1.45;
}

    .au-terms .au-box {
        flex: none;
        margin-top: 1px;
    }

.au-field.has-error .au-box {
    border-color: #ef4444;
}

/* forgot: success state */
.au-done {
    display: grid;
    justify-items: center;
    gap: 6px;
    text-align: center;
    padding: 6px 0 2px;
}

.au-done-ic {
    width: 60px;
    height: 60px;
    display: grid;
    place-items: center;
    margin-bottom: 4px;
    border-radius: 50%;
    background: #eef2ff;
    color: var(--fn-primary, #4f46e5);
    font-size: 1.5rem;
    animation: auPop .3s ease;
}

.au-hint {
    margin: 8px 0 12px;
    font-size: .82rem;
    color: var(--fn-muted, #64748b);
}

a.au-btn {
    text-decoration: none;
    color: #fff;
}

.au-btn-line {
    background: #fff;
    color: var(--fn-primary, #4f46e5) !important;
    border: 1.5px solid var(--fn-line, #e2e8f0);
}

    .au-btn-line:hover {
        background: #eef2ff;
        border-color: var(--fn-primary, #4f46e5);
        box-shadow: none;
        filter: none;
    }

.au-foot i {
    font-size: .75rem;
}

.au-done[hidden], .au-fp-form[hidden] {
    display: none;
}

.au-linkbtn {
    border: 0;
    background: none;
    padding: 0;
    font: inherit;
    font-weight: 600;
    color: var(--fn-primary, #4f46e5);
    cursor: pointer;
}

    .au-linkbtn:hover {
        text-decoration: underline;
    }
