/* ==========================================================================
   FINKU GEN-Z — DESIGN SYSTEM & CORE VARIABLES (style.css)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  /* Color Palette — Premium Dark Mode (Default) */
  --bg-primary: #09090E;
  --bg-secondary: #111118;
  --bg-tertiary: #18181F;
  --bg-card: rgba(17, 17, 24, 0.92);
  --bg-glass: rgba(255, 255, 255, 0.035);
  --bg-glass-hover: rgba(255, 255, 255, 0.065);
  --border-color: rgba(255, 255, 255, 0.06);
  --border-subtle: rgba(255, 255, 255, 0.04);
  --border-focus: rgba(0, 229, 160, 0.45);

  /* Accents & Status Colors */
  --accent-green: #00D98B;      /* Sehat / Surplus / Income */
  --accent-green-glow: rgba(0, 217, 139, 0.2);
  --accent-yellow: #F59E0B;     /* Waspada / Warning / H-3 Alert */
  --accent-yellow-glow: rgba(245, 158, 11, 0.2);
  --accent-red: #F43F5E;        /* Bahaya / Defisit / Expense / BNPL Overdue */
  --accent-red-glow: rgba(244, 63, 94, 0.25);
  --accent-blue: #38BDF8;       /* Brand / Info / Gig Economy */
  --accent-purple: #A78BFA;     /* Goals / Premium / Anti-impulsif */
  --accent-purple-glow: rgba(167, 139, 250, 0.25);
  --accent-ai-purple: #A855F7;      /* AI / Twin insight cards (distinct from --accent-purple) */
  --accent-ai-purple-glow: rgba(168, 85, 247, 0.1);
  --accent-data-purple: #A855F7;    /* Kalkulator: data/scenario accent (chart "Tinggi" line, profit/keuntungan cells) — same hex as --accent-ai-purple but semantically distinct (data-viz, not AI-advisor branding) */
  --accent-data-purple-glow: rgba(168, 85, 247, 0.08);
  --accent-pink: #F472B6;       /* Guilt-Free Spending Envelope */

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #00D98B 0%, #38BDF8 100%);
  --gradient-danger: linear-gradient(135deg, #F43F5E 0%, #FB7185 100%);
  --gradient-goals: linear-gradient(135deg, #A78BFA 0%, #F472B6 100%);
  --gradient-glass: linear-gradient(160deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.01) 100%);
  --gradient-bg: radial-gradient(ellipse 70% 50% at 50% -18%, rgba(255,255,255,0.035) 0%, transparent 58%);

  /* Typography */
  --font-ui: 'Inter', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-mono: 'JetBrains Mono', monospace;
  --text-primary: #F5F4F1;
  --text-secondary: #8E8EA0;
  --text-muted: #6B6B82;

  /* Shadows & Blur — gallery: hairline + restrained depth, not glow circus */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255,255,255,0.055);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.42), 0 0 0 1px rgba(255,255,255,0.05);
  --shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.58);
  --shadow-glow-green: 0 0 16px rgba(0, 217, 139, 0.12);
  --shadow-glow-red: 0 0 16px rgba(244, 63, 94, 0.2);
  --blur-glass: blur(20px);
  --blur-heavy: blur(40px);

  /* Layout Constants */
  --sidebar-width: 252px;
  --header-height: 68px;
  --border-radius-sm: 8px;
  --border-radius-md: 12px;
  --border-radius-lg: 18px;
  --border-radius-xl: 24px;
  --border-radius-pill: 999px;

  /* Transitions */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ==========================================================================
   MODE ANTI-IMPULSIF AKTIF (GUILT-FREE ENVELOPE HABIS)
   Ketika class 'impulsive-locked' aktif di body, UI berubah dramatis ke Merah
   ========================================================================== */
body.impulsive-locked {
  --bg-primary: #180508;
  --bg-secondary: #24090F;
  --bg-tertiary: #34101A;
  --bg-card: rgba(36, 9, 15, 0.9);
  --border-color: rgba(255, 71, 87, 0.25);
  --border-focus: rgba(255, 71, 87, 0.8);
  --accent-blue: #FF4757;
  --accent-purple: #FF6B81;
  --shadow-glow-green: var(--shadow-glow-red);
}

