/* =========================================================
   ATVPEDIA Portal — css/portal.css
   Mandiri (tidak memuat style.css) agar ringan & tak konflik.
   Mobile-first, tanpa inset shorthand / backdrop-filter di HP.
   ========================================================= */

:root {
  --blue-900: #03204d;
  --blue-800: #07306f;
  --blue-700: #0a439e;
  --blue-600: #0a55c4;
  --blue-500: #0066e0;
  --blue-400: #1890ff;
  --cyan-400: #00d2ff;
  --cyan-300: #4de3ff;
  --cyan-200: #a8f0ff;
  --cyan-100: #e0faff;

  --ink-900: #0b1f3a;
  --ink-700: #334c6e;
  --ink-500: #64748b;
  --ink-300: #aab7ca;

  --bg: #f5f9ff;
  --surface: #fff;
  --line: #e4eefa;

  --shadow-sm: 0 2px 10px rgba(6, 66, 160, .08);
  --shadow-md: 0 12px 30px rgba(6, 66, 160, .13);
  --shadow-lg: 0 20px 44px rgba(3, 32, 77, .2);

  --grad: linear-gradient(135deg, #00d2ff 0%, #1890ff 45%, #0066e0 100%);
  --grad-deep: linear-gradient(160deg, #03204d 0%, #0a439e 55%, #0066e0 100%);

  --radius: 18px;
  --radius-lg: 24px;
  --font: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink-900);
  background: var(--bg);
  background-image:
    radial-gradient(80% 55% at 100% 0%, rgba(0, 210, 255, .12) 0%, rgba(0, 210, 255, 0) 70%),
    radial-gradient(70% 50% at 0% 100%, rgba(10, 85, 196, .10) 0%, rgba(10, 85, 196, 0) 70%);
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
@supports (overflow-x: clip) { body { overflow-x: clip; } }

img, svg { max-width: 100%; height: auto; border: 0; }
img { display: block; }
a { text-decoration: none; color: inherit; }
a, button, [role="button"] { touch-action: manipulation; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; -webkit-appearance: none; appearance: none; }
input { font: inherit; font-size: 16px; color: inherit; -webkit-appearance: none; appearance: none; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.4rem, 6vw, 2.1rem); font-weight: 800; letter-spacing: -.02em; line-height: 1.2; overflow-wrap: anywhere; }
h2 { font-size: 1.05rem; font-weight: 800; letter-spacing: -.01em; }
p { color: var(--ink-700); overflow-wrap: anywhere; }

:focus-visible { outline: 3px solid var(--cyan-400); outline-offset: 2px; border-radius: 8px; }

.container { width: 100%; max-width: 880px; margin-inline: auto; padding-inline: 18px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 30;
  background: var(--blue-700); color: #fff; padding: 12px 18px;
  border-radius: 0 0 12px 0; font-weight: 700;
}
.skip-link:focus { left: 0; }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 22px; border-radius: 999px;
  font-weight: 700; font-size: .95rem; line-height: 1.2; text-align: center;
  transition: transform .16s ease, box-shadow .16s ease, background-color .16s ease, color .16s ease;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 6px 18px rgba(0, 132, 230, .32); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0, 132, 230, .42); }
