/* ============================================================
   style.css — Kalkulator Pajak Indonesia
   ============================================================ */

/* ── RESET & BASE ─────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── DESIGN TOKENS ────────────────────────────────────────── */
:root {
  /* Palette */
  --bg:           #f4f6f9;
  --surface:      #ffffff;
  --surface-2:    #f8f9fb;
  --border:       #e2e6ed;
  --border-focus: #2563eb;

  /* Text */
  --text-primary:   #0d1117;
  --text-secondary: #4b5563;
  --text-muted:     #9ca3af;

  /* Brand */
  --blue:         #2563eb;
  --blue-light:   #eff4ff;
  --blue-mid:     #93b4fa;

  /* Semantic */
  --red:          #dc2626;
  --red-light:    #fff1f0;
  --green:        #16a34a;
  --green-light:  #f0fdf4;
  --amber:        #d97706;
  --amber-light:  #fffbeb;

  /* Dark (summary panel) */
  --dark:         #0f172a;
  --dark-2:       #1e293b;
  --dark-border:  rgba(255,255,255,0.07);
  --dark-text:    rgba(255,255,255,0.85);
  --dark-muted:   rgba(255,255,255,0.4);

  /* Typography */
  --font-sans: 'Plus Jakarta Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Spacing */
  --gap-xs:   0.375rem;  /*  6px */
  --gap-sm:   0.75rem;   /* 12px */
  --gap-md:   1rem;      /* 16px */
  --gap-lg:   1.5rem;    /* 24px */
  --gap-xl:   2rem;      /* 32px */

  /* Shape */
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;

  /* Shadow */
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08), 0 0 0 1px rgba(0,0,0,0.04);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.12);

  /* Transitions */
  --transition: 0.18s ease;
}

/* ── GLOBAL ───────────────────────────────────────────────── */
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

/* ── TOPBAR ───────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--dark);
  height: 56px;
  padding: 0 var(--gap-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
}

.brand-icon {
  width: 32px;
  height: 32px;
  background: var(--blue);
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 15px;
}

.brand-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}

.brand-name span {
  color: var(--blue-mid);
}

.topbar-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--dark-muted);
  background: rgba(255,255,255,0.06);
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.08);
}

/* ── PAGE HEADER ──────────────────────────────────────────── */
.page-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: var(--gap-lg) var(--gap-lg);
}

.page-header-inner {
  max-width: 900px;
  margin: 0 auto;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.page-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── MAIN WRAP ────────────────────────────────────────────── */
.main-wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: var(--gap-lg) var(--gap-lg) 5rem;
  display: flex;
  flex-direction: column;
  gap: var(--gap-md);
}

/* ── SECTION CARD ─────────────────────────────────────────── */
.section-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--transition);
}

.section-card:focus-within {
  box-shadow: var(--shadow-md);
}

.section-card-header {
  padding: var(--gap-md) var(--gap-lg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  background: var(--surface-2);
}

.step-chip {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.section-card-header h2 {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.section-card-header .header-note {
  margin-left: auto;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.section-card-body {
  padding: var(--gap-lg);
}

/* ── INPUT FIELD ──────────────────────────────────────────── */
.field-group {
  display: flex;
  flex-direction: column;
  gap: var(--gap-xs);
}

.field-label {
  font-size: 0.73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-secondary);
}

.input-control {
  display: flex;
  align-items: stretch;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.input-control:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.input-adorn {
  padding: 0 var(--gap-md);
  background: var(--surface-2);
  border-right: 1.5px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  white-space: nowrap;
  flex-shrink: 0;
}

.input-adorn.right {
  border-right: none;
  border-left: 1.5px solid var(--border);
}

.input-control input {
  flex: 1;
  border: none;
  outline: none;
  padding: 0.7rem var(--gap-md);
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-primary);
  background: transparent;
  min-width: 0;
  width: 100%;
}

.input-control input::placeholder {
  color: var(--border);
}

.field-hint {
  font-size: 0.71rem;
  color: var(--text-muted);
  padding: 0 2px;
}

/* ── PPN RATE SELECTOR ────────────────────────────────────── */
.ppn-rates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap-sm);
  margin-top: var(--gap-xs);
}

.rate-option {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  padding: 0.8rem var(--gap-md);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  background: var(--surface);
  user-select: none;
}

.rate-option:hover {
  border-color: var(--blue-mid);
  background: var(--blue-light);
}

.rate-option.selected {
  border-color: var(--blue);
  background: var(--blue-light);
  box-shadow: 0 0 0 2px rgba(37,99,235,0.12);
}

.rate-radio {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: all var(--transition);
}

.rate-option.selected .rate-radio {
  border-color: var(--blue);
  background: var(--blue);
}

.rate-option.selected .rate-radio::after {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
}

.rate-option-text strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.rate-option-text small {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.rate-option.selected .rate-option-text strong {
  color: var(--blue);
}

/* ── DPP RESULT BANNER ────────────────────────────────────── */
.dpp-banner {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--gap-md);
  align-items: center;
  padding: var(--gap-md) var(--gap-lg);
  background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
  border-radius: var(--radius-md);
  margin-top: var(--gap-lg);
  transition: opacity var(--transition);
}

.dpp-banner.empty {
  opacity: 0.4;
  pointer-events: none;
}

.dpp-main-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.55);
  margin-bottom: 4px;
}