/* Base Reset & Global Styles */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  font-family: var(--font-ui);
  background-color: var(--bg-primary);
  background-image: var(--gradient-bg);
  background-attachment: fixed;
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color var(--transition-normal), color var(--transition-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv02','cv03','cv04','cv11';
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: var(--border-radius-pill);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Typography Classes */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

/* Gallery wall titles — serif. Body/UI stays Inter + Plus Jakarta. Numbers stay mono. */
h1,
.page-title,
#main-header-title,
.zen-greeting-title,
.brand-name,
.wallets-title,
.es-hero-title,
.twin-intro-title,
.journal-intro-title,
.rp-title,
.inv-title,
.dashboard-ai-widget-title {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.025em;
}
.stat-label {
  font-family: var(--font-display);
  font-weight: 500;
}

.font-mono {
  font-family: var(--font-mono);
  letter-spacing: -0.03em;
}

.text-green { color: var(--accent-green); }
.text-yellow { color: var(--accent-yellow); }
.text-red { color: var(--accent-red); }
.text-blue { color: var(--accent-blue); }
.text-purple { color: var(--accent-purple); }
.text-pink { color: var(--accent-pink); }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }

/* Currency & Numbers formatting style */
.currency {
  font-family: var(--font-mono);
  font-weight: 700;
}

/* Glassmorphism utility */
.glass-panel {
  background: var(--bg-glass);
  backdrop-filter: var(--blur-glass);
  -webkit-backdrop-filter: var(--blur-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
}

/* Sembunyikan scrollbar tapi tetap bisa scroll */
.hide-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }
.hide-scrollbar::-webkit-scrollbar { display: none; }

/* Privacy Shield — primary mask via formatRupiah (Rp ••••••); no CSS blur */

/* Utility visibility classes */
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* --------------------------------------------------------------------------
   DASHBOARD LAYOUT — KPI Grid + Main Split
   -------------------------------------------------------------------------- */
