@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  /* Dark Theme (Default) */
  --bg-color: #0b0f19;
  --surface: #141b2d;
  --surface-hover: #1e293b;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.2);
  
  --accent-primary: #3b82f6; /* Blue */
  --accent-primary-hover: #2563eb;
  
  --income: #10b981; /* Green */
  --expense: #f43f5e; /* Red */
  --saving: #8b5cf6; /* Purple */
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.25);
  
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;
  
  --font-family: 'Inter', sans-serif;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg-color: #f8fafc;
  --surface: #ffffff;
  --surface-hover: #f1f5f9;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #94a3b8;
  
  --border: rgba(0, 0, 0, 0.1);
  --border-strong: rgba(0, 0, 0, 0.2);
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--transition), color var(--transition);
}

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

button {
  font-family: var(--font-family);
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  outline: none;
}

/* Typography */
h1, h2, h3, h4 {
  font-weight: 600;
  line-height: 1.2;
}
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.text-4xl { font-size: 2.25rem; font-weight: 700;}

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-income { color: var(--income); }
.text-expense { color: var(--expense); }
.text-saving { color: var(--saving); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* Layout */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* Sidebar (Desktop) */
.sidebar {
  display: none;
  width: 280px;
  background-color: var(--surface);
  border-right: 1px solid var(--border);
  flex-direction: column;
  padding: 24px;
  z-index: 10;
}
@media (min-width: 768px) {
  .sidebar { display: flex; }
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 40px;
}
.brand-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent-primary), var(--saving));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 18px;
}
.brand-text {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 500;
  transition: all var(--transition);
}
.nav-item:hover {
  background-color: var(--surface-hover);
  color: var(--text-primary);
}
.nav-item.active {
  background-color: var(--accent-primary);
  color: white;
}
.nav-item svg {
  width: 20px;
  height: 20px;
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  position: relative;
  padding-bottom: 80px; /* Space for mobile nav */
}
@media (min-width: 768px) {
  .main-content { padding-bottom: 0; }
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px;
  position: sticky;
  top: 0;
  background: rgba(11, 15, 25, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 5;
  border-bottom: 1px solid transparent;
}
[data-theme="light"] .header {
  background: rgba(248, 250, 252, 0.8);
}
.header.scrolled {
  border-bottom-color: var(--border);
}

.page-container {
  padding: 0 24px 24px 24px;
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
}

/* Mobile Bottom Nav */
.bottom-nav {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: var(--surface);
  border-top: 1px solid var(--border);
  padding: 8px 16px 24px 16px;
  justify-content: space-around;
  z-index: 20;
}
@media (min-width: 768px) {
  .bottom-nav { display: none; }
}
.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 500;
  padding: 8px;
  border-radius: var(--radius-sm);
}
.bottom-nav-item svg {
  width: 24px;
  height: 24px;
}
.bottom-nav-item.active {
  color: var(--accent-primary);
}

/* Cards & UI Components */
.card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-md);
}

.glass-card {
  background: linear-gradient(145deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.01) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}
[data-theme="light"] .glass-card {
  background: linear-gradient(145deg, rgba(255,255,255,0.8) 0%, rgba(255,255,255,0.4) 100%);
}

.glass-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.95rem;
  transition: all var(--transition);
}
.btn-primary {
  background-color: var(--accent-primary);
  color: white;
  box-shadow: 0 4px 14px 0 rgba(59, 130, 246, 0.39);
}
.btn-primary:hover {
  background-color: var(--accent-primary-hover);
  transform: translateY(-1px);
}
.btn-secondary {
  background-color: var(--surface-hover);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background-color: var(--border);
}
.btn-danger {
  background-color: rgba(244, 63, 94, 0.1);
  color: var(--expense);
}
.btn-danger:hover {
  background-color: rgba(244, 63, 94, 0.2);
}
.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--surface-hover);
}
.btn-icon:hover {
  background-color: var(--border);
}
.btn-block {
  width: 100%;
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}
.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.form-input {
  width: 100%;
  background-color: var(--bg-color);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: var(--font-family);
  transition: border-color var(--transition);
}
.form-input:focus {
  outline: none;
  border-color: var(--accent-primary);
}
.form-select {
  width: 100%;
  background-color: var(--bg-color);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: var(--font-family);
  appearance: none;
}
.form-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.form-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-primary);
}

