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

:root {
  --primary: #059669; /* Emerald 600 */
  --primary-light: #34d399; /* Emerald 400 */
  --primary-dark: #065f46; /* Emerald 800 */
  --bg-color: #f8fafc; /* Slate 50 */
  --surface: #ffffff;
  --text-main: #0f172a; /* Slate 900 */
  --text-muted: #64748b; /* Slate 500 */
  --border-color: #e2e8f0;
  
  --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);
  
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-full: 9999px;
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Header */
header {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

nav ul {
  list-style: none;
  display: flex;
  gap: 2rem;
}

nav a {
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 500;
  transition: color 0.3s ease;
}

nav a:hover, nav a.active {
  color: var(--primary);
}

/* Layout */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

section {
  display: none;
  animation: fadeIn 0.4s ease-out forwards;
}

section.active {
  display: block;
}

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

h1, h2, h3 {
  color: var(--text-main);
  margin-bottom: 1rem;
}

/* Hero Section */
.hero {
  text-align: center;
  padding: 4rem 1rem;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  border-radius: var(--radius-lg);
  color: white;
  margin-bottom: 3rem;
  box-shadow: var(--shadow-md);
}

.hero h1 {
  color: white;
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.hero p {
  font-size: 1.2rem;
  max-width: 600px;
  margin: 0 auto;
  opacity: 0.9;
}

/* Theory Section */
.theory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.theory-card {
  background: var(--surface);
  padding: 2rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

.theory-card h3 {
  color: var(--primary);
}

/* Planner Section */
.planner-container {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2rem;
}

.food-selection h2 {
  margin-bottom: 1.5rem;
}

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

.food-item {
  background: var(--surface);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.food-item:hover {
  border-color: var(--primary-light);
  background: #f0fdf4;
}

.food-item.selected {
  border-color: var(--primary);
  background: #ecfdf5;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.food-icon {
  font-size: 2rem;
}

.food-info h4 {
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.food-info span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.ig-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 0.5rem;
}

.ig-low { background: #dcfce7; color: #166534; }
.ig-medium { background: #fef08a; color: #854d0e; }
.ig-high { background: #fee2e2; color: #991b1b; }

.food-brands {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  font-style: italic;
  line-height: 1.2;
}

/* Plate Summary */
.plate-summary {
  background: var(--surface);
  padding: 2rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 100px;
}

.plate-summary h3 {
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 1rem;
  margin-bottom: 1rem;
}

#selected-foods-list {
  list-style: none;
  min-height: 100px;
  margin-bottom: 2rem;
}

#selected-foods-list li {
  display: flex;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-color);
}

.score-panel {
  text-align: center;
  padding: 1.5rem;
  background: var(--bg-color);
  border-radius: var(--radius-md);
}

.score-value {
  font-size: 3rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}

/* Examples Section */
.meals-container {
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

.meal-time h2 {
  color: var(--primary-dark);
  border-bottom: 2px solid var(--primary-light);
  display: inline-block;
  padding-bottom: 0.5rem;
  margin-bottom: 1.5rem;
}

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.recipe-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  transition: transform 0.3s;
}

.recipe-card:hover {
  transform: scale(1.02);
}

.recipe-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.recipe-time {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.recipe-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.tag {
  background: var(--bg-color);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  color: var(--primary-dark);
}

/* Recipe Details Accordion */
.recipe-details {
  background: var(--bg-color);
  border-radius: var(--radius-md);
  margin-top: 1rem;
  overflow: hidden;
}

.recipe-details summary {
  padding: 0.75rem 1rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--primary-dark);
  transition: background 0.2s;
  outline: none;
}

.recipe-details summary:hover {
  background: #f1f5f9;
}

.details-content {
  padding: 1rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.9rem;
}

.recipe-ingredients {
  list-style: none;
  margin-bottom: 1rem;
  padding-left: 0.5rem;
  color: var(--text-main);
}

.recipe-ingredients li {
  margin-bottom: 0.25rem;
}

.recipe-instructions {
  color: var(--text-muted);
  line-height: 1.5;
}

@media (max-width: 768px) {
  .planner-container {
    grid-template-columns: 1fr;
  }
  nav ul {
    gap: 1rem;
  }
}
