/* ===========================================================
   Auth pages (login / register / forgot & reset password)
   Neutral, close to the public site: white + slate, Inter and
   Bricolage Grotesque, brand violet only as the accent.
   Motion lives in public/js/auth.js.
   =========================================================== */

.au {
    --au-bg: #ffffff;
    --au-surface: #ffffff;
    --au-field: #f8fafc;
    --au-line: #e2e8f0;
    --au-line-strong: #cbd5e1;
    --au-text: #0f172a;
    --au-muted: #64748b;
    --au-accent: #6c63ff;
    --au-accent-ink: #5248e8;
    --au-ring: rgba(108, 99, 255, 0.14);
    --au-ease: cubic-bezier(0.22, 1, 0.36, 1);

    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    min-height: calc(100vh - 105px);
    background: var(--au-bg);
    color: var(--au-text);
    font-family: Inter, "Segoe UI", system-ui, sans-serif;
}

:root[data-theme="dark"] .au {
    --au-bg: #0b1120;
    --au-surface: #111827;
    --au-field: #0f172a;
    --au-line: rgba(255, 255, 255, 0.09);
    --au-line-strong: rgba(255, 255, 255, 0.16);
    --au-text: #e5e7eb;
    --au-muted: #94a3b8;
    --au-ring: rgba(139, 125, 255, 0.22);
}

/* ---------- Motion initial states ---------- */
.au-anim .au [data-in],
.au-anim .au [data-aside],
.au-anim .au [data-chip] { opacity: 0; }

/* ---------- Form side ---------- */
.au-main {
    position: relative;
    display: grid;
    place-items: center;
    padding: 48px 28px 64px;
    overflow: hidden;
    isolation: isolate;
}

/* Quiet dotted backdrop, fading out toward the edges */
.au-main::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background-image: radial-gradient(var(--au-line-strong) 1px, transparent 1px);
    background-size: 22px 22px;
    opacity: 0.55;
    -webkit-mask-image: radial-gradient(ellipse 60% 55% at 50% 40%, #000 10%, transparent 75%);
    mask-image: radial-gradient(ellipse 60% 55% at 50% 40%, #000 10%, transparent 75%);
}

.au-card {
    width: 100%;
    max-width: 460px;
}

.au-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px 6px 10px;
    border: 1px solid var(--au-line);
    border-radius: 999px;
    background: var(--au-surface);
    color: var(--au-muted);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.au-badge__dot {
    position: relative;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--au-accent);
}

.au-badge__dot::after {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: var(--au-accent);
    opacity: 0.35;
    animation: au-ping 2.4s var(--au-ease) infinite;
}

.au .au-title {
    margin: 18px 0 10px;
    color: var(--au-text);
    font: 700 clamp(2rem, 3.2vw, 2.6rem)/1.05 "Bricolage Grotesque", Inter, sans-serif;
    letter-spacing: -0.035em;
}

.au-lead {
    margin: 0 0 28px;
    color: var(--au-muted);
    font-size: 1rem;
    line-height: 1.6;
}

/* ---------- Alerts ---------- */
.au-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0 0 20px;
    padding: 12px 14px;
    border: 1px solid #fecaca;
    border-radius: 14px;
    background: #fef2f2;
    color: #b91c1c;
    font-size: 0.92rem;
    line-height: 1.45;
}

.au-alert svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }

.au-alert--success {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #15803d;
}

