/* Admin sign-in screens: moving gradient background with glass cards.
   Self-contained: no Bootstrap, no jQuery. */

:root {
    --a-deep: #0d2418;
    --a-forest: #1d5a3a;
    --a-leaf: #2fa36b;
    --a-teal: #18a3a0;
    --a-mango: #f0a93c;
    --a-ink: #f4faf6;
    --a-muted: rgba(244, 250, 246, .72);
    --a-glass: rgba(255, 255, 255, .11);
    --a-glass-border: rgba(255, 255, 255, .28);
    --a-field: rgba(255, 255, 255, .13);
    --a-danger: #ffb4a8;
    --a-success: #b9f3cf;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body.auth {
    margin: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px 18px;
    color: var(--a-ink);
    font: 16px/1.55 "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
    background: var(--a-deep);
    overflow-x: hidden;
    position: relative;
}

/* ---------- Dynamic background ---------- */
.auth-bg { position: fixed; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; }

.auth-bg::before {                       /* slow-moving colour field */
    content: "";
    position: absolute; inset: -20%;
    background: linear-gradient(120deg, #0d2418, #14532f 28%, #0f6b63 52%, #1d5a3a 74%, #0d2418);
    background-size: 300% 300%;
    animation: auth-shift 22s ease-in-out infinite;
}

.auth-bg::after {                        /* faint grid for depth */
    content: "";
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px);
    background-size: 46px 46px;
    -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 78%);
            mask-image: radial-gradient(ellipse at center, #000 30%, transparent 78%);
}

