/* ============================================================
   TransKu — Global + Mobile-First UI
   ============================================================ */
:root {
  --primary:       #4361ee;
  --primary-dark:  #3a0ca3;
  --success:       #22c55e;
  --danger:        #ef4444;
  --warning:       #f59e0b;
  --bg:            #f0f2f5;
  --card-radius:   18px;
  --bottom-nav-h:  70px;
}

/* ── Base ────────────────────────────────────────────────── */
body {
  background: var(--bg);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

/* extra bottom padding so content clears the bottom nav on mobile */
@media (max-width: 991.98px) {
  body { padding-bottom: calc(var(--bottom-nav-h) + 8px); }
}

/* ── Top Navbar ──────────────────────────────────────────── */
.navbar {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark)) !important;
  backdrop-filter: blur(8px);
  position: relative;
  z-index: 1030;
}

/* on mobile: hide the collapse menu — bottom nav takes over */
@media (max-width: 991.98px) {
  #navMenu { display: none !important; }
  .navbar-toggler { display: none !important; }
}

/* ── Bottom Navigation (mobile only) ────────────────────── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottom-nav-h);
  background: #fff;
  border-top: 1px solid #e8eaed;
  z-index: 1040;
  box-shadow: 0 -4px 20px rgba(0,0,0,.08);
  padding-bottom: env(safe-area-inset-bottom);
}

@media (max-width: 991.98px) {
  .bottom-nav { display: flex; align-items: stretch; }
}

.bottom-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: #94a3b8;
  font-size: .65rem;
  font-weight: 600;
  gap: 3px;
  transition: color .2s, transform .15s;
  position: relative;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
}

.bottom-nav__item i { font-size: 1.35rem; transition: transform .2s; }
.bottom-nav__item.active { color: var(--primary); }
.bottom-nav__item.active i { transform: translateY(-2px); }

/* FAB — centre slot */
.bottom-nav__fab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.fab {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  font-size: 1.4rem;
  border: none;
  box-shadow: 0 4px 14px rgba(67,97,238,.5);
  display: flex; align-items: center; justify-content: center;
  text-decoration: none;
  transition: transform .2s, box-shadow .2s;
  position: absolute;
  top: -18px;
}

.fab:hover, .fab:active {
  transform: scale(1.12);
  box-shadow: 0 6px 20px rgba(67,97,238,.6);
  color: #fff;
}

/* ── Hero Card (Dashboard) ───────────────────────────────── */
.hero-card {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: var(--card-radius);
  color: #fff;
  padding: 24px 20px 28px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(67,97,238,.35);
}

.hero-card::before {
  content: '';
  position: absolute;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  top: -60px; right: -50px;
}

.hero-card::after {
  content: '';
  position: absolute;
  width: 140px; height: 140px;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
  bottom: -40px; left: -30px;
}

.hero-card__label { font-size: .78rem; opacity: .8; letter-spacing: .5px; }
.hero-card__balance { font-size: 2rem; font-weight: 700; letter-spacing: -1px; }
.hero-card__sub { display: flex; gap: 20px; margin-top: 16px; }
.hero-card__sub-item { display: flex; align-items: center; gap: 8px; }
.hero-card__sub-item i { font-size: 1rem; opacity: .85; }
.hero-card__sub-label { font-size: .72rem; opacity: .75; }
.hero-card__sub-value { font-size: .95rem; font-weight: 600; }

/* ── Stat Cards ──────────────────────────────────────────── */
.stat-icon {
  width: 48px; height: 48px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* Horizontal scroll summary chips on mobile */
.summary-scroll {
  display: flex; gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.summary-scroll::-webkit-scrollbar { display: none; }

.summary-chip {
  flex-shrink: 0;
  border-radius: 14px;
  padding: 12px 16px;
  min-width: 130px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
}

/* ── Cards ───────────────────────────────────────────────── */
.card {
  border-radius: var(--card-radius) !important;
  transition: box-shadow .2s, transform .15s;
}

.card:hover { box-shadow: 0 6px 20px rgba(0,0,0,.1) !important; }

/* ── Transaction Card List (mobile) ─────────────────────── */
.tx-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  transition: transform .15s, box-shadow .15s;
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
  -webkit-user-select: none; user-select: none;
}

.tx-card:active { transform: scale(.98); box-shadow: 0 1px 4px rgba(0,0,0,.08); }

.tx-card__icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.15rem; flex-shrink: 0;
}

