/* ============================================
   MY DAILY EXPENSES APP — DESIGN SYSTEM
   Dark Glassmorphism + Purple/Cyan Accents
   ============================================ */

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

/* ── CSS VARIABLES ── */
:root {
  --bg-deep:       #090b14;
  --bg-main:       #0d1117;
  --bg-card:       rgba(255,255,255,0.04);
  --bg-card-hover: rgba(255,255,255,0.07);
  --bg-input:      rgba(255,255,255,0.06);

  --border:        rgba(255,255,255,0.08);
  --border-active: rgba(139,92,246,0.5);

  --accent-purple: #8b5cf6;
  --accent-cyan:   #06b6d4;
  --accent-green:  #10b981;
  --accent-red:    #ef4444;
  --accent-orange: #f59e0b;
  --accent-pink:   #ec4899;

  --text-primary:   #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #475569;

  --gradient-main:   linear-gradient(135deg, #8b5cf6 0%, #06b6d4 100%);
  --gradient-income: linear-gradient(135deg, #10b981 0%, #059669 100%);
  --gradient-expense: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  --gradient-balance: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);

  --shadow-card:  0 8px 32px rgba(0,0,0,0.4);
  --shadow-glow:  0 0 40px rgba(139,92,246,0.15);
  --shadow-green: 0 4px 20px rgba(16,185,129,0.3);
  --shadow-red:   0 4px 20px rgba(239,68,68,0.3);
  --shadow-purple:0 4px 20px rgba(139,92,246,0.3);

  --radius-sm:  8px;
  --radius-md:  14px;
  --radius-lg:  20px;
  --radius-xl:  28px;

  --nav-width: 260px;
  --transition: 0.25s cubic-bezier(0.4,0,0.2,1);
}

/* ── RESET & BASE ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
}

/* Subtle background pattern */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 20%, rgba(139,92,246,0.08) 0%, transparent 60%),
    radial-gradient(ellipse 60% 60% at 80% 80%, rgba(6,182,212,0.06) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ── SIDEBAR NAV ── */
.sidebar {
  width: var(--nav-width);
  min-height: 100vh;
  background: rgba(13,17,23,0.95);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  transition: transform var(--transition);
}

.sidebar-logo {
  padding: 28px 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}

.logo-icon {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: var(--gradient-main);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  box-shadow: var(--shadow-purple);
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.logo-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 12px 4px;
  margin-top: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  position: relative;
  user-select: none;
  border: 1px solid transparent;
}

.nav-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border);
}

.nav-item.active {
  background: rgba(139,92,246,0.15);
  color: #c4b5fd;
  border-color: rgba(139,92,246,0.3);
  box-shadow: 0 0 20px rgba(139,92,246,0.1);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: var(--gradient-main);
}

.nav-icon { font-size: 18px; flex-shrink: 0; width: 22px; text-align: center; }
.nav-badge {
  margin-left: auto;
  background: rgba(139,92,246,0.3);
  color: #c4b5fd;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 20px;
}

.sidebar-footer {
  padding: 16px 12px 24px;
  border-top: 1px solid var(--border);
}

.sidebar-toggle {
  display: none;
  position: fixed;
  top: 16px; left: 16px;
  z-index: 200;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 42px; height: 42px;
  align-items: center; justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(20px);
  font-size: 18px;
  color: var(--text-primary);
}