.dpp-main-value {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.02em;
}

.dpp-main-formula {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.4);
  font-family: var(--font-mono);
  margin-top: 3px;
}

.dpp-ppn-pill {
  text-align: right;
}

.dpp-ppn-pill .pill-label {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.45);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.dpp-ppn-pill .pill-value {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: rgba(255,255,255,0.7);
  margin-top: 2px;
}

.dpp-ppn-pill .pill-rate {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  background: rgba(255,255,255,0.12);
  border-radius: 20px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: rgba(255,255,255,0.55);
}

/* ── NOTICE BOX ───────────────────────────────────────────── */
.notice {
  padding: 0.65rem var(--gap-md);
  background: var(--amber-light);
  border: 1px solid rgba(217,119,6,0.2);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: var(--amber);
  line-height: 1.5;
  margin-bottom: var(--gap-md);
}

.notice strong { font-weight: 700; }

/* ── TAX TABLE HEADER ─────────────────────────────────────── */
.tax-table-head {
  display: grid;
  grid-template-columns: 40px 1fr 110px 120px;
  gap: var(--gap-sm);
  padding: 0 var(--gap-xs) var(--gap-xs);
  margin-bottom: 2px;
}

.tax-table-head span {
  font-size: 0.67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}

.tax-table-head .col-center { text-align: center; }
.tax-table-head .col-right  { text-align: right; }

/* ── TAX ROW ──────────────────────────────────────────────── */
.tax-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tax-row {
  display: grid;
  grid-template-columns: 40px 1fr 110px 120px;
  gap: var(--gap-sm);
  align-items: center;
  padding: 0.7rem var(--gap-md);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: all var(--transition);
}

.tax-row.active {
  border-color: #c7d7fb;
  background: #f8faff;
}

.tax-row.inactive {
  opacity: 0.55;
}

/* Toggle */
.toggle-btn {
  width: 36px;
  height: 20px;
  border-radius: 10px;
  border: none;
  background: var(--border);
  cursor: pointer;
  position: relative;
  transition: background var(--transition);
  flex-shrink: 0;
}

.toggle-btn::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform var(--transition);
}

.toggle-btn.on {
  background: var(--blue);
}

.toggle-btn.on::after {
  transform: translateX(16px);
}

.tax-col-toggle {
  display: flex;
  justify-content: center;
}

/* Tax info */
.tax-col-info {}

.tax-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.tax-row.inactive .tax-name { color: var(--text-muted); }

.tax-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.3;
}

/* Rate input */
.tax-col-rate {}

.rate-input-wrap {
  display: flex;
  align-items: stretch;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.tax-row.active .rate-input-wrap {
  border-color: #c7d7fb;
}

.rate-input-wrap:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(37,99,235,0.1);
}

.tax-row.inactive .rate-input-wrap {
  opacity: 0.5;
  pointer-events: none;
}

.rate-input-wrap input {
  width: 60px;
  border: none;
  outline: none;
  padding: 6px 8px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  background: transparent;
  text-align: right;
  min-width: 0;
}

.rate-input-wrap .rate-pct {
  padding: 0 8px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-2);
  border-left: 1.5px solid var(--border);
  display: flex;
  align-items: center;
}

/* Amount */
.tax-col-amount {
  text-align: right;
}

.tax-amount-val {
  font-family: var(--font-mono);
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text-muted);
}

.tax-row.active .tax-amount-val {
  color: var(--red);
}

.tax-amount-dash {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--border);
}

/* Delete button */
.btn-delete-tax {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 2px 4px;
  border-radius: 4px;
  opacity: 0;
  transition: all var(--transition);
  line-height: 1;
}

.tax-row:hover .btn-delete-tax { opacity: 1; }
.btn-delete-tax:hover { color: var(--red); background: var(--red-light); }

/* ── ADD FORM ─────────────────────────────────────────────── */
.add-form {
  display: none;
  padding: var(--gap-md);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border: 1.5px dashed var(--border);
  margin-top: var(--gap-md);
  gap: var(--gap-sm);
  flex-wrap: wrap;
  align-items: flex-end;
}

.add-form.show { display: flex; }

.add-form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.add-form-field label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-secondary);
}

.add-form-field input {
  padding: 7px 10px;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  outline: none;
  color: var(--text-primary);
  background: var(--surface);
  transition: border-color var(--transition);
}

.add-form-field input:focus { border-color: var(--blue); }

.add-form-field.f-name { flex: 1; min-width: 150px; }
.add-form-field.f-rate { width: 90px; }
.add-form-field.f-desc { flex: 2; min-width: 180px; }

