/* ==========================================================================
   Auth Royal — skin maroon + emas untuk halaman Masuk & Daftar.
   Murni CSS (tanpa CDN Tailwind) agar plug and play di aaPanel/Nginx + PHP 8.2.
   Seluruh identitas (logo, nama, tagline) dirender dinamis dari app_settings.
   ========================================================================== */

:root {
    --auth-maroon-900: #2A040A;
    --auth-maroon-800: #4A0B16;
    --auth-maroon-700: #6A1020;
    --auth-maroon-950: #1A0205;
    --auth-gold-300: #FCE08B;
    --auth-gold-400: #F4C430;
    --auth-gold-500: #D4AF37;
    --auth-gold-600: #AA8825;
    --auth-text: #ffffff;
    --auth-muted: #cfc4c6;
    --auth-radius: 18px;
}

* { box-sizing: border-box; }

/* Ikon stroke vector — tetap tajam pada layar Retina/4K. */
svg {
    flex-shrink: 0;
    shape-rendering: geometricPrecision;
    stroke-linecap: round;
    stroke-linejoin: round;
}

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

html { background: var(--auth-maroon-950); }

body.auth-royal {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100svh;
    min-height: 100dvh;
    padding: 24px 16px;
    overflow-x: hidden;
    background: radial-gradient(circle at center, var(--auth-maroon-800) 0%, var(--auth-maroon-950) 100%);
    color: var(--auth-text);
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior: none;
}

body.auth-royal ::selection {
    background: var(--auth-gold-500);
    color: var(--auth-maroon-900);
}

/* ── Partikel latar ─────────────────────────────────────────────────────── */
.auth-particles {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.auth-particle {
    position: absolute;
    border-radius: 50%;
    opacity: .6;
    background: radial-gradient(circle, var(--auth-gold-300) 0%, rgba(212, 175, 55, 0) 70%);
    animation: authFloatUp linear infinite;
}

@keyframes authFloatUp {
    0%   { transform: translateY(100vh) scale(0); opacity: 0; }
    20%  { opacity: .8; }
    80%  { opacity: .8; }
    100% { transform: translateY(-10vh) scale(1.5); opacity: 0; }
}

/* ── Kartu ──────────────────────────────────────────────────────────────── */
.auth-shell {
    position: relative;
    z-index: 1;
    width: min(100%, 430px);
    animation: authFloat 6s ease-in-out infinite;
}

.auth-shell::before {
    content: '';
    position: absolute;
    inset: -10%;
    border-radius: 50%;
    background: var(--auth-gold-500);
    opacity: .1;
    filter: blur(64px);
    z-index: -1;
}

@keyframes authFloat {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-10px); }
}

@media (prefers-reduced-motion: reduce) {
    .auth-shell, .auth-logo, .auth-particle { animation: none !important; }
}

.auth-card {
    position: relative;
    overflow: hidden;
    padding: 30px 26px;
    border: 1px solid rgba(212, 175, 55, .3);
    border-radius: 22px;
    background: rgba(42, 4, 10, .45);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, .5), inset 0 0 15px rgba(212, 175, 55, .05);
}

/* Sudut dekoratif emas */
.auth-corner {
    position: absolute;
    width: 30px;
    height: 30px;
    margin: 8px;
    opacity: .5;
    pointer-events: none;
}
.auth-corner.tl { top: 0; left: 0; border-top: 2px solid var(--auth-gold-500); border-left: 2px solid var(--auth-gold-500); border-top-left-radius: 12px; }
.auth-corner.tr { top: 0; right: 0; border-top: 2px solid var(--auth-gold-500); border-right: 2px solid var(--auth-gold-500); border-top-right-radius: 12px; }
.auth-corner.bl { bottom: 0; left: 0; border-bottom: 2px solid var(--auth-gold-500); border-left: 2px solid var(--auth-gold-500); border-bottom-left-radius: 12px; }
.auth-corner.br { bottom: 0; right: 0; border-bottom: 2px solid var(--auth-gold-500); border-right: 2px solid var(--auth-gold-500); border-bottom-right-radius: 12px; }

/* ── Brand ──────────────────────────────────────────────────────────────── */
.auth-brand { text-align: center; margin-bottom: 26px; }

.auth-logo-ring {
    position: relative;
    width: 104px;
    height: 104px;
    margin: 0 auto 14px;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--auth-gold-500);
    border-radius: 50%;
    background: var(--auth-maroon-900);
    box-shadow: 0 0 20px rgba(212, 175, 55, .4);
}