/* ── MAIN CONTENT ── */
.main-content {
  flex: 1;
  margin-left: var(--nav-width);
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.page {
  display: none;
  padding: 32px;
  max-width: 1200px;
  animation: fadeIn 0.3s ease;
}

.page.active { display: block; }

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

/* ── PAGE HEADER ── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 32px;
  gap: 16px;
}

.page-title {
  font-size: 28px;
  font-weight: 800;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
  font-weight: 400;
}

.datetime-badge {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  text-align: right;
  flex-shrink: 0;
}

.datetime-time {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.datetime-date {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ── CARDS ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  backdrop-filter: blur(10px);
  transition: all var(--transition);
  box-shadow: var(--shadow-card);
}

.card:hover {
  border-color: rgba(255,255,255,0.12);
  background: var(--bg-card-hover);
}

/* ── STATS GRID ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  border-radius: var(--radius-lg);
  padding: 22px;
  position: relative;
  overflow: hidden;
  cursor: default;
  transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card:hover { transform: translateY(-3px); }

.stat-card.balance {
  background: linear-gradient(135deg, rgba(139,92,246,0.2) 0%, rgba(236,72,153,0.2) 100%);
  border: 1px solid rgba(139,92,246,0.3);
  box-shadow: var(--shadow-purple);
}
.stat-card.income {
  background: linear-gradient(135deg, rgba(16,185,129,0.2) 0%, rgba(5,150,105,0.2) 100%);
  border: 1px solid rgba(16,185,129,0.3);
  box-shadow: var(--shadow-green);
}
.stat-card.expense {
  background: linear-gradient(135deg, rgba(239,68,68,0.2) 0%, rgba(220,38,38,0.2) 100%);
  border: 1px solid rgba(239,68,68,0.3);
  box-shadow: var(--shadow-red);
}
.stat-card.savings {
  background: linear-gradient(135deg, rgba(6,182,212,0.2) 0%, rgba(8,145,178,0.2) 100%);
  border: 1px solid rgba(6,182,212,0.3);
  box-shadow: 0 4px 20px rgba(6,182,212,0.2);
}

.stat-card::after {
  content: '';
  position: absolute;
  right: -20px; top: -20px;
  width: 100px; height: 100px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.04;
}

.stat-icon {
  font-size: 24px;
  margin-bottom: 12px;
}

.stat-label {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.stat-amount {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stat-change {
  font-size: 12px;
  margin-top: 8px;
  font-weight: 500;
}

.stat-change.positive { color: var(--accent-green); }
.stat-change.negative { color: var(--accent-red); }

/* ── PROGRESS BAR ── */
.progress-section {
  margin-bottom: 24px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.progress-label { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.progress-value { font-size: 13px; font-weight: 700; color: var(--text-primary); }

.progress-bar-wrap {
  background: rgba(255,255,255,0.06);
  border-radius: 100px;
  height: 10px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 100px;
  background: var(--gradient-main);
  transition: width 0.8s cubic-bezier(0.4,0,0.2,1);
  position: relative;
}

.progress-bar-fill.warning { background: linear-gradient(90deg, #f59e0b, #ef4444); }
.progress-bar-fill.danger  { background: var(--gradient-expense); }

/* ── CONTENT GRID ── */
.content-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
}

@media (max-width: 1100px) {
  .content-grid { grid-template-columns: 1fr; }
}

/* ── SECTION HEADERS ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.section-action {
  font-size: 13px;
  color: var(--accent-purple);
  cursor: pointer;
  font-weight: 500;
  transition: color var(--transition);
}

.section-action:hover { color: #c4b5fd; }

/* ── TRANSACTION LIST ── */
.tx-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tx-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--transition);
  cursor: default;
}

.tx-item:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255,255,255,0.12);
  transform: translateX(3px);
}

.tx-emoji {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.tx-info { flex: 1; min-width: 0; }

.tx-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tx-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.tx-amount {
  font-size: 15px;
  font-weight: 700;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.tx-amount.income  { color: var(--accent-green); }
.tx-amount.expense { color: var(--accent-red); }

.tx-actions {
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity var(--transition);
}

.tx-item:hover .tx-actions { opacity: 1; }

.tx-btn {
  width: 28px; height: 28px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 13px;
  transition: all var(--transition);
  color: var(--text-secondary);
}

.tx-btn:hover { background: rgba(239,68,68,0.2); border-color: rgba(239,68,68,0.4); color: var(--accent-red); }
.tx-btn.edit:hover { background: rgba(139,92,246,0.2); border-color: rgba(139,92,246,0.4); color: var(--accent-purple); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  outline: none;
  text-decoration: none;
  user-select: none;
}

.btn-primary {
  background: var(--gradient-main);
  color: white;
  box-shadow: var(--shadow-purple);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(139,92,246,0.4);
}

.btn-primary:active { transform: translateY(0); }

.btn-success {
  background: var(--gradient-income);
  color: white;
  box-shadow: var(--shadow-green);
}

.btn-success:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(16,185,129,0.4); }

.btn-danger {
  background: var(--gradient-expense);
  color: white;
  box-shadow: var(--shadow-red);
}

.btn-danger:hover { transform: translateY(-2px); }

.btn-ghost {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.btn-ghost:hover { background: var(--bg-card-hover); color: var(--text-primary); border-color: rgba(255,255,255,0.14); }

.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 15px; }
.btn-full { width: 100%; justify-content: center; }

/* ── FORM ELEMENTS ── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.form-input,
.form-select,
.form-textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  transition: all var(--transition);
  outline: none;
  width: 100%;
}

.form-input::placeholder,
.form-textarea::placeholder { color: var(--text-muted); }

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent-purple);
  background: rgba(139,92,246,0.08);
  box-shadow: 0 0 0 3px rgba(139,92,246,0.15);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-select option { background: #1e2535; color: var(--text-primary); }

.form-textarea { resize: vertical; min-height: 80px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* ── CATEGORY CHIPS ── */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
}

