@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

/* ==========================================================================
   Halaman autentikasi (login & pilih peran) — Institutional Navy
   Berdiri sendiri, tidak memuat Metronic sama sekali.
   ========================================================================== */

:root {
    --navy: #1a2b4a;
    --navy-hover: #243b63;
    --amber: #f59e0b;
    --amber-300: #fcd34d;
    --amber-400: #fbbf24;
}

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

/* Atribut hidden bawaan HTML tidak dijamin berlaku untuk elemen SVG, jadi ditegaskan di sini. */
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
    margin: 0;
    color: #334155;
    background: #f8fafc;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
}
.font-mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }

.login-page { display: flex; min-height: 100vh; }

/* ==========================================================================
   1. Kolom kiri — panel branding
   ========================================================================== */

.login-brand { position: relative; display: flex; flex-direction: column; width: 52%; overflow: hidden; background: var(--navy); }

/* Tekstur grid tipis. */
.login-brand-grid {
    position: absolute; inset: 0; opacity: .04;
    background-image: linear-gradient(#fff 1px, transparent 1px), linear-gradient(90deg, #fff 1px, transparent 1px);
    background-size: 40px 40px;
}

.login-brand-blob { position: absolute; border-radius: 50%; pointer-events: none; }
.login-brand-blob-1 { top: -128px; left: -128px; width: 384px; height: 384px; background: rgba(255,255,255,.05); }
.login-brand-blob-2 { top: 50%; right: -192px; width: 500px; height: 500px; background: rgba(251,191,36,.10); }
.login-brand-blob-3 { bottom: -96px; left: -64px; width: 288px; height: 288px; background: rgba(255,255,255,.05); }

.login-brand-inner { position: relative; display: flex; flex-direction: column; height: 100%; padding: 48px 56px; }

.login-brand-logo { display: flex; align-items: center; gap: 14px; }
.login-brand-mark { display: grid; flex: 0 0 auto; width: 52px; height: 52px; place-items: center; background: #fff; border-radius: 14px; }
.login-brand-mark img { display: block; width: 40px; height: 40px; object-fit: contain; }
.login-brand-name { color: #fff; font-size: 15px; font-weight: 800; line-height: 1.1; }
.login-brand-sub { margin-top: 4px; color: var(--amber-400); font-family: 'JetBrains Mono', monospace; font-size: 10px; letter-spacing: .18em; }

/* Blok headline dipusatkan pada sisa ruang di bawah logo. */
.login-brand-copy { margin: auto 0; padding-top: 40px; }

.login-pill { display: inline-flex; align-items: center; gap: 8px; padding: 5px 13px; margin-bottom: 24px; background: rgba(251,191,36,.15); border: 1px solid rgba(251,191,36,.25); border-radius: 999px; }
.login-pill-dot { width: 6px; height: 6px; background: var(--amber-400); border-radius: 50%; }
.login-pill-text { color: var(--amber-300); font-size: 11px; font-weight: 600; letter-spacing: .04em; }

.login-headline { max-width: 15ch; margin: 0 0 18px; color: #fff; font-size: 38px; font-weight: 700; line-height: 1.18; letter-spacing: -.01em; }
.login-headline em { color: var(--amber-400); font-style: normal; }
.login-lead { max-width: 42ch; margin: 0; color: #94a3b8; font-size: 14px; line-height: 1.7; }

/* ==========================================================================
   2. Kolom kanan — area konten
   ========================================================================== */

.login-main { position: relative; display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; padding: 48px 32px 80px; background: #f8fafc; }

.login-mobile-logo { display: none; align-items: center; gap: 12px; margin-bottom: 40px; }
.login-mobile-mark { display: grid; flex: 0 0 auto; width: 44px; height: 44px; place-items: center; background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; }
.login-mobile-mark img { display: block; width: 34px; height: 34px; object-fit: contain; }
.login-mobile-name { color: var(--navy); font-size: 14px; font-weight: 800; line-height: 1.1; }
.login-mobile-sub { margin-top: 3px; color: var(--amber); font-family: 'JetBrains Mono', monospace; font-size: 10px; letter-spacing: .14em; }

.login-card { width: 100%; max-width: 384px; }

.login-title { margin: 0; color: #1e293b; font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
.login-subtitle { margin: 6px 0 32px; color: #94a3b8; font-size: 14px; line-height: 1.6; }

/* ---------- Alert error ---------- */

.login-alert { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; margin-bottom: 18px; background: #fef2f2; border: 1px solid #fecaca; border-radius: 12px; }
.login-alert svg { flex: 0 0 auto; width: 16px; height: 16px; margin-top: 1px; color: #ef4444; }
.login-alert span { color: #dc2626; font-size: 12px; line-height: 1.5; }

/* ---------- Field ---------- */

.login-field { margin-bottom: 18px; }
.login-label { display: block; margin-bottom: 6px; color: #94a3b8; font-size: 10px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }

.login-control { position: relative; }
.login-control-icon { position: absolute; top: 50%; left: 14px; display: grid; place-items: center; color: #94a3b8; transform: translateY(-50%); pointer-events: none; }
.login-control-icon svg { width: 16px; height: 16px; }

.login-input { width: 100%; padding: 11px 16px 11px 40px; color: #334155; background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; font-family: inherit; font-size: 14px; transition: border-color .18s ease, box-shadow .18s ease; }
.login-input::placeholder { color: #cbd5e1; }
.login-input:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(26,43,74,.2); }
.login-input.has-toggle { padding-right: 44px; }
.login-input.is-invalid { border-color: #fca5a5; }
.login-input.is-invalid:focus { border-color: #f87171; box-shadow: 0 0 0 3px rgba(254,202,202,.55); }

.login-toggle { position: absolute; top: 50%; right: 10px; display: grid; padding: 6px; place-items: center; color: #94a3b8; background: transparent; border: 0; border-radius: 8px; transform: translateY(-50%); cursor: pointer; transition: color .18s ease, background-color .18s ease; }
.login-toggle:hover { color: #475569; background: #f1f5f9; }
.login-toggle svg { width: 16px; height: 16px; }

.login-field-error { margin: 6px 0 0; color: #ef4444; font-size: 11px; }

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

.login-submit { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 13px 16px; margin-top: 26px; color: #fff; background: var(--navy); border: 0; border-radius: 12px; box-shadow: 0 1px 2px rgba(15,23,42,.08); font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer; transition: background-color .18s ease, transform .08s ease; }
.login-submit:hover:not(:disabled) { background: var(--navy-hover); }
.login-submit:active:not(:disabled) { transform: scale(.99); }
.login-submit:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.login-submit:disabled { opacity: .7; cursor: not-allowed; }
.login-submit svg { width: 16px; height: 16px; }

.login-hint { margin: 18px 0 0; color: #cbd5e1; font-size: 11px; line-height: 1.6; text-align: center; }

/* ---------- Footer ---------- */

.login-footer { position: absolute; right: 0; bottom: 24px; left: 0; color: #cbd5e1; font-family: 'JetBrains Mono', monospace; font-size: 11px; text-align: center; }

/* ==========================================================================
   3. Pilih peran
   ========================================================================== */

/* Identitas pengguna yang baru saja lolos autentikasi. */
.auth-identity { display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 20px; background: rgba(26,43,74,.04); border: 1px solid rgba(26,43,74,.1); border-radius: 12px; }
.auth-identity-avatar { display: grid; flex: 0 0 auto; width: 32px; height: 32px; place-items: center; color: #fff; background: var(--navy); border-radius: 50%; font-size: 11px; font-weight: 700; }
.auth-identity-body { min-width: 0; }
.auth-identity-name { overflow: hidden; color: #1e293b; font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.auth-identity-meta { margin-top: 1px; color: #94a3b8; font-size: 10px; }

.role-list { display: grid; gap: 10px; }
.role-list.is-locked { pointer-events: none; }

.role-card { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; color: inherit; text-align: left; background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; font-family: inherit; cursor: pointer; transition: border-color .18s ease, background-color .18s ease, transform .08s ease; }
.role-card:hover { background: rgba(26,43,74,.05); border-color: rgba(26,43,74,.3); }
.role-card:active { transform: scale(.995); }
.role-card:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }

.role-card-icon { display: grid; flex: 0 0 auto; width: 38px; height: 38px; place-items: center; color: var(--navy); background: rgba(26,43,74,.08); border-radius: 10px; transition: background-color .18s ease; }
.role-card-icon svg { width: 18px; height: 18px; }
.role-card:hover .role-card-icon { background: rgba(26,43,74,.14); }

/* Isi kartu berupa <span> agar tetap sah di dalam <button>, jadi display-nya ditegaskan. */
.role-card-body { flex: 1; min-width: 0; }
.role-card-title { display: block; color: #1e293b; font-size: 13px; font-weight: 700; }
.role-card-desc { display: block; margin-top: 2px; color: #94a3b8; font-size: 11px; line-height: 1.5; }

.role-card-chevron { flex: 0 0 auto; color: #cbd5e1; transition: color .18s ease; }
.role-card-chevron svg { display: block; width: 16px; height: 16px; }
.role-card:hover .role-card-chevron { color: var(--navy); }

/* Saat satu kartu dipilih, hanya kartu itu yang menunjukkan proses berjalan. */
.role-card-spinner { flex: 0 0 auto; color: var(--navy); }
.role-card-spinner svg { display: block; width: 16px; height: 16px; animation: auth-spin .8s linear infinite; }
.role-card.is-busy { background: rgba(26,43,74,.05); border-color: rgba(26,43,74,.3); }
.role-list.is-locked .role-card:not(.is-busy) { opacity: .5; }

@keyframes auth-spin { to { transform: rotate(360deg); } }

/* Tidak ada peran yang bisa dipilih. */
.auth-empty { padding: 20px; color: #64748b; background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; font-size: 13px; line-height: 1.6; text-align: center; }

.auth-back { display: block; margin-top: 20px; color: #94a3b8; font-size: 12px; text-align: center; text-decoration: none; transition: color .18s ease; }
.auth-back:hover { color: var(--navy); text-decoration: underline; }

/* ==========================================================================
   4. Responsive
   ========================================================================== */

@media (max-width: 1023.98px) {
    .login-brand { display: none; }
    .login-mobile-logo { display: flex; }
    .login-main { justify-content: flex-start; padding-top: 56px; }
}

@media (max-width: 479.98px) {
    .login-main { padding-right: 20px; padding-left: 20px; }
    .login-title { font-size: 21px; }
}

@media (prefers-reduced-motion: reduce) {
    .login-submit, .login-input, .login-toggle, .role-card { transition: none; }
    .role-card-spinner svg { animation: none; }
}
