/* ==========================================================================
   Design tokens — Undian Pajak
   Palet terinspirasi identitas pemerintahan: hijau tua (kepercayaan/fiskal)
   + emas (hadiah/undian) sebagai aksen.
   ========================================================================== */
:root {
  --color-primary: #2962ff;
  --color-primary-dark: #0d47a1;
  --color-primary-light: #448aff;
  --color-accent: #f2b134;
  --color-accent-dark: #d99a1f;
  --color-bg: #f5f7fa;
  --color-surface: #ffffff;
  --color-text: #1a2b47;
  --color-text-muted: #5f7391;
  --color-border: #e3e8ef;
  --color-success: #1b9c5a;
  --color-danger: #d64545;
  --color-warning: #e0a500;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --shadow-card: 0 8px 24px rgba(15, 92, 70, 0.08);
  --shadow-float: 0 12px 32px rgba(15, 92, 70, 0.18);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --max-app-width: 480px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  font-family: var(--font-sans);
  color: var(--color-text);
  -webkit-tap-highlight-color: transparent;
}

body.app-shell {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  background: linear-gradient(180deg, var(--color-primary-dark) 0%, var(--color-primary) 220px, var(--color-bg) 220px);
}

.app-container {
  width: 100%;
  max-width: var(--max-app-width);
  min-height: 100vh;
  background: var(--color-bg);
  position: relative;
  padding-bottom: 32px;
  box-shadow: 0 0 60px rgba(0,0,0,0.08);
}

/* ---------- App top bar ---------- */
.app-topbar {
  padding: 22px 20px 18px;
  color: #fff;
}
.app-topbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .3px;
  opacity: .95;
}
.app-topbar .brand .dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--color-accent);
}
.app-topbar h1 {
  font-size: 22px;
  margin: 14px 0 4px;
  font-weight: 800;
}
.app-topbar p {
  margin: 0;
  font-size: 10.5px;
  opacity: .85;
}

/* ---------- Progress stepper ---------- */
.stepper {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 20px;
  margin-top: 6px;
}
.stepper .seg {
  flex: 1;
  height: 5px;
  border-radius: 6px;
  background: rgba(255,255,255,0.25);
  overflow: hidden;
}
.stepper .seg > i {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--color-accent);
  transition: width .35s ease;
}
.stepper .seg.done > i,
.stepper .seg.active > i { width: 100%; }
.stepper .seg.active > i { animation: growIn .4s ease; }
@keyframes growIn { from { width: 0; } to { width: 100%; } }

.step-labels {
  display: flex;
  justify-content: space-between;
  padding: 8px 20px 0;
  font-size: 11px;
  color: rgba(255,255,255,.75);
  font-weight: 600;
}

/* ---------- Card ---------- */
.app-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  margin-top: 14px;
  padding: 24px 20px 20px;
  min-height: 60vh;
  box-shadow: var(--shadow-card);
}

.step-view { display: none; animation: fadeSlide .35s ease; }
.step-view.active { display: block; }
@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-title {
  font-size: 17px;
  font-weight: 800;
  margin: 0 0 4px;
  color: var(--color-primary-dark);
}
.section-sub {
  font-size: 13px;
  color: var(--color-text-muted);
  margin: 0 0 18px;
}

/* ---------- Tax type cards (step 1) ---------- */
.taxtype-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.taxtype-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color .2s, background .2s, transform .12s;
  background: #fff;
}
.taxtype-card:active { transform: scale(0.98); }
.taxtype-card.selected {
  border-color: var(--color-primary);
  background: rgba(41, 98, 255, 0.07);
}
.taxtype-card .icon {
  width: 46px; height: 46px;
  border-radius: 12px;
  background: var(--color-primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.taxtype-card .info { flex: 1; }
.taxtype-card .info .nama { font-weight: 700; font-size: 15px; margin-bottom: 2px; }
.taxtype-card .info .min { font-size: 12.5px; color: var(--color-text-muted); }
.taxtype-card .check {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--color-border);
  flex-shrink: 0;
}
.taxtype-card.selected .check {
  border-color: var(--color-primary);
  background: var(--color-primary);
  position: relative;
}
.taxtype-card.selected .check::after {
  content: '';
  position: absolute; left: 50%; top: 50%;
  width: 5px; height: 9px;
  border: solid #fff; border-width: 0 2px 2px 0;
  transform: translate(-50%,-60%) rotate(45deg);
}

/* ---------- Merchant list (step 2) ---------- */
.search-box {
  position: relative;
  margin-bottom: 14px;
}
.search-box input {
  width: 100%;
  padding: 12px 14px 12px 40px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--color-border);
  font-size: 14px;
  background: #fafcfb;
}
.search-box .ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); opacity: .5; }