.category-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-input);
  user-select: none;
}

.category-chip:hover {
  border-color: var(--accent-purple);
  background: rgba(139,92,246,0.1);
}

.category-chip.selected {
  border-color: var(--accent-purple);
  background: rgba(139,92,246,0.2);
  box-shadow: 0 0 20px rgba(139,92,246,0.15);
}

.chip-emoji { font-size: 22px; }
.chip-label { font-size: 11px; font-weight: 600; color: var(--text-secondary); text-align: center; }

/* ── MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: #141926;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-xl);
  padding: 32px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.9) translateY(20px);
  transition: transform var(--transition);
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
}

.modal-overlay.open .modal {
  transform: scale(1) translateY(0);
}

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

.modal-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
}

.modal-close {
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.modal-close:hover { background: rgba(239,68,68,0.2); color: var(--accent-red); border-color: rgba(239,68,68,0.4); }

/* ── QUICK ACTIONS ── */
.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.quick-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  border: 1.5px solid;
  background: transparent;
  font-family: 'Inter', sans-serif;
  text-align: left;
}

.quick-btn.add-income {
  border-color: rgba(16,185,129,0.4);
  color: var(--accent-green);
}

.quick-btn.add-income:hover {
  background: rgba(16,185,129,0.1);
  transform: translateY(-2px);
  box-shadow: var(--shadow-green);
}

.quick-btn.add-expense {
  border-color: rgba(239,68,68,0.4);
  color: var(--accent-red);
}

.quick-btn.add-expense:hover {
  background: rgba(239,68,68,0.1);
  transform: translateY(-2px);
  box-shadow: var(--shadow-red);
}

.quick-icon { font-size: 24px; }
.quick-text strong { display: block; font-size: 14px; font-weight: 700; }
.quick-text span { font-size: 12px; opacity: 0.7; }

/* ── FILTER BAR ── */
.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  font-size: 15px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding-left: 38px;
}

.filter-chip {
  padding: 8px 14px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.filter-chip:hover,
.filter-chip.active {
  background: rgba(139,92,246,0.15);
  border-color: rgba(139,92,246,0.4);
  color: #c4b5fd;
}

/* ── CHART CONTAINERS ── */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 24px;
  margin-bottom: 24px;
}

.chart-wrap {
  position: relative;
}

.chart-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-canvas-wrap {
  position: relative;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

canvas { max-width: 100%; }

/* Donut chart center text */
.donut-center {
  position: absolute;
  text-align: center;
  pointer-events: none;
}

.donut-center-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
}

.donut-center-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Chart legend */
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 14px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.legend-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-title { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.empty-desc { font-size: 13px; line-height: 1.6; }

/* ── SETTINGS PAGE ── */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}

.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.settings-item:last-child { border-bottom: none; }

.settings-item-info strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.settings-item-info span {
  font-size: 12px;
  color: var(--text-muted);
}

/* Toggle switch */
.toggle {
  position: relative;
  width: 44px; height: 24px;
  flex-shrink: 0;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 100px;
  cursor: pointer;
  transition: all var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 2px; top: 50%;
  transform: translateY(-50%);
  border-radius: 50%;
  background: var(--text-muted);
  transition: all var(--transition);
}

