/* Global Stylesheet & Design System - Personal Expense Tracker */

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

:root {
  /* Light Theme Variables */
  --primary-hue: 162;
  --primary-color: hsl(var(--primary-hue), 76%, 42%);
  --primary-hover: hsl(var(--primary-hue), 76%, 36%);
  --primary-light: hsl(var(--primary-hue), 76%, 95%);
  --primary-glow: rgba(16, 185, 129, 0.2);

  --bg-color: #f0fdf4;
  --card-bg: rgba(255, 255, 255, 0.85);
  --card-border: rgba(16, 185, 129, 0.15);
  --text-main: #064e3b;
  --text-muted: #047857;
  --text-white: #ffffff;

  --success-color: #059669;
  --success-bg: rgba(5, 150, 105, 0.1);
  --warning-color: #d97706;
  --warning-bg: rgba(217, 119, 6, 0.1);
  --danger-color: #dc2626;
  --danger-bg: rgba(220, 38, 38, 0.1);
  --info-color: #2563eb;

  --nav-bg: rgba(255, 255, 255, 0.85);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 8px 24px rgba(6, 78, 59, 0.06);
  --shadow-lg: 0 16px 40px rgba(6, 78, 59, 0.08);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.dark-mode {
  /* Dark Theme Variables (Emerald Obsidian) */
  --primary-color: #10b981;
  --primary-hover: #059669;
  --primary-light: rgba(16, 185, 129, 0.12);
  --primary-glow: rgba(16, 185, 129, 0.25);

  --bg-color: #090d16;
  --card-bg: rgba(17, 24, 39, 0.7);
  --card-border: rgba(255, 255, 255, 0.08);
  --text-main: #f4f4f5;
  --text-muted: #94a3b8;

  --nav-bg: rgba(9, 13, 22, 0.8);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.6);
}

/* Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
}

html, body {
  min-height: 100vh;
  background-color: var(--bg-color);
  color: var(--text-main);
  transition: background-color var(--transition-normal), color var(--transition-normal);
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

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

/* Glassmorphism Card Utility */
.glass-card {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.glass-card:hover {
  border-color: rgba(16, 185, 129, 0.3);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* App Header & Navigation Layout */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
  width: 260px;
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  padding: 1.5rem 1rem;
  transition: transform var(--transition-normal);
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 0.75rem 1.5rem;
  border-bottom: 1px solid var(--card-border);
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary-color), #059669);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.25rem;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary-color), #059669);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1.5rem;
  flex-grow: 1;
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
  transition: all var(--transition-fast);
}

.nav-item a:hover {
  background: var(--primary-light);
  color: var(--primary-color);
}

.nav-item.active a {
  background: linear-gradient(135deg, var(--primary-color), #059669);
  color: white;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.nav-item a i {
  font-size: 1.15rem;
  width: 24px;
  text-align: center;
}

/* Sidebar Footer & Theme Toggle */
.sidebar-footer {
  border-top: 1px solid var(--card-border);
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
  background: transparent;
  color: var(--text-main);
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.theme-toggle-btn:hover {
  background: var(--primary-light);
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  margin-left: 260px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.top-bar {
  height: 70px;
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 90;
}

.page-title h1 {
  font-size: 1.4rem;
}

.user-profile-summary {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-avatar {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary-color), #059669);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  box-shadow: 0 2px 8px var(--primary-glow);
  overflow: hidden;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.user-role {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.main-content {
  padding: 2rem;
  flex: 1;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-color);
}
::-webkit-scrollbar-thumb {
  background: var(--card-border);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary-color);
}

/* Monospace text for numbers and data */
.mono-data, .amount, .trans-amount, .metric-value, .balance-val {
  font-family: 'Geist Mono', 'Courier New', monospace !important;
  font-weight: 600;
}

/* Form Controls & Inputs */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.form-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
}

.form-control, .form-select {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-border);
  background: var(--bg-color);
  color: var(--text-main);
  font-size: 0.95rem;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Primary & Action Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.4rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  transition: all var(--transition-fast);
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color), #059669);
  color: white;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--primary-glow);
  opacity: 0.95;
}

.btn-secondary {
  background: var(--card-border);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: var(--primary-light);
  color: var(--primary-color);
}

.btn-danger {
  background: var(--danger-color);
  color: white;
}

.btn-danger:hover {
  opacity: 0.9;
}

.btn-success {
  background: var(--success-color);
  color: white;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-full);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.badge-income {
  background: var(--success-bg);
  color: var(--success-color);
}

.badge-expense {
  background: var(--danger-bg);
  color: var(--danger-color);
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 1000;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-lg);
  color: var(--text-main);
  font-size: 0.9rem;
  font-weight: 500;
  animation: slideIn 0.3s ease forwards;
}

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

.toast.success i { color: var(--success-color); }
.toast.error i { color: var(--danger-color); }
.toast.warning i { color: var(--warning-color); }

/* Modal Backdrop & Dialog */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: 90%;
  max-width: 500px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform var(--transition-fast);
}

.modal-backdrop.active .modal-card {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--text-muted);
  cursor: pointer;
}

/* Mobile Toggle Hamburger */
.mobile-nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-main);
  cursor: pointer;
}

/* Native Mobile WebView Touch Overrides */
* {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}
body {
  user-select: none;
  -webkit-user-select: none;
}
input, textarea, select, [contenteditable="true"] {
  user-select: text;
  -webkit-user-select: text;
}
