/* ============================================================================
   Auth — Login & Signup (Phase 09)
   A split "boutique" card: a dark editorial SHOWCASE panel (the signature
   grain + message-bubble gradient from the home hero) fused to a clean FORM
   panel. Built entirely on the palette CSS variables, so the 8-palette
   switcher and light/dark themes keep working. Display type: Bodoni Moda.
   ========================================================================== */

:root {
    --auth-font-display: 'Bodoni Moda', Georgia, 'Times New Roman', serif;
    --auth-radius: 26px;
}

/* ---------- Stage ------------------------------------------------------- */
.auth {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100dvh - var(--navbar-h, 65px));
    padding: clamp(18px, 4vw, 56px);
}

/* ---------- The card ---------------------------------------------------- */
.auth-card {
    position: relative;
    display: grid;
    grid-template-columns: 1.02fr 1fr;
    width: 100%;
    max-width: 960px;
    border-radius: var(--auth-radius);
    overflow: hidden;
    background: var(--bg-container-solid);
    border: 1px solid var(--border-light);
    box-shadow:
        0 2px 8px -4px var(--shadow),
        0 40px 90px -50px rgba(0, 0, 0, 0.55);
    opacity: 0;
    transform: translateY(14px);
    animation: authCardIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* =====================================================================
   SHOWCASE PANEL — always-dark editorial banner with grain texture
   ===================================================================== */
.auth-aside {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 34px;
    padding: clamp(34px, 4vw, 52px);
    isolation: isolate;
    color: #fff;
    overflow: hidden;
    background:
        radial-gradient(135% 130% at 12% 14%,
            color-mix(in srgb, var(--message-bubble) 52%, #1b1222) 0%,
            #18101f 54%, #0d0a12 100%);
}
/* grain overlay (matches the home hero / footer band) */
.auth-aside::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.34;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}
/* soft glow bloom from the accent, lower-right */
.auth-aside::after {
    content: "";
    position: absolute;
    z-index: 0;
    right: -30%;
    bottom: -34%;
    width: 75%;
    aspect-ratio: 1;
    border-radius: 50%;
    pointer-events: none;
    background: radial-gradient(circle,
        color-mix(in srgb, var(--message-bubble) 45%, transparent) 0%,
        transparent 70%);
    filter: blur(6px);
}
.auth-aside > * { position: relative; z-index: 1; }

/* staggered reveal of the showcase contents */
.auth-aside-head > *,
.auth-aside-foot { opacity: 0; animation: authRise 0.75s cubic-bezier(0.22, 1, 0.36, 1) forwards; }
.auth-wordmark        { animation-delay: 0.10s; }
.auth-eyebrow         { animation-delay: 0.18s; }
.auth-aside-title     { animation-delay: 0.26s; }
.auth-perks           { animation-delay: 0.34s; }
.auth-aside-foot      { animation-delay: 0.44s; }

.auth-wordmark {
    display: inline-block;
    font-family: var(--auth-font-display);
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1;
    color: #fff;
    text-decoration: none;
}
.auth-wordmark span { color: var(--message-bubble); font-style: italic; }

.auth-eyebrow {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 26px 0 18px;
    font-size: 11.5px;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.6);
}
.auth-eyebrow-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--message-bubble);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--message-bubble) 30%, transparent);
}

.auth-aside-title {
    margin: 0;
    font-family: var(--auth-font-display);
    font-weight: 700;
    font-size: clamp(1.9rem, 3vw, 2.55rem);
    line-height: 1.06;
    letter-spacing: -0.015em;
    text-wrap: balance;
}

.auth-perks {
    list-style: none;
    margin: 26px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.auth-perks li {
    display: flex;
    align-items: center;
    gap: 13px;
    font-size: 14.5px;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.82);
}
.auth-perks li svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    padding: 4px;
    border-radius: 50%;
    color: var(--message-bubble);
    background: color-mix(in srgb, var(--message-bubble) 18%, transparent);
}

.auth-aside-foot {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12.5px;
    letter-spacing: 0.02em;
    color: rgba(255, 255, 255, 0.66);
}
.auth-aside-foot .auth-live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #2ecc71;
    box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.25);
    animation: authPulse 2.4s ease-in-out infinite;
}
.auth-aside-foot .auth-18 {
    margin-left: auto;
    padding: 3px 9px;
    border: 1px solid rgba(255, 255, 255, 0.26);
    border-radius: 7px;
    font-weight: 700;
    font-size: 11.5px;
    letter-spacing: 0.02em;
    color: rgba(255, 255, 255, 0.88);
}

/* =====================================================================
   FORM PANEL
   ===================================================================== */
.auth-main {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(34px, 4vw, 54px);
}
.auth-main > * { opacity: 0; animation: authRise 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards; }
.auth-head      { animation-delay: 0.30s; }
.auth-messages  { animation-delay: 0.34s; }
.auth-form      { animation-delay: 0.38s; }
.auth-divider   { animation-delay: 0.46s; }
.auth-socials   { animation-delay: 0.50s; }
.auth-alt       { animation-delay: 0.56s; }

.auth-head { margin-bottom: 28px; }
.auth-title {
    margin: 0 0 8px;
    font-family: var(--auth-font-display);
    font-weight: 700;
    font-size: clamp(1.7rem, 3vw, 2.1rem);
    line-height: 1.08;
    letter-spacing: -0.015em;
    color: var(--text-primary);
}
.auth-sub {
    margin: 0;
    font-size: 14.5px;
    line-height: 1.55;
    color: var(--text-secondary);
}

/* ---------- Fields ------------------------------------------------------ */
.auth-form { display: flex; flex-direction: column; gap: 18px; }

