/* ========================================
   ExpenseIQ — Design System & Tokens
   ======================================== */

/* === CSS RESET === */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-primary);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; background: none; font-family: inherit; color: inherit; }
input, textarea, select { font-family: inherit; color: inherit; }
h1, h2, h3, h4, h5, h6 { line-height: 1.2; font-weight: 600; }

/* Remove autofill styling */
input:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 30px var(--bg-input) inset !important;
  -webkit-text-fill-color: var(--text-primary) !important;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

/* === DESIGN TOKENS === */
:root {
  /* Default: Premium Quartz Mineral FinTech Theme (Light Mode) */
  --bg-primary: #FAF9F6; /* Exquisite warm quartz ivory cream */
  --bg-secondary: #FFFFFF;
  --bg-tertiary: #F3F0E8; /* Soft elegant mineral depth */
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-solid: #FFFFFF;
  --bg-card-hover: rgba(99, 102, 241, 0.03);
  --bg-modal: rgba(9, 9, 11, 0.4);
  --bg-input: rgba(99, 102, 241, 0.02);
  --bg-input-focus: #FFFFFF;

  /* Glass */
  --glass-bg: rgba(255, 255, 255, 0.8);
  --glass-border: rgba(99, 102, 241, 0.05);
  --glass-border-hover: rgba(99, 102, 241, 0.1);
  --glass-shadow: 0 16px 48px rgba(16, 17, 26, 0.03);
  --glass-reflection: linear-gradient(135deg, rgba(255,255,255,0.5) 0%, rgba(255,255,255,0) 60%, rgba(255,255,255,0) 100%);

  /* Accent */
  --accent-primary: #6366F1; /* Premium Brand Indigo */
  --accent-primary-hover: #4F46E5;
  --accent-primary-glow: rgba(99, 102, 241, 0.08);
  --accent-secondary: #0ea5e9; /* Sky Blue Accent */
  --accent-gradient: linear-gradient(135deg, #6366F1, #8B5CF6, #0ea5e9);
  --accent-gradient-hover: linear-gradient(135deg, #4F46E5, #7C3AED, #0284c7);

  /* Semantic */
  --color-income: #10B981; /* Soft Emerald */
  --color-income-hover: #059669;
  --color-income-bg: rgba(16, 185, 129, 0.06);
  --color-income-bg-solid: #ECFDF5;
  --color-expense: #EF4444; /* Soft Red Coral */
  --color-expense-hover: #DC2626;
  --color-expense-bg: rgba(239, 68, 68, 0.06);
  --color-expense-bg-solid: #FEF2F2;
  --color-warning: #F59E0B; /* Amber Warning */
  --color-warning-bg: rgba(245, 158, 11, 0.06);
  --color-info: #3B82F6;
  --color-info-bg: rgba(59, 130, 246, 0.06);
  --color-success: #10B981;
  --color-success-bg: rgba(16, 185, 129, 0.06);

  /* Text */
  --text-primary: #10111A; /* Obsidian charcoal black */
  --text-secondary: #414352; /* Slate dark secondary */
  --text-muted: #8286A8;
  --text-accent: #6366F1;
  --text-inverse: #FFFFFF;

  /* Category Colors */
  --cat-food: #FF7E40;
  --cat-transport: #38BDF8;
  --cat-shopping: #F43F5E;
  --cat-bills: #F59E0B;
  --cat-entertainment: #8B5CF6;
  --cat-health: #10B981;
  --cat-education: #06B6D4;
  --cat-rent: #EC4899;
  --cat-subscriptions: #6366F1;
  --cat-salary: #10B981;
  --cat-freelance: #14B8A6;
  --cat-investment: #F59E0B;
  --cat-gifts: #F43F5E;
  --cat-other: #8286A8;

  /* Typography */
  --font-primary: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --text-xs: 0.72rem;
  --text-sm: 0.85rem;
  --text-base: 0.98rem;
  --text-lg: 1.1rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.85rem;
  --text-4xl: 2.2rem;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Radius */
  --radius-sm: 0.6rem;
  --radius-md: 0.85rem;
  --radius-lg: 1.15rem;
  --radius-xl: 1.5rem;
  --radius-2xl: 2rem;
  --radius-full: 9999px;

  /* Transitions - Spring Easing physics */
  --transition-fast: 150ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-base: 300ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow: 450ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-spring: 600ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Shadows - Layered elegant elevations */
  --shadow-sm: 0 4px 12px rgba(16, 17, 26, 0.015);
  --shadow-md: 0 16px 48px rgba(16, 17, 26, 0.035);
  --shadow-lg: 0 24px 64px rgba(16, 17, 26, 0.05);
  --shadow-xl: 0 40px 96px rgba(16, 17, 26, 0.07);
  --shadow-glow: 0 0 24px var(--accent-primary-glow);
  --shadow-glow-lg: 0 0 48px var(--accent-primary-glow);

  /* Layout */
  --sidebar-width: 280px;
  --sidebar-collapsed: 80px;
  --header-height: 72px;
  --content-max-width: 1240px;
  --bottom-nav-height: 64px;
}

/* === DARK THEME === */
[data-theme="dark"] {
  --bg-primary: #09090B; /* Pure sub-pixel Obsidian mineral dark */
  --bg-secondary: #111115; /* Matte elevated elevations */
  --bg-tertiary: #16161C;
  --bg-card: rgba(17, 17, 21, 0.85);
  --bg-card-solid: #111115;
  --bg-card-hover: rgba(255, 255, 255, 0.03);
  --bg-modal: rgba(0, 0, 0, 0.7);
  --bg-input: rgba(255, 255, 255, 0.02);
  --bg-input-focus: #16161C;

  --glass-bg: rgba(17, 17, 21, 0.75);
  --glass-border: rgba(255, 255, 255, 0.04);
  --glass-border-hover: rgba(255, 255, 255, 0.1);
  --glass-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
  --glass-reflection: linear-gradient(135deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0) 50%, rgba(255,255,255,0) 100%);

  --accent-primary: #6366F1;
  --accent-primary-hover: #818CF8;
  --accent-primary-glow: rgba(99, 102, 241, 0.15);
  --accent-secondary: #0ea5e9;
  --accent-gradient: linear-gradient(135deg, #6366F1, #8B5CF6, #0ea5e9);
  --accent-gradient-hover: linear-gradient(135deg, #818CF8, #a78bfa, #38bdf8);

  --color-income: #34D399;
  --color-income-hover: #059669;
  --color-income-bg: rgba(52, 211, 153, 0.08);
  --color-income-bg-solid: #064E3B;
  --color-expense: #F87171;
  --color-expense-hover: #DC2626;
  --color-expense-bg: rgba(248, 113, 113, 0.08);
  --color-expense-bg-solid: #4C0519;

  --text-primary: #F4F4F5; /* Soft readable light mineral */
  --text-secondary: #A1A1AA;
  --text-muted: #52525B;
  --text-accent: #a78bfa;
  --text-inverse: #111115;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 16px 48px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 40px 96px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 24px rgba(99, 102, 241, 0.2);
}

/* === UTILITY 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); border: 0; }

.text-income { color: var(--color-income); }
.text-expense { color: var(--color-expense); }
.text-warning { color: var(--color-warning); }
.text-accent { color: var(--text-accent); }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }

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

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gradient-text {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Glassmorphism Polish */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  position: relative;
  overflow: hidden;
}

.glass-panel::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--glass-reflection);
  pointer-events: none;
}

