/* ─── Nav Auth Elements ──────────────────────────────────────────────────── */

.auth-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

@media (max-width: 768px) {
    .auth-nav { display: none !important; }
}

.auth-signin-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 22px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border: 1.5px solid rgba(139, 92, 246, 0.5);
    cursor: pointer;
    font-family: inherit;
    color: #c4b5fd;
    background: transparent;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.auth-signin-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(109,40,217,0.0), rgba(139,92,246,0.18));
    opacity: 0;
    transition: opacity 0.2s;
}

.auth-signin-btn:hover { border-color: rgba(167,139,250,0.8); color: #fff; }
.auth-signin-btn:hover::before { opacity: 1; }

/* ─── Avatar / Dropdown ──────────────────────────────────────────────────── */

.auth-avatar-wrap { position: relative; }

.auth-avatar-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 14px 5px 5px;
    border-radius: 999px;
    background: rgba(109,40,217,0.1);
    border: 1px solid rgba(109,40,217,0.28);
    cursor: pointer;
    font-family: inherit;
    color: #e2e8f0;
    font-size: 0.82rem;
    font-weight: 600;
    transition: background 0.2s, border-color 0.2s;
}

.auth-avatar-btn:hover { background: rgba(109,40,217,0.2); border-color: rgba(139,92,246,0.5); }

.auth-avatar-circle {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6d28d9, #a78bfa);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.82rem; font-weight: 700; color: #fff; flex-shrink: 0;
}