.auth-field { display: flex; flex-direction: column; gap: 8px; }
.auth-field > label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.auth-input { position: relative; display: flex; align-items: center; }
.auth-input-icon {
    position: absolute;
    left: 15px;
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
    transition: color 0.2s ease;
}
.auth-input input {
    box-sizing: border-box;
    width: 100%;
    padding: 14px 16px 14px 44px;
    font-size: 15px;
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border-main);
    border-radius: 13px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.auth-input input::placeholder { color: var(--text-muted); }
.auth-input input:focus {
    outline: none;
    border-color: var(--message-bubble);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--message-bubble) 16%, transparent);
}
.auth-input:focus-within .auth-input-icon { color: var(--message-bubble); }

/* ---------- Submit ------------------------------------------------------ */
.auth-submit {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 4px;
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 13px;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: #fff;
    background: var(--message-bubble);
    box-shadow: 0 16px 36px -16px color-mix(in srgb, var(--message-bubble) 85%, transparent);
    transition: transform 0.2s ease, box-shadow 0.25s ease, filter 0.2s ease;
}
/* a sweeping shine on hover */
.auth-submit::after {
    content: "";
    position: absolute;
    top: 0;
    left: -120%;
    width: 70%;
    height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    transform: skewX(-18deg);
    transition: left 0.6s ease;
}
.auth-submit:hover {
    transform: translateY(-2px);
    filter: brightness(1.04);
    box-shadow: 0 20px 42px -16px color-mix(in srgb, var(--message-bubble) 90%, transparent);
}
.auth-submit:hover::after { left: 140%; }
.auth-submit:active { transform: translateY(0); }

/* ---------- Divider ----------------------------------------------------- */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 26px 0;
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border-main);
}

/* ---------- Social ------------------------------------------------------ */
.auth-socials { display: flex; flex-direction: column; gap: 12px; }
.auth-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 13px 20px;
    border-radius: 13px;
    font-size: 14.5px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border-main);
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}
.auth-google:hover {
    border-color: var(--message-bubble);
    background: var(--bg-hover);
    transform: translateY(-1px);
}
.auth-google svg { flex-shrink: 0; }

/* ---------- Footer links ------------------------------------------------ */
.auth-alt {
    margin-top: 26px;
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
}
.auth-alt a {
    color: var(--text-primary);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid color-mix(in srgb, var(--message-bubble) 60%, transparent);
    padding-bottom: 1px;
    transition: color 0.2s ease, border-color 0.2s ease;
}
.auth-alt a:hover {
    color: var(--message-bubble);
    border-color: var(--message-bubble);
}
.auth-alt .auth-alt-muted { display: block; margin-bottom: 6px; }
.auth-alt .auth-forgot { font-weight: 500; }

/* ---------- Status pages (no form: link-sent / complete / expired) ------ */
.auth-status { animation-delay: 0.3s; }
.auth-status-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    margin-bottom: 24px;
    border-radius: 50%;
    color: var(--message-bubble);
    background: color-mix(in srgb, var(--message-bubble) 14%, transparent);
    box-shadow: 0 0 0 6px color-mix(in srgb, var(--message-bubble) 7%, transparent);
}
.auth-status-icon svg { width: 27px; height: 27px; }
.auth-status .auth-title { margin-bottom: 12px; }
.auth-status .auth-sub + .auth-sub { margin-top: 10px; }
.auth-status .auth-submit { margin-top: 30px; }
.auth-status .auth-alt { margin-top: 22px; text-align: left; }

/* ---------- Messages / errors ------------------------------------------- */
.auth-messages { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.auth-message {
    padding: 12px 14px;
    border-radius: 11px;
    font-size: 14px;
    line-height: 1.4;
}
.auth-message.error {
    background: color-mix(in srgb, var(--accent-red) 12%, var(--bg-container));
    color: var(--accent-red);
    border: 1px solid color-mix(in srgb, var(--accent-red) 35%, transparent);
}
.auth-message.success {
    background: color-mix(in srgb, var(--accent-green) 12%, var(--bg-container));
    color: var(--accent-green);
    border: 1px solid color-mix(in srgb, var(--accent-green) 35%, transparent);
}

/* Django field errors + helptext */
.auth-form .errorlist {
    list-style: none;
    margin: 2px 0 0;
    padding: 0;
    font-size: 13px;
    color: var(--accent-red);
}
.auth-form .helptext {
    font-size: 12.5px;
    color: var(--text-muted);
    line-height: 1.5;
}
.auth-login .auth-form .helptext { display: none; }

/* ---------- Responsive -------------------------------------------------- */
@media (max-width: 800px) {
    .auth { padding: 0; align-items: stretch; }
    .auth-card {
        grid-template-columns: 1fr;
        max-width: 480px;
        margin: clamp(16px, 5vw, 40px) auto;
        border: none;
    }
    /* showcase collapses to a compact brand band; perks hidden to save room */
    .auth-aside {
        gap: 18px;
        padding: clamp(28px, 7vw, 40px);
    }
    .auth-aside::after { opacity: 0.7; }
    .auth-eyebrow { margin: 18px 0 14px; }
    .auth-perks { display: none; }
    .auth-aside-foot { margin-top: 4px; }
}

@media (max-width: 420px) {
    .auth-card { border-radius: 0; min-height: calc(100dvh - var(--navbar-h, 65px)); margin: 0; }
}

/* ---------- Keyframes --------------------------------------------------- */
@keyframes authCardIn {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
}
@keyframes authRise {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: none; }
}
@keyframes authPulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.25); }
    50%      { box-shadow: 0 0 0 6px rgba(46, 204, 113, 0.08); }
}

@media (prefers-reduced-motion: reduce) {
    .auth-card,
    .auth-aside-head > *,
    .auth-aside-foot,
    .auth-main > * {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
    .auth-aside-foot .auth-live-dot { animation: none !important; }
}