.btn-ghost { background: rgba(255, 255, 255, .16); color: #fff; border: 1px solid rgba(255, 255, 255, .5); }
.btn-ghost:hover { background: rgba(255, 255, 255, .28); }
.btn-light { background: #fff; color: var(--blue-700); box-shadow: var(--shadow-sm); }
.btn-light:hover { transform: translateY(-2px); }
.btn-sm { min-height: 44px; padding: 10px 16px; font-size: .86rem; }
.btn-lg { min-height: 54px; font-size: 1.02rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .6; pointer-events: none; }

/* ============ HEADER ============ */
.p-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--grad-deep);
  color: #fff;
  padding-top: var(--safe-t);
  box-shadow: var(--shadow-md);
}
.p-header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 62px; }
.p-brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; padding-block: 10px; }
.p-brand img { width: 42px; height: 26px; object-fit: contain; background: #fff; border-radius: 7px; padding: 2px; }
.p-brand span { font-size: .8rem; font-weight: 600; letter-spacing: .1em; color: var(--cyan-200); text-transform: uppercase; }
.p-brand strong { color: #fff; font-weight: 800; font-size: .95rem; letter-spacing: -.01em; }

/* ============ STAGE ============ */
.stage { padding: 28px 18px calc(40px + var(--safe-b)); }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  box-shadow: var(--shadow-md);
  animation: rise .35s ease both;
}
.panel[hidden] { display: none; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.panel-head { display: flex; flex-direction: column; gap: 8px; align-items: center; text-align: center; margin-bottom: 22px; }
.panel-tag, .dash-role {
  display: inline-flex; padding: 5px 13px; border-radius: 999px;
  font-size: .68rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
  color: var(--blue-600); background: var(--cyan-100);
}
.dash-role[data-kind="teknisi"] { color: #fff; background: var(--grad); }
.panel-ico {
  display: flex; align-items: center; justify-content: center;
  width: 64px; height: 64px; border-radius: 18px; font-size: 1.9rem;
  background: var(--grad); box-shadow: 0 8px 20px rgba(0, 132, 230, .3);
}
.panel-head p { font-size: .94rem; max-width: 46ch; }

.stage-note { margin-top: 18px; text-align: center; font-size: .84rem; color: var(--ink-500); }
.stage-note a { color: var(--blue-600); font-weight: 700; text-decoration: underline; }

/* ============ PILIH PERAN ============ */
.role-grid { display: grid; gap: 14px; }
.role-card {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  padding: 18px 16px; border-radius: var(--radius);
  border: 2px solid var(--line); background: var(--bg);
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}
.role-card:hover { transform: translateY(-4px); border-color: var(--cyan-300); background: #fff; box-shadow: var(--shadow-md); }
.role-card:active { transform: scale(.99); }
.role-ico {
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 52px; height: 52px; border-radius: 15px; font-size: 1.6rem;
  background: var(--grad); box-shadow: 0 5px 14px rgba(0, 132, 230, .28);
}
.role-card[data-role="teknisi"] .role-ico { background: linear-gradient(135deg, #0a439e, #0066e0); }
.role-txt { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-width: 0; }
.role-txt strong { font-size: 1.05rem; font-weight: 800; color: var(--ink-900); }
.role-txt small { font-size: .82rem; color: var(--ink-500); }
.role-arrow { flex-shrink: 0; font-size: 1.3rem; font-weight: 800; color: var(--blue-500); transition: transform .2s ease; }
.role-card:hover .role-arrow { transform: translateX(4px); }

.apk-download-box { margin-top: 18px; padding: 14px 16px; background: #e0faff; border-radius: 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid #a8f0ff; }

.back-btn {
  display: inline-flex; align-items: center; min-height: 44px; margin-bottom: 12px;
  padding: 8px 14px; border-radius: 999px; font-size: .86rem; font-weight: 700;
  color: var(--blue-600); background: var(--cyan-100);
}
.back-btn:hover { background: var(--cyan-200); }

/* ============ FORM ============ */
#loginForm { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: .86rem; font-weight: 700; color: var(--ink-700); }
.field input {
  width: 100%; min-height: 50px; padding: 13px 14px;
  font-size: 16px; border: 1.5px solid var(--line); border-radius: 12px;
  background: #fff; transition: border-color .16s ease, box-shadow .16s ease;
}
.field input:focus { outline: none; border-color: var(--blue-400); box-shadow: 0 0 0 3px rgba(24, 144, 255, .16); }
.pass-wrap { position: relative; display: block; }
.pass-wrap input { padding-right: 54px; }
.pass-toggle {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 10px;
  font-size: 1.1rem; color: var(--blue-600); background: var(--cyan-100);
}
.pass-toggle:hover { background: var(--cyan-200); }

.alert, .notice {
  padding: 12px 14px; border-radius: 12px;
  font-size: .88rem; font-weight: 600;
}
.alert[hidden], .notice[hidden], .demo-hint[hidden], .api-warn[hidden] { display: none; }
.alert { color: #8a2b12; background: #fdece8; border: 1px solid #f6c9bd; }
.alert.ok { color: #12572b; background: #e6f8ed; border: 1px solid #b2e6c4; }
.notice { color: var(--blue-700); background: var(--cyan-100); border: 1px solid var(--cyan-200); }
.demo-hint {
  padding: 11px 14px; border-radius: 12px; text-align: center;
  font-size: .8rem; color: var(--ink-700);
  background: var(--bg); border: 1px dashed var(--cyan-300);
}

.api-warn {
  margin-top: 16px; padding: 14px 16px; border-radius: var(--radius);
  font-size: .88rem; font-weight: 600; color: #8a5a00;
  background: #fff7e6; border: 1px solid #f3dfae;
}
.api-warn code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }

/* ============ DASHBOARD ============ */
.dash-top {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 14px; padding-bottom: 18px; margin-bottom: 18px;
  border-bottom: 2px solid var(--cyan-100);
}
.dash-top > div { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.dash-top h1 { font-size: clamp(1.3rem, 5.5vw, 1.8rem); }
.dash-top p { font-size: .9rem; color: var(--ink-500); }

.dash-grid { display: grid; gap: 14px; }
.dcard { padding: 18px 16px; border-radius: var(--radius); border: 1.5px solid var(--line); background: var(--bg); }
.dcard h2 { margin-bottom: 10px; color: var(--blue-700); font-size: .98rem; }
.drow {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: .9rem;
}
.drow:last-of-type { border-bottom: 0; }
.drow span:first-child { color: var(--ink-500); flex-shrink: 0; }
.drow span:last-child { font-weight: 700; color: var(--ink-900); text-align: right; }
.dempty { font-size: .88rem; color: var(--ink-500); padding: 6px 0; }
.dacts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.dact { flex: 1 1 170px; font-size: .86rem; }

/* ============ FOOTER ============ */
.p-footer {
  padding: 22px 0 calc(22px + var(--safe-b));
  background: var(--blue-900); color: #93aed2; font-size: .8rem; text-align: center;
}
.p-footer p { color: inherit; }

/* ============ BREAKPOINT ============ */
@media (min-width: 640px) {
  .container { padding-inline: 24px; }
  .stage { padding-top: 44px; }
  .panel { padding: 32px 30px; }
  .role-grid { grid-template-columns: 1fr 1fr; }
  .dash-grid { grid-template-columns: 1fr 1fr; }
  .p-header-inner { min-height: 72px; }
  .p-brand img { width: 52px; height: 32px; }
}

@media (max-width: 359px) {
  .dash-top { flex-direction: column; align-items: flex-start; }
  .dash-top .btn { width: 100%; }
}

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