/* =====================================================================
   auth.css - popup Masuk / Daftar (src/site/auth.js), tema gelap & terang
   Dipakai halaman utama, simulator (app.html) dan panel developer.
   ===================================================================== */
@font-face { font-family: 'Inter'; src: url('../vendor/fonts/inter-latin-wght.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }

.ma-ov {
  --ma-bg: #0d0f12; --ma-panel: #121418; --ma-art: linear-gradient(160deg, #24272c 0%, #15171b 46%, #0e1013 100%);
  --ma-line: rgba(255, 255, 255, 0.12); --ma-line2: rgba(255, 255, 255, 0.2);
  --ma-text: #f4f5f7; --ma-text2: rgba(236, 238, 242, 0.78); --ma-text3: rgba(236, 238, 242, 0.5);
  --ma-field: rgba(255, 255, 255, 0.035); --ma-field-f: rgba(255, 255, 255, 0.07);
  --ma-btn: linear-gradient(180deg, #fbfbfc 0%, #d9dade 55%, #c4c6cb 100%); --ma-btn-t: #111317;
  --ma-shade: rgba(4, 5, 7, 0.62); --ma-shadow: 0 40px 120px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  --ma-logo: #f4f5f7; --ma-logo-s: #15171b; --ma-board: url('img/esc-pi.jpg');
  position: fixed; inset: 0; z-index: 10000; display: none; align-items: center; justify-content: center; padding: 24px;
  background: var(--ma-shade); -webkit-backdrop-filter: blur(10px) saturate(110%); backdrop-filter: blur(10px) saturate(110%);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; color: var(--ma-text); line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
html[data-theme='light'] .ma-ov {
  --ma-bg: #ffffff; --ma-panel: #fbfbfc; --ma-art: linear-gradient(160deg, #ffffff 0%, #eef0f3 50%, #e2e5ea 100%);
  --ma-line: rgba(15, 20, 30, 0.1); --ma-line2: rgba(15, 20, 30, 0.18);
  --ma-text: #111418; --ma-text2: rgba(17, 20, 24, 0.74); --ma-text3: rgba(17, 20, 24, 0.5);
  --ma-field: rgba(15, 20, 30, 0.025); --ma-field-f: #fff;
  --ma-btn: linear-gradient(180deg, #2b2f36 0%, #15181c 100%); --ma-btn-t: #fff;
  --ma-shade: rgba(220, 224, 230, 0.55); --ma-shadow: 0 40px 110px rgba(30, 40, 60, 0.28), 0 0 0 1px rgba(255, 255, 255, 0.8) inset;
  --ma-logo: #15181c; --ma-logo-s: #fff; --ma-board: url('img/esc-pi-light.jpg');
}
.ma-ov.show { display: flex; animation: ma-fade 0.22s ease-out; }
.ma-ov.show .ma-box { animation: ma-pop 0.32s cubic-bezier(0.2, 0.9, 0.25, 1.05); }
@keyframes ma-fade { from { opacity: 0; } }
@keyframes ma-pop { from { opacity: 0; transform: translateY(14px) scale(0.975); } }
html.ma-open, html.ma-open body { overflow: hidden; }
.ma-ov *, .ma-ov *::before, .ma-ov *::after { box-sizing: border-box; }
:where(.ma-ov) button, :where(.ma-ov) input { font: inherit; color: inherit; }
.ma-ov svg { flex: none; }

.ma-box {
  position: relative; display: grid; grid-template-columns: 0.88fr 1fr; width: min(960px, 100%); max-height: calc(100dvh - 48px);
  border-radius: 24px; overflow: hidden; background: var(--ma-panel); border: 1px solid var(--ma-line2); box-shadow: var(--ma-shadow);
}

/* ---------------------------------------------------------- panel kiri */
.ma-art {
  position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 96px 34px 0; overflow: hidden;
  background: var(--ma-art); border-right: 1px solid var(--ma-line);
}
.ma-shine { position: absolute; inset: 0; pointer-events: none; background:
  linear-gradient(125deg, transparent 0 9%, rgba(255, 255, 255, 0.13) 9% 16%, transparent 16% 19%, rgba(255, 255, 255, 0.06) 19% 23%, transparent 23%); }
html[data-theme='light'] .ma-shine { background: linear-gradient(125deg, transparent 0 9%, rgba(255, 255, 255, 0.9) 9% 16%, transparent 16% 19%, rgba(255, 255, 255, 0.6) 19% 23%, transparent 23%); }
.ma-logo { position: relative; width: 84px; height: 84px; filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.35)); }
.ma-logo rect { fill: var(--ma-logo); }
.ma-logo path { fill: none; stroke: var(--ma-logo-s); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.ma-name { position: relative; margin-top: 22px; font-size: clamp(30px, 3.4vw, 40px); font-weight: 700; letter-spacing: -0.025em; line-height: 1.1; }
.ma-tag { position: relative; margin-top: 10px; font-size: 17px; color: var(--ma-text2); }
.ma-intro { position: relative; margin: 26px 0 0; max-width: 300px; font-size: 15.5px; color: var(--ma-text2); }
.ma-board {
  position: relative; flex: 1; width: calc(100% + 68px); min-height: 190px; margin-top: 18px;
  background: var(--ma-board) 58% 74% / 215% auto no-repeat;
  -webkit-mask-image: radial-gradient(75% 85% at 50% 62%, #000 45%, transparent 85%); mask-image: radial-gradient(75% 85% at 50% 62%, #000 45%, transparent 85%);
}

/* ---------------------------------------------------------- panel kanan */
.ma-main { position: relative; display: flex; flex-direction: column; padding: 46px 36px 30px; overflow-y: auto; }
.ma-x {
  position: absolute; top: 18px; right: 18px; width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 50%;
  background: none; cursor: pointer; color: var(--ma-text2); transition: background 0.15s, color 0.15s;
}
.ma-x:hover { background: var(--ma-field-f); color: var(--ma-text); }
.ma-x svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.ma-ov.locked .ma-x { display: none; }

.ma-tabs { display: grid; grid-template-columns: 1fr 1fr; margin-right: 40px; border-bottom: 1px solid var(--ma-line); }
.ma-tabs button {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 10px; height: 58px; border: 1px solid transparent; border-bottom: 0;
  border-radius: 14px 14px 0 0; background: none; cursor: pointer; font-size: 16px; font-weight: 550; color: var(--ma-text2); transition: color 0.15s, background 0.15s;
}
.ma-tabs button:hover { color: var(--ma-text); }
.ma-tabs button.on { color: var(--ma-text); background: linear-gradient(180deg, var(--ma-field-f), var(--ma-field)); border-color: var(--ma-line2); }
.ma-tabs button.on::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--ma-text); border-radius: 2px; }
.ma-tabs svg { width: 22px; height: 22px; }
.ma-tabs svg .f { fill: currentColor; }
.ma-tabs svg .k { fill: none; stroke: var(--ma-panel); stroke-width: 2.2; stroke-linecap: round; }
.ma-tabs svg path.f:nth-child(2) { fill: currentColor; }

.ma-h { margin: 40px 0 0; text-align: center; font-size: clamp(24px, 2.6vw, 30px); font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.ma-sub { margin: 10px auto 0; max-width: 380px; text-align: center; font-size: 16px; color: var(--ma-text2); }
.ma-msg { display: none; margin-top: 18px; padding: 11px 14px; border-radius: 12px; font-size: 14px; line-height: 1.45; border: 1px solid; overflow-wrap: anywhere; }
.ma-msg.on { display: block; }
.ma-msg.err { color: #ffb4b4; border-color: rgba(255, 110, 110, 0.35); background: rgba(255, 80, 80, 0.08); }
.ma-msg.ok { color: #a8f0c6; border-color: rgba(80, 220, 140, 0.35); background: rgba(60, 200, 120, 0.08); }
.ma-msg.info { color: var(--ma-text2); border-color: var(--ma-line2); background: var(--ma-field); }
html[data-theme='light'] .ma-msg.err { color: #b3261e; background: #fdecec; }
html[data-theme='light'] .ma-msg.ok { color: #176c3c; background: #e9f8ef; }

.ma-form { display: flex; flex-direction: column; gap: 16px; margin-top: 26px; }
.ma-field {
  position: relative; display: flex; align-items: center; height: 60px; padding: 0 16px 0 20px; border-radius: 16px;
  border: 1px solid var(--ma-line2); background: var(--ma-field); transition: border-color 0.15s, background 0.15s, box-shadow 0.15s; cursor: text;
}
.ma-field:focus-within { border-color: var(--ma-text3); background: var(--ma-field-f); box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.05); }
html[data-theme='light'] .ma-field:focus-within { box-shadow: 0 0 0 4px rgba(15, 20, 30, 0.06); }
.ma-ico { display: grid; place-items: center; width: 28px; color: var(--ma-text); }
.ma-ico svg, .ma-eye svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ma-field input { flex: 1; min-width: 0; height: 100%; margin-left: 16px; border: 0; outline: 0; background: none; font-size: 16.5px; }
.ma-field input::placeholder { color: var(--ma-text3); }
.ma-eye { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 10px; background: none; cursor: pointer; color: var(--ma-text2); }
.ma-eye:hover { color: var(--ma-text); background: var(--ma-field-f); }

.ma-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 2px 4px 4px; font-size: 15.5px; }
.ma-check { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; }
.ma-check input { position: absolute; opacity: 0; pointer-events: none; }
.ma-box-c { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; border: 1.5px solid var(--ma-line2); background: var(--ma-field); transition: background 0.15s; }
.ma-box-c svg { width: 16px; height: 16px; fill: none; stroke: var(--ma-panel); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.ma-check input:checked + .ma-box-c { background: var(--ma-text); border-color: var(--ma-text); }
.ma-check input:checked + .ma-box-c svg { opacity: 1; }
.ma-check input:focus-visible + .ma-box-c { outline: 2px solid var(--ma-text3); outline-offset: 2px; }
.ma-link { display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none; cursor: pointer; font-size: 14.5px; color: var(--ma-text2); text-decoration: underline; text-underline-offset: 3px; }
.ma-link:hover { color: var(--ma-text); }
.ma-link.strong { font-size: 15.5px; color: var(--ma-text); font-weight: 550; }
.ma-link svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.ma-submit, .ma-google {
  display: flex; align-items: center; justify-content: center; gap: 14px; width: 100%; height: 58px; border-radius: 999px; cursor: pointer;
  font-size: 17px; font-weight: 550; transition: transform 0.12s, filter 0.15s, background 0.15s, border-color 0.15s;
}
.ma-submit { border: 0; background: var(--ma-btn); color: var(--ma-btn-t); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.9); }
html[data-theme='light'] .ma-submit { box-shadow: 0 10px 26px rgba(20, 25, 35, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.15); }
.ma-submit svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ma-submit:hover:not(:disabled) { filter: brightness(1.05); transform: translateY(-1px); }
.ma-submit:active:not(:disabled) { transform: translateY(0); }
.ma-ov.busy .ma-submit span::after { content: '…'; }
.ma-ov button:disabled { cursor: default; opacity: 0.7; }

.ma-or { display: flex; align-items: center; gap: 16px; margin: 22px 0; font-size: 15.5px; color: var(--ma-text2); }
.ma-or::before, .ma-or::after { content: ''; flex: 1; height: 1px; background: var(--ma-line); }
.ma-google { border: 1px solid var(--ma-line2); background: transparent; }
.ma-google:hover:not(:disabled) { background: var(--ma-field-f); border-color: var(--ma-text3); }
.ma-g { width: 26px; height: 26px; }
.ma-foot { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px 22px; margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--ma-line); font-size: 14.5px; color: var(--ma-text2); }
.ma-foot:empty { display: none; }

/* ---------------------------------------------------------- tampilan per langkah */
.ma-main[data-view='login'] [data-f='name'],
.ma-main[data-view='signup'] [data-f='row'],
.ma-main[data-view='forgot'] [data-f='name'], .ma-main[data-view='forgot'] [data-f='pass'], .ma-main[data-view='forgot'] [data-f='row'],
.ma-main[data-view='forgot'] [data-f='google'],
.ma-main[data-view='reset'] [data-f='name'], .ma-main[data-view='reset'] [data-f='email'], .ma-main[data-view='reset'] [data-f='row'],
.ma-main[data-view='reset'] [data-f='google'], .ma-main[data-view='reset'] .ma-tabs { display: none; }
.ma-main[data-view='forgot'] .ma-tabs button.on::after, .ma-main[data-view='forgot'] .ma-tabs button { background: none; border-color: transparent; }
.ma-main[data-view='forgot'] .ma-tabs button::after { display: none; }
.ma-main[data-view='reset'] .ma-h { margin-top: 20px; }

/* ---------------------------------------------------------- layar kecil */
@media (max-height: 760px) and (min-width: 821px) {
  .ma-main { padding-top: 30px; padding-bottom: 22px; }
  .ma-h { margin-top: 24px; }
  .ma-form { gap: 12px; margin-top: 18px; }
  .ma-field, .ma-submit, .ma-google { height: 52px; }
  .ma-or { margin: 14px 0; }
  .ma-foot { margin-top: 14px; padding-top: 14px; }
  .ma-art { padding-top: 60px; }
}
@media (max-width: 820px) {
  .ma-ov { padding: 12px; align-items: flex-start; overflow-y: auto; }
  .ma-box { grid-template-columns: 1fr; max-height: none; }
  .ma-art { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 4px 14px; padding: 22px 56px 20px 20px; border-right: 0; border-bottom: 1px solid var(--ma-line); }
  .ma-logo { width: 46px; height: 46px; }
  .ma-name { margin-top: 0; font-size: 26px; align-self: center; }
  .ma-tag { flex-basis: 100%; margin-top: 2px; font-size: 15px; }
  .ma-intro, .ma-board { display: none; }
  .ma-main { padding: 22px 18px 22px; overflow: visible; }
  .ma-x { top: -76px; right: 6px; }
  .ma-tabs { margin-right: 0; }
  .ma-h { margin-top: 26px; }
}
@media (prefers-reduced-motion: reduce) { .ma-ov.show, .ma-ov.show .ma-box { animation: none; } }
