/*
 * Auth pages (login / register / forgot / new password).
 *
 * Layout is driven by the panel artwork (character + frame), not by a
 * blurred photo + glass card. The artwork is a fixed 1406x709 image;
 * every position below is a percentage measured off that image, so the
 * markup lines up with it at any screen size as long as the container
 * keeps a 1406:709 aspect ratio.
 *
 * Asset: save the panel image as /img/background/auth-panel.png
 * (the copy in this delivery is named auth-panel.png).
 *
 * Note on the title: the artwork you sent has "Log in to your account"
 * baked into the graphic. That's fine for the login/register screens,
 * but "new password" needs its own title, and both need to work in
 * English and Khmer. Two ways to handle it:
 *   1) export one panel per screen/locale with the right title baked in, or
 *   2) export a "clean" panel with no title, and let .auth-heading below
 *      render the real (translatable) title in HTML.
 * This file assumes (2) — it renders a real heading — because it's the
 * only version that doesn't need a new export for every string. If you
 * go with (1) instead, just add a `.auth-heading{ ... sr-only rule }`
 * and keep the image's title as the visible one.
 */

:root {
    --auth-page-bg: #0b141e;
    --auth-page-bg-2: #0f1c2b;

    --auth-parchment: #eceae6;
    --auth-parchment-dim: #dedbd6;
    --auth-slate: #aab1bd;

    --auth-ink: #262b36;
    --auth-ink-soft: #5b6270;
    --auth-line: rgba(38, 43, 54, 0.16);

    --auth-gold-1: #e3c37f;
    --auth-gold-2: #9c7a3f;
    --auth-gold-3: #6e5228;

    --auth-error: #b3372c;
    --auth-error-bg: #fbebe9;
    --auth-success: #1f7a52;
    --auth-success-bg: #e9f6ef;

    /* percentages measured off the 1406x709 panel artwork */
    --panel-ratio: 1406 / 709;
    --field-left: 39%;
    --field-width: 28.3%;
    --field-top: 21%;
    --field-bottom: 7%;
}

html,
body.auth-page {
    min-height: 100%;
}

body.auth-page {
    background: radial-gradient(120% 140% at 50% 0%, var(--auth-page-bg-2), var(--auth-page-bg) 60%);
    color: var(--auth-ink);
}

.auth-container {
    align-items: center;
    display: flex;
    justify-content: center;
    min-height: 100svh;
    padding: 32px 20px;
    width: 100%;
}

/* ---------- panel ---------- */

.auth-card {
    aspect-ratio: var(--panel-ratio);
    background: url('../img/background/auth-panel.png') center / 100% 100% no-repeat;
    max-width: 1050px;
    position: relative;
    width: 100%;
}

.auth-brand {
    display: none; /* the artwork carries the branding on this layout */
}

/* the readable content sits inside the artwork's light panel */
.auth-card__inner {
    bottom: var(--field-bottom);
    display: flex;
    flex-direction: column;
    justify-content: center;
    left: var(--field-left);
    position: absolute;
    top: var(--field-top);
    width: var(--field-width);
}

.auth-card__header {
    margin-bottom: clamp(10px, 2.2vw, 20px);
    text-align: center;
}

.auth-heading {
    align-items: center;
    color: var(--auth-ink);
    display: flex;
    font-size: clamp(15px, 1.7vw, 19px);
    font-weight: 700;
    gap: 10px;
    justify-content: center;
    line-height: 1.3;
    margin: 0;
}

.auth-heading::before,
.auth-heading::after {
    background: linear-gradient(90deg, transparent, var(--auth-gold-2));
    content: "";
    height: 1px;
    width: clamp(14px, 3vw, 28px);
}

.auth-heading::after {
    background: linear-gradient(90deg, var(--auth-gold-2), transparent);
}

.auth-note {
    color: var(--auth-ink-soft);
    font-size: clamp(11px, 1vw, 13px);
    line-height: 1.6;
    margin: 8px auto 0;
    max-width: 34ch;
}

/* ---------- alert ---------- */

.auth-alert,
.alert {
    background: var(--auth-error-bg);
    border: 1px solid rgba(179, 55, 44, 0.28);
    border-left: 3px solid var(--auth-error);
    border-radius: 8px;
    color: var(--auth-error);
    font-size: 12px;
    line-height: 1.5;
    margin: 0 0 12px;
    padding: 9px 11px;
    text-align: left !important;
}