.glow-on-hover {
  transition: var(--transition-base);
}

.glow-on-hover:hover {
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

.bg-gradient-soft {
  background: linear-gradient(180deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0) 100%);
}

/* Dynamic Aurora Mesh Glows */
.mesh-glow-1 {
  position: fixed;
  top: -10%;
  left: -10%;
  width: 50vw;
  height: 50vw;
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow-color-1, rgba(99, 102, 241, 0.05)) 0%, transparent 70%);
  z-index: 0;
  pointer-events: none;
  animation: floatGlow1 25s infinite alternate ease-in-out;
  transition: background 1.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.mesh-glow-2 {
  position: fixed;
  bottom: -10%;
  right: -10%;
  width: 60vw;
  height: 60vw;
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow-color-2, rgba(14, 165, 233, 0.05)) 0%, transparent 70%);
  z-index: 0;
  pointer-events: none;
  animation: floatGlow2 30s infinite alternate ease-in-out;
  transition: background 1.5s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] .mesh-glow-1 {
  background: radial-gradient(circle, var(--glow-color-1, rgba(99, 102, 241, 0.12)) 0%, transparent 70%);
}
[data-theme="dark"] .mesh-glow-2 {
  background: radial-gradient(circle, var(--glow-color-2, rgba(139, 92, 246, 0.1)) 0%, transparent 70%);
}

@keyframes floatGlow1 {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(12%, 18%) scale(1.25); }
}
@keyframes floatGlow2 {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-12%, -18%) scale(1.15); }
}
