/**
 * Authentication UI
 *
 * - Login gate (full-screen overlay before auth)
 * - Auth container (header chip: avatar + name + logout)
 */

/* ============ LOGIN GATE ============ */

.login-gate {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0a1a14;
    z-index: var(--z-max);
    transition: opacity 0.4s ease, visibility 0.4s ease;
    overflow: hidden;
}

/* Background image layer */
.login-gate::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('/static/assets/login-bg-v2.webp') center center / cover no-repeat;
    z-index: 0;
}

/* Subtle vignette for content readability */
.login-gate::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 20%, rgba(0, 0, 0, 0.35) 100%);
    z-index: 1;
}

.login-gate.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.login-gate-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: var(--space-10);
    max-width: 420px;
}

.login-gate-logo {
    width: 120px;
    height: 120px;
    border-radius: var(--radius-2xl);
    object-fit: cover;
    margin-bottom: var(--space-6);
    background: #e8e8e8;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.5),
        0 0 60px rgba(191, 155, 81, 0.15);
    border: 2px solid rgba(191, 155, 81, 0.5);
}

.login-gate-title {
    font-family: var(--font-family-display);
    font-size: 2.8rem;
    font-weight: var(--font-weight-bold);
    color: #e8dcc8;
    letter-spacing: 6px;
    margin: 0 0 var(--space-3) 0;
    text-shadow:
        0 0 30px rgba(191, 155, 81, 0.25),
        0 2px 4px rgba(0, 0, 0, 0.5);
}

.login-gate-subtitle {
    font-size: 1rem;
    color: #c4b99a;
    margin: 0 0 var(--space-8) 0;
    opacity: 0.85;
    letter-spacing: 0.5px;
}

.login-gate-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    width: 100%;
    max-width: 280px;
    padding: 14px 32px;
    background: rgba(15, 25, 20, 0.7);
    border: 1.5px solid rgba(191, 155, 81, 0.5);
    border-radius: 100px;
    color: #e8e0d0;
    font-size: 1rem;
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-in-out);
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(191, 155, 81, 0.08);
    backdrop-filter: blur(var(--blur-md));
    -webkit-backdrop-filter: blur(var(--blur-md));
}

.login-gate-btn:hover {
    background: rgba(25, 40, 30, 0.8);
    border-color: rgba(191, 155, 81, 0.7);
    transform: var(--btn-hover-lift);
    box-shadow:
        0 6px 24px rgba(0, 0, 0, 0.5),
        0 0 30px rgba(191, 155, 81, 0.15);
}

.login-gate-btn:active {
    transform: translateY(0);
}

.login-gate-btn svg {
    width: 20px;
    height: 20px;
}

.login-gate-note {
    font-size: 0.8rem;
    color: #a89e86;
    margin: var(--space-5) 0 0 0;
    opacity: 0.7;
    letter-spacing: 0.3px;
}

/* ============ PATRON KEY GATE ============ */

.patron-gate {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0b1410;
    z-index: var(--z-max);
    transition: opacity 0.4s ease, visibility 0.4s ease;
    overflow-y: auto;
}

.patron-gate-content {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 40px 24px;
    max-width: 400px;
    width: 100%;
}

/* --- Eyebrow --- */

.patron-gate-eyebrow {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #bf9b51;
    margin: 0 0 20px 0;
}

/* --- Hero GIF --- */

.patron-gate-hero {
    width: 100%;
    max-width: 340px;
    margin-bottom: 24px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Hide hero container when image fails to load */
.patron-gate-hero:has(.patron-gate-gif[src=""]),
.patron-gate-gif:not([src]) {
    display: none;
}

.patron-gate-gif {
    display: block;
    width: 100%;
    height: auto;
}

/* --- Typography --- */

.patron-gate-headline {
    font-family: var(--font-family-display, 'Inter', system-ui, sans-serif);
    font-size: 1.5rem;
    font-weight: 700;
    color: #f0ece4;
    margin: 0 0 8px 0;
    letter-spacing: -0.01em;
}

.patron-gate-tagline {
    font-size: 0.9rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.55);
    margin: 0 0 28px 0;
    max-width: 320px;
}

/* --- Key input section --- */

.patron-key-section {
    width: 100%;
    max-width: 300px;
    margin-bottom: 20px;
}

.patron-key-input-row {
    display: flex;
    gap: 8px;
    width: 100%;
}