.alert-success {
    background: var(--auth-success-bg);
    border-color: rgba(31, 122, 82, 0.28);
    border-left-color: var(--auth-success);
    color: var(--auth-success);
}

/* ---------- fields ---------- */

.auth-card .form-group {
    margin-bottom: clamp(8px, 1.4vw, 14px);
}

.auth-card .auth-field label {
    color: var(--auth-ink-soft);
    display: block;
    font-size: clamp(10px, 0.95vw, 12px);
    font-weight: 600;
    margin: 0 0 5px;
}

.auth-control {
    position: relative;
}

.auth-control__icon {
    color: var(--auth-ink-soft);
    font-size: 13px;
    left: 13px;
    pointer-events: none;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}

.auth-card form .auth-control .form-control {
    background: #fff;
    border: 1px solid var(--auth-line);
    border-radius: 8px;
    color: var(--auth-ink);
    font-size: clamp(12px, 1.1vw, 14px);
    height: clamp(34px, 4.2vw, 44px);
    padding: 0 40px 0 36px;
    transition: border-color 140ms ease, box-shadow 140ms ease;
    width: 100%;
}

.auth-card form .auth-control .form-control::placeholder {
    color: #9aa0ab;
}

.auth-card form .auth-control .form-control:hover {
    border-color: var(--auth-gold-2);
}

.auth-card form .auth-control .form-control:focus {
    border-color: var(--auth-gold-2);
    box-shadow: 0 0 0 3px rgba(156, 122, 63, 0.18);
    outline: 0;
}

.auth-password-toggle {
    align-items: center;
    background: transparent;
    border: 0;
    color: var(--auth-ink-soft);
    display: inline-flex;
    height: 28px;
    justify-content: center;
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
}

.auth-password-toggle:hover,
.auth-password-toggle:focus-visible {
    color: var(--auth-ink);
    outline: 0;
}

.auth-row {
    align-items: center;
    display: flex;
    justify-content: flex-end;
    margin: -2px 0 12px;
}

.auth-card form .forget-pass a,
.auth-card form .link a {
    color: var(--auth-gold-3);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
}

.auth-card form .forget-pass a:hover,
.auth-card form .link a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ---------- submit ---------- */

.auth-submit.button {
    align-items: center;
    background: linear-gradient(180deg, var(--auth-gold-1), var(--auth-gold-2));
    border: 1px solid var(--auth-gold-3);
    border-radius: 8px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 6px 14px rgba(110, 82, 40, 0.28);
    color: #3b2c10;
    display: inline-flex;
    font-size: clamp(12px, 1.1vw, 14px);
    font-weight: 700;
    height: clamp(34px, 4.2vw, 44px);
    justify-content: center;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
    transition: filter 140ms ease, transform 140ms ease;
    width: 100%;
}

.auth-submit.button:hover {
    filter: brightness(1.05);
}

.auth-submit.button:active {
    transform: translateY(1px);
}

.auth-submit.button:disabled {
    filter: grayscale(0.4);
    opacity: 0.65;
}

.login-link {
    border-top: 1px solid var(--auth-line);
    color: var(--auth-ink-soft);
    font-size: 12px;
    margin-top: 14px;
    padding: 12px 0 0;
    text-align: center;
}

/* ---------- language ---------- */

html[lang="km"] .auth-card,
html[lang="km"] .auth-card input,
html[lang="km"] .auth-card button,
html[lang="km"] .auth-card a {
    font-family: 'Hanuman', sans-serif;
}

/* ---------- small screens: the wide artwork stops working, fall back
   to a plain parchment card so the character art doesn't get cropped
   into something illegible ---------- */

@media (max-width: 680px) {
    .auth-card {
        aspect-ratio: auto;
        background: var(--auth-parchment);
        border: 1px solid var(--auth-line);
        border-radius: 16px;
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
        max-width: 400px;
    }

    .auth-card__inner {
        bottom: auto;
        left: auto;
        padding: 26px 22px;
        position: static;
        top: auto;
        width: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-submit.button,
    .auth-card form .auth-control .form-control {
        transition: none;
    }
}
