/* ============================================================
   Sandbox Chip Merah Putih — auth layer (doc 11-auth-spec.md)
   auth.css — shared styles for the five auth screens.

   Tokens: doc 07 §2 + doc 11 §2.4. No hex value invented here.
   --text / --danger / --danger-soft resolved per build ruling
   (12 Aug 2026): #101444 (doc 07 --text-strong), #A8201A /
   #FBECEB (app v2.1 build prompt §1).
   ============================================================ */

:root {
  /* §2.4 Table A — verified values */
  --core-blue-900: #202887;   /* headings */
  --violet:        #3E3EFE;   /* primary button, focus ring, links, demo chip */
  --line:          #E6E7F2;   /* card border, dividers, frame rules */
  --line-strong:   #D5D7E9;   /* secondary / OAuth button borders */
  --line-field:    #8B8FA8;   /* INPUT borders only — WCAG 1.4.11, 3.19:1 */
  --text-soft:     #676D90;   /* sub-copy, helper text, page footer (5.04:1) */
  --surface-2:     #F7F7FE;   /* divider label chip, OAuth button hover */

  /* §2.4 Table B — inherited from doc 07 §2 */
  --surface-0:     #FFFFFF;   /* page and card background */
  --text:          #101444;   /* labels, input text, email echo */
  --violet-soft:   #EDEDFF;   /* demo chip background only */
  --danger:        #A8201A;   /* error banner border + icon */
  --danger-soft:   #FBECEB;   /* error banner background */
  --r-sm:  8px;               /* error banner, input, button radii */
  --r-md: 12px;               /* card, mark square radii */
  --r-full: 9999px;           /* demo chip pill radius */
}

/* ---- base ---- */
* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  background: var(--surface-0);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--violet); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }

/* §7.4 / A7 — focus ring on every interactive element. Never outline:none
   without a replacement. */
:focus-visible {
  outline: 2px solid var(--violet);
  outline-offset: 2px;
}

/* ---- §2.1 / §2.2 shell: centred single column, no split panel ---- */
.auth-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;      /* vertical centring ≥768 */
  padding: 48px 24px;
}
.auth-main {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* §2.2 hairline frame — the two 1px rules at the 1280px content-frame
   edges. Fixed, full viewport height; only on screen ≥1280px (they sit
   outside the viewport between 768 and 1279 — correct, do not clamp).
   Hidden below 768px so they cannot cause overflow. */
.auth-page::before,
.auth-page::after {
  content: '';
  position: fixed;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--line);
  pointer-events: none;
  display: none;
}
@media (min-width: 768px) {
  .auth-page::before { display: block; left: calc(50% - 640px); }
  .auth-page::after  { display: block; left: calc(50% + 640px); }
}
@media (max-width: 767px) {
  .auth-page {
    justify-content: flex-start;  /* top-aligned <768 */
    padding: 32px 16px;
  }
}

/* ---- logo above card: 28px tall, → {LANDING} (href set by page script) ---- */
.auth-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 32px;
}
.auth-logo img {
  height: 28px;
  width: auto;
  display: block;
}

/* ---- card: 400px column, hairline border, ONE elevation level ---- */
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface-0);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 32px;
}
@media (max-width: 767px) {
  /* §2.3 — below 768 the card stops being a card */
  .auth-card { border: none; padding: 0; }
}

/* ---- §2.5 type ---- */
.auth-h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--core-blue-900);
}
.auth-sub {
  margin: 8px 0 0;              /* H1 → sub: 8px */
  font-size: 15px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--text-soft);
}
.auth-center { text-align: center; }

/* spacing after the sub → first control: 24px */
.auth-card > .auth-sub { margin-bottom: 24px; }

/* ---- buttons: 44px everywhere ---- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 44px;
  border-radius: var(--r-sm);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}
.btn--primary {
  background: var(--violet);
  color: var(--surface-0);
  border: 1px solid var(--violet);
}
.btn--primary:hover { background: var(--violet); text-decoration: none; }
.btn--primary:disabled {
  /* §7.1 — disabled keeps its full appearance: same violet fill, same
     label; only the cursor changes. No opacity, no greyed token. */
  background: var(--violet);
  color: var(--surface-0);
  border-color: var(--violet);
  cursor: default;
}
.btn--oauth {
  background: var(--surface-0);
  color: var(--text);
  border: 1px solid var(--line-strong);
}
.btn--oauth:hover { background: var(--surface-2); text-decoration: none; }
.btn--oauth svg { flex: none; }

/* ---- OAuth stack: gap 12px ---- */
.auth-oauth {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;             /* sub → first control */
}

/* ---- divider: hairline — chip — hairline, label "atau" ---- */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 24px;             /* OAuth stack → divider */
  margin-bottom: 24px;          /* divider → first field */
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}
.auth-divider span {
  background: var(--surface-2); /* divider label chip */
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 400;
  padding: 4px 12px;
  border-radius: var(--r-full);
}

/* ---- fields ---- */
.field-group { margin-bottom: 16px; }   /* field → field */
.field-group:last-of-type { margin-bottom: 0; }

.field-label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}
.label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
}
.label-row .field-label { margin-bottom: 0; }
.label-link {                 /* "Lupa kata sandi?" — inline control, exempt from 44px */
  font-size: 14px;
  font-weight: 400;
  color: var(--text-soft);
}
.label-link a,
.label-link a:hover { color: var(--violet); font-weight: 500; text-decoration: none; }
.label-link a:hover { text-decoration: underline; }

