/*
 * The admin's sign-in pages (views/auth/login.php, reset_password.php): a night sky — the stars are drawn by
 * js/space-login.js on a canvas, a planet glows on the horizon, an astronaut floats beside the form — and the fields on
 * "liquid glass". After the SpaceLogin component (React, Tailwind, framer-motion), redone in plain CSS and JavaScript
 * for this PHP app. These pages load nothing else: no Bootstrap, no jQuery.
 *
 * Liquid glass: every browser gets frosted glass (a blurred backdrop). Chromium also gets the component's refraction —
 * js/space-login.js builds an SVG displacement filter for each field and adds .sl-liquid to <html>.
 */
@font-face {
    font-family: 'Noto Sans Khmer';
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url(../fonts/noto-sans-khmer-400-800.woff2) format('woff2');
    unicode-range: U+1780-17FF, U+19E0-19FF, U+200C-200D, U+25CC;
}

:root {
    color-scheme: dark;
}
*, *::before, *::after {
    box-sizing: border-box;
}
html, body {
    margin: 0;
}
body.sl {
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    background: #03060f;
    color: #fff;
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans Khmer", sans-serif;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
html[lang="km"] body.sl {
    line-height: 1.7;
}

/* the sky */
.sl-stars {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}
.sl-horizon {
    position: fixed;
    left: 50%;
    bottom: -192px;
    width: 160vw;
    max-width: 1900px;
    height: 480px;
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 0;
}
.sl-horizon::before, .sl-horizon::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 100%;
}
.sl-horizon::before {
    background: radial-gradient(ellipse at 50% 100%, rgba(224, 102, 70, 0.95) 0%, rgba(199, 81, 58, 0.75) 20%, rgba(67, 142, 145, 0.5) 42%, rgba(20, 48, 70, 0.25) 60%, transparent 80%);
    filter: blur(32px);
}
.sl-horizon::after {
    background: radial-gradient(ellipse at 50% 100%, rgba(255, 170, 110, 0.6) 0%, rgba(94, 219, 210, 0.4) 30%, transparent 65%);
    filter: blur(48px);
    opacity: 0.4;
    mix-blend-mode: screen;
}
@media (min-width: 640px) {
    .sl-horizon { bottom: -224px; height: 550px; }
}
@media (min-width: 768px) {
    .sl-horizon { bottom: -256px; height: 620px; }
}

/* the page: the astronaut on the left, the form in the middle */
.sl-stage {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 40px 16px 56px;
}
.sl-inner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 1024px;
}
.sl-astronaut {
    display: none;
    position: absolute;
    left: 8px;
    top: 50%;
    z-index: 1;
    transform: translate(var(--sl-px, 0px), calc(-65% + var(--sl-py, 0px)));
    pointer-events: none;
    user-select: none;
}
.sl-astronaut-float {
    position: relative;
    animation: sl-float 7s ease-in-out infinite;
}
.sl-astronaut img {
    display: block;
    width: 176px;
    height: auto;
    filter: contrast(1.25) drop-shadow(0 15px 30px rgba(0, 0, 0, 0.85));
}
.sl-sparkle {
    position: absolute;
    right: -12px;
    top: 50%;
    width: 24px;
    height: 24px;
    color: #ff4bb8;
    filter: drop-shadow(0 0 12px #ff4bb8);
    animation: sl-pulse 2.8s ease-in-out infinite;
}
@media (min-width: 768px) {
    .sl-astronaut { display: block; }
}
@media (min-width: 1024px) {
    .sl-astronaut { left: 48px; }
    .sl-astronaut img { width: 208px; }
}
@media (min-width: 1280px) {
    .sl-astronaut { left: 80px; }
}
@keyframes sl-float {
    0%, 100% { transform: translateY(-12px) rotate(-2deg); }
    50% { transform: translateY(14px) rotate(3deg); }
}
@keyframes sl-pulse {
    0%, 100% { transform: translateY(-50%) scale(0.85); opacity: 0.65; }
    50% { transform: translateY(-50%) scale(1.25); opacity: 1; }
}

.sl-panel {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    animation: sl-rise 0.6s ease-out both;
}
.sl-panel.sl-wide {
    max-width: 640px;
}
@keyframes sl-rise {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: none; }
}

