:root {
  --primary: #4f46e5;
  --primary-light: rgba(79, 70, 229, 0.1);
  --primary-hover: #4338ca;
  --secondary: #f59e0b;
  --success: #10b981;
  --success-light: rgba(16, 185, 129, 0.1);
  --danger: #ef4444;
  --danger-light: rgba(239, 68, 68, 0.1);
  --warning: #f59e0b;
  --warning-light: rgba(245, 158, 11, 0.1);
  --info: #3b82f6;
  --info-light: rgba(59, 130, 246, 0.1);
  
  --bg-app: #f3f4f6;
  --bg-card: #ffffff;
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --border-color: #e5e7eb;
  
  --border-radius: 12px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.07), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
}

html, body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  overflow-x: hidden;
  width: 100%;
}

/* Custom Utilities */
.text-primary-custom { color: var(--primary); }
.bg-primary-custom { background-color: var(--primary); }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* Dashboard Wrapper & Main Layout */
.app-wrapper {
  display: flex;
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

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

/* Sidebar Component */
.sidebar {
  width: 260px;
  background: #111827;
  color: #f9fafb;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  flex-shrink: 0;
  overflow-y: auto; /* Enable vertical scrolling */
  -webkit-overflow-scrolling: touch; /* Smooth momentum scrolling on iOS */
}

/* Custom scrollbar for the sidebar */
.sidebar::-webkit-scrollbar {
  width: 6px;
}
.sidebar::-webkit-scrollbar-track {
  background: #111827;
}
.sidebar::-webkit-scrollbar-thumb {
  background: #374151;
  border-radius: 3px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
  background: #4b5563;
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid #1f2937;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.sidebar-logo {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #fff;
}

.sidebar-menu {
  list-style: none;
  padding: 1rem 0;
  margin: 0;
  flex: 1 0 auto;
}

.sidebar-footer {
  flex-shrink: 0;
}

.sidebar-item a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  color: #9ca3af;
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
  border-left: 3px solid transparent;
}

.sidebar-item a:hover,
.sidebar-item.active a {
  color: #fff;
  background: #1f2937;
  border-left-color: var(--primary);
}

.sidebar-item i {
  width: 20px;
  text-align: center;
}

.sidebar-item a .sidebar-icon-badge {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
  transition: var(--transition);
}

.sidebar-item a .sidebar-icon-badge i {
  width: auto;
  font-size: 0.9rem;
  line-height: 1;
}

.sidebar-item a:hover .sidebar-icon-badge,
.sidebar-item.active a .sidebar-icon-badge {
  transform: scale(1.05);
}

.sidebar-icon-home {
  background: linear-gradient(135deg, #38bdf8, #2563eb);
}

.sidebar-icon-meal {
  background: linear-gradient(135deg, #fb7185, #f97316);
}

.sidebar-icon-menu {
  background: linear-gradient(135deg, #22c55e, #16a34a);
}

.sidebar-icon-notify {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

.sidebar-icon-profile {
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
}

/* Header & Top Nav */
.navbar {
  background: var(--bg-card);
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.navbar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
}

.navbar-user img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary);
}

/* Stat Cards & KPI panels */
.stat-card {
  background: var(--bg-card);
  padding: 1.5rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 1.25rem;
  border-bottom: 4px solid var(--accent-color, var(--primary));
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: var(--icon-bg);
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
}

/* Cards & Tables */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.card-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 1.5rem;
  font-weight: 600;
}

.table th {
  background: #f9fafb;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
}

.meal-chip {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.meal-chip.breakfast { background: rgba(59, 130, 246, 0.1); color: #2563eb; }
.meal-chip.lunch { background: rgba(16, 185, 129, 0.1); color: #059669; }
.meal-chip.snacks { background: rgba(245, 158, 11, 0.1); color: #d97706; }
.meal-chip.dinner { background: rgba(139, 92, 246, 0.1); color: #7c3aed; }

/* Custom Buttons */
.btn-primary {
  background-color: var(--primary);
  border-color: var(--primary);
  border-radius: 8px;
  padding: 0.5rem 1.25rem;
  font-weight: 500;
}
.btn-primary:hover {
  background-color: var(--primary-hover);
  border-color: var(--primary-hover);
}

.bg-purple { background-color: #7e22ce !important; color: #fff !important; }
.bg-purple-light { background-color: rgba(126, 34, 206, 0.1) !important; color: #7e22ce !important; }

.btn-xs {
  padding: 2px 6px !important;
  font-size: 10px !important;
  line-height: 1.2 !important;
  border-radius: 4px !important;
}