.add-form-actions {
  display: flex;
  gap: 6px;
  align-items: flex-end;
  padding-bottom: 1px;
}

/* ── BUTTONS ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0.55rem 1rem;
  border-radius: 7px;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  border: 1.5px solid transparent;
  white-space: nowrap;
}

.btn-primary {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.btn-primary:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37,99,235,0.25);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}

.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text-secondary);
  border-color: var(--text-muted);
}

.btn-add-row {
  width: 100%;
  padding: 0.7rem;
  margin-top: var(--gap-md);
  background: transparent;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all var(--transition);
}

.btn-add-row:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-light);
}

/* ── SUMMARY PANEL ────────────────────────────────────────── */
.summary-panel {
  background: var(--dark);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.summary-panel-header {
  padding: var(--gap-md) var(--gap-lg);
  border-bottom: 1px solid var(--dark-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.summary-panel-header h3 {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--dark-muted);
}

.summary-panel-header .live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 2px rgba(34,197,94,0.25);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(34,197,94,0.25); }
  50%       { box-shadow: 0 0 0 5px rgba(34,197,94,0.08); }
}

.summary-body {
  padding: var(--gap-md) var(--gap-lg);
}

.sum-empty {
  padding: var(--gap-xl) var(--gap-md);
  text-align: center;
  color: var(--dark-muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.sum-group {
  margin-bottom: var(--gap-md);
}

.sum-group-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: rgba(255,255,255,0.2);
  padding-bottom: var(--gap-xs);
  margin-bottom: 2px;
  border-bottom: 1px solid var(--dark-border);
}

.sum-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.55rem 0;
}

.sum-row + .sum-row {
  border-top: 1px solid rgba(255,255,255,0.04);
}

.sum-row .lbl { font-size: 0.82rem; color: var(--dark-muted); }
.sum-row .val { font-family: var(--font-mono); font-size: 0.85rem; font-weight: 600; color: var(--dark-text); }

.sum-row.ppn .lbl { color: #93c5fd; }
.sum-row.ppn .val { color: #93c5fd; }

.sum-row.deduct .lbl { color: #fca5a5; }
.sum-row.deduct .val { color: #fca5a5; }

.sum-divider {
  height: 1px;
  background: rgba(255,255,255,0.1);
  margin: var(--gap-md) 0;
}

.sum-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--gap-sm) var(--gap-md);
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.07);
  margin-top: var(--gap-md);
}

.sum-total-row .total-lbl {
  font-size: 0.82rem;
  font-weight: 700;
  color: rgba(255,255,255,0.6);
}

.sum-total-row .total-val {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 700;
  color: #4ade80;
}

.sum-meta {
  margin-top: var(--gap-md);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap-sm);
}

.sum-meta-chip {
  padding: var(--gap-sm) var(--gap-md);
  background: rgba(255,255,255,0.04);
  border-radius: 8px;
  border: 1px solid var(--dark-border);
}

.sum-meta-chip .chip-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: rgba(255,255,255,0.25);
}

.sum-meta-chip .chip-val {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 600;
  color: rgba(255,255,255,0.6);
  margin-top: 2px;
}

/* ── RESPONSIVE ───────────────────────────────────────────── */

/* Tablet (≤768px) */
@media (max-width: 768px) {
  .main-wrap,
  .page-header-inner {
    padding-left: var(--gap-md);
    padding-right: var(--gap-md);
  }

  .main-wrap {
    padding-bottom: 4rem;
  }

  .dpp-banner {
    grid-template-columns: 1fr;
    gap: var(--gap-sm);
  }

  .dpp-ppn-pill {
    text-align: left;
    padding-top: var(--gap-sm);
    border-top: 1px solid rgba(255,255,255,0.12);
  }

  .tax-table-head {
    grid-template-columns: 40px 1fr 90px 90px;
    gap: var(--gap-xs);
  }

  .tax-row {
    grid-template-columns: 40px 1fr 90px 90px;
    gap: var(--gap-xs);
  }

  .rate-input-wrap input { width: 48px; }

  .tax-amount-val,
  .tax-amount-dash {
    font-size: 0.75rem;
  }

  .add-form-field.f-desc { display: none; }

  .sum-meta { grid-template-columns: 1fr; }
}

/* Mobile (≤480px) */
@media (max-width: 480px) {
  .topbar { padding: 0 var(--gap-md); }

  .page-title { font-size: 1.2rem; }

  .ppn-rates { grid-template-columns: 1fr 1fr; }

  .tax-table-head {
    grid-template-columns: 36px 1fr 80px;
    gap: 6px;
  }

  .tax-table-head .col-amount { display: none; }

  .tax-row {
    grid-template-columns: 36px 1fr 80px;
    gap: 6px;
  }

  .tax-col-amount { display: none; }

  .tax-name { font-size: 0.8rem; }

  .dpp-main-value { font-size: 1.2rem; }

  .sum-total-row .total-val { font-size: 1rem; }

  .section-card-body { padding: var(--gap-md); }

  .summary-body { padding: var(--gap-md); }
}