.patron-key-input {
    flex: 1;
    min-width: 0;
    padding: 11px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: #f0ece4;
    font-size: 0.95rem;
    letter-spacing: 3px;
    text-align: center;
    text-transform: uppercase;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.patron-key-input::placeholder {
    color: rgba(255, 255, 255, 0.2);
    letter-spacing: 0;
    text-transform: none;
    font-size: 0.85rem;
}

.patron-key-input:focus {
    border-color: rgba(191, 155, 81, 0.6);
    box-shadow: 0 0 0 3px rgba(191, 155, 81, 0.1);
}

.patron-key-submit {
    padding: 12px 20px;
    background: #bf9b51;
    border: none;
    border-radius: 8px;
    color: #0b1410;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
    white-space: nowrap;
}

.patron-key-submit:hover {
    background: #cda95e;
}

.patron-key-submit:active {
    transform: scale(0.97);
}

.patron-key-submit:disabled {
    opacity: 0.4;
    pointer-events: none;
}

.patron-key-error {
    font-size: 0.8rem;
    color: #e07060;
    margin: 10px 0 0 0;
}

/* --- Patreon CTA --- */

.patron-gate-cta {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.4);
    margin: 0;
}

.patron-gate-cta a {
    color: #bf9b51;
    font-weight: 600;
    text-decoration: none;
    margin-left: 4px;
    transition: color 0.15s ease;
}

.patron-gate-cta a:hover {
    color: #d4b06a;
    text-decoration: underline;
}

/* --- Mobile --- */

@media (max-width: 480px) {
    .patron-gate-content {
        padding: 32px 16px;
    }

    .patron-gate-hero {
        max-width: 100%;
    }

    .patron-gate-headline {
        font-size: 1.3rem;
    }
}

/* ============ NDA CONSENT GATE ============ */

.nda-gate {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0b1410;
    z-index: var(--z-max);
    transition: opacity 0.4s ease, visibility 0.4s ease;
    overflow-y: auto;
}

.nda-gate-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 40px 24px;
    max-width: 520px;
    width: 100%;
}

.nda-gate-eyebrow {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #bf9b51;
    margin: 0 0 16px 0;
}

.nda-gate-headline {
    font-family: var(--font-family-display, 'Inter', system-ui, sans-serif);
    font-size: 1.5rem;
    font-weight: 700;
    color: #f0ece4;
    margin: 0 0 24px 0;
}

.nda-gate-terms {
    text-align: left;
    width: 100%;
    max-height: 50vh;
    overflow-y: auto;
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    margin-bottom: 20px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.nda-gate-terms::-webkit-scrollbar {
    width: 6px;
}

.nda-gate-terms::-webkit-scrollbar-track {
    background: transparent;
}

.nda-gate-terms::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

.nda-gate-terms::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

.nda-gate-intro {
    font-size: 0.82rem;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.55);
    margin: 0 0 16px 0;
}

.nda-term {
    margin-bottom: 16px;
}

.nda-term:last-child {
    margin-bottom: 0;
}

.nda-term h3 {
    font-size: 0.85rem;
    font-weight: 600;
    color: #e0d8c8;
    margin: 0 0 4px 0;
}

.nda-term p {
    font-size: 0.82rem;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.55);
    margin: 0;
}

.nda-term strong {
    color: #e0d8c8;
}

.nda-gate-disclaimer {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.4);
    margin: 0 0 20px 0;
    max-width: 400px;
}

.nda-agree-btn {
    padding: 14px 48px;
    background: #bf9b51;
    border: none;
    border-radius: 8px;
    color: #0b1410;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
}

.nda-agree-btn:hover {
    background: #cda95e;
}

.nda-agree-btn:active {
    transform: scale(0.97);
}

.nda-agree-btn:disabled {
    opacity: 0.4;
    pointer-events: none;
}

@media (max-width: 480px) {
    .nda-gate-content {
        padding: 32px 16px;
    }

    .nda-gate-terms {
        max-height: 45vh;
    }
}

/* ============ AUTH CONTAINER (Header chip) ============ */

.auth-container {
    display: flex;
    align-items: center;
}

.auth-user-info {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.auth-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: none;
    margin-left: 6px;
}

.auth-user-name {
    padding: 6px var(--space-2) 6px var(--space-2);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--text-alpha-secondary);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.auth-logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 100%;
    padding: 8px 0;
    background: transparent;
    border: none;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: color var(--duration-quick), background var(--duration-quick);
}

.auth-logout-btn:hover {
    background: rgba(255, 100, 100, 0.12);
    color: rgba(255, 150, 150, 0.9);
}

/* Mobile responsive */
@media (max-width: 600px) {
    .auth-user-name {
        display: none;
    }
}