.tx-card__body { flex: 1; min-width: 0; }
.tx-card__desc { font-size: .88rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-card__meta { font-size: .73rem; color: #94a3b8; margin-top: 2px; }

.tx-card__amount { font-size: .95rem; font-weight: 700; text-align: right; white-space: nowrap; }
.tx-card__amount.income { color: var(--success); }
.tx-card__amount.expense { color: var(--danger); }

/* Swipe actions hint */
.tx-list-hint {
  font-size: .72rem; color: #94a3b8;
  text-align: center; padding: 6px 0 2px;
}
.tx-list-hint i { font-size: .8rem; }

/* ── Table (desktop) ─────────────────────────────────────── */
.table > :not(caption) > * > * { padding: .75rem .5rem; }

/* ── Form Select & Date — global polish ──────────────────── */
.form-select {
  border-radius: 10px;
  border-color: #e2e8f0;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(67,97,238,.12);
}
.form-select-sm { border-radius: 8px; font-size: .8rem; }

/* Date input with calendar icon via input-group wrapper */
.date-input-wrap {
  position: relative;
}
.date-input-wrap .bi {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--primary);
  font-size: 1rem;
  pointer-events: none;
  z-index: 2;
}
.date-input-wrap input[type="date"] {
  padding-left: 38px;
  border-radius: 10px;
  border-color: #e2e8f0;
  font-weight: 500;
  transition: border-color .15s, box-shadow .15s;
}
.date-input-wrap input[type="date"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(67,97,238,.12);
}

/* ── Period Picker (month + year selector) ───────────────── */
.period-picker {
  display: inline-flex;
  align-items: center;
  gap: 0;
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 4px 6px 4px 10px;
  box-shadow: 0 1px 6px rgba(0,0,0,.07);
  transition: border-color .15s, box-shadow .15s;
}
.period-picker:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(67,97,238,.1);
}
.period-picker > i {
  color: var(--primary);
  font-size: 1rem;
  margin-right: 6px;
  flex-shrink: 0;
}
.period-picker .form-select {
  border: none !important;
  box-shadow: none !important;
  background: transparent;
  padding: 0 22px 0 0;
  font-size: .82rem;
  font-weight: 600;
  color: #1e293b;
  min-height: unset;
  height: auto;
  cursor: pointer;
}
.period-picker .form-select:focus { box-shadow: none !important; }
.period-picker .sep {
  width: 1px; height: 18px;
  background: #e2e8f0;
  margin: 0 4px;
  flex-shrink: 0;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border: none;
}
.btn-primary:hover {
  background: linear-gradient(135deg, #3a52d4, #320a8e);
}

/* Ripple */
.ripple {
  position: relative; overflow: hidden;
}
.ripple-effect {
  position: absolute; border-radius: 50%;
  background: rgba(255,255,255,.35);
  transform: scale(0);
  animation: ripple-anim .5s linear;
  pointer-events: none;
}
@keyframes ripple-anim {
  to { transform: scale(4); opacity: 0; }
}

/* ── Brand icon (login page) ─────────────────────────────── */
.brand-icon {
  width: 60px; height: 60px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.6rem; margin: 0 auto;
}

/* ── Badge ───────────────────────────────────────────────── */
.badge.rounded-pill { font-size: .72em; padding: .35em .7em; }

/* ── Animated counter ────────────────────────────────────── */
.count-up { transition: none; }

/* ── Form touch targets ──────────────────────────────────── */
@media (max-width: 767.98px) {
  .form-control, .form-select { min-height: 46px; font-size: .92rem; }
  .btn:not(.btn-icon):not(.btn-sm) { min-height: 44px; }
  .btn-sm { min-height: 36px; }
  .form-control-sm, .form-select-sm { min-height: 38px; }
}

/* ── Icon-only action button (edit/delete di tx-card) ────── */
.btn-icon {
  width: 32px;
  height: 32px;
  min-height: unset !important;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: .8rem;
  line-height: 1;
  flex-shrink: 0;
}

/* Kolom kanan tx-card: amount + action buttons */
.tx-card__right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.tx-card__actions {
  display: flex;
  gap: 4px;
}

/* ── Filter pills (mobile transactions) ──────────────────── */
.filter-pills {
  display: flex; gap: 8px; overflow-x: auto;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
  padding-bottom: 2px;
}
.filter-pills::-webkit-scrollbar { display: none; }

.filter-pill {
  flex-shrink: 0; border-radius: 20px; padding: 6px 14px;
  font-size: .78rem; font-weight: 600; cursor: pointer;
  border: 1.5px solid #e2e8f0; background: #fff; color: #64748b;
  transition: all .15s; white-space: nowrap;
}
.filter-pill.active {
  background: var(--primary); border-color: var(--primary); color: #fff;
}

/* ── Page-enter animation ────────────────────────────────── */
.page-content {
  animation: fadeSlideUp .25s ease both;
}
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Scan modal ──────────────────────────────────────────── */
#scanResult .alert { border-radius: 12px; }

/* ── Empty state ─────────────────────────────────────────── */
.empty-state { padding: 48px 16px; text-align: center; }
.empty-state i { font-size: 3rem; color: #cbd5e1; }
.empty-state p { color: #94a3b8; margin-top: 8px; font-size: .9rem; }

/* ── Scrollbar (desktop) ─────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }

/* ============================================================
   DARK MODE — data-bs-theme="dark" (Bootstrap 5.3 built-in)
   Bootstrap otomatis handle: card, form, table, modal, dropdown
   Kita hanya override komponen custom di bawah ini.
   ============================================================ */
[data-bs-theme="dark"] {
  --primary:      #7b9fff;
  --primary-dark: #4361ee;
  --success:      #3fb950;
  --danger:       #f85149;
  --warning:      #d29922;
  --bg:           #0d1117;
}

[data-bs-theme="dark"] body {
  background: #0d1117;
}

/* Navbar */
[data-bs-theme="dark"] .navbar {
  background: linear-gradient(135deg, #1c1f3a, #0d1020) !important;
}

/* Hero card — gradient tetap, shadow disesuaikan */
[data-bs-theme="dark"] .hero-card {
  box-shadow: 0 8px 32px rgba(123,159,255,.18);
}

/* Bottom nav */
[data-bs-theme="dark"] .bottom-nav {
  background: #161b22;
  border-top-color: #21262d;
  box-shadow: 0 -4px 20px rgba(0,0,0,.45);
}
[data-bs-theme="dark"] .bottom-nav__item       { color: #6e7681; }
[data-bs-theme="dark"] .bottom-nav__item.active { color: var(--primary); }

/* FAB */
[data-bs-theme="dark"] .fab {
  background: linear-gradient(135deg, #7b9fff, #4361ee);
  box-shadow: 0 4px 14px rgba(123,159,255,.35);
}
[data-bs-theme="dark"] .fab:hover, [data-bs-theme="dark"] .fab:active {
  box-shadow: 0 6px 20px rgba(123,159,255,.5);
}

/* Transaction card */
[data-bs-theme="dark"] .tx-card {
  background: #161b22;
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
}
[data-bs-theme="dark"] .tx-card:active {
  box-shadow: 0 1px 4px rgba(0,0,0,.45);
}

/* Summary chips */
[data-bs-theme="dark"] .summary-chip {
  background: #161b22;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

/* Period picker */
[data-bs-theme="dark"] .period-picker {
  background: #161b22;
  border-color: #30363d;
}
[data-bs-theme="dark"] .period-picker .form-select { color: #c9d1d9; }
[data-bs-theme="dark"] .period-picker .sep         { background: #30363d; }

/* Filter pills */
[data-bs-theme="dark"] .filter-pill {
  background: #161b22;
  border-color: #30363d;
  color: #8b949e;
}
[data-bs-theme="dark"] .filter-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* Date input */
[data-bs-theme="dark"] .date-input-wrap input[type="date"] {
  border-color: #30363d;
}

/* Tombol outline — border lebih visible di dark */
[data-bs-theme="dark"] .btn-outline-secondary { border-color: #30363d; }

/* Cards border subtle */
[data-bs-theme="dark"] .card { border-color: #21262d !important; }

/* Empty state icon */
[data-bs-theme="dark"] .empty-state i { color: #30363d; }
[data-bs-theme="dark"] .empty-state p { color: #6e7681; }

/* Scrollbar dark */
[data-bs-theme="dark"] ::-webkit-scrollbar-thumb { background: #30363d; }

/* Scan modal progress bar track */
[data-bs-theme="dark"] .progress { background: #21262d; }

/* Form inputs — paksa teks terang di dark mode */
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
  background-color: #1c2128;
  color: #c9d1d9;
  border-color: #30363d;
}
[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
  background-color: #1c2128;
  color: #e6edf3;
  border-color: #7b9fff;
  box-shadow: 0 0 0 .25rem rgba(123,159,255,.2);
}
[data-bs-theme="dark"] .form-control::placeholder { color: #484f58; }
[data-bs-theme="dark"] .form-control:disabled,
[data-bs-theme="dark"] .form-control[readonly] {
  background-color: #21262d;
  color: #6e7681;
}
[data-bs-theme="dark"] .input-group-text {
  background-color: #21262d;
  color: #c9d1d9;
  border-color: #30363d;
}
[data-bs-theme="dark"] .form-check-input {
  background-color: #1c2128;
  border-color: #30363d;
}
[data-bs-theme="dark"] .form-check-input:checked {
  background-color: #7b9fff;
  border-color: #7b9fff;
}
/* Label & teks form */
[data-bs-theme="dark"] .form-label { color: #c9d1d9; }
/* Table head */
[data-bs-theme="dark"] .table-light,
[data-bs-theme="dark"] .table-light th,
[data-bs-theme="dark"] .table-light td {
  background-color: #1c2128 !important;
  color: #8b949e;
}
/* Modal body */
[data-bs-theme="dark"] .modal-content {
  background-color: #161b22;
  color: #c9d1d9;
}
[data-bs-theme="dark"] .modal-header,
[data-bs-theme="dark"] .modal-footer { border-color: #21262d; }

/* Modal foto struk — backdrop hitam penuh */
#modalReceipt .modal-dialog { max-width: 95vw; }
#modalReceipt .modal-body   { background: rgba(0,0,0,.85); border-radius: .75rem; }
/* Alert di dalam form */
[data-bs-theme="dark"] .alert-danger  { background-color: #2d1b1e; border-color: #4d2427; color: #f85149; }
[data-bs-theme="dark"] .alert-success { background-color: #1a2d1e; border-color: #234d29; color: #3fb950; }
/* Raw text OCR */
[data-bs-theme="dark"] pre.bg-light { background-color: #1c2128 !important; color: #c9d1d9; }
/* Scan card */
[data-bs-theme="dark"] .bg-primary-subtle { background-color: #1a2040 !important; }

/* Theme toggle icon warna */
#themeToggle { transition: color .2s; }
[data-bs-theme="dark"] #themeToggle { color: #f0c040 !important; }
[data-bs-theme="light"] #themeToggle, :root #themeToggle { color: rgba(255,255,255,.85) !important; }