.auth-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.auth-brand h1 {
    margin: 0;
    font-family: 'Cinzel', 'Times New Roman', serif;
    font-size: 30px;
    font-weight: 700;
    letter-spacing: .06em;
    background: linear-gradient(to right, var(--auth-gold-300), var(--auth-gold-500), var(--auth-gold-600));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 2px 10px rgba(212, 175, 55, .2);
}

.auth-brand p {
    margin: 6px 0 0;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: #d3d3d3;
}

.auth-divider {
    width: 50%;
    height: 1px;
    margin: 16px auto 0;
    opacity: .5;
    background: linear-gradient(to right, transparent, var(--auth-gold-500), transparent);
}

/* ── Notifikasi ─────────────────────────────────────────────────────────── */
.auth-alert {
    display: flex;
    gap: 9px;
    align-items: flex-start;
    margin-bottom: 18px;
    padding: 11px 13px;
    border: 1px solid rgba(248, 113, 113, .35);
    border-radius: 12px;
    background: rgba(127, 29, 29, .25);
    color: #fecaca;
    font-size: 12px;
    line-height: 1.5;
}

.auth-toast {
    position: fixed;
    top: -140px;
    left: 50%;
    z-index: 60;
    display: flex;
    gap: 10px;
    align-items: center;
    max-width: min(92vw, 380px);
    padding: 12px 20px;
    border: 1px solid var(--auth-gold-500);
    border-radius: 999px;
    background: rgba(42, 4, 10, .92);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, .5);
    font-size: 13px;
    transform: translateX(-50%);
    transition: top .4s cubic-bezier(.68, -.55, .265, 1.55);
}
.auth-toast.show { top: 20px; }
.auth-toast.is-error { border-color: #ef4444; color: #fecaca; }
.auth-toast svg { flex: 0 0 18px; width: 18px; height: 18px; }

/* ── Form ───────────────────────────────────────────────────────────────── */
.auth-form { display: block; }

.auth-field { margin-bottom: 16px; }

.auth-field > label,
.auth-label {
    display: block;
    margin: 0 0 6px 2px;
    color: var(--auth-gold-300);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.auth-input-wrap { position: relative; display: block; }

.auth-input-wrap > svg {
    position: absolute;
    top: 50%;
    left: 13px;
    width: 17px;
    height: 17px;
    transform: translateY(-50%);
    color: var(--auth-gold-500);
    opacity: .75;
    pointer-events: none;
}

.auth-input {
    width: 100%;
    padding: 13px 14px 13px 40px;
    border: 1px solid rgba(212, 175, 55, .4);
    border-radius: 12px;
    background: rgba(0, 0, 0, .3);
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    transition: border-color .25s ease, box-shadow .25s ease, background .25s ease;
    -webkit-appearance: none;
    appearance: none;
}

.auth-input::placeholder { color: #9b9096; }

.auth-input:focus {
    outline: none;
    border-color: var(--auth-gold-500);
    background: rgba(0, 0, 0, .5);
    box-shadow: 0 0 10px rgba(212, 175, 55, .3);
}

.auth-input[readonly] { opacity: .8; cursor: not-allowed; }

.auth-input.has-toggle { padding-right: 44px; }

.auth-eye {
    position: absolute;
    top: 50%;
    right: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #b9adae;
    cursor: pointer;
    transform: translateY(-50%);
    transition: color .2s ease;
}
.auth-eye:hover { color: var(--auth-gold-400); }
.auth-eye svg { width: 18px; height: 18px; }

/* Baris opsi (ingat perangkat / lupa sandi) */
.auth-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: -4px 0 16px;
    font-size: 12px;
}

.auth-remember {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--auth-muted);
    cursor: pointer;
}

.auth-remember input,
.auth-terms input {
    width: 15px;
    height: 15px;
    accent-color: var(--auth-gold-500);
    cursor: pointer;
}

.auth-link {
    color: var(--auth-muted);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: color .2s ease, border-color .2s ease;
}
.auth-link:hover { color: var(--auth-gold-400); border-bottom-color: var(--auth-gold-400); }
.auth-link strong { color: var(--auth-gold-500); font-weight: 600; }

/* ── Captcha ────────────────────────────────────────────────────────────── */
.auth-captcha-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.auth-captcha-timer {
    color: #a89ea0;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 10px;
}

.auth-captcha-row {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 8px;
    border: 1px solid rgba(212, 175, 55, .2);
    border-radius: 14px;
    background: rgba(0, 0, 0, .2);
}

.auth-captcha-box {
    flex: 1;
    height: 52px;
    overflow: hidden;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
}

.auth-captcha-box canvas { display: block; width: 100%; height: 100%; }

.auth-captcha-refresh {
    display: flex;
    flex: 0 0 52px;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border: 1px solid rgba(212, 175, 55, .3);
    border-radius: 10px;
    background: var(--auth-maroon-800);
    color: var(--auth-gold-400);
    cursor: pointer;
    transition: background .2s ease;
}
.auth-captcha-refresh:hover { background: var(--auth-maroon-700); }
.auth-captcha-refresh svg { width: 19px; height: 19px; transition: transform .5s ease; }
.auth-captcha-refresh:hover svg { transform: rotate(180deg); }

.auth-captcha-input {
    margin-top: 8px;
    padding-left: 14px;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: .3em;
    text-align: center;
    text-transform: uppercase;
}
.auth-captcha-input::placeholder { font-size: 13px; font-weight: 400; letter-spacing: .1em; text-transform: none; }

/* ── Tombol ─────────────────────────────────────────────────────────────── */
.auth-submit {
    position: relative;
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 18px;
    padding: 14px 18px;
    overflow: hidden;
    border: 1px solid var(--auth-gold-300);
    border-radius: 12px;
    background: linear-gradient(135deg, var(--auth-gold-400) 0%, var(--auth-gold-500) 50%, var(--auth-gold-600) 100%);
    color: var(--auth-maroon-950);
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform .25s ease, box-shadow .25s ease, opacity .25s ease;
}

.auth-submit::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,.4) 50%, rgba(255,255,255,0) 100%);
    transform: skewX(-25deg);
    transition: left .7s ease;
}

