/* ===== AI Recipe Generator - Shared Styles ===== */
:root {
  --primary: #e8590c;
  --primary-dark: #d9480f;
  --primary-light: #fff4e6;
  --accent: #2f9e44;
  --accent-light: #ebfbee;
  --bg: #fffbf7;
  --surface: #ffffff;
  --text: #2b2b2b;
  --text-light: #6b6b6b;
  --border: #f0e6dc;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.10);
  --shadow-lg: 0 16px 48px rgba(0,0,0,0.14);
  --radius: 16px;
  --radius-sm: 10px;
  --nav-h: 64px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-display: 'Playfair Display', Georgia, serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ===== Navigation ===== */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: var(--nav-h);
}
.nav-inner {
  max-width: 1280px; margin: 0 auto; padding: 0 20px;
  height: 100%; display: flex; align-items: center; gap: 8px;
}
.nav-logo {
  font-family: var(--font-display);
  font-size: 1.35rem; font-weight: 700;
  color: var(--primary);
  display: flex; align-items: center; gap: 8px;
  margin-right: auto;
}
.nav-logo .logo-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--primary); display: inline-block;
}
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a {
  color: var(--text); font-size: 0.92rem; font-weight: 500;
  padding: 8px 12px; border-radius: 8px; transition: all 0.2s;
}
.nav-links a:hover, .nav-links a.active {
  background: var(--primary-light); color: var(--primary);
}
.nav-actions { display: flex; align-items: center; gap: 8px; margin-left: 8px; }
.lang-toggle {
  background: var(--surface); border: 1px solid var(--border);
  padding: 6px 12px; border-radius: 20px; cursor: pointer;
  font-size: 0.85rem; font-weight: 600; color: var(--text);
  transition: all 0.2s;
}
.lang-toggle:hover { border-color: var(--primary); color: var(--primary); }
.fav-btn {
  position: relative;
  background: var(--primary-light); border: none;
  width: 40px; height: 40px; border-radius: 50%;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}
.fav-btn .count {
  position: absolute; top: -4px; right: -4px;
  background: var(--primary); color: #fff;
  font-size: 0.7rem; min-width: 18px; height: 18px;
  border-radius: 9px; display: flex; align-items: center; justify-content: center;
  padding: 0 5px; font-weight: 700;
}
.menu-toggle {
  display: none; background: none; border: none;
  font-size: 1.5rem; cursor: pointer; padding: 8px;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 24px; border-radius: 999px; border: none;
  font-size: 0.95rem; font-weight: 600; cursor: pointer;
  transition: all 0.2s; text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-md); color:#fff; }
.btn-outline { background: transparent; border: 1.5px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-ghost { background: var(--border); color: var(--text); }
.btn-sm { padding: 8px 16px; font-size: 0.85rem; }

/* ===== Hero ===== */
.hero {
  position: relative; padding: 80px 0 60px;
  background: linear-gradient(135deg, var(--primary-light) 0%, #ffe8cc 100%);
  overflow: hidden;
}
.hero::before {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(circle at 80% 20%, rgba(232,89,12,0.15) 0%, transparent 50%);
  pointer-events: none;
}
.hero-inner { position: relative; text-align: center; max-width: 720px; margin: 0 auto; padding: 0 20px; }
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.15; margin-bottom: 16px;
}
.hero h1 .highlight { color: var(--primary); }
.hero p { font-size: 1.1rem; color: var(--text-light); margin-bottom: 32px; }
.hero-input {
  background: var(--surface); border-radius: 999px;
  padding: 8px; display: flex; gap: 8px;
  box-shadow: var(--shadow-md);
  max-width: 560px; margin: 0 auto;
}
.hero-input input {
  flex: 1; border: none; outline: none; padding: 12px 20px;
  font-size: 1rem; border-radius: 999px; background: transparent;
}

/* ===== Section ===== */
.section { padding: 64px 0; }
.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  text-align: center; margin-bottom: 12px;
}
.section-subtitle { text-align: center; color: var(--text-light); max-width: 600px; margin: 0 auto 40px; }