.toggle input:checked + .toggle-slider { background: var(--accent-purple); border-color: var(--accent-purple); }
.toggle input:checked + .toggle-slider::before { left: 22px; background: white; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ── TOAST NOTIFICATION ── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #1e2535;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  min-width: 280px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  transform: translateX(120%);
  transition: transform 0.4s cubic-bezier(0.4,0,0.2,1);
}

.toast.show { transform: translateX(0); }
.toast.success { border-color: rgba(16,185,129,0.4); }
.toast.error   { border-color: rgba(239,68,68,0.4); }
.toast.info    { border-color: rgba(139,92,246,0.4); }

/* ── AMOUNT INPUT SPECIAL ── */
.amount-input-wrap {
  position: relative;
}

.amount-prefix {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-secondary);
  pointer-events: none;
}

.amount-input { padding-left: 30px !important; font-size: 18px !important; font-weight: 700; }

/* ── CATEGORY BADGE ── */
.cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(139,92,246,0.15);
  color: #c4b5fd;
}

/* ── RESPONSIVE ── */

/* ── Tablet (≤900px) ── */
@media (max-width: 900px) {
  .content-grid { grid-template-columns: 1fr; }
  .charts-grid  { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr !important; }
}

/* ── Mobile (≤768px) ── */
@media (max-width: 768px) {
  /* Sidebar: slide off-screen, toggled open */
  .sidebar {
    transform: translateX(-100%);
    width: min(260px, 80vw);
    box-shadow: 4px 0 40px rgba(0,0,0,0.5);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: flex; }
  .sidebar-footer { display: none; }          /* footer in mobile = bottom nav */

  /* Main content fills full width */
  .main-content { margin-left: 0; }

  /* Pages: give breathing room + space for bottom nav */
  .page {
    padding: 72px 16px 96px;   /* top: room for hamburger, bottom: room for nav */
    max-width: 100%;
  }

  /* Page header stacks vertically */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 20px;
  }

  /* Datetime badge goes full-width on mobile */
  .datetime-badge {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
  }
  .datetime-time { font-size: 16px; }

  /* Titles */
  .page-title  { font-size: 22px; }
  .page-subtitle { font-size: 13px; }

  /* Stats: 2 columns on mobile */
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card  { padding: 16px 14px; }
  .stat-amount { font-size: 20px; }
  .stat-icon  { font-size: 20px; margin-bottom: 8px; }

  /* Quick actions: full width stack */
  .quick-actions { grid-template-columns: 1fr; gap: 10px; }
  .quick-btn { padding: 14px; }

  /* Forms */
  .form-row { grid-template-columns: 1fr; }

  /* Cards */
  .card { padding: 18px 16px; }

  /* Filter bar wraps */
  .filter-bar {
    flex-wrap: wrap;
    gap: 8px;
  }
  .search-wrap { width: 100%; }

  /* Transaction items: compact */
  .tx-item { padding: 12px 12px; gap: 10px; }
  .tx-emoji { width: 36px; height: 36px; font-size: 16px; }
  .tx-name  { font-size: 13px; }
  .tx-amount { font-size: 14px; }
  .tx-actions { opacity: 1; }   /* always visible on touch */

  /* Modal: full-screen bottom-sheet feel */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal {
    border-radius: 24px 24px 0 0;
    max-width: 100%;
    width: 100%;
    max-height: 92vh;
    padding: 28px 20px 32px;
  }

  /* Category chips: smaller */
  .category-grid { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 6px; }
  .category-chip { padding: 10px 6px; }
  .chip-emoji { font-size: 18px; }
  .chip-label { font-size: 10px; }

  /* Buttons */
  .btn-lg { padding: 13px 22px; font-size: 14px; }

  /* Charts: prevent overflow */
  .chart-canvas-wrap canvas { max-width: 100%; }

  /* Month nav: compact */
  .month-nav { gap: 8px; margin-bottom: 16px; }
  .month-label { font-size: 14px; }

  /* Show bottom nav */
  .mobile-bottom-nav { display: flex !important; }
}

