/* =====================================================================
   NovelAuthors — Shared Auth Styles
   Unified Login + Sign Up flip-card UI
   Backend (login.php / register.php) remains untouched.
   ===================================================================== */

:root {
    --auth-bg: #fffaf4;
    --auth-line: #eadfce;
    --auth-ink: #6f5942;
    --auth-muted: #a08d78;
    --auth-gold: #bd8c4b;
    --auth-soft: #fdf9f3;
    /* Neon / electric focus colors (from the reference design) */
    --auth-neon-1: #00eaff;
    --auth-neon-2: #00aaff;
    --auth-neon-3: #006cff;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--auth-bg);
    color: var(--auth-ink);
    font-family: Tahoma, Arial, "Segoe UI", sans-serif;
    line-height: 1.8;
}



a {
    color: inherit;
    text-decoration: none;
}

/* =========================================================
   HEADER NAV
   ========================================================= */

.auth-nav {
    min-height: 72px;
    background: #fff;
    border-bottom: 1px solid var(--auth-line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 0 clamp(20px, 6vw, 90px);
}

.auth-nav .auth-brand-logo {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
}

.auth-nav .auth-brand-logo img {
    display: block;
    width: 100px;
    height: auto;
    max-width: 100px;
    object-fit: contain;
}

.auth-nav .auth-nav-link {
    color: var(--auth-gold);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    padding: 8px 0;
    transition: opacity .2s ease;
}

.auth-nav .auth-nav-link:hover { opacity: .75; }

.auth-nav-footer {
    width: min(1240px, calc(100% - 48px));
    margin: 0 auto;
    padding: 28px 0;
    color: #ad9a84;
    border-top: 1px solid var(--auth-line);
    font-size: 12px;
    text-align: center;
}



/* =========================================================
   PAGE WRAPPER
   ========================================================= */

.auth-page {
    min-height: calc(100vh - 72px);
    background:
        radial-gradient(circle at 15% 20%, rgba(201, 149, 63, .08), transparent 30%),
        radial-gradient(circle at 85% 80%, rgba(227, 184, 106, .05), transparent 28%),
        radial-gradient(circle at 50% 50%, rgba(219, 180, 115, .03) 0%, transparent 40%),
        linear-gradient(135deg, #f3ead8 0%, #efe3cd 55%, #e7d7bd 100%);
    padding: 48px 0 58px;
    position: relative;
    overflow: hidden;
}

.auth-page::before {
    content: "";
    position: absolute;
    inset: -8%;
    background:
        radial-gradient(circle at 85% 15%, rgba(201, 149, 63, .04), transparent 25%),
        radial-gradient(circle at 15% 85%, rgba(227, 184, 106, .03), transparent 25%);
    opacity: .6;
    pointer-events: none;
    /* PERF: compositor-only transform drift. This used to animate
       background-position, which repainted the whole page layer on
       the main thread every frame and made typing laggy. */
    will-change: transform;
    animation: auth-bgPan 22s ease-in-out infinite;
}

@keyframes auth-bgPan {
    0%   { transform: translate3d(0, 0, 0); }
    50%  { transform: translate3d(1.8%, 1.2%, 0); }
    100% { transform: translate3d(0, 0, 0); }
}

.auth-container {
    width: min(1120px, calc(100% - 36px));
    margin: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 26px;
    align-items: stretch;
}

/* =========================================================
   FLIP CARD
   ========================================================= */

.auth-card {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 560px;
    perspective: 1200px;
}

@media (prefers-reduced-motion: reduce) {
    .auth-card { perspective: none; }
}

.auth-card-inner {
    position: relative;
    display: grid;
    width: 100%;
    transition: transform .55s cubic-bezier(.23, .6, .55, 1);
    transform-style: preserve-3d;
    border-radius: 18px;
}

@media (prefers-reduced-motion: reduce) {
    .auth-card-inner {
        transition: none;
        transform: none !important;
    }
}

.auth-card.is-signup .auth-card-inner {
    transform: rotateY(180deg);
}

.auth-panel {
    grid-area: 1 / 1;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 22px 65px rgba(86, 65, 38, .14);
    border: 1px solid rgba(255, 255, 255, .08);
    padding: 38px;
    display: flex;
    flex-direction: column;
}

.auth-panel.login-panel {
    transform: rotateY(0deg);
}

.auth-panel.signup-panel {
    transform: rotateY(180deg);
}

@media (prefers-reduced-motion: reduce) {
    .auth-panel {
        transform: none !important;
    }

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

    .auth-card.is-signup .auth-panel.login-panel {
        display: none;
    }

    .auth-card.is-signup .auth-panel.signup-panel {
        display: flex;
    }
}

[data-theme=dark] .auth-panel {
    background: #fffaf0;
    border-color: #d8c7aa;
}

/* =========================================================
   BRAND SIDE
   ========================================================= */

.auth-brand {
    min-height: 580px;
    border-radius: 18px;
    background:
        radial-gradient(circle at 50% 30%, rgba(201, 149, 63, .09), transparent 28%),
        linear-gradient(145deg, #f8f1e4, #f3ead8);
    border: 1px solid rgba(227, 184, 106, .12);
    box-shadow: 0 22px 65px rgba(86, 65, 38, .16);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 45px;
}

.auth-brand-inner {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.auth-logo {
    width: 330px;
    max-width: 92%;
    height: auto;
    display: block;
    object-fit: contain;
    margin-bottom: 32px;
    filter: drop-shadow(0 12px 24px rgba(86, 65, 38, .16));
}

.auth-kicker {
    color: #9a6b2f;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 5px;
    margin-bottom: 12px;
}

.auth-brand h2 {
    margin: 0 0 15px;
    color: #d9b15f;
    text-shadow:
        0 0 4px rgba(255, 220, 140, .45),
        0 0 10px rgba(217, 177, 95, .25);
    font-size: 38px;
    line-height: 1.4;
    font-weight: 800;
}

.auth-brand h2 strong { color: #9a6b2f; }

.auth-brand p {
    margin: 0;
    max-width: 470px;
    color: #5f5548;
    font-size: 15px;
    line-height: 2.1;
}

.auth-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
}

.auth-tags span {
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid rgba(227, 184, 106, .18);
    background: rgba(255, 255, 255, .025);
    color: #665b4c;
    font-size: 15px;
}

.auth-features {
    width: min(480px, 100%);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 26px;
}

.auth-feature {
    padding: 13px;
    text-align: right;
    border: 1px solid rgba(227, 184, 106, .18);
    background: rgba(255, 255, 255, .025);
    border-radius: 11px;
}

.auth-feature strong {
    display: block;
    color: #9a6b2f;
    font-size: 15px;
    margin-bottom: 3px;
}

.auth-feature span {
    color: #6b6052;
    font-size: 15px;
}

/* =========================================================
   CARD HEAD + ALERT
   ========================================================= */

.auth-card-head { margin-bottom: 24px; }

.auth-card-head h1 {
    margin: 0 0 7px;
    font-size: 29px;
    line-height: 1.3;
}

.auth-card-head p {
    margin: 0;
    color: var(--auth-muted);
    font-size: 15px;
}

.auth-alert {
    margin-bottom: 18px;
    padding: 12px 14px;
    border-radius: 10px;
    color: #ad3838;
    background: rgba(173, 56, 56, .07);
    border: 1px solid rgba(173, 56, 56, .14);
    font-size: 15px;
    line-height: 1.8;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* =========================================================
   FIELDS + FLOATING LABELS
   ========================================================= */

.auth-field { margin-bottom: 16px; }

.auth-field > label,
.auth-field-label {
    display: block;
    margin-bottom: 7px;
    font-size: 15px;
    font-weight: 800;
    color: var(--auth-ink);
}

.auth-floating {
    position: relative;
}

.auth-floating input {
    width: 100%;
    height: 49px;
    display: block;      /* wrapper box == input box (exact neon geometry) */
    position: relative;  /* paint above the neon pseudo-elements */
    z-index: 1;
    border: 1px solid var(--auth-line);
    border-radius: 10px;
    background: var(--auth-soft);
    color: var(--auth-ink);
    outline: 0;
    padding: 16px 14px 4px;
    font-size: 15px;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.auth-floating input:focus {
    border-color: var(--auth-neon-2);
    box-shadow: 0 0 0 3px rgba(0, 170, 255, .14);
}

.auth-floating label {
    position: absolute;
    right: 14px;
    top: 15px;
    z-index: 2;
    pointer-events: none;
    color: var(--auth-muted);
    font-size: 15px;
    transform-origin: 100% 0; /* anchor on the RTL (right) edge */
    /* PERF: float via transform only — animating top/font-size forced
       a layout pass exactly when typing started. */
    transition: transform .2s ease, color .2s ease;
}

.auth-floating input:focus + label,
.auth-floating input:not(:placeholder-shown) + label {
    /* Equivalent to the old top:4px / font-size:11px float,
       but compositor-friendly (translate -11px, scale 11/15). */
    transform: translateY(-11px) scale(.7333);
    color: var(--auth-gold);
}

.auth-floating input.password { padding-left: 48px; }

.auth-hint {
    margin-top: 6px;
    color: var(--auth-muted);
    font-size: 15px;
    line-height: 1.7;
}

.auth-hint.is-error { color: #ad3838; font-weight: 700; }

/* =========================================================
   NEON / ELECTRIC FOCUS
   (adapted from the reference .electric-glow / .electric-border)
   — activates on :focus-within,
   — animates transform + opacity ONLY (no layout, no size change,
     no layout shift, nothing covering the text/label/toggle),
   — glow fades in/out, border spins only while focused and never
     restarts on keypress,
   — direction-agnostic, so RTL is unaffected.
   ========================================================= */

.auth-floating { isolation: isolate; }

.auth-floating::before,
.auth-floating::after {
    content: "";
    position: absolute;
    z-index: 0;          /* below input (z-index:1) and label/toggle (2) */
    opacity: 0;
    pointer-events: none;
}

/* Soft external glow — gradient falloff instead of an expensive
   filter: blur(); fades out gradually on blur. */
.auth-floating::before {
    inset: -10px;
    border-radius: 16px;
    background: radial-gradient(circle at 50% 50%,
        rgba(0, 234, 255, .40),
        rgba(0, 170, 255, .17) 45%,
        rgba(0, 108, 255, .06) 65%,
        transparent 78%);
    transition: opacity .35s ease;
}

/* Moving neon border ring */
.auth-floating::after {
    inset: -3px;
    border-radius: 13px;
    overflow: hidden;
    transition: opacity .2s ease;
}

/* Oversized square so the conic sweep never gaps while rotating.
   Rotating a static gradient = compositor-only, no repaint. */
.auth-floating::after::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 720px;
    height: 720px;
    margin: -360px 0 0 -360px;
    background: conic-gradient(
        from 0deg,
        transparent 0deg,
        transparent 30deg,
        var(--auth-neon-1) 45deg,
        var(--auth-neon-2) 65deg,
        var(--auth-neon-3) 80deg,
        transparent 100deg,
        transparent 360deg);
    animation: auth-electricSpin 3s linear infinite;
    animation-play-state: paused; /* idle until focus — zero cost */
}

.auth-floating:focus-within::before { opacity: .55; }
.auth-floating:focus-within::after { opacity: 1; }
.auth-floating:focus-within::after::before { animation-play-state: running; }

@keyframes auth-electricSpin {
    to { transform: rotate(360deg); }
}

/* =========================================================
   PASSWORD TOGGLE
   ========================================================= */

.password-toggle {
    position: absolute;
    z-index: 2; /* above the input + neon layers */
    left: 7px;
    top: 7px;
    width: 35px;
    height: 35px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--auth-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background .2s ease, color .2s ease;
}

.password-toggle:hover {
    background: rgba(201, 149, 63, .06);
    color: var(--auth-gold);
}

.password-toggle:focus-visible {
    outline: 2px solid rgba(201, 149, 63, .35);
    outline-offset: 1px;
}

.password-toggle .icon-eye-off { display: none; }
.password-toggle.is-visible .icon-eye { display: none; }
.password-toggle.is-visible .icon-eye-off { display: block; }

/* Password strength meter */
.password-meter {
    display: flex;
    gap: 4px;
    margin-top: 8px;
}

.password-meter i {
    height: 4px;
    flex: 1;
    border-radius: 999px;
    background: var(--auth-line);
}

.password-meter i.active { background: var(--auth-gold); }

/* =========================================================
   OPTIONS / LINKS / TERMS / SUBMIT
   ========================================================= */

.auth-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin: 3px 0 19px;
    font-size: 15px;
    color: var(--auth-muted);
}

.auth-options label {
    display: flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
}

.auth-options input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--auth-gold);
    cursor: pointer;
}

.auth-link {
    color: var(--auth-gold);
    font-weight: 800;
}

.auth-link:hover { color: #94681f; }

.auth-forgot {
    color: var(--auth-ink);
    font-weight: 700;
}

.auth-forgot:hover { color: var(--auth-gold); }

.auth-terms {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    margin: 3px 0 18px;
    color: var(--auth-muted);
    font-size: 15px;
    line-height: 1.7;
}

.auth-terms input {
    width: 16px;
    height: 16px;
    margin-top: 3px;
    accent-color: var(--auth-gold);
    flex: 0 0 16px;
    cursor: pointer;
}

.auth-terms a {
    color: var(--auth-gold);
    font-weight: 800;
}

.auth-submit {
    width: 100%;
    height: 50px;
    border: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, #c9953f, #ad7a31);
    color: #fff;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    text-align: center;
    box-shadow: 0 10px 25px rgba(201, 149, 63, .19);
    transition: transform .2s ease, box-shadow .2s ease;
}

.auth-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(201, 149, 63, .24);
}

.auth-submit:focus-visible {
    outline: 3px solid rgba(201, 149, 63, .28);
    outline-offset: 2px;
}

/* =========================================================
   DIVIDER + GOOGLE + BOTTOM SWITCH
   ========================================================= */

.auth-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 20px 0 14px;
    color: var(--auth-muted);
    font-size: 15px;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--auth-line);
}

.auth-google {
    width: 100%;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 1px solid var(--auth-line);
    border-radius: 10px;
    background: var(--auth-soft);
    color: var(--auth-ink);
    text-decoration: none;
    font-size: 15px;
    font-weight: 800;
    transition: background .2s ease, border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}

.auth-google:hover {
    border-color: rgba(201, 149, 63, .35);
    background: rgba(201, 149, 63, .035);
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(86, 65, 38, .07);
}

.auth-google-icon {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    display: grid;
    place-items: center;
}

.auth-google-icon svg {
    width: 20px;
    height: 20px;
    display: block;
}

.auth-bottom {
    margin-top: 21px;
    padding-top: 18px;
    text-align: center;
    border-top: 1px solid var(--auth-line);
    color: var(--auth-muted);
    font-size: 15px;
}

.auth-bottom a {
    color: var(--auth-gold);
    font-weight: 800;
}

.auth-bottom .auth-link {
    background: none;
    border: 0;
    font: inherit;
    cursor: pointer;
    padding: 0;
}

.auth-copy {
    margin-top: 14px;
    text-align: center;
    font-size: 15px;
    color: var(--auth-muted);
}

/* =========================================================
   DECORATIVE CIRCLES
   ========================================================= */

.auth-circle {
    position: absolute;
    border-radius: 50%;
    border: 22px solid;
    opacity: .55;
    pointer-events: none;
    z-index: 0;
}

.auth-circle-1 {
    width: 340px;
    height: 340px;
    top: -110px;
    left: -120px;
    border-color: #e5a94e;
    opacity: .40;
}

.auth-circle-2 {
    width: 300px;
    height: 300px;
    bottom: -110px;
    right: -90px;
    border-color: #d9c199;
    opacity: .55;
}

.auth-circle-3 {
    width: 150px;
    height: 150px;
    bottom: 15%;
    left: 6%;
    border-color: #e8c07a;
    border-width: 16px;
    opacity: .35;
}

.auth-container,
.auth-nav { position: relative; z-index: 1; }

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 900px) {
    .auth-container {
        grid-template-columns: 1fr;
        width: min(620px, calc(100% - 26px));
    }

    .auth-brand { order: 1; min-height: 430px; }

    .auth-card { order: 2; min-height: 0; }

    .auth-logo { width: 280px; }

    .auth-circle-3 { display: none; }
}

@media (max-width: 600px) {
    .auth-page { padding: 24px 0 32px; }

    .auth-container {
        width: calc(100% - 18px);
        gap: 14px;
    }

    .auth-brand {
        min-height: 370px;
        padding: 28px 18px;
        border-radius: 14px;
    }

    .auth-panel {
        padding: 24px 20px;
        border-radius: 14px;
    }

    .auth-logo { width: 235px; margin-bottom: 22px; }

    .auth-features { grid-template-columns: 1fr; }

    .auth-brand h2 { font-size: 28px; }

    .auth-card-head h1 { font-size: 25px; }

    .auth-circle-1 { width: 230px; height: 230px; border-width: 18px; top: -80px; left: -80px; }

    .auth-circle-2 { width: 200px; height: 200px; border-width: 18px; bottom: -70px; right: -60px; }
}

/* =========================================================
   REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }

    .auth-page::before {
        animation: none;
        will-change: auto;
    }

    /* Neon: keep the static ring/glow, drop the rotation */
    .auth-floating::after::before { animation: none; }
}