/* ===== Card Grid ===== */
.grid {
  display: grid; gap: 24px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

/* ===== Card ===== */
.card {
  position: relative; border-radius: var(--radius);
  overflow: hidden; background: var(--surface);
  box-shadow: var(--shadow-sm); transition: all 0.3s;
  cursor: pointer; display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.card-img {
  position: relative; height: 180px; overflow: hidden;
  background-color: #ffe8cc;
  background-size: cover; background-position: center;
}
.card-img::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,0.5) 100%);
}
.card-badge {
  position: absolute; top: 12px; left: 12px; z-index: 2;
  background: var(--primary); color: #fff;
  font-size: 0.75rem; font-weight: 600;
  padding: 4px 10px; border-radius: 999px;
}
.card-body { padding: 16px; flex: 1; display: flex; flex-direction: column; }
.card-title {
  font-size: 1.05rem; font-weight: 700; margin-bottom: 6px;
  color: var(--text);
}
.card-desc { font-size: 0.88rem; color: var(--text-light); flex: 1; }
.card-meta {
  display: flex; gap: 12px; margin-top: 12px;
  font-size: 0.8rem; color: var(--text-light);
}
.card-meta span { display: flex; align-items: center; gap: 4px; }
.card-fav {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,0.9); border: none;
  cursor: pointer; font-size: 1rem; display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.card-fav.active { color: var(--primary); background: #fff; }
.card-fav:hover { transform: scale(1.1); }

/* ===== Page header ===== */
.page-header {
  padding: 48px 0 32px; text-align: center;
  background: linear-gradient(135deg, var(--primary-light), #ffe8cc);
}
.page-header h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.6rem); margin-bottom: 8px;
}
.page-header p { color: var(--text-light); max-width: 600px; margin: 0 auto; }

/* ===== Recipe detail ===== */
.detail-layout {
  display: grid; grid-template-columns: 1fr 360px; gap: 32px;
  padding: 40px 0;
}
.detail-img {
  border-radius: var(--radius); overflow: hidden;
  height: 400px; background-color: #ffe8cc; background-size: cover; background-position: center;
  margin-bottom: 24px;
}
.detail-info h1 {
  font-family: var(--font-display);
  font-size: 2rem; margin-bottom: 12px;
}
.detail-meta {
  display: flex; gap: 16px; flex-wrap: wrap;
  margin-bottom: 24px; color: var(--text-light); font-size: 0.9rem;
}
.detail-meta span { display: flex; align-items: center; gap: 6px; }
.detail-section { margin-bottom: 28px; }
.detail-section h2 {
  font-size: 1.25rem; margin-bottom: 14px;
  padding-bottom: 8px; border-bottom: 2px solid var(--border);
}
.ingredient-list { list-style: none; }
.ingredient-list li {
  padding: 10px 0; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between;
}
.step-list { counter-reset: step; list-style: none; }
.step-list li {
  counter-increment: step; padding: 14px 0 14px 48px;
  position: relative; border-bottom: 1px solid var(--border);
}
.step-list li::before {
  content: counter(step);
  position: absolute; left: 0; top: 14px;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9rem;
}
.nutrition-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
}
.nutrition-item {
  background: var(--primary-light); border-radius: var(--radius-sm);
  padding: 14px; text-align: center;
}
.nutrition-item .val { font-size: 1.3rem; font-weight: 700; color: var(--primary); }
.nutrition-item .label { font-size: 0.8rem; color: var(--text-light); }
.tag {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 0.75rem; font-weight: 500; margin: 2px;
  background: var(--accent-light); color: var(--accent);
}

/* ===== Sidebar ===== */
.sidebar {
  position: sticky; top: calc(var(--nav-h) + 20px);
  align-self: start;
}
.sidebar-card {
  background: var(--surface); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow-sm); margin-bottom: 20px;
}