.merchant-list { display: flex; flex-direction: column; gap: 10px; max-height: 48vh; overflow-y: auto; padding-right: 2px; }
.merchant-item {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
}
.merchant-item.selected { border-color: var(--color-primary); background: rgba(41, 98, 255, 0.07); }
.merchant-item .m-icon {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--color-accent); color: #4a3300;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px;
  flex-shrink: 0;
}
.merchant-item .m-info .nama { font-weight: 700; font-size: 14px; }
.merchant-item .m-info .alamat { font-size: 12px; color: var(--color-text-muted); }
.empty-state { text-align: center; padding: 30px 10px; color: var(--color-text-muted); font-size: 13.5px; }

/* ---------- Form (step 3) ---------- */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--color-text);
}
.form-group .hint { font-size: 11.5px; color: var(--color-text-muted); margin-top: 5px; }
.form-control {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--color-border);
  font-size: 14.5px;
  background: #fafcfb;
  font-family: inherit;
}
.form-control:focus { outline: none; border-color: var(--color-primary); background: #fff; }

.segmented {
  display: flex;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.segmented button {
  flex: 1;
  padding: 11px 8px;
  border: none;
  background: #fafcfb;
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
  color: var(--color-text-muted);
}
.segmented button.active { background: var(--color-primary); color: #fff; }

.upload-box {
  border: 1.5px dashed var(--color-border);
  border-radius: var(--radius-md);
  padding: 18px;
  text-align: center;
  cursor: pointer;
  background: #fafcfb;
  position: relative;
}
.upload-box.has-file { border-color: var(--color-success); background: rgba(27,156,90,.06); }
.upload-box input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload-box .ico { font-size: 26px; margin-bottom: 6px; }
.upload-box .txt { font-size: 12.5px; color: var(--color-text-muted); }
.upload-box .fname { font-size: 12.5px; font-weight: 700; color: var(--color-success); word-break: break-all; }

.rupiah-wrap { position: relative; }
.rupiah-wrap span { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-weight: 700; color: var(--color-text-muted); }
.rupiah-wrap input { padding-left: 42px; }

.alert-min {
  font-size: 12.5px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(242,177,52,.15);
  color: #7a5a05;
  margin-top: -8px;
  margin-bottom: 16px;
}
.alert-min.err { background: rgba(214,69,69,.12); color: var(--color-danger); }
.alert-min.ok { background: rgba(27,156,90,.12); color: var(--color-success); }

/* ---------- Bottom navigation ---------- */
.bottom-nav {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 10px;
  padding: 14px 20px calc(14px + env(safe-area-inset-bottom)); /* 245, 247, 250 */
  background: linear-gradient(180deg, rgba(245,247,250,0), var(--color-bg) 25%);
}
.btn {
  border: none;
  border-radius: 14px;
  padding: 14px 18px;
  font-weight: 800;
  font-size: 14.5px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-primary { background: var(--color-primary); color: #fff; flex: 1; box-shadow: var(--shadow-float); }
.btn-primary:disabled { background: #b7c4bf; box-shadow: none; cursor: not-allowed; }
.btn-ghost { background: #fff; color: var(--color-primary); border: 1.5px solid var(--color-border); }
.btn-block { width: 100%; }

.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed;
  left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--color-text);
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 13.5px;
  max-width: 90%;
  opacity: 0;
  transition: all .25s ease;
  z-index: 999;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--color-danger); }

.closed-banner {
  margin: 60px 24px;
  text-align: center;
  color: var(--color-text-muted);
}
.closed-banner .ico { font-size: 46px; margin-bottom: 12px; }

/* Success page */
.success-wrap { text-align: center; padding: 50px 24px 20px; }
.success-wrap .check-circle {
  width: 84px; height: 84px; border-radius: 50%;
  background: var(--color-success);
  margin: 0 auto 20px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 40px;
}
.kode-box {
  background: #fff;
  border: 1.5px dashed var(--color-primary);
  border-radius: var(--radius-md);
  padding: 16px;
  margin: 20px 0;
}
.kode-box .kode { font-size: 22px; font-weight: 800; letter-spacing: 1px; color: var(--color-primary-dark); }

@media (min-width: 520px) {
  .app-container { margin-top: 24px; margin-bottom: 24px; border-radius: var(--radius-lg); min-height: auto; }
}
