:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
}

/* Header */
header {
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.brand {
  font-weight: bold;
  font-size: 1.25rem;
  color: var(--primary);
  text-decoration: none;
}

/* Container Layout */
.container {
  max-w: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

/* Hero Template */
.hero {
  padding: 3rem;
  border-radius: 1rem;
  color: white;
  margin-bottom: 2rem;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}
.hero h1 {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

/* Split Layout for Calculator */
.calc-layout {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

@media (max-width: 768px) {
  .calc-layout {
    flex-direction: column;
  }
}

/* Menu List */
.menu-section {
  flex: 1;
  background: var(--bg-card);
  padding: 2rem;
  border-radius: 1rem;
  border: 1px solid var(--border);
}
.category-title {
  font-size: 1.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
  margin-top: 2rem;
}

.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
}

.menu-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: white;
  cursor: pointer;
  transition: all 0.2s;
}
.menu-item:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}
.item-title { font-weight: bold; margin-bottom: 4px; }
.item-cals { font-size: 0.875rem; color: var(--text-muted); }
.add-btn {
  background: var(--bg-main);
  border: none;
  color: var(--primary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-weight: bold;
  cursor: pointer;
}
.menu-item:hover .add-btn { background: var(--primary); color: white; }

/* Sticky Label */
.nutrition-sidebar {
  width: 400px;
  position: sticky;
  top: 100px;
}
@media (max-width: 768px) {
  .nutrition-sidebar {
    width: 100%;
    position: static;
  }
}

.nutrition-label {
  background: white;
  border: 1px solid #d1d5db;
  border-top: 8px solid black;
  padding: 1.5rem;
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}
.label-title {
  font-size: 2.5rem;
  font-weight: 900;
  border-bottom: 8px solid black;
  padding-bottom: 0.25rem;
  margin-bottom: 0.5rem;
}
.label-row {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid #d1d5db;
  padding: 0.5rem 0;
}
.label-row.thick {
  border-bottom: 4px solid black;
  margin-bottom: 0.5rem;
}

/* Meal List */
.meal-list {
  background: var(--bg-card);
  padding: 1rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  margin-top: 1.5rem;
}
.meal-item {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}
.meal-item:last-child { border-bottom: none; }
.clear-btn { color: red; cursor: pointer; font-size: 0.875rem; border: none; background: none; }
.remove-btn { color: #9ca3af; cursor: pointer; border: none; background: none; }
.remove-btn:hover { color: red; }

/* Homepage Grid */
.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}
.home-card {
  display: block;
  text-decoration: none;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  overflow: hidden;
  color: var(--text-main);
  transition: transform 0.2s, box-shadow 0.2s;
}
.home-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}
.home-card-color { height: 100px; }
.home-card-content { padding: 1.5rem; }
.home-card h3 { color: var(--text-main); margin-bottom: 0.5rem; }
.home-card:hover h3 { color: var(--primary); }