.auth-submit:hover:not(:disabled)::after { left: 150%; }

.auth-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(212, 175, 55, .6);
}

.auth-submit:disabled { opacity: .65; cursor: not-allowed; }
.auth-submit svg { width: 15px; height: 15px; }
.auth-submit .auth-spinner { animation: authSpin .9s linear infinite; }

@keyframes authSpin { to { transform: rotate(360deg); } }

/* ── Kaki halaman ───────────────────────────────────────────────────────── */
.auth-footlinks {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
    font-size: 12px;
}

.auth-terms {
    display: flex;
    gap: 9px;
    align-items: flex-start;
    margin: 4px 0 2px;
    color: var(--auth-muted);
    font-size: 12px;
    line-height: 1.55;
    cursor: pointer;
}

.auth-secure {
    display: flex;
    gap: 7px;
    align-items: center;
    justify-content: center;
    margin-top: 18px;
    color: #a3969a;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
}
.auth-secure svg { width: 13px; height: 13px; color: var(--auth-gold-500); }

.auth-regulator {
    margin-top: 16px;
    padding-top: 15px;
    border-top: 1px solid rgba(212, 175, 55, .18);
    text-align: center;
}
.auth-regulator img {
    display: block;
    width: min(48%, 165px);
    height: auto;
    margin: 0 auto;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .35));
}

/* ── Responsif ──────────────────────────────────────────────────────────── */
@media (max-width: 380px) {
    .auth-card { padding: 24px 18px; }
    .auth-logo-ring { width: 88px; height: 88px; }
    .auth-brand h1 { font-size: 26px; }
    .auth-captcha-refresh { flex-basis: 46px; width: 46px; height: 46px; }
    .auth-captcha-box { height: 46px; }
}

/* ── Tablet & desktop ───────────────────────────────────────────────────── */
@media (min-width: 768px) {
    .auth-shell { width: min(100%, 480px); }
    .auth-card { padding: 36px 32px; }

    .auth-logo-ring { width: 118px; height: 118px; }
    .auth-brand h1 { font-size: 34px; }
    .auth-brand p { font-size: 11px; }

    .auth-field > label, .auth-label { font-size: 11px; }
    .auth-input { padding: 15px 16px 15px 44px; font-size: 15px; }
    .auth-input-wrap > svg { left: 15px; width: 19px; height: 19px; }
    .auth-meta { font-size: 13px; }

    .auth-captcha-box, .auth-captcha-refresh { height: 58px; }
    .auth-captcha-refresh { flex-basis: 58px; width: 58px; }
    .auth-captcha-input { font-size: 19px; }

    .auth-submit { padding: 16px 20px; font-size: 14px; }
    .auth-footlinks, .auth-terms { font-size: 13px; }
}
