/* SAKU-KU Design System & Custom Utilities (Anti-AI Slop Manifesto) */

:root {
  --brand-mint: #00E599;
  --brand-emerald-500: #10B981;
  --brand-emerald-600: #059669;
  --brand-dark: #064E3B;
  --slate-surface: #F8FAFC;
  --slate-border: rgba(226, 232, 240, 0.85);

  --bg-primary: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-input: #F8FAFC;
  --text-primary: #0F172A;
  --text-muted: #64748B;
  --border-subtle: #E2E8F0;
}

/* Tabular numbers for fintech precision */
.font-tabular {
  font-variant-numeric: tabular-nums;
}

/* Subtle ambient backdrop for header */
.bg-ambient-mint {
  background: radial-gradient(130% 90% at 50% 0%, rgba(16, 185, 129, 0.08) 0%, rgba(248, 250, 252, 0) 100%), #F8FAFC;
}

/* Premium Bank Card Glassmorphic Finish */
.card-bca-prioritas {
  background: linear-gradient(135deg, #064E3B 0%, #0F382E 50%, #022019 100%);
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 25px -5px rgba(6, 78, 59, 0.35), 0 8px 10px -6px rgba(6, 78, 59, 0.2);
}

.card-bca-prioritas::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -20%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(0, 229, 153, 0.15) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

/* Micro-interaction tactile button press */
.btn-tactile {
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-tactile:active {
  transform: scale(0.97);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Material Symbols Styling */
.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  vertical-align: middle;
}
.material-symbols-outlined.fill {
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* ========================================================
   DARK THEME SYSTEM (Luxury Cyber-Fintech Obsidian Navy)
   Exact match to the high-end SAKU-KU dark dashboard
   ======================================================== */

html.dark {
  color-scheme: dark;
}

html.dark body {
  background-color: #070d18 !important;
  color: #e2e8f0 !important;
}

html.dark .bg-ambient-mint {
  background: radial-gradient(130% 90% at 50% 0%, rgba(0, 229, 153, 0.07) 0%, rgba(7, 13, 24, 0) 100%), #070d18 !important;
}

/* Header & Sidebar */
html.dark header {
  background-color: #070d18 !important;
  border-color: rgba(255, 255, 255, 0.06) !important;
}

html.dark aside {
  background-color: #091122 !important;
  border-color: rgba(255, 255, 255, 0.06) !important;
}

html.dark aside .border-b,
html.dark aside .border-t {
  border-color: rgba(255, 255, 255, 0.06) !important;
}

/* Active and Inactive Sidebar Items */
html.dark aside a.sidebar-item.bg-\[\#e6f7ef\],
html.dark aside a.sidebar-item.bg-\[\#064e3b\],
html.dark .nav-item-active {
  background-color: #064e3b !important;
  color: #34d399 !important;
  border: 1px solid rgba(16, 185, 129, 0.3) !important;
}
html.dark aside a.sidebar-item.bg-\[\#e6f7ef\] .sidebar-text,
html.dark aside a.sidebar-item.bg-\[\#064e3b\] .sidebar-text {
  color: #ffffff !important;
  font-weight: 800 !important;
}
html.dark aside a.sidebar-item.bg-\[\#e6f7ef\] > div,
html.dark aside a.sidebar-item.bg-\[\#064e3b\] > div {
  background-color: #033628 !important;
  color: #ffffff !important;
}
html.dark aside a.sidebar-item:not(.bg-\[\#e6f7ef\]):not(.bg-\[\#064e3b\]) {
  color: #94a3b8 !important;
}
html.dark aside a.sidebar-item:not(.bg-\[\#e6f7ef\]):not(.bg-\[\#064e3b\]):hover {
  background-color: #111d38 !important;
  color: #ffffff !important;
}

/* Hero Welcome Banner */
html.dark .bg-gradient-to-r.from-emerald-50\/50.via-teal-50\/30.to-white {
  background: radial-gradient(100% 120% at 85% 50%, rgba(16, 185, 129, 0.12) 0%, rgba(13, 23, 46, 0.95) 100%), #0d172e !important;
  border-color: rgba(255, 255, 255, 0.07) !important;
}

/* Surface Cards & Panels */
html.dark .bg-white {
  background-color: #0d172e !important;
  color: #e2e8f0 !important;
}

html.dark .bg-slate-50,
html.dark .bg-slate-50\/70,
html.dark .bg-slate-50\/50,
html.dark .bg-slate-50\/80 {
  background-color: #091224 !important;
}

html.dark .bg-slate-100,
html.dark .bg-slate-100\/80 {
  background-color: #121f3a !important;
  color: #cbd5e1 !important;
}

html.dark .bg-slate-200 {
  background-color: #1b2c4e !important;
}

/* Preserving high-contrast colored left borders on KPI cards */
html.dark .border-l-emerald-500,
html.dark .border-l-\[\#10B981\] {
  border-left-color: #10b981 !important;
}
html.dark .border-l-blue-500,
html.dark .border-l-\[\#3B82F6\] {
  border-left-color: #3b82f6 !important;
}
html.dark .border-l-rose-500,
html.dark .border-l-\[\#F43F5E\] {
  border-left-color: #f43f5e !important;
}
html.dark .border-l-indigo-500,
html.dark .border-l-\[\#6366F1\] {
  border-left-color: #6366f1 !important;
}

/* KPI Card icons and badges */
html.dark .bg-emerald-100\/80,
html.dark .bg-emerald-100 {
  background-color: rgba(16, 185, 129, 0.18) !important;
  color: #34d399 !important;
}
html.dark .bg-blue-100\/80,
html.dark .bg-blue-100 {
  background-color: rgba(59, 130, 246, 0.18) !important;
  color: #60a5fa !important;
}
html.dark .bg-rose-100\/80,
html.dark .bg-rose-100 {
  background-color: rgba(244, 63, 94, 0.18) !important;
  color: #fb7185 !important;
}
html.dark .bg-indigo-100\/80,
html.dark .bg-indigo-100 {
  background-color: rgba(99, 102, 241, 0.18) !important;
  color: #818cf8 !important;
}
html.dark .bg-emerald-50 {
  background-color: rgba(16, 185, 129, 0.14) !important;
  color: #34d399 !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
}
html.dark .bg-rose-50 {
  background-color: rgba(244, 63, 94, 0.14) !important;
  color: #fb7185 !important;
  border-color: rgba(244, 63, 94, 0.3) !important;
}

/* Borders */
html.dark .border-slate-200,
html.dark .border-slate-200\/80,
html.dark .border-slate-200\/90,
html.dark .border-slate-200\/70,
html.dark .border-slate-200\/60,
html.dark .border-slate-100 {
  border-color: rgba(255, 255, 255, 0.07) !important;
}

/* Typography Overrides */
html.dark .text-slate-900 {
  color: #f8fafc !important;
}
html.dark .text-slate-800 {
  color: #e2e8f0 !important;
}
html.dark .text-slate-700 {
  color: #cbd5e1 !important;
}
html.dark .text-slate-600 {
  color: #94a3b8 !important;
}
html.dark .text-slate-500 {
  color: #64748b !important;
}
html.dark .text-slate-400 {
  color: #64748b !important;
}

/* Topbar Elements in Dark Mode */
html.dark #topbarSearchInput {
  background-color: #0d172e !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  color: #e2e8f0 !important;
}
html.dark #btnThemeToggle,
html.dark #btnNotificationBell {
  color: #94a3b8 !important;
}
html.dark #btnThemeToggle:hover,
html.dark #btnNotificationBell:hover {
  background-color: #111d38 !important;
  color: #ffffff !important;
}
html.dark #btnCurrencyToggle {
  background-color: #08291f !important;
  border-color: rgba(16, 185, 129, 0.35) !important;
  color: #34d399 !important;
}
html.dark #btnLangToggle {
  background-color: #0d172e !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  color: #e2e8f0 !important;
}
html.dark #currencyDropdownMenu,
html.dark #langDropdownMenu,
html.dark #notificationDropdownMenu,
html.dark #topbarSearchDropdown {
  background-color: #0d172e !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  color: #e2e8f0 !important;
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.6) !important;
}
html.dark #topbarSearchDropdown mark.search-hl {
  background-color: rgba(16, 185, 129, 0.25) !important;
  color: #6ee7b7 !important;
}
html.dark #topbarSearchDropdown .search-item-active {
  background-color: rgba(16, 185, 129, 0.16) !important;
}
html.dark #topbarSearchDropdown .topbar-search-item:hover {
  background-color: rgba(255, 255, 255, 0.05) !important;
}
html.dark #currencyDropdownMenu a,
html.dark #langDropdownMenu a {
  color: #cbd5e1 !important;
}
html.dark #currencyDropdownMenu a:hover,
html.dark #langDropdownMenu a:hover {
  background-color: #122144 !important;
  color: #ffffff !important;
}