/* FAB - Floating Action Button */
.fab {
  position: fixed;
  bottom: 90px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background-color: var(--accent-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 25px -5px rgba(59, 130, 246, 0.5);
  z-index: 30;
  transition: transform var(--transition);
}
.fab:hover {
  transform: scale(1.05);
}
@media (min-width: 768px) {
  .fab {
    bottom: 40px;
    right: 40px;
  }
}

/* Modals / Bottom Sheets */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
@media (min-width: 768px) {
  .modal-overlay { align-items: center; }
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
.modal-content {
  background-color: var(--surface);
  width: 100%;
  max-width: 500px;
  border-radius: 24px 24px 0 0;
  padding: 24px;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1);
}
@media (min-width: 768px) {
  .modal-content {
    border-radius: var(--radius-lg);
    transform: translateY(20px) scale(0.95);
  }
}
.modal-overlay.active .modal-content {
  transform: translateY(0) scale(1);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.modal-close {
  background: var(--surface-hover);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

/* Auth Screens */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at top right, rgba(59, 130, 246, 0.1), transparent 40%),
              radial-gradient(circle at bottom left, rgba(139, 92, 246, 0.1), transparent 40%);
}
.auth-card {
  width: 100%;
  max-width: 420px;
}
.auth-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 32px;
  text-align: center;
}
.auth-error {
  background-color: rgba(244, 63, 94, 0.1);
  color: var(--expense);
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 20px;
  display: none;
}

/* Utilities */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.w-full { width: 100%; }

/* Dashboard Specifics */
.hero-balance {
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: -1px;
  background: linear-gradient(to right, #fff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}
[data-theme="light"] .hero-balance {
  background: linear-gradient(to right, #0f172a, #475569);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 32px;
}
.stat-card {
  background: var(--surface-hover);
  padding: 16px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.stat-val {
  font-size: 1.25rem;
  font-weight: 600;
}

/* Transaction Item */
.tx-item {
  display: flex;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  gap: 16px;
}
.tx-item:last-child {
  border-bottom: none;
}
.tx-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.tx-icon.income { background-color: rgba(16, 185, 129, 0.1); color: var(--income); }
.tx-icon.expense { background-color: rgba(244, 63, 94, 0.1); color: var(--expense); }
.tx-icon.saving { background-color: rgba(139, 92, 246, 0.1); color: var(--saving); }
.tx-details {
  flex: 1;
}
.tx-title {
  font-weight: 600;
  color: var(--text-primary);
}
.tx-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.tx-amount {
  font-weight: 600;
  text-align: right;
}

/* Progress Bar */
.progress-bar-bg {
  width: 100%;
  height: 8px;
  background-color: var(--surface-hover);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 8px;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary), var(--saving));
  border-radius: var(--radius-full);
  transition: width 1s ease-in-out;
}

/* Date Picker for Daily */
.date-selector {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 8px 16px;
  margin-bottom: 24px;
}
.date-selector input[type="date"] {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-family);
  font-weight: 600;
  outline: none;
}
.date-selector input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
}
[data-theme="light"] .date-selector input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0);
}

/* Add Modal Tabs */
.modal-tabs {
  display: flex;
  background: var(--bg-color);
  padding: 4px;
  border-radius: var(--radius-sm);
  margin-bottom: 24px;
}
.modal-tab {
  flex: 1;
  text-align: center;
  padding: 8px 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: 6px;
  transition: all var(--transition);
}
.modal-tab.active {
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* Toasts */
#toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-weight: 500;
  font-size: 0.9rem;
  animation: slideIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1) forwards;
}
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  color: var(--text-tertiary);
}
.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}