.dashboard-grid-kpi {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.dashboard-main-split {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 20px;
  margin-bottom: 24px;
}

@media (max-width: 1200px) {
  .dashboard-main-split {
    grid-template-columns: 1fr 340px;
  }
}

@media (max-width: 1024px) {
  .dashboard-grid-kpi {
    grid-template-columns: repeat(2, 1fr);
  }
  .dashboard-main-split {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   LIGHT MODE THEME — Wealthsimple cream-paper gallery (NOT lavender)
   Pastel / Hangat / Dingin packs below still override --bg-* when selected.
   ========================================================================== */
body.light-mode {
  --bg-primary: #FAF8F5;
  --bg-secondary: #FCFCFC;
  --bg-tertiary: #F3EFEB;
  --bg-card: #FFFFFF;
  --bg-glass: rgba(50, 48, 47, 0.035);
  --bg-glass-hover: rgba(50, 48, 47, 0.07);
  --border-color: #E4E2E1;
  --border-subtle: rgba(50, 48, 47, 0.06);
  --text-primary: #09090A;
  --text-secondary: #32302F;
  --text-muted: #6B6864;
  /* Ink accents — readable on cream */
  --accent-green: #047857;
  --accent-yellow: #B45309;
  --accent-red: #E11D48;
  --accent-blue: #0369A1;
  --accent-purple: #6D28D9;
  --accent-ai-purple: #6D28D9;
  --accent-ai-purple-glow: rgba(109, 40, 217, 0.14);
  --accent-pink: #DB2777;
  --shadow-sm: 0 1px 2px rgba(50, 48, 47, 0.06), 0 0 0 1px #E4E2E1;
  --shadow-md: 0 8px 20px rgba(50, 48, 47, 0.08), 0 0 0 1px #E4E2E1;
  --gradient-bg: radial-gradient(ellipse 70% 50% at 50% -18%, rgba(50, 48, 47, 0.03) 0%, transparent 55%);
  color-scheme: light;
}
body.light-mode::-webkit-scrollbar-track { background: #F3EFEB; }
body.light-mode::-webkit-scrollbar-thumb { background: #C8C4BE; }
body.light-mode .glass-panel { background: rgba(255,255,255,0.92); }

/* Featured “lukisan di dinding” — tinted Origin panels on cream wall.
   Ordinary cards stay paper via --bg-card. Palette packs may retint --accent-*. */
body.light-mode .twin-intro-card,
body.light-mode .journal-intro-card,
body.light-mode .es-hero {
  background: linear-gradient(160deg, rgba(109, 40, 217, 0.14) 0%, #F3EFEB 64%);
}
body.light-mode .dashboard-ai-widget {
  background: linear-gradient(135deg, rgba(109, 40, 217, 0.12) 0%, rgba(3, 105, 161, 0.07) 42%, #FFFFFF 100%);
  border-color: rgba(109, 40, 217, 0.28);
}
body.light-mode .rp-ai-box {
  background: rgba(109, 40, 217, 0.10);
  border-color: rgba(109, 40, 217, 0.32);
  color: #32302F;
}
body.light-mode .bnpl-debt-simulator-card {
  background: linear-gradient(160deg, rgba(109, 40, 217, 0.10) 0%, #FFFFFF 72%);
}
body.light-mode .bnpl-ai-strategy-result {
  background: rgba(109, 40, 217, 0.07);
}

/* Mobile light: graphite on cream (no purple-tinted gray) */
@media (max-width: 768px) {
  body.light-mode {
    --text-secondary: #32302F;
    --text-muted: #5C5956;
  }
  body.light-mode .budget-item-icon,
  body.light-mode .budget-item-wallet {
    background: rgba(0, 0, 0, 0.05);
  }
  body.light-mode .page-kpi-grid .card,
  body.light-mode .kpi-card,
  body.light-mode .stat-label,
  body.light-mode .form-label,
  body.light-mode .tx-item-category,
  body.light-mode .tx-item-date {
    color: var(--text-secondary);
  }
}

/* ==========================================================================
   RILIS 1 — PALETTE PACKS (atmosphere / brand; semantic money stays readable)
   Classes: theme-default | theme-pastel | theme-warm | theme-cold
   ========================================================================== */

/* --- Pastel (dark) --- */
body.theme-pastel {
  --bg-primary: #0C0B12;
  --bg-secondary: #15131C;
  --bg-tertiary: #1E1B28;
  --bg-card: rgba(24, 20, 36, 0.92);
  --bg-glass: rgba(255, 220, 240, 0.04);
  --bg-glass-hover: rgba(255, 220, 240, 0.08);
  --border-color: rgba(232, 200, 230, 0.1);
  --border-subtle: rgba(232, 200, 230, 0.06);
  --border-focus: rgba(196, 168, 255, 0.5);
  --accent-blue: #7EB8F7;
  --accent-purple: #C4A8FF;
  --accent-purple-glow: rgba(196, 168, 255, 0.28);
  --accent-pink: #F5A3C7;
  --gradient-primary: linear-gradient(135deg, #7DD3C0 0%, #C4A8FF 100%);
  --gradient-goals: linear-gradient(135deg, #C4A8FF 0%, #F5A3C7 100%);
  --gradient-bg: radial-gradient(ellipse 80% 60% at 50% -20%, rgba(196,168,255,0.12) 0%, transparent 60%);
  /* Semantic money: mild retint, keep contrast meaning */
  --accent-green: #3ECF9A;
  --accent-green-glow: rgba(62, 207, 154, 0.22);
  --accent-yellow: #E8B84A;
  --accent-yellow-glow: rgba(232, 184, 74, 0.22);
  --accent-red: #E85A7A;
  --accent-red-glow: rgba(232, 90, 122, 0.25);
}

body.light-mode.theme-pastel {
  --bg-primary: #F7F0F8;
  --bg-secondary: #FFFBFE;
  --bg-tertiary: #F0E6F4;
  --bg-card: rgba(255, 252, 255, 0.97);
  --bg-glass: rgba(120, 60, 140, 0.04);
  --bg-glass-hover: rgba(120, 60, 140, 0.08);
  --border-color: rgba(90, 50, 110, 0.1);
  --accent-blue: #2563A8;
  --accent-purple: #6B3FA0;
  --accent-pink: #B8326E;
  --gradient-bg: radial-gradient(ellipse 80% 60% at 50% -20%, rgba(196,168,255,0.18) 0%, transparent 55%);
  --accent-green: #047857;
  --accent-yellow: #B45309;
  --accent-red: #BE123C;
}

/* --- Warm (dark) --- */
body.theme-warm {
  --bg-primary: #0E0A08;
  --bg-secondary: #17110E;
  --bg-tertiary: #211814;
  --bg-card: rgba(28, 20, 14, 0.94);
  --bg-glass: rgba(255, 180, 100, 0.04);
  --bg-glass-hover: rgba(255, 180, 100, 0.08);
  --border-color: rgba(255, 180, 120, 0.1);
  --border-subtle: rgba(255, 180, 120, 0.06);
  --border-focus: rgba(245, 158, 11, 0.5);
  --accent-blue: #5BA4D9;
  --accent-purple: #C4936A;
  --accent-purple-glow: rgba(196, 147, 106, 0.25);
  --accent-pink: #E8896A;
  --gradient-primary: linear-gradient(135deg, #00D98B 0%, #F59E0B 100%);
  --gradient-goals: linear-gradient(135deg, #C4936A 0%, #E8896A 100%);
  --gradient-bg: radial-gradient(ellipse 80% 60% at 45% -18%, rgba(245,158,11,0.1) 0%, transparent 60%);
  --accent-green: #22C55E;
  --accent-green-glow: rgba(34, 197, 94, 0.22);
  --accent-yellow: #F59E0B;
  --accent-yellow-glow: rgba(245, 158, 11, 0.25);
  --accent-red: #EF4444;
  --accent-red-glow: rgba(239, 68, 68, 0.28);
}

body.light-mode.theme-warm {
  --bg-primary: #FFF7ED;
  --bg-secondary: #FFFBF5;
  --bg-tertiary: #FFEDD5;
  --bg-card: rgba(255, 252, 248, 0.97);
  --bg-glass: rgba(180, 100, 40, 0.04);
  --bg-glass-hover: rgba(180, 100, 40, 0.08);
  --border-color: rgba(120, 60, 20, 0.1);
  --accent-blue: #0369A1;
  --accent-purple: #9A3412;
  --accent-pink: #C2410C;
  --gradient-bg: radial-gradient(ellipse 80% 60% at 50% -20%, rgba(245,158,11,0.14) 0%, transparent 55%);
  --accent-green: #15803D;
  --accent-yellow: #B45309;
  --accent-red: #DC2626;
}

/* --- Cold (dark) --- */
body.theme-cold {
  --bg-primary: #070B10;
  --bg-secondary: #0D141C;
  --bg-tertiary: #131C28;
  --bg-card: rgba(14, 22, 32, 0.94);
  --bg-glass: rgba(100, 180, 255, 0.04);
  --bg-glass-hover: rgba(100, 180, 255, 0.08);
  --border-color: rgba(120, 180, 230, 0.1);
  --border-subtle: rgba(120, 180, 230, 0.06);
  --border-focus: rgba(56, 189, 248, 0.5);
  --accent-blue: #38BDF8;
  --accent-purple: #818CF8;
  --accent-purple-glow: rgba(129, 140, 248, 0.28);
  --accent-pink: #67E8F9;
  --gradient-primary: linear-gradient(135deg, #22D3EE 0%, #38BDF8 100%);
  --gradient-goals: linear-gradient(135deg, #818CF8 0%, #38BDF8 100%);
  --gradient-bg: radial-gradient(ellipse 80% 60% at 50% -20%, rgba(56,189,248,0.1) 0%, transparent 60%);
  --accent-green: #34D399;
  --accent-green-glow: rgba(52, 211, 153, 0.22);
  --accent-yellow: #FBBF24;
  --accent-yellow-glow: rgba(251, 191, 36, 0.22);
  --accent-red: #F87171;
  --accent-red-glow: rgba(248, 113, 113, 0.28);
}

body.light-mode.theme-cold {
  --bg-primary: #F0F7FC;
  --bg-secondary: #FFFFFF;
  --bg-tertiary: #E0EEF8;
  --bg-card: rgba(255, 255, 255, 0.97);
  --bg-glass: rgba(30, 90, 140, 0.04);
  --bg-glass-hover: rgba(30, 90, 140, 0.08);
  --border-color: rgba(20, 70, 110, 0.1);
  --accent-blue: #0369A1;
  --accent-purple: #4338CA;
  --accent-pink: #0E7490;
  --gradient-bg: radial-gradient(ellipse 80% 60% at 50% -20%, rgba(56,189,248,0.16) 0%, transparent 55%);
  --accent-green: #047857;
  --accent-yellow: #B45309;
  --accent-red: #E11D48;
}

/* ==========================================================================
   RILIS 1 — SHAPE PACKS (default = soft)
   Classes: shape-sharp | shape-soft | shape-bubbly
   ========================================================================== */
body.shape-sharp {
  --border-radius-sm: 2px;
  --border-radius-md: 4px;
  --border-radius-lg: 6px;
  --border-radius-xl: 8px;
  --border-radius-pill: 4px;
}

body.shape-soft {
  --border-radius-sm: 8px;
  --border-radius-md: 12px;
  --border-radius-lg: 18px;
  --border-radius-xl: 24px;
  --border-radius-pill: 999px;
}

body.shape-bubbly {
  --border-radius-sm: 14px;
  --border-radius-md: 20px;
  --border-radius-lg: 28px;
  --border-radius-xl: 36px;
  --border-radius-pill: 999px;
}

/* --------------------------------------------------------------------------
   Theme prefs popover (palette + shape chips)
   -------------------------------------------------------------------------- */
.theme-prefs-wrap {
  position: relative;
  display: inline-flex;
  margin-right: 4px;
}
.theme-prefs-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 1200;
  min-width: 220px;
  padding: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-md);
}
.theme-prefs-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 8px;
}
.theme-prefs-label + .theme-prefs-chips {
  margin-bottom: 12px;
}
.theme-prefs-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.theme-pref-chip {
  appearance: none;
  border: 1px solid var(--border-color);
  background: var(--bg-glass);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-ui);
  padding: 6px 10px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}
.theme-pref-chip:hover {
  color: var(--text-primary);
  border-color: var(--border-focus);
}
.theme-pref-chip.active {
  color: var(--accent-green);
  border-color: var(--accent-green);
  background: var(--accent-green-glow);
}
body.light-mode .theme-prefs-panel {
  background: var(--bg-secondary);
}
