/* ============================================================
   Demo Login OTP — stylesheet tampilan ID Apple / iCloud
   logo Apple, headline besar, input lebar floating label,
   tombol pil biru, subnote kecil. Dark mode otomatis.
   Tanpa framework. Murni CSS.
   ============================================================ */

:root {
  --bg: #fbfbfd;
  --surface: #ffffff;
  --text: #1d1d1f;
  --text-soft: #6e6e73;
  --field-bg: #ffffff;
  --field-border: #d2d2d7;
  --primary: #0071e3;
  --primary-hover: #0077ed;
  --primary-off: #a1c2fa;
  --primary-off-text: #f5f5f7;
  --avatar-bg: #1d1d1f;
  --avatar-fg: #ffffff;
  --error: #d70015;
  --banner-bg: #fff4e5;
  --banner-border: #ffcf8a;
  --banner-text: #8a5300;
  --err-banner-bg: #fdecec;
  --err-banner-border: #f5b5b5;
  --err-banner-text: #a4000f;
  --ring: color-mix(in srgb, var(--primary) 30%, transparent);
  --radius: 12px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.07);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #1d1d1f;
    --text: #f5f5f7;
    --text-soft: #a1a1a6;
    --field-bg: #1d1d1f;
    --field-border: #3a3a3e;
    --primary: #2997ff;
    --primary-hover: #44a6ff;
    --primary-off: #274b8f;
    --primary-off-text: #a1a1a6;
    --avatar-bg: #f5f5f7;
    --avatar-fg: #1d1d1f;
    --error: #ff6b78;
    --banner-bg: #33260f;
    --banner-border: #6b4d17;
    --banner-text: #ffcf8a;
    --err-banner-bg: #3a1114;
    --err-banner-border: #7a2a30;
    --err-banner-text: #ff9aa2;
  }

  .back-link.account-chip {
    background: rgba(255, 255, 255, 0.12);
  }

  .back-link.account-chip:hover {
    background: rgba(255, 255, 255, 0.18);
  }
}

* {
  box-sizing: border-box;
}

/* Atribut hidden harus selalu menang (display:flex bisa menimpanya) */
[hidden] {
  display: none !important;
}

html, body {
  margin: 0;
  padding: 0;
}

body.page-auth {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
}

/* ---------- Konten utama ---------- */

.auth {
  flex: 1;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: clamp(36px, 12vh, 110px) 24px 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.banner.banner-error {
  background: var(--err-banner-bg);
  border-color: var(--err-banner-border);
  color: var(--err-banner-text);
}

.banner {
  width: 100%;
  margin-bottom: 22px;
  padding: 12px 14px;
  border: 1px solid var(--banner-border);
  border-radius: 10px;
  background: var(--banner-bg);
  color: var(--banner-text);
  font-size: 0.92rem;
  text-align: center;
  animation: fade-in 0.25s ease-out;
}

/* ---------- Logo Apple ---------- */

.brand-logo {
  line-height: 0;
  color: var(--text);
  margin-bottom: 10px;
}

.brand-logo svg {
  display: block;
  width: 54px;
  height: 54px;
}

.headline {
  margin: 6px 0 10px;
  font-size: clamp(1.55rem, 4.4vw, 2.05rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  text-align: center;
  line-height: 1.2;
}

.subtitle {
  margin: 0 0 26px;
  color: var(--text-soft);
  font-size: 0.98rem;
  text-align: center;
}

/* ---------- Form ---------- */

form {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.step {
  display: flex;
  flex-direction: column;
}

.input-wrap {
  position: relative;
  width: 100%;
}

.field {
  width: 100%;
  height: 58px;
  padding: 22px 16px 6px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: var(--field-bg);
  border: 1px solid var(--field-border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--ring);
}

/* Floating label: naik jadi caption kecil saat fokus / terisi */
.float-label {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-soft);
  font-size: 1rem;
  pointer-events: none;
  transition: top 0.15s ease, font-size 0.15s ease, transform 0.15s ease;
}

.field:focus + .float-label,
.field:not(:placeholder-shown) + .float-label {
  top: 15px;
  transform: none;
  font-size: 0.7rem;
  letter-spacing: 0.02em;
}

.error {
  margin: 8px 0 0;
  color: var(--error);
  font-size: 0.86rem;
}

.center-text {
  text-align: center;
}

.hint {
  margin: 8px 0 0;
  color: var(--text-soft);
  font-size: 0.83rem;
}

/* ---------- Link & tombol kembali ---------- */

.link {
  align-self: center;
  margin-top: 16px;
  padding: 4px;
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
}

.link:hover {
  text-decoration: underline;
}

.back-link {
  align-self: flex-start;
  margin: 0 0 14px;
  padding: 0;
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.95rem;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
}

.back-link:hover {
  text-decoration: underline;
}

.back-link.center {
  display: block;
  margin-top: 18px;
  text-align: center;
}

/* Pil email di langkah sandi (gaya pill Apple) */
.back-link.account-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 14px;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.05);
  color: var(--text);
  font-size: 0.95rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.back-link.account-chip:hover {
  background: rgba(0, 0, 0, 0.09);
  text-decoration: none;
}

/* ---------- Paragraf info (ikon + teks, seperti pola referensi) ---------- */

.info {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  width: 100%;
  margin-top: 26px;
  color: var(--text-soft);
  font-size: 0.85rem;
  line-height: 1.55;
  text-align: left;
}

.info p {
  margin: 0;
}

.info-icon {
  flex-shrink: 0;
  color: var(--primary);
  margin-top: 1px;
}

/* ---------- Tombol utama ---------- */

.btn-primary {
  margin-top: 24px;
  width: 100%;
  height: 52px;
  font-size: 1.02rem;
  font-weight: 500;
  font-family: inherit;
  color: #ffffff;
  background: var(--primary);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-primary:active:not(:disabled) {
  transform: scale(0.995);
}

.btn-primary:disabled {
  background: var(--primary-off);
  color: var(--primary-off-text);
  cursor: default;
}

.btn-primary:focus-visible,
.link:focus-visible,
.back-link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.subnote {
  margin: 14px 0 0;
  color: var(--text-soft);
  font-size: 0.8rem;
  text-align: center;
}

.subnote a {
  color: var(--primary);
  text-decoration: underline;
}

/* ---------- Kotak OTP (6 digit terpisah) ---------- */

.otp-boxes {
  display: flex;
  gap: 10px;
  justify-content: center;
  width: 100%;
}

.otp-box {
  flex: 1 1 0;
  min-width: 0;
  max-width: 58px;
  height: 66px;
  text-align: center;
  font-size: 1.6rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--text);
  background: var(--field-bg);
  border: 1px solid var(--field-border);
  border-radius: var(--radius);
  outline: none;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.otp-box:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--ring);
}

/* ---------- Animasi & responsif ---------- */

@keyframes fade-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 520px) {
  .auth {
    padding: 30px 18px 40px;
  }

  .brand-logo svg {
    width: 46px;
    height: 46px;
  }

  .otp-boxes {
    gap: 6px;
  }

  .otp-box {
    height: 56px;
    font-size: 1.35rem;
  }

  .field {
    height: 54px;
  }
}
