/* ==========================================================================
   Digikor Kiosk — mobile-first styles for the search and SIM detail pages.
   ========================================================================== */

:root {
  --blue-top: #5b7ad4;
  --blue-bottom: #3c4d97;
  --red: #e1222b;
  --ink: #1d2330;
  --muted: #6b7185;
  --line: #dde1ea;
  --bg: #f1f2f5;
  --panel: #ffffff;
  --danger-bg: #fdeceb;
  --danger-ink: #b3261e;
  --warn-bg: #fff4e0;
  --warn-ink: #8a5300;
  --shadow: 0 10px 30px rgba(28, 39, 84, 0.12);
  --font: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --card-font: Arial, "Helvetica Neue", Helvetica, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: #d9dee8;
  -webkit-tap-highlight-color: transparent;
}

img { max-width: 100%; }

.app {
  position: relative;
  max-width: 430px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding-bottom: 32px;
  background: var(--bg);
  overflow-x: hidden;
}

@media (min-width: 431px) {
  .app { box-shadow: 0 0 40px rgba(20, 30, 60, 0.1); }
}

/* ---------- Shared: hero header & panel ---------- */

.hero {
  position: relative;
  padding: calc(env(safe-area-inset-top, 0px) + 16px) 16px 0;
  color: #fff;
  background:
    radial-gradient(120% 55% at 90% 0%, rgba(255, 255, 255, 0.16), transparent 60%),
    linear-gradient(180deg, var(--blue-top) 0%, var(--blue-bottom) 100%);
  border-radius: 0 0 24px 24px;
}

.panel {
  position: relative;
  margin: 0 16px;
  padding: 24px 20px;
  background: var(--panel);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

/* ---------- Page 1: search ---------- */

.hero--search {
  padding-bottom: 64px;
  text-align: center;
}

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 0;
  padding: 6px 14px 6px 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
}

.hero__eyebrow img { width: 24px; height: 24px; }

.hero__title {
  margin: 16px 0 8px;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
}

.hero__subtitle {
  max-width: 32ch;
  margin: 0 auto;
  font-size: 15px;
  line-height: 1.5;
  opacity: 0.88;
}