/* ── Small phones (≤480px) ── */
@media (max-width: 480px) {
  .page { padding: 68px 12px 90px; }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .stat-card  { padding: 14px 12px; }
  .stat-amount { font-size: 18px; }

  /* Sidebar toggle: slightly smaller */
  .sidebar-toggle { width: 38px; height: 38px; font-size: 16px; top: 14px; left: 14px; }

  /* History summary: wrap */
  #hist-summary { flex-wrap: wrap; font-size: 12px; }

  /* Quick actions side-by-side on very small */
  .quick-actions { grid-template-columns: 1fr 1fr; gap: 8px; }
  .quick-btn { padding: 12px 10px; gap: 8px; }
  .quick-icon { font-size: 20px; }

  /* Settings grid */
  .settings-item { flex-direction: column; gap: 10px; }
  .settings-item .btn { align-self: flex-start; }
}

/* ── Landscape phones ── */
@media (max-width: 768px) and (orientation: landscape) {
  .page { padding-top: 60px; }
  .modal { max-height: 95vh; }
  .mobile-bottom-nav { padding: 4px 0; }
  .mob-nav-item { padding: 4px 10px; }
}


/* Mobile bottom nav */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: rgba(9, 11, 20, 0.97);
  border-top: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  z-index: 150;
  padding: 6px 4px max(10px, env(safe-area-inset-bottom));
  justify-content: space-around;
  align-items: stretch;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.4);
}

.mob-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  padding: 6px 10px 4px;
  border-radius: 12px;
  transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  min-width: 52px;
  flex: 1;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.mob-nav-item:active {
  transform: scale(0.9);
}

.mob-nav-item.active {
  color: #c4b5fd;
}

/* Active indicator dot above icon */
.mob-nav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: linear-gradient(90deg, #8b5cf6, #06b6d4);
  box-shadow: 0 0 8px rgba(139,92,246,0.6);
}

.mob-nav-icon {
  font-size: 21px;
  line-height: 1;
  transition: transform 0.2s cubic-bezier(0.34,1.56,0.64,1);
}

.mob-nav-item.active .mob-nav-icon {
  transform: scale(1.15) translateY(-1px);
}

/* ── DIVIDER ── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

/* ── BADGE ── */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
}

