/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green-50: #f0fdf4;
  --green-100: #dcfce7;
  --green-200: #bbf7d0;
  --green-400: #4ade80;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --green-700: #15803d;
  --green-800: #166534;
  --green-900: #14532d;

  --orange-400: #fb923c;
  --orange-500: #f97316;

  --red-400: #f87171;
  --red-500: #ef4444;

  --blue-400: #60a5fa;
  --blue-500: #3b82f6;

  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
  --shadow-xl: 0 20px 25px rgba(0,0,0,0.1), 0 10px 10px rgba(0,0,0,0.04);

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --radius-xl: 20px;

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--green-600); text-decoration: none; }
a:hover { color: var(--green-700); }

/* ===== Navbar ===== */
.navbar {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
  background: rgba(255,255,255,0.95);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--green-700);
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-links { display: flex; gap: 8px; }

.nav-link {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  color: var(--gray-600);
  font-weight: 500;
  font-size: 0.9rem;
  transition: var(--transition);
}

.nav-link:hover,
.nav-link.active {
  background: var(--green-50);
  color: var(--green-700);
}

.nav-toggle { display: none; background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--gray-600); }

/* ===== Main Content ===== */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
  min-height: calc(100vh - 140px);
}

.page { display: none; }
.page.active { display: block; animation: fadeIn 0.3s ease; }

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

/* ===== Hero Section ===== */
.hero {
  position: relative;
  border-radius: var(--radius-xl);
  overflow: hidden;
  margin-bottom: 32px;
  min-height: 340px;
  display: flex;
  align-items: center;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--green-800) 0%, var(--green-700) 30%, var(--green-600) 70%, var(--green-500) 100%);
  z-index: 0;
}

.hero-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.hero-content {
  position: relative;
  z-index: 1;
  padding: 48px 56px;
  color: white;
  max-width: 700px;
}

.hero-badge {
  display: inline-block;
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(4px);
  padding: 4px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 16px;
  letter-spacing: 0.5px;
}

.hero-content h1 {
  font-size: 2.2rem;
  font-weight: 700;
  margin-bottom: 12px;
  line-height: 1.3;
}

.hero-desc {
  font-size: 1rem;
  opacity: 0.9;
  margin-bottom: 16px;
  line-height: 1.7;
}

.hero-meta {
  display: flex;
  gap: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.hero-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  opacity: 0.9;
  background: rgba(255,255,255,0.1);
  padding: 4px 12px;
  border-radius: 6px;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.btn-primary {
  background: white;
  color: var(--green-700);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: rgba(255,255,255,0.15);
  color: white;
  border: 1px solid rgba(255,255,255,0.3);
}
.btn-secondary:hover {
  background: rgba(255,255,255,0.25);
}

/* ===== Stats ===== */
.stats-section { margin-bottom: 40px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

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

.stat-icon { font-size: 1.5rem; display: block; margin-bottom: 8px; }
.stat-number { font-size: 1.6rem; font-weight: 700; color: var(--green-700); display: block; }
.stat-label { font-size: 0.8rem; color: var(--gray-500); margin-top: 4px; }

/* ===== Section ===== */
.section { margin-bottom: 48px; }

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}

.section-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--gray-800);
}

/* ===== Filter Bar ===== */
.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 6px 16px;
  border-radius: 20px;
  border: 1px solid var(--gray-200);
  background: white;
  color: var(--gray-600);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.filter-btn:hover {
  border-color: var(--green-400);
  color: var(--green-600);
}

.filter-btn.active {
  background: var(--green-500);
  border-color: var(--green-500);
  color: white;
}

/* ===== Recipe Grid ===== */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.recipe-card {
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: var(--transition);
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

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

.recipe-card-header {
  background: linear-gradient(135deg, var(--green-500), var(--green-600));
  padding: 24px 20px 20px;
  color: white;
  position: relative;
}

.recipe-card-header .recipe-emoji {
  font-size: 2rem;
  margin-bottom: 8px;
  display: block;
}

.recipe-card-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.recipe-card-header .recipe-category {
  font-size: 0.75rem;
  opacity: 0.8;
  background: rgba(255,255,255,0.2);
  padding: 2px 10px;
  border-radius: 10px;
  display: inline-block;
}

.recipe-card-body {
  padding: 16px 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.recipe-card-body p {
  font-size: 0.85rem;
  color: var(--gray-600);
  line-height: 1.6;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.recipe-nutrition {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--gray-100);
}

.nutrition-item {
  text-align: center;
}

.nutrition-item .num {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gray-800);
}

.nutrition-item .label {
  font-size: 0.7rem;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.nutrition-item.highlight .num { color: var(--green-600); }

/* ===== Loading ===== */
.loading {
  text-align: center;
  padding: 48px;
  color: var(--gray-400);
  font-size: 0.95rem;
  grid-column: 1 / -1;
}

/* ===== Modal ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  backdrop-filter: blur(4px);
  padding: 24px;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.open { display: flex; }

.modal-content {
  background: white;
  border-radius: var(--radius-xl);
  max-width: 700px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-xl);
  animation: slideUp 0.3s ease;
}

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

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--gray-100);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-500);
  transition: var(--transition);
  z-index: 10;
}

.modal-close:hover {
  background: var(--gray-200);
  color: var(--gray-700);
}

.modal-body { padding: 32px; }

/* ===== Detail View ===== */
.detail-header {
  margin-bottom: 24px;
}

.detail-header .detail-emoji {
  font-size: 2.5rem;
  margin-bottom: 12px;
  display: block;
}

.detail-header h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--gray-800);
}

