/* ==========================================================
   Arthanara — Sovereign FinTech Design System
   ========================================================== */

/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Space+Grotesk:wght@500;600;700;800&display=swap');

/* ---------- CSS Custom Properties ---------- */
:root {
  /* --- Dark Theme (Matte Obsidian & Slate) --- */
  --color-bg-base: #0a0e14;
  --color-bg-primary: #0f141c;
  --color-bg-secondary: #151c27;
  --color-bg-tertiary: #1c2635;
  
  --color-surface: #141b26;
  --color-surface-hover: #1b2433;
  --color-surface-active: #222e40;
  --color-surface-elevated: #182230;
  
  --color-border: rgba(255, 255, 255, 0.08);
  --color-border-hover: rgba(255, 255, 255, 0.16);
  --color-border-focus: rgba(45, 212, 191, 0.6);
  
  --color-text-primary: #f1f5f9;
  --color-text-secondary: #94a3b8;
  --color-text-tertiary: #64748b;
  --color-text-muted: #475569;
  --color-text-inverse: #0a0e14;

  /* --- Refined Accent System (Sage Mint & Sky Blue) --- */
  --color-accent: #2dd4bf;
  --color-accent-hover: #14b8a6;
  --color-accent-subtle: rgba(45, 212, 191, 0.12);
  --color-accent-gradient: linear-gradient(135deg, #2dd4bf 0%, #38bdf8 100%);
  --color-accent-warm-gradient: linear-gradient(135deg, #fb923c 0%, #f43f5e 100%);

  /* --- Financial Semantic Palette --- */
  --color-income: #10b981;
  --color-income-bg: rgba(16, 185, 129, 0.12);
  --color-income-border: rgba(16, 185, 129, 0.22);
  
  --color-expense: #f43f5e;
  --color-expense-bg: rgba(244, 63, 94, 0.12);
  --color-expense-border: rgba(244, 63, 94, 0.22);
  
  --color-transfer: #38bdf8;
  --color-transfer-bg: rgba(56, 189, 248, 0.12);
  --color-transfer-border: rgba(56, 189, 248, 0.22);

  --color-warning: #f59e0b;
  --color-warning-bg: rgba(245, 158, 11, 0.12);
  --color-danger: #f43f5e;
  --color-danger-bg: rgba(244, 63, 94, 0.12);
  --color-success: #10b981;
  --color-success-bg: rgba(16, 185, 129, 0.12);
  --color-info: #38bdf8;
  --color-info-bg: rgba(56, 189, 248, 0.12);

  /* --- Rule 50/30/20 FinTech Colors --- */
  --color-needs: #38bdf8;
  --color-needs-bg: rgba(56, 189, 248, 0.12);
  --color-wants: #fb923c;
  --color-wants-bg: rgba(251, 146, 60, 0.12);
  --color-savings: #2dd4bf;
  --color-savings-bg: rgba(45, 212, 191, 0.12);

  /* --- Sidebar & Surfaces --- */
  --color-sidebar-bg: #0f141c;
  --color-sidebar-item-hover: rgba(255, 255, 255, 0.05);
  --color-sidebar-item-active: rgba(45, 212, 191, 0.1);

  /* --- Layout & Dimensions --- */
  --sidebar-width: 250px;
  --sidebar-collapsed-width: 70px;
  --topbar-height: 64px;

  /* --- Spacing --- */
  --spacing-xxs: 4px;
  --spacing-xs: 8px;
  --spacing-sm: 12px;
  --spacing-md: 16px;
  --spacing-lg: 20px;
  --spacing-xl: 28px;
  --spacing-2xl: 40px;

  /* --- Border Radius --- */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* --- Natural Shadows --- */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
  --shadow-elevated: 0 20px 40px rgba(0, 0, 0, 0.6);

  /* --- Typography --- */
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Space Grotesk', 'Plus Jakarta Sans', sans-serif;
  --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 0.9375rem;
  --text-lg: 1.0625rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;

  --leading-tight: 1.2;
  --leading-normal: 1.5;
  --leading-relaxed: 1.7;

  /* --- Transitions --- */
  --transition-fast: 140ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 220ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 360ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 400ms cubic-bezier(0.34, 1.4, 0.64, 1);

  /* --- Z-index --- */
  --z-dropdown: 100;
  --z-sidebar: 200;
  --z-modal: 300;
  --z-toast: 500;
}

/* ---------- Light Theme ---------- */
[data-theme="light"] {
  --color-bg-base: #f4f6f8;
  --color-bg-primary: #ffffff;
  --color-bg-secondary: #ffffff;
  --color-bg-tertiary: #f1f5f9;

  --color-surface: #ffffff;
  --color-surface-hover: #f8fafc;
  --color-surface-active: #f1f5f9;
  --color-surface-elevated: #ffffff;

  --color-border: rgba(15, 23, 42, 0.08);
  --color-border-hover: rgba(15, 23, 42, 0.16);
  --color-border-focus: rgba(20, 184, 166, 0.6);

  --color-text-primary: #0f172a;
  --color-text-secondary: #475569;
  --color-text-tertiary: #64748b;
  --color-text-muted: #94a3b8;
  --color-text-inverse: #ffffff;

  --color-accent: #0d9488;
  --color-accent-hover: #0f766e;
  --color-accent-subtle: rgba(13, 148, 136, 0.1);
  --color-accent-gradient: linear-gradient(135deg, #0d9488 0%, #0284c7 100%);

  --color-sidebar-bg: #ffffff;
  --color-sidebar-item-hover: rgba(15, 23, 42, 0.04);
  --color-sidebar-item-active: rgba(13, 148, 136, 0.08);

  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 10px 25px rgba(15, 23, 42, 0.1);
  --shadow-elevated: 0 20px 40px rgba(15, 23, 42, 0.12);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text-primary);
  background-color: var(--color-bg-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: var(--leading-tight);
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--color-accent-hover); }

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  outline: none;
}

ul, ol { list-style: none; }
img { max-width: 100%; display: block; }
svg { flex-shrink: 0; }

/* ---------- Scrollbars ---------- */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--color-border-hover);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-tertiary);
}

::selection {
  background: var(--color-accent);
  color: #0a0e14;
}

/* ---------- Keyframes ---------- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes countUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes progressFill {
  from { width: 0; }
}

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastSlideOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(100%); }
}

@keyframes modalBackdropIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalContentIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ---------- Utilities ---------- */
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.text-3xl { font-size: var(--text-3xl); }

.text-primary { color: var(--color-text-primary); }
.text-secondary { color: var(--color-text-secondary); }
.text-tertiary { color: var(--color-text-tertiary); }
.text-accent { color: var(--color-accent); }
.text-income { color: var(--color-income); }
.text-expense { color: var(--color-expense); }
.text-needs { color: var(--color-needs); }
.text-wants { color: var(--color-wants); }
.text-savings { color: var(--color-savings); }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-mono { font-family: var(--font-mono); }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hidden { display: none !important; }