.mini-card {
  position: relative;
  width: 210px;
  aspect-ratio: 674 / 425;
  margin: 28px auto 0;
  overflow: hidden;
  background: linear-gradient(180deg, #f7f8fa, #e3e6eb);
  border-radius: 12px;
  box-shadow: 0 16px 32px rgba(10, 20, 60, 0.35);
  transform: rotate(-4deg);
}

.mini-card__band {
  position: absolute;
  inset: 0 0 auto;
  height: 17%;
  background: var(--red);
}

.mini-card__photo {
  position: absolute;
  left: 7%;
  top: 30%;
  width: 18%;
  height: 46%;
  background: linear-gradient(#cdd2db, #a9b0be);
  border-radius: 50% / 40%;
}

.mini-card__lines {
  position: absolute;
  left: 31%;
  top: 31%;
  width: 40%;
  display: grid;
  gap: 8px;
}

.mini-card__lines i {
  display: block;
  height: 6px;
  background: #c5cad5;
  border-radius: 3px;
}

.mini-card__lines i:nth-child(1) { width: 90%; background: #9aa2b3; }
.mini-card__lines i:nth-child(3) { width: 70%; }
.mini-card__lines i:nth-child(4) { width: 55%; }

.mini-card__qr {
  position: absolute;
  right: 6%;
  bottom: 10%;
  width: 19%;
  aspect-ratio: 1;
  background:
    conic-gradient(#2a2f3a 25%, transparent 0 50%, #2a2f3a 0 75%, transparent 0)
    0 0 / 33.34% 33.34%;
  border-radius: 2px;
}

.panel--form { margin-top: -40px; }

.search-form {
  display: grid;
  gap: 10px;
}

.field__label {
  font-size: 14px;
  font-weight: 600;
}

.field { position: relative; }

.field__icon {
  position: absolute;
  left: 14px;
  top: 50%;
  width: 20px;
  height: 20px;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.field__input {
  width: 100%;
  height: 52px;
  padding: 0 16px 0 44px;
  font: inherit;
  font-size: 16px; /* ≥16px stops iOS from zooming on focus */
  color: var(--ink);
  background: #f6f7fa;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}

.field__input::placeholder { color: #9aa0b0; }

.field__input:focus {
  background: #fff;
  border-color: var(--blue-top);
  box-shadow: 0 0 0 4px rgba(91, 122, 212, 0.18);
}

.field__input[aria-invalid="true"] { border-color: var(--danger-ink); }
.field__input[aria-invalid="true"]:focus { box-shadow: 0 0 0 4px rgba(179, 38, 30, 0.14); }

/* Autocomplete nama */
.suggest {
  position: absolute;
  z-index: 10;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 280px;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  list-style: none;
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.suggest__option {
  padding: 12px 14px;
  font-size: 16px;
  line-height: 1.3;
  color: var(--ink);
  border-radius: 10px;
  cursor: pointer;
}

.suggest__option:hover,
.suggest__option[aria-selected="true"] { background: #eef1fb; }

.suggest__option mark {
  font-weight: 700;
  color: var(--blue-bottom);
  background: none;
}

.field__hint {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.45;
  border-radius: 12px;
}

.alert__icon {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 1px;
}

.alert__body strong { display: block; }
.alert--error { color: var(--danger-ink); background: var(--danger-bg); }
.alert--warning { color: var(--warn-ink); background: var(--warn-bg); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 52px;
  margin-top: 6px;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(180deg, var(--blue-top), var(--blue-bottom));
  border: 0;
  border-radius: 14px;
  box-shadow: 0 8px 18px rgba(60, 77, 151, 0.3);
  cursor: pointer;
  transition: transform 0.1s, filter 0.15s;
}

.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid rgba(91, 122, 212, 0.45); outline-offset: 2px; }
.btn:disabled { cursor: progress; filter: saturate(0.75) brightness(1.06); }

.btn__spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.btn.is-loading .btn__spinner { display: inline-block; }

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

.footnote {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin: 20px 24px 0;
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
}

.footnote__icon { flex: none; width: 15px; height: 15px; }

/* ---------- Page 2: SIM detail ---------- */

.page--detail {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.page--detail img { -webkit-user-drag: none; }

.hero--detail { padding-bottom: 44px; }

.topbar {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  margin-bottom: 22px;
}

.topbar__back {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-left: -6px;
  color: #fff;
  border-radius: 50%;
}

.topbar__back svg { width: 28px; height: 28px; }
.topbar__back:focus-visible { outline: 2px solid #fff; }

.topbar__title {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.01em;
}

.panel--qr {
  margin-top: -26px;
  padding: 22px 24px 46px;
  text-align: center;
}

.qr__caption {
  max-width: 28ch;
  margin: 0 auto;
  font-size: 17px;
  line-height: 1.45;
  color: #6d7180;
}

.qr__image {
  display: block;
  width: 78%;
  max-width: 300px;
  aspect-ratio: 1;
  margin: 26px auto 0;
  image-rendering: pixelated;
}

.qr__empty { margin: 24px 0 0; color: var(--muted); }

.screenshot-note {
  position: relative;
  z-index: 1;
  width: fit-content;
  max-width: calc(100% - 48px);
  margin: -22px auto 0;
  padding: 9px 22px;
  font-size: 15px;
  color: #6d7180;
  text-align: center;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 6px 16px rgba(28, 39, 84, 0.13);
}

/* Screenshot deterrent: blur personal data whenever the page loses focus. */
.protected { transition: filter 0.15s; }
.is-obscured .protected { filter: blur(18px); }

@media print {
  .protected, .screenshot-note { visibility: hidden !important; }
}

/* ---------- SIM card ----------
   Sized from the design (674×425 card). Everything inside uses cqw so the
   card scales as one piece with the screen width. */

.sim-card-wrap { container-type: inline-size; }

.sim-card {
  position: relative;
  aspect-ratio: 674 / 425;
  overflow: hidden;
  font-family: var(--card-font);
  color: #161616;
  background:
    radial-gradient(60% 55% at 52% 62%, rgba(150, 158, 170, 0.22), transparent 70%),
    repeating-linear-gradient(118deg, rgba(40, 50, 70, 0.035) 0 0.25cqw, transparent 0.25cqw 0.9cqw),
    linear-gradient(180deg, #f5f6f7 0%, #e6e8eb 100%);
  border-radius: 2.6cqw;
  box-shadow: 0 2cqw 5cqw rgba(12, 20, 60, 0.28);
}

.sim-card p, .sim-card dl, .sim-card dd { margin: 0; }

.sim-card__band {
  position: absolute;
  inset: 0 0 auto;
  height: 16.5%;
  background: linear-gradient(180deg, #ea2530, #d71c25);
}

.sim-card__emblem {
  position: absolute;
  z-index: 2;
  left: 7.8%;
  top: 3.5%;
  width: 13%;
  filter: drop-shadow(0 0.3cqw 0.4cqw rgba(0, 0, 0, 0.25));
}

.sim-card__country {
  position: absolute;
  left: 25.2%;
  top: 3.4%;
  font-size: 6.3cqw;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.1cqw;
  color: #fff;
  /* The printed card uses a condensed face; squeeze Arial to match. */
  transform: scaleX(0.84);
  transform-origin: left center;
}

.sim-card__doc-en {
  position: absolute;
  right: 12.5%;
  top: 9.8%;
  font-size: 2.45cqw;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.12cqw;
  color: #fff;
}

.sim-card__doc-id {
  position: absolute;
  left: 25.4%;
  top: 17.6%;
  font-size: 2.45cqw;
  font-weight: 700;
  line-height: 1;
  color: var(--red);
}

.sim-card__number {
  position: absolute;
  left: 25.4%;
  top: 22.6%;
  font-size: 4.3cqw;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.1cqw;
}

.sim-card__photo {
  position: absolute;
  left: 5%;
  top: 30%;
  width: 19%;
  height: 49%;
  object-fit: cover;
  background: #cfd4dc;
}

.sim-card__signature {
  position: absolute;
  left: 4.5%;
  top: 80.5%;
  width: 19%;
  height: 12%;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.sim-card__fields {
  position: absolute;
  left: 25.4%;
  top: 32.2%;
  width: 52%;
  display: grid;
  grid-template-columns: 30cqw 1fr;
  column-gap: 2cqw;
  row-gap: 1.25cqw;
}

.sim-field { min-width: 0; }
.sim-field--wide { grid-column: 1 / -1; }

.sim-field__label {
  font-size: 1.85cqw;
  font-weight: 700;
  line-height: 1.2;
  color: #2a2a2a;
}

.sim-field__value {
  overflow: hidden;
  font-size: 2.6cqw;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Address always reserves two lines so the rows below never jump. */
.sim-field--address .sim-field__value {
  display: -webkit-box;
  min-height: 2.4em;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.sim-card__class {
  position: absolute;
  left: 73%;
  top: 18.5%;
  width: 25.5%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.sim-card__class-code {
  font-size: 7.6cqw;
  font-weight: 700;
  line-height: 1;
}

.sim-card__class-icon {
  width: 12cqw;
  height: auto;
  margin-top: 0.4cqw;
  /* The JPGs have a white ground; multiply lets the card texture show through. */
  mix-blend-mode: multiply;
}

.sim-card__class-icon--motorbike { width: 10cqw; }

.sim-card__class-label {
  margin-top: 0.8cqw !important;
  font-size: 1.6cqw;
  font-weight: 700;
  line-height: 1.25;
}

.sim-card__qr {
  position: absolute;
  left: 79.2%;
  top: 58.3%;
  width: 18.4%;
  aspect-ratio: 1;
  padding: 0.6cqw;
  background: #fff;
  image-rendering: pixelated;
}

.sim-card__expiry {
  position: absolute;
  right: 4.4%;
  top: 89.6%;
  font-size: 2.75cqw;
  font-weight: 700;
}

.sim-card__watermark {
  position: absolute;
  z-index: 5;
  inset: -30% -10%;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 1.8cqw 3.2cqw;
  font-size: 2.1cqw;
  font-weight: 700;
  letter-spacing: 0.1cqw;
  white-space: nowrap;
  color: rgba(70, 80, 105, 0.15);
  transform: rotate(-14deg);
  pointer-events: none;
}

.sim-card__toggle {
  position: absolute;
  z-index: 6;
  right: 0;
  top: 3.8%;
  display: grid;
  place-items: center;
  width: 11.2%;
  height: 16%;
  padding: 0 0 0 1%;
  color: #2f3f8c;
  background: rgba(255, 255, 255, 0.94);
  border: 0;
  border-radius: 50cqw 0 0 50cqw;
  box-shadow: 0 0.4cqw 1.2cqw rgba(0, 0, 0, 0.18);
  cursor: pointer;
}

.sim-card__toggle svg { width: 58%; height: auto; }
.sim-card__toggle:focus-visible { outline: 0.5cqw solid var(--blue-top); outline-offset: -0.5cqw; }

.sim-card__toggle .icon-eye,
.sim-card[data-reveal="true"] .sim-card__toggle .icon-eye-off { display: none; }
.sim-card[data-reveal="true"] .sim-card__toggle .icon-eye { display: block; }

.secret__full { display: none; }
[data-reveal="true"] .secret__masked { display: none; }
[data-reveal="true"] .secret__full { display: inline; }

/* ---------- Page 2: error state ---------- */

.hero--compact { padding-bottom: 64px; }

.panel--status {
  margin-top: -40px;
  padding: 28px 24px;
  text-align: center;
}

.status__icon {
  width: 44px;
  height: 44px;
  color: var(--warn-ink);
}

.status__title {
  margin: 12px 0 6px;
  font-size: 18px;
}

.status__detail {
  margin: 0 0 18px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--muted);
}

.status__actions {
  display: grid;
  gap: 4px;
}

a.btn { text-decoration: none; }

.btn--secondary {
  color: var(--blue-bottom);
  background: #fff;
  border: 1.5px solid var(--line);
  box-shadow: none;
}