.detail-header .detail-category {
  display: inline-block;
  background: var(--green-50);
  color: var(--green-700);
  padding: 2px 12px;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 500;
}

.detail-header p {
  color: var(--gray-600);
  line-height: 1.7;
  margin-top: 12px;
}

.detail-nutrition {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

.detail-nutrition .nut-item {
  background: var(--green-50);
  padding: 16px;
  border-radius: var(--radius-sm);
  text-align: center;
}

.detail-nutrition .nut-item .num {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--green-700);
  display: block;
}

.detail-nutrition .nut-item .label {
  font-size: 0.75rem;
  color: var(--gray-500);
  margin-top: 4px;
  display: block;
}

.detail-section {
  margin-bottom: 24px;
}

.detail-section h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--gray-700);
  display: flex;
  align-items: center;
  gap: 8px;
}

.ingredient-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.ingredient-list li {
  background: var(--gray-50);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--gray-600);
  border-left: 3px solid var(--green-400);
}

.step-list {
  list-style: none;
  counter-reset: step;
}

.step-list li {
  counter-increment: step;
  padding: 10px 12px 10px 40px;
  position: relative;
  font-size: 0.88rem;
  color: var(--gray-600);
  border-bottom: 1px solid var(--gray-100);
  line-height: 1.6;
}

.step-list li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 10px;
  width: 26px;
  height: 26px;
  background: var(--green-500);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.step-list li:last-child { border-bottom: none; }

/* ===== About Page ===== */
.about-section { max-width: 720px; margin: 0 auto; }
.about-section h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 24px;
  text-align: center;
  color: var(--gray-800);
}

.about-card {
  background: white;
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.about-card h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--green-700);
  margin-bottom: 10px;
}

.about-card p { color: var(--gray-600); font-size: 0.9rem; line-height: 1.7; }
.about-card ul { list-style: none; }
.about-card ul li {
  padding: 6px 0;
  color: var(--gray-600);
  font-size: 0.9rem;
  border-bottom: 1px solid var(--gray-50);
}
.about-card ul li:last-child { border-bottom: none; }

/* ===== Footer ===== */
.footer {
  background: white;
  border-top: 1px solid var(--gray-200);
  padding: 24px;
  text-align: center;
}

.footer-content p { color: var(--gray-500); font-size: 0.9rem; }
.footer-small { font-size: 0.8rem; margin-top: 4px; color: var(--gray-400); }
.footer-beian { margin-top: 12px; font-size: 0.8rem; }
.footer-beian a { color: var(--gray-400); text-decoration: none; transition: var(--transition); }
.footer-beian a:hover { color: var(--green-500); }
.footer-beian .sep { color: var(--gray-300); margin: 0 8px; }
.footer-beian .beian img { width: 16px; height: 16px; vertical-align: middle; margin-right: 2px; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-toggle { display: block; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: white;
    padding: 16px;
    border-bottom: 1px solid var(--gray-200);
    box-shadow: var(--shadow-md);
  }

  .hero-content { padding: 32px 24px; }
  .hero-content h1 { font-size: 1.5rem; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  .recipe-grid { grid-template-columns: 1fr; }

  .detail-nutrition { grid-template-columns: repeat(2, 1fr); }
  .ingredient-list { grid-template-columns: 1fr; }

  .modal-content { max-height: 90vh; }
  .modal-body { padding: 24px; }
}

@media (max-width: 480px) {
  .hero-content h1 { font-size: 1.3rem; }
  .hero-meta { gap: 10px; }
  .hero-meta-item { font-size: 0.8rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .section-header { flex-direction: column; }
}