/* Inputs, Selects & Textareas */
html.dark input:not([type="checkbox"]):not([type="radio"]),
html.dark select,
html.dark textarea {
  background-color: #091224 !important;
  color: #f8fafc !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}

html.dark input:focus,
html.dark select:focus,
html.dark textarea:focus {
  background-color: #0c1730 !important;
  border-color: #00E599 !important;
  box-shadow: 0 0 0 2px rgba(0, 229, 153, 0.2) !important;
}

/* Modals */
html.dark .modal-content,
html.dark #modalCatat > div,
html.dark #modalTambahKategori > div,
html.dark #modalEditKategori > div,
html.dark #modalKelolaAnggaran > div,
html.dark #modalTargetTabungan > div,
html.dark #modalEditTargetTabungan > div,
html.dark #modalSetorTabungan > div,
html.dark #modalTransfer > div,
html.dark #modalTambahDompet > div,
html.dark #modalEditDompet > div,
html.dark #modalOCR > div,
html.dark #commandPaletteModal > div {
  background-color: #0d172e !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: #e2e8f0 !important;
}

/* Tables in Dark Mode */
html.dark table thead th {
  background-color: #091224 !important;
  color: #64748b !important;
  border-color: rgba(255, 255, 255, 0.06) !important;
}
html.dark table tbody tr {
  border-color: rgba(255, 255, 255, 0.05) !important;
}
html.dark table tbody tr:hover {
  background-color: #111d38 !important;
}