.field { position: relative; }
.field input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line-field);   /* A8 — inputs use --line-field, nothing else */
  border-radius: var(--r-sm);
  background: var(--surface-0);
  color: var(--text);
  font-size: 15px;
  font-weight: 400;
  font-family: inherit;
}
.field input::placeholder { color: var(--text-soft); }
.field input:focus {
  outline: 2px solid var(--violet);
  outline-offset: 2px;
  border-color: var(--violet);
}

/* Password fields — input + show/hide toggle as ONE split control, the exact
   wireframe shape (┌──────┬──────┐). The input owns the left boundary; the
   toggle's left border is the internal divider. Spacing scale only: 44px
   height, 12px padding, 8px radius, 1px border — no 96px clearance hack. */
.field--split { display: flex; }
.field--split input {
  flex: 1 1 auto;
  min-width: 0;
  border-right: none;                       /* the toggle's left border is the divider */
  border-radius: var(--r-sm) 0 0 var(--r-sm);
}

.field-toggle {
  flex: none;
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line-field);      /* completes the field boundary + divider */
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: var(--surface-0);
  font-size: 13px;
  font-weight: 500;
  color: var(--violet);
  cursor: pointer;
}
.field-toggle:hover { text-decoration: underline; }

.field-helper {
  margin: 8px 0 0;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-soft);
}

/* ---- submit → secondary text button: 16px ---- */
.auth-primary { margin-top: 24px; }   /* last field → primary button */
.auth-text-btn {
  margin-top: 16px;                   /* primary → text button */
  display: flex;
  justify-content: center;
}
.btn--text {
  border: none;
  background: none;
  padding: 8px 16px;
  height: 44px;                       /* exempt under A6, sized comfortably anyway */
  color: var(--violet);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}
.btn--text:hover { text-decoration: underline; }

/* ---- §4.2 legal line under the primary button ---- */
.auth-legal {
  margin: 16px 0 0;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--text-soft);
}
.auth-legal a { color: var(--violet); }

/* ---- below-card link / switch line ---- */
.auth-switch {
  margin-top: 24px;                   /* card → switch link */
  text-align: center;
  font-size: 14px;
  font-weight: 400;
  color: var(--text-soft);
}
.auth-switch a { color: var(--violet); font-weight: 500; }
.auth-switch a:hover { text-decoration: underline; }

/* ---- page footer: Bantuan · Dokumentasi ---- */
.auth-footer {
  margin-top: 32px;                   /* switch/below-card link → footer, or card → footer */
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-soft);
}
.auth-footer a { color: var(--violet); }
.auth-footer a:hover { text-decoration: underline; }
.auth-footer .dot { color: var(--text-soft); }

/* ---- §4.3 back link ---- */
.auth-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  font-size: 14px;
  font-weight: 400;
  color: var(--violet);
}
.auth-back:hover { text-decoration: underline; }

/* ---- §4.4 / §4.5 mark: 56px square, hairline, --r-md, glyph --violet ---- */
.auth-mark {
  width: 56px;
  height: 56px;
  margin: 0 auto 24px;                /* mark → H1: 24px */
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--violet);
}
.auth-mark svg { width: 28px; height: 28px; }

/* ---- §4.4 demo chip: "Khusus prototipe", inside the primary button ---- */
.demo-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--r-full);
  background: var(--violet-soft);
  color: var(--violet);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

/* ---- §7.3 demo error banner (query-parameter only) ---- */
.error-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 24px;
  padding: 12px 16px;
  border: 1px solid var(--danger);
  border-radius: var(--r-sm);
  background: var(--danger-soft);
  color: var(--text);                 /* not --text-soft: A13 forbids it on --danger-soft */
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
}
.error-banner svg {
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 1px;
  color: var(--danger);               /* icon + border carry the signal, never colour alone */
}

/* ---- §7.4 email echo on cek-email ---- */
.email-echo { font-weight: 500; color: var(--text); }

/* ---- §8.2 toast: 3s, bottom-centre, role=status, dismiss on click ---- */
.auth-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 12px 16px;
  background: var(--surface-0);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  z-index: 100;
  box-shadow: none;                   /* one elevation level: hairlines, no shadows */
}

/* ---- §7.2 OAuth overlay: full-viewport page transition, no scrim ---- */
.oauth-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  background: var(--surface-0);       /* full opacity, no blur, no scrim */
}
.oauth-mark { width: 32px; height: 32px; color: var(--text); }
.oauth-msg {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
}
.oauth-bar {
  width: 200px;
  height: 2px;
  border-radius: var(--r-full);
  background: var(--line);            /* track */
  overflow: hidden;
}
.oauth-bar-fill {
  display: block;
  height: 100%;
  width: 40%;
  border-radius: var(--r-full);
  background: var(--violet);          /* fill */
  animation: oauth-sweep 1.1s ease-in-out infinite;
}
@keyframes oauth-sweep {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(250%); }
}
.oauth-cancel {
  border: none;
  background: none;
  padding: 8px 16px;
  font-size: 15px;
  font-weight: 500;
  color: var(--violet);
  cursor: pointer;
}
.oauth-cancel:hover { text-decoration: underline; }

/* §7.2 / A12 — reduced motion: bar static at 40%, no sweep. Delays stay. */
@media (prefers-reduced-motion: reduce) {
  .oauth-bar-fill { animation: none; }
}

/* §4.5 — State A/B swap container */
.auth-state[hidden] { display: none; }