.auth-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    opacity: .62;
    will-change: transform;
}
.auth-blob--1 { width: 46vmax; height: 46vmax; left: -14vmax; top: -16vmax; background: radial-gradient(circle at 30% 30%, #39c583, transparent 68%); animation: auth-drift-1 26s ease-in-out infinite; }
.auth-blob--2 { width: 40vmax; height: 40vmax; right: -12vmax; bottom: -14vmax; background: radial-gradient(circle at 60% 40%, #18b7b0, transparent 68%); animation: auth-drift-2 31s ease-in-out infinite; }
.auth-blob--3 { width: 26vmax; height: 26vmax; right: 12vw; top: 8vh; background: radial-gradient(circle at 50% 50%, #f0a93c, transparent 66%); opacity: .38; animation: auth-drift-3 24s ease-in-out infinite; }
.auth-blob--4 { width: 20vmax; height: 20vmax; left: 10vw; bottom: 6vh; background: radial-gradient(circle at 50% 50%, #8fe3b4, transparent 66%); opacity: .3; animation: auth-drift-3 29s ease-in-out infinite reverse; }

@keyframes auth-shift { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
@keyframes auth-drift-1 { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(9vw, 7vh) scale(1.12); } }
@keyframes auth-drift-2 { 0%, 100% { transform: translate(0, 0) scale(1.05); } 50% { transform: translate(-8vw, -9vh) scale(.92); } }
@keyframes auth-drift-3 { 0%, 100% { transform: translate(0, 0); } 33% { transform: translate(-6vw, 5vh); } 66% { transform: translate(5vw, -4vh); } }

/* ---------- Glass card ---------- */
.auth-wrap { position: relative; z-index: 1; width: 100%; max-width: 440px; }

.auth-card {
    position: relative;
    padding: 38px 34px 30px;
    border-radius: 26px;
    background: var(--a-glass);
    border: 1px solid var(--a-glass-border);
    -webkit-backdrop-filter: blur(22px) saturate(150%);
            backdrop-filter: blur(22px) saturate(150%);
    box-shadow: 0 30px 80px rgba(0, 0, 0, .38), inset 0 1px 0 rgba(255, 255, 255, .28);
    animation: auth-rise .55s cubic-bezier(.2, .8, .2, 1) both;
}
/* Fallback where blur is not supported: a more solid panel keeps text readable */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .auth-card { background: rgba(16, 52, 35, .9); }
}
.auth-card::before {                     /* light sheen along the top edge */
    content: "";
    position: absolute; left: 18px; right: 18px; top: 0; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.7), transparent);
}
@keyframes auth-rise { from { opacity: 0; transform: translateY(18px) scale(.985); } to { opacity: 1; transform: none; } }

.auth-brand { display: flex; flex-direction: column; align-items: center; text-align: center; margin-bottom: 26px; }
.auth-logo {
    display: flex; align-items: center; justify-content: center;
    width: 86px; height: 86px; margin-bottom: 16px;
    border-radius: 24px; background: #fff;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .28);
}
.auth-logo img { max-width: 66px; max-height: 60px; display: block; }
.auth-logo svg { width: 40px; height: 40px; color: var(--a-forest); }
.auth-title { margin: 0 0 4px; font-size: 25px; font-weight: 800; letter-spacing: -.01em; line-height: 1.2; }
.auth-sub { margin: 0; color: var(--a-muted); font-size: 15px; }

/* ---------- Messages ---------- */
.auth-alert { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 18px; padding: 12px 14px; border-radius: 14px; font-size: 15px; font-weight: 600; border: 1px solid transparent; }
.auth-alert svg { flex: 0 0 18px; width: 18px; height: 18px; margin-top: 2px; }
.auth-alert--error { background: rgba(255, 99, 71, .16); border-color: rgba(255, 150, 130, .45); color: var(--a-danger); }
.auth-alert--success { background: rgba(60, 200, 130, .16); border-color: rgba(140, 230, 180, .45); color: var(--a-success); }
.auth-alert ul { margin: 0; padding-left: 18px; }

/* ---------- Fields ---------- */
.auth-field { margin-bottom: 16px; }
.auth-label { display: block; margin-bottom: 7px; font-size: 14px; font-weight: 700; color: var(--a-ink); }
.auth-control { position: relative; }
.auth-control > svg { position: absolute; left: 15px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--a-muted); pointer-events: none; }
.auth-input {
    width: 100%; height: 52px; padding: 0 48px 0 44px;
    font: inherit; color: var(--a-ink);
    background: var(--a-field);
    border: 1px solid rgba(255, 255, 255, .26);
    border-radius: 15px;
    outline: none;
    transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
}
.auth-input::placeholder { color: rgba(244, 250, 246, .5); }
.auth-input:hover { border-color: rgba(255, 255, 255, .45); }
.auth-input:focus { background: rgba(255, 255, 255, .18); border-color: var(--a-mango); box-shadow: 0 0 0 4px rgba(240, 169, 60, .28); }
/* keep browser autofill from painting a white box over the glass */
.auth-input:-webkit-autofill { -webkit-text-fill-color: var(--a-ink); transition: background-color 9999s ease-out; caret-color: var(--a-ink); }

.auth-code { padding: 0 16px; text-align: center; font-size: 26px; font-weight: 800; letter-spacing: .42em; text-indent: .42em; }

.auth-toggle {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    width: 40px; height: 40px; padding: 0; border: 0; border-radius: 11px;
    background: transparent; color: var(--a-muted); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.auth-toggle:hover { background: rgba(255, 255, 255, .14); color: var(--a-ink); }
.auth-toggle svg { width: 19px; height: 19px; }
.auth-toggle .icon-hide, .auth-toggle[aria-pressed="true"] .icon-show { display: none; }
.auth-toggle[aria-pressed="true"] .icon-hide { display: block; }

.auth-hint { margin: 7px 2px 0; font-size: 13.5px; color: var(--a-muted); }
.auth-caps { display: none; margin: 7px 2px 0; font-size: 13.5px; font-weight: 700; color: var(--a-mango); }
.auth-caps.is-on { display: block; }

.auth-meter { display: flex; gap: 6px; margin-top: 10px; }
.auth-meter span { flex: 1; height: 5px; border-radius: 99px; background: rgba(255, 255, 255, .2); transition: background-color .2s ease; }
.auth-meter[data-score="1"] span:nth-child(-n+1) { background: #ff8f7d; }
.auth-meter[data-score="2"] span:nth-child(-n+2) { background: var(--a-mango); }
.auth-meter[data-score="3"] span:nth-child(-n+3) { background: #b8e06a; }
.auth-meter[data-score="4"] span:nth-child(-n+4) { background: #5fe0a0; }
.auth-rules { margin: 10px 0 0; padding: 0; list-style: none; font-size: 13.5px; color: var(--a-muted); display: grid; grid-template-columns: 1fr 1fr; gap: 3px 12px; }
.auth-rules li::before { content: "\25CB"; margin-right: 7px; }
.auth-rules li.is-ok { color: var(--a-success); }
.auth-rules li.is-ok::before { content: "\2713"; }

/* ---------- Button ---------- */
.auth-btn {
    position: relative; overflow: hidden;
    width: 100%; height: 54px; margin-top: 8px;
    border: 0; border-radius: 15px; cursor: pointer;
    font: inherit; font-size: 17px; font-weight: 800; color: #10301f;
    background: linear-gradient(135deg, #f7c15f, #f0a93c 55%, #e8922a);
    box-shadow: 0 12px 28px rgba(240, 169, 60, .34);
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.auth-btn:hover { transform: translateY(-1px); box-shadow: 0 16px 34px rgba(240, 169, 60, .44); filter: brightness(1.04); }
.auth-btn:active { transform: translateY(0); }
.auth-btn:focus-visible, .auth-toggle:focus-visible, .auth-link:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.auth-btn[disabled] { cursor: progress; filter: saturate(.6) brightness(.92); transform: none; }
.auth-btn::after {                        /* sheen sweep on hover */
    content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%;
    background: linear-gradient(100deg, transparent, rgba(255,255,255,.5), transparent);
    transform: skewX(-18deg); transition: left .6s ease;
}
.auth-btn:hover::after { left: 120%; }

.auth-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 20px; font-size: 15px; }
.auth-link { color: var(--a-ink); font-weight: 700; text-decoration: underline; text-underline-offset: 4px; text-decoration-color: rgba(255,255,255,.45); border-radius: 4px; }
.auth-link:hover { text-decoration-color: var(--a-mango); color: #fff; }

.auth-secure { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 20px 0 0; font-size: 13.5px; color: var(--a-muted); text-align: center; }
.auth-secure svg { width: 15px; height: 15px; flex: 0 0 15px; }

.auth-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

@media (max-width: 480px) {
    .auth-card { padding: 30px 22px 24px; border-radius: 22px; }
    .auth-title { font-size: 22px; }
    .auth-rules { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    .auth-bg::before, .auth-blob, .auth-card { animation: none !important; }
    .auth-btn, .auth-btn::after, .auth-input { transition: none !important; }
}