:root[data-theme="dark"] .au-alert { border-color: rgba(248, 113, 113, 0.3); background: rgba(127, 29, 29, 0.25); color: #fca5a5; }
:root[data-theme="dark"] .au-alert--success { border-color: rgba(74, 222, 128, 0.3); background: rgba(20, 83, 45, 0.3); color: #86efac; }

/* ---------- Form ---------- */
.au-form { display: grid; gap: 18px; }

.au-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.au-field { display: grid; gap: 8px; min-width: 0; }

/* Long <select> options must not widen the column */
.au-card, .au-form, .au-row > * { min-width: 0; }

.au-field[hidden] { display: none; }

.au-label {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    color: var(--au-text);
    font-size: 0.88rem;
    font-weight: 600;
}

.au-label a {
    color: var(--au-accent);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
}

.au-label a:hover { text-decoration: underline; }

.au-input {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 52px;
    border: 1px solid var(--au-line);
    border-radius: 14px;
    background: var(--au-field);
    transition: border-color 0.2s, box-shadow 0.25s var(--au-ease), background 0.2s;
}

.au-input:hover { border-color: var(--au-line-strong); }

.au-input:focus-within {
    border-color: var(--au-accent);
    background: var(--au-surface);
    box-shadow: 0 0 0 4px var(--au-ring);
}

.au-input__icon {
    display: grid;
    place-items: center;
    width: 46px;
    flex: none;
    color: #94a3b8;
    transition: color 0.2s, scale 0.3s var(--au-ease);
}

.au-input__icon svg { width: 18px; height: 18px; }

.au-input:focus-within .au-input__icon { color: var(--au-accent); scale: 1.08; }

.au-input__prefix {
    flex: none;
    padding-right: 10px;
    margin-right: 2px;
    border-right: 1px solid var(--au-line);
    color: var(--au-text);
    font-weight: 600;
}

.au-input input,
.au-input select {
    flex: 1;
    min-width: 0;
    height: 50px;
    padding: 0 14px 0 0;
    border: 0;
    background: transparent;
    color: var(--au-text);
    font: 500 0.98rem/1 Inter, sans-serif;
    outline: none;
    box-shadow: none;
}

.au-input__prefix + input { padding-left: 10px; }

.au-input input::placeholder { color: #94a3b8; }

.au-input select {
    width: 100%;
    text-overflow: ellipsis;
    appearance: none;
    -webkit-appearance: none;
    padding-right: 40px;
    cursor: pointer;
}

.au-input select:disabled {
    color: #94a3b8;
    cursor: not-allowed;
}

.au-input--select::after {
    content: "";
    position: absolute;
    right: 16px;
    top: 50%;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--au-muted);
    border-bottom: 2px solid var(--au-muted);
    translate: 0 -70%;
    rotate: 45deg;
    pointer-events: none;
}

:root[data-theme="dark"] .au-input select option { background: #111827; color: #e5e7eb; }

.au-eye {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin-right: 3px;
    flex: none;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
}

.au-eye:hover { color: var(--au-text); background: var(--au-line); }
.au-eye svg { width: 18px; height: 18px; }
.au-eye .au-eye__off { display: none; }
.au-eye.is-on .au-eye__on { display: none; }
.au-eye.is-on .au-eye__off { display: block; }

/* Password strength (visual only) */
.au-strength {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-top: 2px;
}

.au-strength span {
    height: 4px;
    border-radius: 999px;
    background: var(--au-line);
    transition: background 0.3s, scale 0.3s var(--au-ease);
    transform-origin: left;
}

.au-strength[data-level="1"] span:nth-child(-n+1) { background: #ef4444; }
.au-strength[data-level="2"] span:nth-child(-n+2) { background: #f59e0b; }
.au-strength[data-level="3"] span:nth-child(-n+3) { background: #84cc16; }
.au-strength[data-level="4"] span:nth-child(-n+4) { background: #22c55e; }

/* Match hint for confirm-password */
.au-input.is-match { border-color: #22c55e; }
.au-input.is-mismatch { border-color: #f87171; }

/* ---------- Buttons ---------- */
.au-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 54px;
    margin-top: 4px;
    border: 0;
    border-radius: 14px;
    background: var(--au-accent);
    color: #fff;
    font: 700 1rem/1 Inter, sans-serif;
    cursor: pointer;
    overflow: hidden;
    isolation: isolate;
    box-shadow: 0 10px 24px -12px rgba(108, 99, 255, 0.8);
    transition: background 0.2s, box-shadow 0.25s var(--au-ease), translate 0.25s var(--au-ease);
}

.au-btn::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.3) 50%, transparent 65%);
    translate: -110% 0;
    transition: translate 0.7s var(--au-ease);
}

.au-btn:hover { background: var(--au-accent-ink); translate: 0 -1px; box-shadow: 0 14px 30px -12px rgba(108, 99, 255, 0.9); }
.au-btn:hover::before { translate: 110% 0; }
.au-btn:focus-visible { outline: 3px solid var(--au-ring); outline-offset: 2px; }

.au-btn svg { width: 18px; height: 18px; transition: translate 0.25s var(--au-ease); }
.au-btn:hover svg { translate: 4px 0; }

.au-btn.is-loading { color: transparent; pointer-events: none; }
.au-btn.is-loading svg { opacity: 0; }

.au-btn.is-loading::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2.5px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: au-spin 0.7s linear infinite;
}

.au-foot {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 26px;
    padding-top: 22px;
    border-top: 1px solid var(--au-line);
    color: var(--au-muted);
    font-size: 0.93rem;
}

.au-foot a {
    color: var(--au-text);
    font-weight: 700;
    text-decoration: none;
    background: linear-gradient(var(--au-accent), var(--au-accent)) 0 100% / 0 2px no-repeat;
    transition: background-size 0.3s var(--au-ease), color 0.2s;
}

.au-foot a:hover { color: var(--au-accent); background-size: 100% 2px; }

/* ---------- Kaspi payment block (register) ---------- */
.au-pay {
    display: grid;
    gap: 12px;
    padding: 18px;
    border: 1px solid var(--au-line);
    border-radius: 18px;
    background: var(--au-field);
}

.au-pay__lead {
    margin: 0;
    color: var(--au-muted);
    font-size: 0.92rem;
    line-height: 1.6;
}

.au-pay__lead strong { color: var(--au-text); }
.au-pay__was { opacity: 0.75; text-decoration-thickness: 2px; }

.au-kaspi {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    border-radius: 12px;
    background: #f14635;
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    transition: filter 0.2s, translate 0.25s var(--au-ease);
}

.au-kaspi:hover { filter: brightness(1.06); translate: 0 -1px; }

.au-file {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1.5px dashed var(--au-line-strong);
    border-radius: 14px;
    background: var(--au-surface);
    color: var(--au-muted);
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.au-file:hover { border-color: var(--au-accent); }
.au-file.has-file { border-style: solid; border-color: #22c55e; color: var(--au-text); }

.au-file svg { width: 20px; height: 20px; flex: none; color: var(--au-accent); }

.au-file input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.au-pay__hint { color: var(--au-muted); font-size: 0.8rem; }

.au-pay__b2b {
    margin: 2px 0 0;
    padding-top: 12px;
    border-top: 1px solid var(--au-line);
    color: var(--au-muted);
    font-size: 0.86rem;
    line-height: 1.55;
}

/* ---------- Visual side ---------- */
.au-aside {
    position: relative;
    margin: 16px 16px 16px 0;
    border-radius: 28px;
    overflow: hidden;
    isolation: isolate;
    background: #0f172a;
    color: #fff;
    min-height: 560px;
}

.au-aside__media {
    position: absolute;
    inset: 0;
    z-index: -2;
}

.au-aside__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    animation: au-kenburns 24s ease-in-out infinite alternate;
}

.au-aside__shade {
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        linear-gradient(to top, rgba(2, 6, 23, 0.94) 0%, rgba(2, 6, 23, 0.55) 45%, rgba(2, 6, 23, 0.15) 100%);
}

.au-aside__content {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 44px;
}

.au-aside__eyebrow {
    display: inline-block;
    padding: 6px 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.au-aside__title {
    max-width: 18ch;
    margin: 18px 0 28px;
    color: #fff;
    font: 700 clamp(1.9rem, 3vw, 2.8rem)/1.08 "Bricolage Grotesque", Inter, sans-serif;
    letter-spacing: -0.03em;
}

.au-aside__title em {
    font-style: normal;
    color: rgba(255, 255, 255, 0.62);
    background: none;
    -webkit-text-fill-color: currentColor;
}

.au-aside__stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.au-aside__stats > div {
    display: grid;
    gap: 4px;
    padding: 14px 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.06);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.au-aside__stats strong {
    font: 700 1.6rem/1 "Bricolage Grotesque", Inter, sans-serif;
    font-variant-numeric: tabular-nums;
}

.au-aside__stats span { color: rgba(255, 255, 255, 0.65); font-size: 0.8rem; line-height: 1.35; }

.au-chip {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px 10px 10px;
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.88);
    color: #0f172a;
    box-shadow: 0 18px 40px -16px rgba(2, 6, 23, 0.6);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    will-change: transform;
}

.au-chip strong { display: block; font-size: 0.9rem; }
.au-chip small { display: block; margin-top: 2px; color: #64748b; font-size: 0.76rem; }

.au-chip__icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    flex: none;
    border-radius: 11px;
    background: #0f172a;
    color: #fff;
}

.au-chip__icon--light { background: #fef3c7; color: #b45309; }
.au-chip__icon svg { width: 18px; height: 18px; }

.au-chip--a { top: 32px; left: 32px; animation: au-float 6s ease-in-out infinite; }
.au-chip--b { top: 96px; right: 32px; animation: au-float 7s ease-in-out -2s infinite; }

/* ---------- Keyframes ---------- */
@keyframes au-ping { 0% { transform: scale(0.6); opacity: 0.5; } 80%, 100% { transform: scale(2.2); opacity: 0; } }
@keyframes au-spin { to { rotate: 360deg; } }
@keyframes au-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -8px; } }
@keyframes au-kenburns { from { scale: 1.02; } to { scale: 1.12; translate: -2% -1%; } }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
    .au { grid-template-columns: 1fr; min-height: 0; }
    .au-aside { display: none; }
    .au-main { padding: 36px 16px 56px; }
}

@media (max-width: 480px) {
    .au-row { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    .au *, .au *::before, .au *::after {
        animation: none !important;
        transition-duration: 0.01ms !important;
    }
}