.badge-green { background: rgba(16,185,129,0.2); color: #34d399; }
.badge-red   { background: rgba(239,68,68,0.2);  color: #f87171; }
.badge-blue  { background: rgba(6,182,212,0.2);  color: #67e8f9; }

/* ── MONTH SELECTOR ── */
.month-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.month-nav-btn {
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition);
  font-size: 16px;
}

.month-nav-btn:hover { background: var(--bg-card-hover); color: var(--text-primary); }

.month-label {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
  text-align: center;
}

/* Shimmer loading */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.shimmer {
  background: linear-gradient(90deg, var(--bg-card) 25%, rgba(255,255,255,0.07) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* ── TRANSACTION SLIDE-IN ANIMATION ── */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(22px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tx-item {
  opacity: 0;
  animation: slideInUp 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Each item gets a staggered delay via inline style set by JS */

/* ── LANGUAGE TOGGLE ── */
.lang-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.lang-switch {
  display: flex;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 3px;
  gap: 2px;
}

.lang-switch-lg {
  padding: 4px;
}

.lang-btn {
  padding: 5px 12px;
  border-radius: 100px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.3px;
}

.lang-btn.active {
  background: var(--accent-purple);
  color: #fff;
  box-shadow: 0 2px 8px rgba(139,92,246,0.4);
}

.lang-btn:not(.active):hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.08);
}

.lang-switch-lg .lang-btn {
  padding: 7px 18px;
  font-size: 13px;
}

/* ══════════════════════════════════════════
   AUTH OVERLAY — LOGIN / REGISTER
══════════════════════════════════════════ */

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(ellipse 80% 60% at 20% 30%, rgba(139,92,246,0.18) 0%, transparent 60%),
    radial-gradient(ellipse 70% 60% at 80% 70%, rgba(6,182,212,0.13) 0%, transparent 60%),
    #090b14;
  animation: authFadeIn 0.5s ease;
}

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

.auth-overlay.hidden {
  display: none;
}

.auth-card {
  background: rgba(20, 25, 38, 0.92);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 28px;
  padding: 40px 36px;
  width: 100%;
  max-width: 420px;
  backdrop-filter: blur(30px);
  box-shadow:
    0 32px 80px rgba(0,0,0,0.6),
    0 0 60px rgba(139,92,246,0.12),
    inset 0 1px 0 rgba(255,255,255,0.06);
  animation: authCardIn 0.5s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes authCardIn {
  from { transform: scale(0.88) translateY(30px); opacity: 0; }
  to   { transform: scale(1)    translateY(0);    opacity: 1; }
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
  justify-content: center;
}

.auth-logo-icon {
  width: 52px; height: 52px;
  border-radius: 16px;
  background: linear-gradient(135deg, #8b5cf6, #06b6d4);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  box-shadow: 0 8px 30px rgba(139,92,246,0.4);
  flex-shrink: 0;
}

.auth-logo-text { display: flex; flex-direction: column; }

.auth-logo-title {
  font-size: 20px;
  font-weight: 800;
  background: linear-gradient(135deg, #c4b5fd, #67e8f9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.auth-logo-sub {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
}

.auth-tabs {
  display: flex;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 28px;
  gap: 4px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 9px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
  color: var(--text-muted);
  background: transparent;
}

.auth-tab.active {
  background: linear-gradient(135deg, #8b5cf6, #06b6d4);
  color: white;
  box-shadow: 0 4px 20px rgba(139,92,246,0.35);
}

.auth-tab:not(.active):hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.06);
}

.auth-welcome { margin-bottom: 22px; }

.auth-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.auth-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

.auth-pw-wrap { position: relative; }
.auth-pw-wrap .form-input { padding-right: 46px; }

.auth-pw-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  opacity: 0.6;
  transition: opacity 0.2s;
  line-height: 1;
}

.auth-pw-toggle:hover { opacity: 1; }

.auth-error {
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.35);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  color: #fca5a5;
  margin-bottom: 14px;
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60%  { transform: translateX(-6px); }
  40%, 80%  { transform: translateX(6px); }
}

.auth-switch {
  text-align: center;
  margin-top: 18px;
  font-size: 13px;
  color: var(--text-muted);
}

.auth-switch span {
  color: #c4b5fd;
  cursor: pointer;
  font-weight: 600;
  transition: color 0.2s;
}

.auth-switch span:hover { color: #8b5cf6; text-decoration: underline; }

.auth-privacy {
  margin-top: 22px;
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  padding: 10px;
  background: rgba(139,92,246,0.07);
  border-radius: 8px;
  border: 1px solid rgba(139,92,246,0.15);
}

/* ── LOGOUT BUTTON ── */
.logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 12px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: #fca5a5;
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.25);
  transition: all var(--transition);
}

.logout-btn:hover {
  background: rgba(239,68,68,0.18);
  border-color: rgba(239,68,68,0.5);
  color: #ef4444;
  transform: translateY(-1px);
}

@media (max-width: 480px) {
  .auth-overlay {
    padding: 12px;
    align-items: center;
  }
  .auth-card {
    padding: 28px 20px 32px;
    border-radius: 20px;
    max-height: 96vh;
    overflow-y: auto;
  }
  .auth-title { font-size: 18px; }
  .auth-logo-icon { width: 44px; height: 44px; font-size: 20px; }
  .auth-logo-title { font-size: 17px; }
  .auth-tab { padding: 9px 6px; font-size: 12px; }
}

/* Safe area insets for modern phones (iPhone notch / Android edge) */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .auth-overlay {
    padding-bottom: env(safe-area-inset-bottom);
  }
  .mobile-bottom-nav {
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }
  .page {
    padding-bottom: calc(96px + env(safe-area-inset-bottom));
  }
}

/* Auth overlay landscape phones */
@media (max-width: 768px) and (orientation: landscape) {
  .auth-overlay { align-items: flex-start; padding: 8px 20px; }
  .auth-card {
    max-height: 96vh;
    overflow-y: auto;
    padding: 24px 28px;
    border-radius: 20px;
  }
  .auth-logo { margin-bottom: 16px; }
  .auth-tabs { margin-bottom: 16px; }
  .auth-welcome { margin-bottom: 14px; }
  .auth-title { font-size: 18px; }
  .auth-privacy { display: none; }
}