/* ===== Chips / Filters ===== */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.chip {
  padding: 8px 16px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  cursor: pointer; font-size: 0.88rem; transition: all 0.2s;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== Form elements ===== */
.input, select, textarea {
  width: 100%; padding: 12px 16px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 0.95rem; font-family: inherit;
  background: var(--surface); color: var(--text);
  outline: none; transition: border 0.2s;
}
.input:focus, select:focus, textarea:focus { border-color: var(--primary); }
label { display: block; font-size: 0.88rem; font-weight: 600; margin-bottom: 6px; }

/* ===== Tool widget ===== */
.tool-widget {
  background: var(--surface); border-radius: var(--radius);
  padding: 28px; box-shadow: var(--shadow-sm);
  max-width: 720px; margin: 0 auto;
}
.tool-widget h2 { margin-bottom: 16px; font-size: 1.5rem; }
.tool-output {
  margin-top: 20px; padding: 20px;
  background: var(--primary-light); border-radius: var(--radius-sm);
  min-height: 60px;
}

/* ===== Footer ===== */
.footer {
  background: #2b2b2b; color: #ccc; padding: 48px 0 24px;
  margin-top: 64px;
}
.footer-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 32px; margin-bottom: 32px;
}
.footer h4 { color: #fff; margin-bottom: 14px; font-size: 1rem; }
.footer a { color: #aaa; display: block; padding: 4px 0; font-size: 0.9rem; }
.footer a:hover { color: #fff; }
.footer-bottom {
  text-align: center; padding-top: 24px;
  border-top: 1px solid #444; font-size: 0.85rem; color: #888;
}

/* ===== Article ===== */
.article { max-width: 760px; margin: 0 auto; padding: 40px 20px; }
.article h1 { font-family: var(--font-display); font-size: 2rem; margin-bottom: 16px; }
.article-meta { color: var(--text-light); font-size: 0.9rem; margin-bottom: 24px; }
.article-content p { margin-bottom: 16px; line-height: 1.8; }
.article-content h2 { font-size: 1.4rem; margin: 28px 0 12px; }
.article-content ul, .article-content ol { margin: 12px 0 12px 24px; }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  z-index: 200; display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--surface); border-radius: var(--radius);
  max-width: 800px; width: 100%; max-height: 90vh; overflow-y: auto;
  padding: 28px; position: relative;
}
.modal-close {
  position: absolute; top: 16px; right: 16px;
  background: none; border: none; font-size: 1.5rem; cursor: pointer;
}

/* ===== Empty state ===== */
.empty { text-align: center; padding: 60px 20px; color: var(--text-light); }
.empty .emoji { font-size: 3rem; margin-bottom: 16px; }

/* ===== Utilities ===== */
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.flex { display: flex; } .flex-wrap { flex-wrap: wrap; } .gap-2 { gap: 12px; }
.items-center { align-items: center; } .justify-between { justify-content: space-between; }
.hidden { display: none !important; }

/* ===== Responsive ===== */
@media (max-width: 1100px) {
  .nav-logo { font-size: 1.1rem; }
  .nav-links a { padding: 8px 8px; font-size: 0.88rem; }
}
@media (max-width: 900px) {
  .detail-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
}
@media (max-width: 768px) {
  .menu-toggle { display: block; }
  .nav-links {
    display: none; position: absolute; top: var(--nav-h); left: 0; right: 0;
    background: #fff; flex-direction: column; padding: 16px;
    border-bottom: 1px solid var(--border); box-shadow: var(--shadow-md);
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px; width: 100%; }
  .hero { padding: 48px 0 40px; }
  .section { padding: 40px 0; }
  .detail-img { height: 240px; }
}
@media (max-width: 480px) {
  .hero-input { flex-direction: column; border-radius: var(--radius); }
  .hero-input .btn { width: 100%; }
  .nutrition-grid { grid-template-columns: 1fr 1fr; }
}
