/* ======================================================
   UI-DARK — stylesheet bersama semua halaman SSO
   (dimuat oleh templates/sso/ui-dark/base.html)
   ====================================================== */

/* Inter variable, self-hosted (SIL OFL 1.1, lihat fonts/LICENSE-Inter.txt) */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/inter-latin-wght-normal.woff2") format("woff2-variations"),
       url("fonts/inter-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
                 U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191,
                 U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ======================================================
   DESIGN TOKENS
   ====================================================== */
:root {
  --bg:            #f4f4f3;
  --surface:       #ffffff;
  --surface-2:     #fafafa;
  --text:          #0a0a0a;
  --text-muted:    #6b6b6b;
  --text-subtle:   #9a9a9a;
  --border:        #e6e6e4;
  --border-strong: #d4d4d2;
  --accent:        #0a0a0a;
  --accent-text:   #ffffff;
  --dot:           rgba(0, 0, 0, .07);
  --ring:          rgba(0, 0, 0, .12);

  --radius-sm: 10px;
  --radius:    14px;
  --radius-lg: 24px;

  /* Shadow berlapis (layered) — lembut & realistis */
  --shadow-card:
    0 0 0 1px rgba(0, 0, 0, .04),
    0 1px 2px rgba(0, 0, 0, .04),
    0 4px 8px -2px rgba(0, 0, 0, .04),
    0 16px 32px -8px rgba(0, 0, 0, .08),
    0 40px 80px -24px rgba(0, 0, 0, .12);
  --shadow-btn:
    0 1px 0 rgba(255, 255, 255, .12) inset,
    0 1px 2px rgba(0, 0, 0, .2),
    0 6px 16px -6px rgba(0, 0, 0, .35);
  --shadow-input: 0 1px 2px rgba(0, 0, 0, .03);

  --font: "Inter", ui-sans-serif, system-ui, -apple-system,
          "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --ease: cubic-bezier(.2, .8, .2, 1);

  /* Ikon alert untuk CSS mask (data URI, diizinkan CSP img-src data:) */
  --icon-alert: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 8v4M12 16h.01'/%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:            #0a0a0a;
    --surface:       #121212;
    --surface-2:     #171717;
    --text:          #f5f5f4;
    --text-muted:    #a3a3a3;
    --text-subtle:   #6b6b6b;
    --border:        #262626;
    --border-strong: #363636;
    --accent:        #f5f5f4;
    --accent-text:   #0a0a0a;
    --dot:           rgba(255, 255, 255, .06);
    --ring:          rgba(255, 255, 255, .16);

    --shadow-card:
      0 0 0 1px rgba(255, 255, 255, .06),
      0 1px 0 rgba(255, 255, 255, .04) inset,
      0 24px 64px -16px rgba(0, 0, 0, .8);
    --shadow-btn:
      0 1px 0 rgba(255, 255, 255, .6) inset,
      0 6px 16px -6px rgba(0, 0, 0, .6);
    --shadow-input: 0 0 #0000;
  }
}

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

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--bg);
  /* Dot grid halus + vignette */
  background-image:
    radial-gradient(ellipse 80% 60% at 50% 40%, transparent 40%, var(--bg) 100%),
    radial-gradient(var(--dot) 1px, transparent 1px);
  background-size: 100% 100%, 20px 20px;
  background-attachment: fixed;
  overflow-wrap: anywhere;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

a { color: inherit; }

/* Sprite ikon SVG (lihat base.html + _icon.html) */
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ======================================================
   LAYOUT (shell)
   ====================================================== */
.shell {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

.stack {
  width: 100%;
  max-width: 400px;
  animation: rise .6s var(--ease) both;
}

/* Halaman lebar (dashboard, dsb.): <body class="is-wide"> */
.is-wide .stack { max-width: 760px; }

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.footer {
  text-align: center;
  padding: 0 16px 24px;
  font-size: 12px;
  color: var(--text-subtle);
}

/* ======================================================
   COMPONENTS
   ====================================================== */

/* Brand */
.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 28px;
}
.brand-mark {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-text);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-btn);
}
.brand-name {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -.01em;
}
.brand-name span {
  color: var(--text-subtle);
  font-weight: 500;
}

/* Card */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 36px 32px 28px;
}

.card-header { margin-bottom: 24px; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  margin-bottom: 16px;
}
.eyebrow::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text);
}

.title {
  margin: 0 0 6px;
  font-size: 26px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -.025em;
}
.subtitle {
  margin: 0;
  color: var(--text-muted);
}

/* Alert */
.alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  margin-bottom: 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  font-size: 13px;
  animation: shake .4s var(--ease);
}
.alert svg { flex-shrink: 0; margin-top: 1px; }

/* Notifikasi netral (mis. "Anda telah keluar"): tanpa getar */
.alert.is-info {
  animation: none;
  border-color: var(--border);
  color: var(--text-muted);
}
@keyframes shake {
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}

/* Field */
.field { margin-bottom: 16px; }

.label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 8px;
}
/* Label + info di kanan (mis. Caps Lock) tanpa masuk ke nama aksesibel label */
.label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}
.label-row .label { margin-bottom: 0; }
.caps-hint {
  font-weight: 500;
  color: var(--text);
  font-size: 12px;
}