/* the business, then the title */
.sl-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 22px;
    color: rgba(229, 229, 229, 0.88);
    font-size: 14px;
    font-weight: 600;
    text-align: center;
}
.sl-mark {
    display: grid;
    place-items: center;
    flex: none;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: linear-gradient(135deg, #1043c9, #7c3aed);
    box-shadow: 0 6px 20px rgba(16, 67, 201, 0.35);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.04em;
}
.sl-title {
    margin: 0 0 32px;
    color: #fff;
    font-size: 36px;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.025em;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.sl-sub {
    margin: -22px 0 28px;
    color: #a3a3a3;
    font-size: 14px;
    text-align: center;
}
@media (min-width: 640px) {
    .sl-title { margin-bottom: 36px; font-size: 42px; }
}

/* messages: errors, what went well, the site being offline */
.sl-alert {
    position: relative;
    margin-bottom: 20px;
    padding: 12px 44px 12px 14px;
    border: 1px solid;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}
.sl-alert p, .sl-alert ul {
    margin: 0;
    padding: 0;
    list-style: none;
}
.sl-alert p + p {
    margin-top: 4px;
}
.sl-alert-error { background: rgba(220, 38, 38, 0.14); border-color: rgba(248, 113, 113, 0.35); color: #fecaca; }
.sl-alert-ok { background: rgba(16, 185, 129, 0.14); border-color: rgba(52, 211, 153, 0.35); color: #a7f3d0; }
.sl-alert-warn { background: rgba(245, 158, 11, 0.14); border-color: rgba(251, 191, 36, 0.35); color: #fde68a; }
.sl-alert-x {
    position: absolute;
    top: 8px;
    right: 8px;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: inherit;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.75;
}
.sl-alert-x:hover { opacity: 1; background: rgba(255, 255, 255, 0.08); }

/* the forms */
.sl-view[hidden] {
    display: none;
}
.sl-view {
    animation: sl-fade 0.35s ease-out;
}
@keyframes sl-fade {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}
.sl-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 0;
}
.sl-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}
.sl-label {
    color: #e5e5e5;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.025em;
    user-select: none;
}
.sl-text {
    margin: 0;
    color: #a3a3a3;
    font-size: 14px;
}
.sl-hint {
    color: #a3a3a3;
    font-size: 12px;
}

/* a field on glass */
.sl-glass {
    position: relative;
    display: flex;
    align-items: center;
    height: 52px;
    min-height: 52px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.3);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.sl-liquid .sl-glass {
    background: hsl(0 0% 0% / 0.1);
    box-shadow: 0 0 1px 0 rgba(255, 255, 255, 0.1) inset, 0 4px 16px rgba(17, 17, 26, 0.05);
}
.sl-glass:focus-within {
    border-color: rgba(255, 255, 255, 0.32);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.07);
}
.sl-glass input {
    flex: 1;
    width: 100%;
    min-width: 0;
    height: 100%;
    margin: 0;
    padding: 0 16px;
    border: 0;
    border-radius: 0;
    outline: 0;
    background: transparent;
    box-shadow: none;
    color: #f5f5f5;
    font: inherit;
    font-size: 15px;
    font-weight: 500;
    line-height: normal;
}
.sl-glass input::placeholder {
    color: rgba(163, 163, 163, 0.7);
    opacity: 1;
}
/* the browser's own autofill colours would paint the field white */
.sl-glass input:-webkit-autofill,
.sl-glass input:-webkit-autofill:hover,
.sl-glass input:-webkit-autofill:focus {
    -webkit-text-fill-color: #f5f5f5;
    caret-color: #fff;
    transition: background-color 600000s 0s, color 600000s 0s;
}
.sl-eye {
    display: grid;
    place-items: center;
    flex: none;
    width: 36px;
    height: 36px;
    margin-right: 8px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #a3a3a3;
    cursor: pointer;
    transition: color 0.15s;
}
.sl-eye:hover { color: #e5e5e5; }
.sl-eye:focus-visible { outline: 2px solid rgba(255, 255, 255, 0.55); outline-offset: -2px; }
.sl-eye svg { width: 20px; height: 20px; }
.sl-eye .sl-i-off, .sl-eye[aria-pressed="true"] .sl-i-on { display: none; }
.sl-eye[aria-pressed="true"] .sl-i-off { display: block; }

/* the captcha, when the settings ask for one */
.sl-captcha {
    display: flex;
    align-items: center;
    gap: 10px;
}
.sl-captcha img {
    display: block;
    height: 40px;
    width: auto;
    border-radius: 8px;
    background: #fff;
}
.sl-iconbtn {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    color: #d4d4d4;
}
.sl-iconbtn:hover { color: #fff; border-color: rgba(255, 255, 255, 0.2); }
.sl-iconbtn svg { width: 18px; height: 18px; }

/* remember me, and the way to the other forms */
.sl-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
    padding-top: 4px;
    font-size: 13px;
}
.sl-check {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #d4d4d4;
    cursor: pointer;
    user-select: none;
}
.sl-check input {
    position: absolute;
    left: 0;
    width: 16px;
    height: 16px;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}
.sl-box {
    display: grid;
    place-items: center;
    flex: none;
    width: 16px;
    height: 16px;
    border: 1px solid #525252;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    color: #000;
    transition: background-color 0.15s, border-color 0.15s;
}
.sl-box svg { width: 12px; height: 12px; opacity: 0; }
.sl-check:hover { color: #fff; }
.sl-check:hover .sl-box { border-color: #a3a3a3; }
.sl-check input:checked + .sl-box { border-color: #e5e5e5; background: #e5e5e5; }
.sl-check input:checked + .sl-box svg { opacity: 1; }
.sl-check input:focus-visible + .sl-box { outline: 2px solid rgba(255, 255, 255, 0.6); outline-offset: 2px; }
.sl-link {
    color: #d4d4d4;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.15s;
}
.sl-link:hover, .sl-link:focus-visible {
    color: #fff;
    text-decoration: underline;
    text-underline-offset: 4px;
}
.sl-alt {
    margin: 4px 0 0;
    color: #a3a3a3;
    font-size: 13px;
    text-align: center;
}
.sl-alt a {
    color: #fff;
    font-weight: 700;
    text-decoration: none;
}
.sl-alt a:hover { text-decoration: underline; text-underline-offset: 4px; }

/* buttons */
.sl-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 48px;
    margin-top: 8px;
    padding: 0 18px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    background: #252831;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
    color: #f5f5f5;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.025em;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s, transform 0.1s;
}
.sl-btn:hover { border-color: rgba(255, 255, 255, 0.2); background: #2d313c; color: #fff; }
.sl-btn:active { background: #22252e; transform: scale(0.98); }
.sl-btn:focus-visible { outline: 2px solid rgba(255, 255, 255, 0.6); outline-offset: 2px; }
.sl-btn[aria-busy="true"] { cursor: progress; }
.sl-btn svg { width: 16px; height: 16px; flex: none; }
.sl-btn-ghost { background: transparent; box-shadow: none; }
.sl-btn-ghost:hover { background: rgba(255, 255, 255, 0.06); }
.sl-btns {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}
.sl-btns .sl-btn { margin-top: 0; }
.sl-spin { animation: sl-spin 1s linear infinite; }
@keyframes sl-spin { to { transform: rotate(360deg); } }

/* registration's two columns */
.sl-grid {
    display: grid;
    gap: 18px 16px;
}
@media (min-width: 640px) {
    .sl-grid { grid-template-columns: 1fr 1fr; }
}

.sl-noscript {
    position: relative;
    z-index: 3;
    padding: 10px 16px;
    background: #7c2d12;
    color: #fff;
    font-size: 14px;
    text-align: center;
}

@media (prefers-reduced-motion: reduce) {
    .sl-astronaut-float, .sl-sparkle, .sl-panel, .sl-view, .sl-spin { animation: none; }
}