.auth-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 9999;
    min-width: 185px;
    background: rgba(12, 10, 26, 0.97);
    border: 1px solid rgba(109,40,217,0.2);
    border-radius: 14px;
    padding: 8px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.7);
    display: none; flex-direction: column; gap: 2px;
    backdrop-filter: blur(20px);
    animation: authDropIn 0.15s cubic-bezier(0.22,1,0.36,1);
}
.auth-dropdown.open { display: flex; }
@keyframes authDropIn {
    from { opacity: 0; transform: translateY(-8px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.auth-drop-info { padding: 8px 10px 10px; border-bottom: 1px solid rgba(109,40,217,0.12); margin-bottom: 4px; }
.auth-drop-name { font-size: 0.85rem; font-weight: 700; color: #e2e8f0; }
.auth-drop-email { font-size: 0.72rem; color: #475569; margin-top: 2px; word-break: break-all; }
.auth-drop-btn {
    display: flex; align-items: center; gap: 8px;
    padding: 9px 10px; border-radius: 8px;
    background: none; border: none; cursor: pointer;
    font-family: inherit; font-size: 0.82rem; font-weight: 500;
    color: #94a3b8; width: 100%; text-align: left; transition: background 0.15s, color 0.15s;
}
.auth-drop-btn:hover { background: rgba(109,40,217,0.12); color: #c4b5fd; }
.auth-drop-btn.logout { color: #f87171; }
.auth-drop-btn.logout:hover { background: rgba(248,113,113,0.1); }

/* ─── Overlay ────────────────────────────────────────────────────────────── */

.auth-overlay {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    z-index: 10000;
    background: rgba(4, 2, 14, 0.88);
    backdrop-filter: blur(16px) saturate(1.6);
    -webkit-backdrop-filter: blur(16px) saturate(1.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto;
    overscroll-behavior: contain;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.auth-overlay.open { opacity: 1; visibility: visible; }

/* ─── Modal Shell ────────────────────────────────────────────────────────── */

.auth-modal {
    width: 100%;
    max-width: 410px;
    max-height: calc(100vh - 40px);
    max-height: calc(100dvh - 40px);
    overflow-y: auto;
    overscroll-behavior: contain;
    position: relative;
    padding: 32px 32px 24px;
    margin: auto;
    box-sizing: border-box;
    border-radius: 28px;

    background:
        radial-gradient(ellipse 120% 80% at 85% -20%, rgba(109,40,217,0.28) 0%, transparent 55%),
        radial-gradient(ellipse 60% 40% at 5% 110%, rgba(139,92,246,0.15) 0%, transparent 50%),
        #080716;

    /* outer glow ring */
    box-shadow:
        0 0 0 1px rgba(139,92,246,0.18),
        0 0 0 4px rgba(109,40,217,0.06),
        0 40px 100px rgba(0,0,0,0.8),
        0 0 120px rgba(109,40,217,0.15);

    transform: translateY(28px) scale(0.95);
    transition: transform 0.36s cubic-bezier(0.22, 1, 0.36, 1);
}

@media (max-width: 520px), (max-height: 720px) {
    .auth-overlay {
        align-items: center;
        padding: 12px;
        overflow-y: auto;
    }

    .auth-modal {
        max-height: calc(100vh - 24px);
        max-height: calc(100dvh - 24px);
        padding: 28px 20px 20px;
        border-radius: 22px;
        margin: auto;
    }
}

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

/* top shimmer line */
.auth-modal::before {
    content: '';
    position: absolute;
    top: 0; left: 15%; right: 15%; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(167,139,250,0.7) 30%, rgba(109,40,217,1) 50%, rgba(167,139,250,0.7) 70%, transparent);
    border-radius: 999px;
}

/* ─── Close Button ───────────────────────────────────────────────────────── */

.auth-modal-close {
    position: absolute;
    top: 16px; right: 18px;
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 50%;
    color: #334155;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.18s;
    z-index: 2;
}
.auth-modal-close:hover {
    background: rgba(248,113,113,0.1);
    border-color: rgba(248,113,113,0.3);
    color: #fca5a5;
    transform: rotate(90deg);
}

/* ─── Logo ───────────────────────────────────────────────────────────────── */

.auth-modal-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 22px;
}

.auth-modal-logo-text {
    font-size: 1.52rem;
    font-weight: 900;
    letter-spacing: 0.25em;
    background: linear-gradient(110deg, #ede9fe 20%, #a78bfa 55%, #7c3aed 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* ─── Tabs — underline style ─────────────────────────────────────────────── */

.auth-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    margin-bottom: 22px;
    padding: 0;
    background: none;
}

.auth-tab {
    flex: 1;
    padding: 10px 8px 11px;
    border-radius: 0;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    color: #334155;
    letter-spacing: 0.03em;
    transition: color 0.2s, border-color 0.2s;
}

.auth-tab.active {
    color: #c4b5fd;
    border-bottom-color: #8b5cf6;
    background: none;
    box-shadow: none;
}

.auth-tab:hover:not(.active) { color: #64748b; }

/* ─── Panels ─────────────────────────────────────────────────────────────── */

.auth-panel { display: none; flex-direction: column; gap: 15px; }
.auth-panel.active { display: flex; }

/* ─── Fields — bottom-border style ──────────────────────────────────────── */

.auth-field { display: flex; flex-direction: column; gap: 0; position: relative; }

.auth-label {
    font-size: 0.68rem;
    font-weight: 700;
    color: #4c1d95;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 4px;
    transition: color 0.2s;
}

.auth-field:focus-within .auth-label { color: #a78bfa; }

.auth-input {
    width: 100%;
    padding: 8px 2px 8px;
    background: transparent;
    border: none;
    border-bottom: 1.5px solid rgba(255,255,255,0.08);
    border-radius: 0;
    color: #e2e8f0;
    font-family: inherit;
    font-size: 0.9rem;
    transition: border-color 0.22s;
    outline: none;
    box-sizing: border-box;
}

.auth-input:hover { border-bottom-color: rgba(139,92,246,0.3); }

.auth-input:focus {
    border-bottom-color: #7c3aed;
    box-shadow: 0 1px 0 0 #7c3aed;
}

.auth-input.error {
    border-bottom-color: rgba(248,113,113,0.7);
    box-shadow: 0 1px 0 0 rgba(248,113,113,0.5);
}

.auth-input::placeholder { color: #1e2a3a; }

/* ─── Password Strength Bar ──────────────────────────────────────────────── */

.auth-pw-bar {
    height: 2px;
    background: rgba(255,255,255,0.04);
    overflow: hidden;
    margin-top: 8px;
}

.auth-pw-fill {
    height: 100%;
    width: 0;
    transition: width 0.35s cubic-bezier(0.22,1,0.36,1), background 0.35s;
}

/* ─── Error Banner ───────────────────────────────────────────────────────── */

.auth-error {
    background: rgba(248,113,113,0.07);
    border-left: 3px solid rgba(248,113,113,0.6);
    border-radius: 0 8px 8px 0;
    padding: 8px 12px;
    font-size: 0.81rem;
    color: #fca5a5;
    display: none;
    line-height: 1.45;
}
.auth-error.show { display: block; }

/* ─── Submit Button ──────────────────────────────────────────────────────── */

.auth-submit {
    margin-top: 2px;
    padding: 12px;
    border-radius: 14px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #fff;
    background: linear-gradient(135deg, #4c1d95 0%, #6d28d9 40%, #7c3aed 70%, #8b5cf6 100%);
    background-size: 200% 200%;
    background-position: 0% 50%;
    box-shadow: 0 8px 32px rgba(109,40,217,0.5), 0 2px 8px rgba(0,0,0,0.3);
    position: relative;
    overflow: hidden;
    transition: background-position 0.4s ease, box-shadow 0.25s, transform 0.18s;
}

.auth-submit::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, transparent 30%, rgba(255,255,255,0.12) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 0.55s ease;
}

.auth-submit:hover::after { transform: translateX(100%); }
.auth-submit:hover {
    background-position: 100% 50%;
    box-shadow: 0 12px 48px rgba(109,40,217,0.65), 0 2px 8px rgba(0,0,0,0.3);
    transform: translateY(-2px);
}
.auth-submit:active { transform: translateY(0); }
.auth-submit:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }

.auth-submit-spinner {
    display: none;
    width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,0.25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: kvSpin 0.65s linear infinite;
    margin: 0 auto;
}
.auth-submit.loading .auth-submit-text  { display: none; }
.auth-submit.loading .auth-submit-spinner { display: block; }
@keyframes kvSpin { to { transform: rotate(360deg); } }

/* ─── Divider ────────────────────────────────────────────────────────────── */

.auth-divider {
    display: flex; align-items: center;
    color: #1e293b; font-size: 0.7rem;
    font-weight: 700; letter-spacing: 0.1em;
    text-transform: uppercase; gap: 12px;
}
.auth-divider::before,
.auth-divider::after {
    content: ''; flex: 1; height: 1px;
    background: rgba(255,255,255,0.05);
}

/* ─── AniList OAuth Button ───────────────────────────────────────────────── */

.auth-anilist-btn {
    display: flex; align-items: center; justify-content: center;
    gap: 10px; padding: 10px 14px;
    border-radius: 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    color: #94a3b8;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.86rem;
    font-weight: 600;
    transition: all 0.2s;
}
.auth-anilist-btn:hover {
    background: rgba(2,169,255,0.07);
    border-color: rgba(2,169,255,0.25);
    color: #7dd3fc;
    box-shadow: 0 0 20px rgba(2,169,255,0.08);
}

/* ─── Switch Link ────────────────────────────────────────────────────────── */

.auth-switch {
    text-align: center; font-size: 0.79rem; color: #1e293b; margin-top: -4px;
}
.auth-switch a,
.auth-switch button {
    color: #7c3aed; font-weight: 700; cursor: pointer; text-decoration: none; transition: color 0.15s;
    background: none; border: 0; padding: 0; font: inherit;
}
.auth-switch a:hover,
.auth-switch button:hover { color: #a78bfa; }

/* ─── reCAPTCHA Terms ────────────────────────────────────────────────────── */

.auth-recaptcha-terms {
    margin-top: 16px; text-align: center;
    font-size: 0.62rem; color: #1e293b; line-height: 1.5;
}
.auth-recaptcha-terms a { color: #1e293b; text-decoration: underline; transition: color 0.15s; }
.auth-recaptcha-terms a:hover { color: #7c3aed; }
.grecaptcha-badge { visibility: hidden !important; }

/* ─── Auth Toast ─────────────────────────────────────────────────────────── */

.auth-toast {
    position: fixed; bottom: 24px; right: 24px;
    z-index: 99999;
    background: rgba(8, 7, 22, 0.96);
    border: 1px solid rgba(74,222,128,0.25);
    border-radius: 14px;
    padding: 13px 18px;
    display: flex; align-items: center; gap: 10px;
    color: #86efac; font-size: 0.84rem; font-weight: 600;
    box-shadow: 0 12px 40px rgba(0,0,0,0.55), 0 0 20px rgba(74,222,128,0.06);
    backdrop-filter: blur(16px);
    animation: authToastIn 0.3s cubic-bezier(0.22,1,0.36,1);
}
@keyframes authToastIn {
    from { opacity: 0; transform: translateY(14px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