.control {
  position: relative;
  display: flex;
  align-items: center;
}
.control > .icon {
  position: absolute;
  left: 14px;
  color: var(--text-subtle);
  pointer-events: none;
  transition: color .2s var(--ease);
}

.input {
  width: 100%;
  height: 46px;
  padding: 0 14px 0 42px;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-input);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease);
  -webkit-appearance: none;
  appearance: none;
}
.input::placeholder { color: var(--text-subtle); }
@media (hover: hover) {
  .input:hover { border-color: var(--border-strong); }
}
.input:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--text);
  box-shadow: 0 0 0 4px var(--ring);
}
.control:focus-within > .icon { color: var(--text); }
.input.has-action { padding-right: 46px; }

.input-action {
  position: absolute;
  right: 6px;
  width: 34px; height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-subtle);
  cursor: pointer;
  transition: background .2s var(--ease), color .2s var(--ease);
}
@media (hover: hover) {
  .input-action:hover { background: var(--border); color: var(--text); }
}
.input-action .eye-off { display: none; }
.input-action[aria-pressed="true"] .eye     { display: none; }
.input-action[aria-pressed="true"] .eye-off { display: block; }

.hint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.hint:empty { display: none; }

/* Input tidak valid: garis tepi tegas (monokrom) + pesan ber-ikon */
.input[aria-invalid="true"] {
  border-color: var(--text);
  border-style: dashed;
}
.input[aria-invalid="true"]:focus { border-style: solid; }
.control:has(.input[aria-invalid="true"]) > .icon { color: var(--text); }
.field:has(.input[aria-invalid="true"]) .hint {
  color: var(--text);
  font-weight: 500;
}
.field:has(.input[aria-invalid="true"]) .hint {
  display: flex;
  align-items: center;
  gap: 6px;
}
.field:has(.input[aria-invalid="true"]) .hint:empty { display: none; }
/* Ikon alert dekoratif: pseudo-element tanpa teks sehingga tidak dibacakan */
.field:has(.input[aria-invalid="true"]) .hint::before {
  content: "";
  flex-shrink: 0;
  width: 13px; height: 13px;
  background: currentColor;
  -webkit-mask: var(--icon-alert) center / contain no-repeat;
          mask: var(--icon-alert) center / contain no-repeat;
}

/* Button */
.btn {
  position: relative;
  width: 100%;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--accent-text);
  background: var(--accent);
  border: 0;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-btn);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: transform .15s var(--ease), box-shadow .2s var(--ease), opacity .2s;
}
.btn:active { transform: scale(.99); }
.btn .arrow { transition: transform .2s var(--ease); }
@media (hover: hover) {
  .btn:hover { transform: translateY(-1px); }
  .btn:hover .arrow { transform: translateX(3px); }
}

.btn .spinner {
  display: none;
  width: 16px; height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.btn.is-loading { pointer-events: none; opacity: .85; }
.btn.is-loading .spinner { display: block; }
.btn.is-loading .arrow   { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn-secondary {
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--border-strong) inset, var(--shadow-input);
}
@media (hover: hover) {
  .btn-secondary:hover { background: var(--surface-2); }
}

a.btn { text-decoration: none; }

.btn-sm {
  width: auto;
  height: 36px;
  padding: 0 14px;
  gap: 6px;
  font-size: 13px;
}

.btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Meta row */
.meta {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px dashed var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}
.meta svg { flex-shrink: 0; }

.help {
  margin-top: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

/* Layar sentuh: font input 16px agar iOS tidak auto-zoom,
   target sentuh minimal ~44px */
@media (pointer: coarse) {
  .input, .btn { height: 48px; font-size: 16px; }
  .input-action { width: 40px; height: 40px; right: 4px; }
  .btn.btn-sm { height: 40px; font-size: 14px; }
}

/* Tablet */
@media (min-width: 640px) and (min-height: 700px) {
  .stack { max-width: 420px; }
  .card  { padding: 40px 36px 32px; }
}

/* Mobile */
@media (max-width: 480px) {
  /* Tombol berpasangan ditumpuk; tombol utama di atas (mengurangi salah ketuk) */
  .btn-row { grid-template-columns: 1fr; }
  .btn-row > .btn:not(.btn-secondary) { order: -1; }

  .shell { place-items: start center; padding: 40px 16px 24px; }
  .brand { margin-bottom: 20px; }
  .card  { padding: 28px 20px 22px; border-radius: 20px; }
  .title { font-size: 22px; }
}

/* Layar pendek (HP landscape): rapatkan jarak vertikal */
@media (max-height: 520px) {
  .shell { place-items: start center; padding-top: 20px; padding-bottom: 16px; }
  .brand { margin-bottom: 16px; }
  .card  { padding-top: 24px; padding-bottom: 20px; }
  .card-header { margin-bottom: 18px; }
}

/* Area aman notch / home indicator */
@supports (padding: max(0px)) {
  .shell  { padding-left: max(16px, env(safe-area-inset-left));
            padding-right: max(16px, env(safe-area-inset-right)); }
  .footer { padding-bottom: max(24px, env(safe-area-inset-bottom)); }
}

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