/* Dark Mode Scrollbars */
html.dark ::-webkit-scrollbar-track {
  background: #070d18;
}
html.dark ::-webkit-scrollbar-thumb {
  background: #1b2b48;
}
html.dark ::-webkit-scrollbar-thumb:hover {
  background: #2a3f68;
}

/* Pill & Hover effects */
html.dark .hover\:bg-slate-50:hover,
html.dark .hover\:bg-slate-100:hover,
html.dark .hover\:bg-slate-100\/80:hover {
  background-color: #121e38 !important;
}

/* ========================================================
   COLLAPSIBLE SIDEBAR ENGINE (Exact Match to User Mockup)
   ======================================================== */
#mainSidebar {
  width: 16rem; /* 256px */
  transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: width;
}

#mainSidebar.is-collapsed,
html.sidebar-is-collapsed #mainSidebar {
  width: 5rem !important; /* 80px */
}

#mainSidebar.is-collapsed .sidebar-text,
html.sidebar-is-collapsed #mainSidebar .sidebar-text,
#mainSidebar.is-collapsed .sidebar-collapse-hide,
html.sidebar-is-collapsed #mainSidebar .sidebar-collapse-hide {
  display: none !important;
  opacity: 0;
}

#mainSidebar.is-collapsed .sidebar-item,
html.sidebar-is-collapsed #mainSidebar .sidebar-item {
  justify-content: center !important;
  padding-left: 0.5rem !important;
  padding-right: 0.5rem !important;
}

#mainSidebar.is-collapsed .sidebar-brand-box,
html.sidebar-is-collapsed #mainSidebar .sidebar-brand-box {
  justify-content: center !important;
  padding-left: 0.5rem !important;
  padding-right: 0.5rem !important;
}

#mainSidebar.is-collapsed .sidebar-bottom-quote,
html.sidebar-is-collapsed #mainSidebar .sidebar-bottom-quote {
  display: none !important;
}

/* Tooltip on collapsed menu items */
#mainSidebar.is-collapsed .sidebar-item:hover::after,
html.sidebar-is-collapsed #mainSidebar .sidebar-item:hover::after {
  content: attr(data-title);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background-color: #0f172a;
  color: #ffffff;
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
  z-index: 999;
  box-shadow: 0 4px 14px rgba(0,0,0,0.18);
}

/* Real-time Scanner laser & camera viewfinder */
@keyframes scanLaser {
  0% { top: 4%; opacity: 0.85; }
  50% { top: 92%; opacity: 1; }
  100% { top: 4%; opacity: 0.85; }
}

.scan-laser-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #00E599, #38bdf8, transparent);
  box-shadow: 0 0 14px 2px #00E599, 0 0 6px 1px #38bdf8;
  animation: scanLaser 2.2s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
  pointer-events: none;
}

.viewfinder-frame {
  position: relative;
  overflow: hidden;
  border-radius: 1.25rem;
}

.viewfinder-corner-tl {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 26px;
  height: 26px;
  border-top: 3px solid #00E599;
  border-left: 3px solid #00E599;
  border-top-left-radius: 6px;
  pointer-events: none;
}
.viewfinder-corner-tr {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 26px;
  height: 26px;
  border-top: 3px solid #00E599;
  border-right: 3px solid #00E599;
  border-top-right-radius: 6px;
  pointer-events: none;
}
.viewfinder-corner-bl {
  position: absolute;
  bottom: 10px;
  left: 10px;
  width: 26px;
  height: 26px;
  border-bottom: 3px solid #00E599;
  border-left: 3px solid #00E599;
  border-bottom-left-radius: 6px;
  pointer-events: none;
}
.viewfinder-corner-br {
  position: absolute;
  bottom: 10px;
  right: 10px;
  width: 26px;
  height: 26px;
  border-bottom: 3px solid #00E599;
  border-right: 3px solid #00E599;
  border-bottom-right-radius: 6px;
  pointer-events: none;
}

/* ========================================================
   FORMAL PRINT & PDF STYLESHEET
   Clean, professional A4 financial ledger printing
   ======================================================== */
@media print {
  /* Sembunyikan elemen navigasi dan tombol interaktif */
  #sidebar,
  header,
  nav,
  button,
  .no-print,
  #commandPaletteModal,
  #modalCatat,
  #modalOCR,
  #modalTambahKategori,
  #modalEditKategori,
  #modalKelolaAnggaran,
  #modalTargetTabungan,
  #modalTransfer,
  #globalToast {
    display: none !important;
  }

  /* Reset halaman ke format putih formal */
  body, html, main {
    background: #ffffff !important;
    color: #0f172a !important;
    font-size: 11pt !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
  }

  /* Tampilkan header cetak resmi jika ada */
  .print-only {
    display: block !important;
  }

  /* Pastikan warna badge, progress bar, dan tabel tercetak jelas */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Halaman dan tabel tidak terpotong canggung */
  table, tr, .print-card {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  /* Border tabel cetak jelas */
  table {
    width: 100% !important;
    border-collapse: collapse !important;
  }

  th, td {
    border-bottom: 1px solid #cbd5e1 !important;
  }

  /* Maksimalkan lebar konten */
  .flex-1 {
    flex: 1 1 100% !important;
    max-width: 100% !important;
    padding: 15px !important;
  }
}
