/* Dapur.org — Indonesian Recipe Platform */
:root {
  --primary: #e74c3c;
  --primary-dark: #c0392b;
  --accent: #f39c12;
  --bg: #fafafa;
  --bg-card: #ffffff;
  --text: #2c3e50;
  --text-light: #7f8c8d;
  --border: #ecf0f1;
  --radius: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --max-width: 1200px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none !important; }
a:hover { color: var(--primary-dark); text-decoration: none !important; }

img { max-width: 100%; height: auto; }

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 20px; }

/* ========= NAV ========= */
.site-header {
  background: white;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  position: relative;
}
.nav-links { margin-left: auto; }
.nav-toggle { margin-left: auto; }
.logo { display: flex; align-items: center; gap: 8px; font-size: 1.4em; font-weight: 700; color: var(--primary) !important; text-decoration: none !important; }
.logo:hover { color: var(--primary) !important; text-decoration: none !important; }
.logo-icon { font-size: 1.2em; }
.nav-search {
  flex: 0 1 400px;
  display: flex;
}
.nav-search .search-wrapper { flex: 1; display: flex; }
.nav-search input {
  flex: 1;
  padding: 8px 14px;
  border: 2px solid var(--border);
  border-right: none;
  border-left: none;
  border-radius: 0;
  font-size: 0.95em;
  outline: none;
  min-width: 0;
}
.nav-search input:focus { border-color: #999; }
.nav-search button {
  padding: 8px 14px;
  background: white;
  color: #999;
  border: 2px solid var(--border);
  border-left: none;
  border-radius: 0 var(--radius) var(--radius) 0;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 0.9em;
}
.nav-search button:hover { color: var(--text); }
.search-attach { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 2px solid var(--border); border-right: none; border-radius: var(--radius) 0 0 var(--radius); cursor: pointer; flex-shrink: 0; transition: opacity 0.15s; opacity: 0.5; }
.search-attach:hover { opacity: 1; }
.search-attach svg { pointer-events: none; }
.nav-links { display: flex; gap: 4px; align-items: center; margin-left: auto; }
.nav-link { color: var(--text); font-weight: 500; padding: 8px 12px; border-radius: 8px; font-size: 0.9em; white-space: nowrap; }
.nav-link:hover { color: var(--primary); }
.nav-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); }
.nav-avatar-ph { width: 28px; height: 28px; border-radius: 50%; background: var(--border); display: inline-flex; align-items: center; justify-content: center; font-size: 0.75em; }
.nav-btn-login { padding: 8px 18px; background: var(--primary); color: white !important; border-radius: 8px; font-weight: 600; font-size: 0.9em; }
.nav-btn-login:hover { background: var(--primary-dark); color: white !important; }
/* User dropdown */
.nav-dropdown { position: relative; padding-bottom: 8px; margin-bottom: -8px; }
.nav-user-btn { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 8px; background: none; border: none; cursor: pointer; font-size: 0.9em; font-weight: 500; color: var(--text); }
.nav-user-btn:hover { color: var(--primary); }
.nav-dropdown-menu { display: none; position: absolute; top: 100%; right: 0; min-width: 200px; background: white; border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,0.12); padding: 6px; z-index: 999; border: 1px solid var(--border); }
.nav-dropdown.open .nav-dropdown-menu, .nav-dropdown:hover .nav-dropdown-menu { display: block; }
.nav-dropdown-menu a { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 8px; color: var(--text) !important; font-size: 0.9em; font-weight: 500; cursor: pointer; }
.nav-dropdown-menu a:hover { background: #f5f5f5; color: var(--primary) !important; }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 8px; }
.nav-btn-login:hover { background: var(--primary-dark); color: white !important; }
/* Voice mic inside search input */
.voice-btn-inside { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; padding: 4px; border-radius: 50%; opacity: 0.3; transition: opacity 0.2s; z-index: 2; line-height: 0; }
.voice-btn-inside:hover { opacity: 0.6; }
.voice-btn-inside.listening { opacity: 0.6; }

/* Autocomplete */
.search-wrapper { position: relative; flex: 1; }
.hero-search-wrap { flex: 1; }
.search-suggest { display: none; position: absolute; top: 100%; left: 0; right: 0; background: white; border-radius: 0 0 12px 12px; box-shadow: 0 8px 24px rgba(0,0,0,0.15); z-index: 500; max-height: 400px; overflow-y: auto; border: 1px solid var(--border); border-top: none; }
.suggest-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; color: var(--text); transition: background 0.1s; }
.suggest-item:hover, .suggest-item.active { background: var(--bg); }
.suggest-img { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; flex-shrink: 0; }
.suggest-info { flex: 1; min-width: 0; }
.suggest-title { font-size: 0.85em; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggest-title strong { color: var(--primary); }
.suggest-meta { font-size: 0.75em; color: var(--text-light); }
.suggest-empty { padding: 12px; text-align: center; color: var(--text-light); font-size: 0.85em; }

.nav-toggle { display: none; background: none; border: none; font-size: 1.4em; cursor: pointer; }

/* ========= HERO ========= */
.hero {
  text-align: center;
  padding: 48px 20px;
  background: linear-gradient(135deg, var(--primary), #e67e22);
  color: white;
  border-radius: var(--radius);
  margin: 24px 0;
}
.hero h1 { font-size: 2.2em; margin-bottom: 8px; }
.hero p { font-size: 1.1em; opacity: 0.9; margin-bottom: 24px; }
.hero-search {
  display: flex;
  max-width: 500px;
  margin: 0 auto;
  position: relative;
}
.hero-search .search-suggest { border-radius: 0 0 12px 12px; }
.hero-search input {
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: var(--radius) 0 0 var(--radius);
  font-size: 1.05em;
  outline: none;
  color: var(--text);
}
.hero-search button {
  padding: 14px 24px;
  background: var(--text);
  color: white;
  border: none;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-weight: 600;
  cursor: pointer;
}
.hero-search button:hover { background: #1a252f; }

/* Hero random */
.hero-random { cursor: pointer; margin: 16px auto 0; text-align: center; transition: transform 0.2s; }
.hero-random:hover { transform: scale(1.05); }
.hero-random-icon { font-size: 3.5em; line-height: 1; }
.hero-random-text { color: rgba(255,255,255,0.85); font-size: 0.95em; margin-top: 4px; }
.hero-random-result { margin-top: 12px; }
.random-card { display: flex; align-items: center; gap: 12px; background: rgba(255,255,255,0.15); backdrop-filter: blur(8px); border-radius: 12px; padding: 8px; max-width: 400px; margin: 0 auto; color: white; }
.random-card:hover { background: rgba(255,255,255,0.25); color: white; }
.random-card img { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; }
.random-card h3 { font-size: 1em; margin: 0; }
.random-card span { font-size: 0.8em; opacity: 0.8; }
@keyframes spinPlate { 0% { transform: rotate(0deg) scale(1); } 50% { transform: rotate(180deg) scale(1.2); } 100% { transform: rotate(360deg) scale(1); } }

/* ========= SECTIONS ========= */
.section { margin: 32px 0; }
.section h2 { font-size: 1.5em; margin-bottom: 16px; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.see-all { color: var(--primary); font-weight: 500; }

/* ========= RECIPE GRID ========= */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.recipe-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}
.recipe-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.12); }
.recipe-card a { color: inherit; text-decoration: none; display: block; }
.recipe-card-img { position: relative; padding-top: 66%; overflow: hidden; background: var(--border); }
.recipe-card-img img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; }
.recipe-card-body { padding: 16px; }
.recipe-card-body h3 { font-size: 1.1em; margin-bottom: 4px; line-height: 1.3; }
.recipe-card-desc { color: var(--text-light); font-size: 0.9em; margin-bottom: 8px; }
.recipe-card-meta { display: flex; gap: 12px; font-size: 0.85em; color: var(--text-light); }

/* ========= CATEGORY GRID ========= */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.category-grid.large { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.category-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 20px 12px;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--text);
  transition: transform 0.2s;
}
.category-card:hover { transform: translateY(-2px); text-decoration: none; }
.category-icon { font-size: 2em; }
.category-name { font-weight: 600; font-size: 0.95em; text-align: center; }
.category-name-en { font-size: 0.8em; color: var(--text-light); }
.category-count { font-size: 0.8em; color: var(--text-light); }

/* ========= RECIPE DETAIL ========= */
.recipe-detail { max-width: 800px; margin: 24px auto; }
.recipe-header { margin-bottom: 20px; }
.recipe-header h1 { font-size: 2em; line-height: 1.2; }
.recipe-desc { color: var(--text-light); font-size: 1.05em; margin: 8px 0; }
.recipe-meta { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px; font-size: 0.95em; color: var(--text-light); }
.recipe-image { margin: 20px 0; border-radius: var(--radius); overflow: hidden; }
.recipe-image img { width: 100%; border-radius: var(--radius); }
.image-credit { display: block; text-align: right; color: var(--text-light); margin-top: 4px; }

.recipe-content { display: grid; grid-template-columns: 1fr 2fr; gap: 32px; margin: 24px 0; }
.recipe-ingredients { background: var(--bg-card); padding: 20px; border-radius: var(--radius); box-shadow: var(--shadow); }
.ing-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.ing-header h2 { font-size: 1.2em; color: var(--primary); margin: 0; }
.portion-control { display: flex; align-items: center; gap: 4px; background: var(--bg); border-radius: 8px; padding: 2px; }
.portion-btn { width: 32px; height: 32px; border: none; background: white; border-radius: 6px; font-size: 1.2em; font-weight: 700; cursor: pointer; color: var(--primary); transition: background 0.15s; }
.portion-btn:hover { background: var(--primary); color: white; }
.portion-display { padding: 0 8px; font-size: 0.9em; font-weight: 600; white-space: nowrap; }
.unit-toggle { display: flex; gap: 2px; background: var(--bg); border-radius: 8px; padding: 2px; margin-bottom: 12px; }
.unit-btn { flex: 1; padding: 6px 12px; border: none; background: none; border-radius: 6px; font-size: 0.8em; font-weight: 600; cursor: pointer; color: var(--text-light); transition: all 0.15s; }
.unit-btn.active { background: var(--primary); color: white; }
.recipe-ingredients ul { list-style: none; }
.recipe-ingredients li { padding: 6px 0; border-bottom: 1px solid var(--border); }
.recipe-ingredients li:last-child { border-bottom: none; }

.recipe-steps h2 { font-size: 1.2em; margin-bottom: 12px; color: var(--primary); }
.recipe-steps ol { padding-left: 24px; }
.recipe-steps li { margin-bottom: 16px; line-height: 1.7; }
.step-tip { background: #fff8e1; padding: 8px 12px; border-radius: 6px; font-size: 0.9em; margin-top: 6px; }

/* ========= NUTRITION SECTION — Enhanced ========= */
.recipe-nutrition { margin: 24px 0; background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.recipe-nutrition h2 { margin-bottom: 16px; }

/* Donut chart */
.nutrition-chart-wrapper { display: flex; align-items: center; gap: 24px; margin-bottom: 20px; flex-wrap: wrap; }
.nutrition-donut { width: 140px; height: 140px; border-radius: 50%; position: relative; flex-shrink: 0; }
.donut-center { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 90px; height: 90px; background: var(--bg-card); border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut-cal { font-size: 1.5em; font-weight: 800; color: var(--text); line-height: 1; }
.donut-label { font-size: 0.75em; color: var(--text-light); }

.nutrition-legend { display: flex; flex-direction: column; gap: 8px; }
.legend-item { display: flex; align-items: center; gap: 8px; }
.legend-dot { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.legend-text { font-weight: 500; min-width: 80px; }
.legend-val { font-weight: 700; }
.legend-pct { color: var(--text-light); font-size: 0.9em; }

/* Nutrition table rows */
.nutrition-sections { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.nutrition-sections h3 { font-size: 0.95em; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; border-bottom: 2px solid var(--border); padding-bottom: 4px; }
.nutrition-table { display: flex; flex-direction: column; }
.nut-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 0.9em; }
.nut-row:last-child { border-bottom: none; }
.nut-name { flex: 1; }
.nut-val { font-weight: 600; min-width: 60px; text-align: right; margin-right: 8px; }
.nut-dv { color: var(--text-light); font-size: 0.85em; min-width: 65px; text-align: right; }
.nutrition-disclaimer { font-size: 0.78em; color: var(--text-light); margin-top: 12px; font-style: italic; }

/* Legacy grid still used if needed */
.nutrition-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 12px 0; }
.nutrition-item { text-align: center; background: var(--bg-card); padding: 16px; border-radius: var(--radius); box-shadow: var(--shadow); }
.nutrition-value { font-size: 1.4em; font-weight: 700; color: var(--primary); display: block; }
.nutrition-label { font-size: 0.85em; color: var(--text-light); }

/* ========= COST SECTION ========= */
.recipe-cost { margin: 24px 0; background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.recipe-cost h2 { margin-bottom: 16px; }
.cost-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-bottom: 16px; }
.cost-total { display: flex; flex-direction: column; }
.cost-total .cost-label { font-size: 0.85em; color: var(--text-light); }
.cost-total .cost-amount { font-size: 1.8em; font-weight: 800; color: var(--primary); line-height: 1.1; }
.cost-per-serving { display: flex; flex-direction: column; }
.cost-per-serving .cost-label { font-size: 0.85em; color: var(--text-light); }
.cost-per-serving .cost-amount-sm { font-size: 1.2em; font-weight: 600; color: var(--text); }
.cost-savings { background: #ecfdf5; border: 1px solid #a7f3d0; border-radius: 8px; padding: 8px 14px; }
.cost-savings-text { color: #065f46; font-size: 0.9em; }

.cost-breakdown { margin-top: 8px; }
.cost-breakdown summary { cursor: pointer; font-weight: 500; color: var(--primary); padding: 8px 0; }
.cost-breakdown summary:hover { color: var(--primary-dark); }
.cost-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 0.88em; }
.cost-table th { background: var(--bg); padding: 8px 10px; text-align: left; font-weight: 600; border-bottom: 2px solid var(--border); }
.cost-table td { padding: 6px 10px; border-bottom: 1px solid var(--border); }
.cost-table tr.cost-unmatched td { color: var(--text-light); font-style: italic; }
.cost-disclaimer { font-size: 0.78em; color: var(--text-light); margin-top: 10px; font-style: italic; }

.recipe-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.tag { background: var(--border); padding: 4px 12px; border-radius: 20px; font-size: 0.85em; color: var(--text); }
.tag:hover { background: var(--primary); color: white; text-decoration: none; }
/* Recipe action buttons */
.recipe-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.action-btn { display: inline-flex; align-items: center; gap: 4px; padding: 8px 16px; background: var(--bg-card); border: 1.5px solid var(--border); border-radius: 8px; cursor: pointer; font-size: 0.85em; font-weight: 500; color: var(--text); transition: all 0.15s; text-decoration: none !important; }
.action-btn:hover { border-color: var(--primary); background: #fef0ef; color: var(--primary); }
.action-btn.active { border-color: var(--primary); background: #fef0ef; color: var(--primary); }

/* Share bar */
.share-bar { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.share-label { font-size: 0.85em; color: var(--text-light); font-weight: 500; }
.share-btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; width: 38px; height: 38px; border-radius: 50%; border: none; cursor: pointer; transition: transform 0.15s, opacity 0.15s; color: white; }
.share-btn:hover { transform: scale(1.1); opacity: 0.9; color: white; }
.share-btn.whatsapp { background: #25D366; }
.share-btn.facebook { background: #1877F2; }
.share-btn.twitter { background: #000; }
.share-btn.telegram { background: #0088cc; }
.share-btn.tiktok { background: #000; }
.share-btn.pinterest { background: #E60023; }
.share-btn.copy-link { background: var(--text-light); width: auto; border-radius: 20px; padding: 0 14px; font-size: 0.8em; gap: 5px; font-family: inherit; }

/* Add/Edit recipe form */
.add-recipe-page { max-width: 700px; margin: 24px auto; }
.add-recipe-page h1 { margin-bottom: 4px; }
.add-recipe-page > p { color: var(--text-light); margin-bottom: 24px; }
.recipe-form { background: var(--bg-card); padding: 24px; border-radius: var(--radius); box-shadow: var(--shadow); }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-weight: 600; font-size: 0.9em; margin-bottom: 6px; }
.form-group input[type="text"],
.form-group input[type="number"],
.form-group textarea,
.form-group select { width: 100%; padding: 10px 12px; border: 2px solid var(--border); border-radius: 8px; font-size: 0.9em; font-family: inherit; }
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { border-color: var(--primary); outline: none; }
.form-group input[type="file"] { font-size: 0.85em; }
.form-hint { font-size: 0.8em; color: var(--text-light); margin-bottom: 4px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.form-categories { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; }

.recipe-source { margin-top: 16px; color: var(--text-light); }

/* Diet banner */
.diet-banner { background: linear-gradient(135deg, #e8f5e9, #f1f8e9); border: 2px solid #66bb6a; border-radius: var(--radius); padding: 14px 18px; margin-bottom: 20px; max-width: 800px; }
.diet-banner-title { font-weight: 700; font-size: 0.95em; color: #2e7d32; margin-bottom: 6px; }
.diet-banner-changes { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.diet-change { font-size: 0.8em; background: white; padding: 3px 10px; border-radius: 6px; border: 1px solid #c8e6c9; }
.diet-change s { color: #999; }
.diet-change strong { color: #2e7d32; }
.diet-banner-link { font-size: 0.8em; color: #2e7d32; }
li.substituted { background: #f1f8e9; border-radius: 6px; padding: 4px 8px; margin: 2px 0; }
.sub-badge { font-size: 0.7em; background: #e8f5e9; color: #2e7d32; padding: 2px 6px; border-radius: 4px; margin-left: 4px; }

/* ========= BAHAN PANEL (integrated in search page) ========= */
.bahan-panel { margin: 16px 0 0; }
.bahan-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.bahan-selected { display: flex; align-items: center; gap: 6px; flex: 1; flex-wrap: wrap; }
.bahan-selected-label { font-size: 0.85em; color: var(--text-light); white-space: nowrap; }
.bahan-chips-inline { display: flex; flex-wrap: wrap; gap: 4px; }
.bahan-input-inline { flex: 1; min-width: 120px; padding: 6px 10px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 0.85em; outline: none; }
.bahan-input-inline:focus { border-color: var(--text-light); }
.bahan-photo-label { cursor: pointer; font-size: 1.2em; padding: 2px 6px; flex-shrink: 0; opacity: 0.6; transition: opacity 0.15s; }
.bahan-photo-label:hover { opacity: 1; }
.bahan-go-btn { padding: 6px 14px; background: var(--primary); color: white; border: none; border-radius: 8px; font-size: 0.85em; cursor: pointer; white-space: nowrap; }
.bahan-scanning { font-size: 0.85em; color: var(--text-light); }
.bahan-categories { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.bahan-cat-box { border: 1px solid var(--border); border-radius: 10px; padding: 10px; }
.bahan-cat-box h4 { font-size: 0.8em; color: var(--text-light); margin-bottom: 6px; padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.bahan-cat-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.bc-chip { padding: 3px 8px; border: 1px solid var(--border); border-radius: 6px; background: white; cursor: pointer; font-size: 0.75em; transition: all 0.1s; }
.bc-chip:hover { border-color: var(--primary); }
.bc-chip.active { border-color: var(--primary); color: var(--primary); font-weight: 600; }
@media (max-width: 768px) { .bahan-categories { grid-template-columns: 1fr 1fr; } }

/* ========= BROWSE ========= */
.browse-header { margin: 16px 0; }
.browse-header h1 { margin-bottom: 12px; }
.browse-filters { display: flex; gap: 12px; flex-wrap: wrap; }
.browse-filters input, .browse-filters select {
  padding: 8px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95em;
  outline: none;
}
.browse-filters input { flex: 1; min-width: 200px; }
.browse-filters button {
  padding: 8px 24px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
}

/* ========= PAGINATION ========= */
.pagination { display: flex; justify-content: center; align-items: center; gap: 16px; margin: 32px 0; }
.pagination a {
  padding: 8px 20px;
  background: var(--primary);
  color: white;
  border-radius: var(--radius);
}
.pagination a:hover { background: var(--primary-dark); text-decoration: none; }

/* ========= DONATE ========= */
.donate-page { max-width: 700px; margin: 32px auto; }
.donate-page h1 { font-size: 2em; margin-bottom: 12px; }
.donate-page p { margin-bottom: 16px; line-height: 1.7; }
.donate-amounts { margin: 32px 0; }
.donate-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin: 16px 0; }
.donate-btn {
  padding: 16px;
  font-size: 1.3em;
  font-weight: 700;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
}
.donate-btn:hover, .donate-btn.active { border-color: var(--primary); background: var(--primary); color: white; }
.donate-custom { margin: 16px 0; }
.donate-custom input {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 1.1em;
  margin-top: 4px;
}
.donate-note { font-size: 0.85em; color: var(--text-light); margin-top: 8px; }
.impact-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 16px 0; }
.impact-item { text-align: center; padding: 20px; background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow); }
.impact-icon { font-size: 2em; display: block; margin-bottom: 8px; }

.donate-banner {
  text-align: center;
  padding: 40px 20px;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin: 40px 0;
}
.donate-banner h2 { margin-bottom: 8px; }
.donate-banner p { color: var(--text-light); margin-bottom: 16px; }

/* ========= BUTTONS ========= */
.btn {
  display: inline-block;
  padding: 10px 24px;
  border-radius: var(--radius);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); text-decoration: none; }
.btn-large { padding: 14px 32px; font-size: 1.1em; width: 100%; }

/* ========= FOOTER ========= */
.site-footer {
  background: #2c3e50;
  color: #bdc3c7;
  margin-top: 48px;
  padding: 40px 0 20px;
}
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 24px; }
.footer-grid h3, .footer-grid h4 { color: white; margin-bottom: 12px; }
.footer-links { display: flex; flex-direction: column; gap: 8px; }
.footer-links a { color: #bdc3c7; }
.footer-links a:hover { color: white; }
.subscribe-form { display: flex; margin-top: 8px; }
.subscribe-form input {
  flex: 1;
  padding: 8px 12px;
  border: none;
  border-radius: var(--radius) 0 0 var(--radius);
}
.subscribe-form button {
  padding: 8px 16px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 0 var(--radius) var(--radius) 0;
  cursor: pointer;
}
.footer-bottom { text-align: center; margin-top: 24px; padding-top: 16px; border-top: 1px solid #34495e; font-size: 0.9em; }

/* ========= MISC ========= */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-light); }
.empty-state p { margin-bottom: 16px; }
.error-page { text-align: center; padding: 80px 20px; }
.error-page h1 { font-size: 4em; color: var(--primary); }
.error-page p { margin: 16px 0; }
.about-page { max-width: 700px; margin: 32px auto; }
.about-page h2 { margin-top: 24px; margin-bottom: 8px; color: var(--primary); }
.about-page ul { margin-left: 20px; margin-bottom: 16px; }
.about-page li { margin-bottom: 8px; }

/* ========= LEGAL PAGES ========= */
.legal-page { max-width: 700px; margin: 32px auto; line-height: 1.7; }
.legal-page h1 { font-size: 2em; margin-bottom: 4px; }
.legal-page h2 { margin-top: 28px; margin-bottom: 8px; color: var(--primary); }
.legal-page h3 { margin-top: 16px; margin-bottom: 4px; }
.legal-page p { margin-bottom: 12px; }
.legal-page ul { margin-left: 20px; margin-bottom: 16px; }
.legal-page li { margin-bottom: 6px; }
.legal-updated { color: #888; font-size: 0.9em; margin-bottom: 20px; }

/* ========= RESPONSIVE ========= */
@media (max-width: 768px) {
  /* Nav — hide search & links, show hamburger */
  .nav-search { display: none; }
  .nav-links { display: none; flex-direction: column; position: absolute; top: 56px; right: 12px; width: 200px; background: white; padding: 8px; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,0.15); gap: 2px; z-index: 999; margin-left: 0; }
  .nav-links.open { display: flex; }
  .nav-link, .nav-user-link, .nav-btn-login { width: 100%; text-align: left; padding: 10px 14px; box-sizing: border-box; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .nav-btn-login { text-align: center; display: block; }
  .nav-user-link { display: flex; }
  .nav-toggle { display: block; }

  /* Hero */
  .hero { padding: 28px 16px; margin: 12px 0; border-radius: 10px; }
  .hero h1 { font-size: 1.4em; }
  .hero p { font-size: 0.9em; margin-bottom: 16px; }
  .hero-search { flex-direction: column; gap: 8px; }
  .hero-search input { border-radius: 8px; padding: 12px 14px; font-size: 0.95em; }
  .hero-search button { border-radius: 8px; padding: 12px; }
  .hero-search .search-suggest { border-radius: 0 0 8px 8px; }

  /* Container padding */
  .container { padding: 0 12px; }

  /* Recipe grid */
  .recipe-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .recipe-card-body h3 { font-size: 0.85em; }
  .recipe-card-desc { display: none; }
  .recipe-card-meta { font-size: 0.75em; gap: 6px; }

  /* Category grid */
  .category-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .category-icon { font-size: 1.5em; }
  .category-name { font-size: 0.8em; }
  .category-count { font-size: 0.7em; }
  .category-card { padding: 12px 8px; }

  /* Recipe detail */
  .recipe-detail { margin: 12px auto; }
  .recipe-header h1 { font-size: 1.4em; }
  .recipe-meta { font-size: 0.8em; gap: 8px; }
  .recipe-content { grid-template-columns: 1fr; gap: 16px; }
  .recipe-ingredients { padding: 14px; }
  .ing-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .portion-control { align-self: stretch; justify-content: center; }
  .unit-toggle { margin-bottom: 8px; }
  .unit-btn { padding: 5px 8px; font-size: 0.75em; }
  .nutrition-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .nutrition-item { padding: 10px; }
  .nutrition-value { font-size: 1.1em; }
  .nutrition-chart-wrapper { flex-direction: column; align-items: center; }
  .nutrition-donut { width: 120px; height: 120px; }
  .donut-center { width: 76px; height: 76px; }
  .donut-cal { font-size: 1.3em; }
  .nutrition-legend { flex-direction: row; flex-wrap: wrap; gap: 12px; justify-content: center; }
  .nutrition-sections { grid-template-columns: 1fr; gap: 12px; }
  .cost-summary { flex-direction: column; align-items: flex-start; gap: 10px; }
  .cost-total .cost-amount { font-size: 1.5em; }
  .cost-table { font-size: 0.8em; }
  .cost-table th, .cost-table td { padding: 5px 6px; }

  /* Donate */
  .donate-page { margin: 16px auto; padding: 0; }
  .donate-page h1 { font-size: 1.4em; }
  .donate-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .donate-btn { padding: 12px 8px; font-size: 1em; }
  .impact-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }

  /* Scanner */
  .scanner-layout { grid-template-columns: 1fr !important; }
  .scanner-picker { grid-template-columns: 1fr !important; }
  .scanner-sidebar { position: static !important; }
  .scanner-box { padding: 14px; }

  /* Login */
  .auth-page { padding: 12px 8px; }
  .auth-card { padding: 20px 14px; max-width: 100%; box-sizing: border-box; }
  .auth-icon { font-size: 2em; }
  .auth-header h1 { font-size: 1.2em; }
  .auth-header p { font-size: 0.8em; }
  .auth-btn { padding: 12px 12px; font-size: 0.85em; gap: 8px; }
  .auth-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
  .auth-features { grid-template-columns: 1fr; gap: 4px; }
  .auth-feature { padding: 6px 10px; font-size: 0.8em; }
  .auth-info { padding: 10px 12px; }
  .auth-info p { font-size: 0.8em; }
  .auth-divider span { font-size: 0.75em; }

  /* Profile */
  .profile-top { flex-direction: column; text-align: center; gap: 10px; }
  .profile-top .btn-outline { align-self: center; }
  .profile-card { padding: 14px; }
  .profile-info h1 { font-size: 1.1em; }
  .profile-tabs { flex-wrap: wrap; }
  .tab { font-size: 0.8em; padding: 8px 6px; }
  .tab-content { padding: 14px; }
  .chip-grid { grid-template-columns: repeat(2, 1fr); }
  .chip { padding: 7px 10px; font-size: 0.8em; }
  .radio-row { flex-wrap: wrap; }
  .radio-chip { padding: 7px 10px; font-size: 0.8em; }
  .prefs-section h3 { font-size: 0.85em; }

  /* Footer */
  .site-footer { padding: 24px 0 16px; }
  .footer-grid { grid-template-columns: 1fr; gap: 16px; }
  .subscribe-form { flex-direction: column; }
  .subscribe-form input { border-radius: 8px; }
  .subscribe-form button { border-radius: 8px; padding: 10px; }

  /* Browse filters */
  .browse-filters { flex-direction: column; }
  .browse-filters input, .browse-filters select { min-width: 0; }

  /* AI chat */
  .recipe-tools { margin: 16px auto; }
  .quick-questions { gap: 4px; }
  .qq-btn { padding: 5px 10px; font-size: 0.75em; }
  .ai-input input { padding: 10px 12px; font-size: 0.9em; }
  .ai-input button { padding: 10px 16px; }

  /* Comments */
  .comment { padding: 12px; }
}

/* Extra small — Fold3 folded (280-360px) */
@media (max-width: 380px) {
  .recipe-grid { grid-template-columns: 1fr; }
  .category-grid { grid-template-columns: repeat(2, 1fr); }
  .donate-grid { grid-template-columns: repeat(2, 1fr); }
  .chip-grid { grid-template-columns: 1fr; }
  .tool-buttons, .quick-questions { justify-content: center; }
  .auth-card { padding: 16px 10px; border-radius: 12px; box-shadow: none; border: 1px solid var(--border); }
  .auth-icon { font-size: 1.8em; }
  .auth-header h1 { font-size: 1.1em; }
  .auth-header p { font-size: 0.75em; }
  .auth-btn { padding: 10px 8px; font-size: 0.8em; border-radius: 8px; }
  .auth-btn svg { width: 16px; height: 16px; }
  .auth-buttons { gap: 8px; margin: 16px 0; }
  .auth-feature { font-size: 0.75em; padding: 5px 8px; }
  .auth-info p { font-size: 0.75em; }
  .hero h1 { font-size: 1.2em; }
  .hero p { font-size: 0.8em; }
  .footer-grid h3, .footer-grid h4 { font-size: 0.9em; }
  .footer-grid a, .footer-grid p { font-size: 0.8em; }
}

/* ========= AUTH / LOGIN ========= */
.auth-page { display: flex; justify-content: center; padding: 40px 20px; }
.auth-card { background: var(--bg-card); border-radius: 16px; box-shadow: 0 4px 24px rgba(0,0,0,0.1); padding: 40px; max-width: 440px; width: 100%; text-align: center; }
.auth-header { margin-bottom: 28px; }
.auth-icon { font-size: 3em; display: block; margin-bottom: 8px; }
.auth-header h1 { font-size: 1.6em; margin-bottom: 6px; }
.auth-header p { color: var(--text-light); font-size: 0.95em; line-height: 1.5; }
.auth-buttons { display: flex; flex-direction: column; gap: 12px; margin: 24px 0; }
.auth-btn { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 14px 24px; border-radius: var(--radius); font-size: 1.05em; font-weight: 600; text-decoration: none; color: white; transition: transform 0.15s, box-shadow 0.15s; }
.auth-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); text-decoration: none; color: white; }
.auth-btn.google { background: #4285F4; }
.auth-btn.facebook { background: #1877F2; }
.auth-divider { display: flex; align-items: center; margin: 20px 0; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; border-bottom: 1px solid var(--border); }
.auth-divider span { padding: 0 16px; color: var(--text-light); font-size: 0.85em; text-transform: uppercase; letter-spacing: 1px; }
.auth-info { background: #f0f9ff; padding: 12px 16px; border-radius: var(--radius); margin-bottom: 20px; }
.auth-info p { font-size: 0.9em; color: var(--text); margin: 0; }
.auth-features { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; text-align: left; }
.auth-feature { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--bg); border-radius: 8px; font-size: 0.9em; }

/* ========= PROFILE ========= */
.profile-page { max-width: 700px; margin: 24px auto; }
.profile-card { background: var(--bg-card); border-radius: 16px; box-shadow: var(--shadow); padding: 24px; margin-bottom: 16px; }
.profile-top { display: flex; align-items: center; gap: 16px; }
.profile-avatar { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; border: 3px solid var(--primary); }
.profile-avatar-default { width: 64px; height: 64px; border-radius: 50%; background: var(--border); display: flex; align-items: center; justify-content: center; font-size: 1.8em; }
.profile-info { flex: 1; }
.profile-info h1 { font-size: 1.3em; margin-bottom: 2px; }
.profile-info p { color: var(--text-light); font-size: 0.9em; margin: 0; }
.btn-outline { padding: 6px 16px; border: 2px solid var(--border); border-radius: var(--radius); color: var(--text-light); font-size: 0.85em; text-decoration: none; }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }

.profile-tabs { display: flex; gap: 4px; background: var(--bg-card); border-radius: 12px; padding: 4px; box-shadow: var(--shadow); margin-bottom: 16px; }
.tab { flex: 1; padding: 10px; border: none; background: none; border-radius: 10px; cursor: pointer; font-size: 0.9em; font-weight: 500; color: var(--text-light); transition: all 0.2s; }
.tab.active { background: var(--primary); color: white; }
.tab:hover:not(.active) { background: var(--bg); }

.tab-content { background: var(--bg-card); border-radius: 16px; box-shadow: var(--shadow); padding: 24px; }
.prefs-section { margin-bottom: 24px; }
.prefs-section h3 { font-size: 0.95em; color: var(--text-light); margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.5px; }
.chip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.chip { display: flex; align-items: center; gap: 6px; padding: 10px 14px; background: var(--bg); border: 2px solid transparent; border-radius: 12px; cursor: pointer; font-size: 0.9em; transition: all 0.15s; }
.chip input { display: none; }
.chip:hover { background: #fef0ef; }
.chip.selected { border-color: var(--primary); background: #fef0ef; }
.chip-icon { font-size: 1.1em; }
.chip-label { font-weight: 500; }
.radio-row { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-chip { padding: 10px 18px; background: var(--bg); border: 2px solid transparent; border-radius: 12px; cursor: pointer; font-size: 0.9em; font-weight: 500; transition: all 0.15s; }
.radio-chip input { display: none; }
.radio-chip:hover { background: #fef0ef; }
.radio-chip.selected { border-color: var(--primary); background: #fef0ef; }

.empty-tab { text-align: center; padding: 40px 20px; }
.empty-tab span { font-size: 3em; display: block; margin-bottom: 12px; }
.empty-tab p { color: var(--text-light); margin-bottom: 16px; }

.btn-small { padding: 4px 14px; font-size: 0.85em; }

/* ========= SCANNER ========= */
.scanner-page { max-width: 1000px; margin: 24px auto; }
.scanner-header { text-align: center; margin-bottom: 24px; }
.scanner-header h1 { margin-bottom: 6px; }
.scanner-header p { color: var(--text-light); }
.scanner-layout { display: grid; grid-template-columns: 300px 1fr; gap: 20px; align-items: start; }
.scanner-sidebar { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 80px; }
.scanner-box { background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.scanner-box h3 { font-size: 0.95em; margin-bottom: 12px; color: var(--text); }
.scanner-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ingredient-box { background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.ingredient-box h3 { font-size: 0.85em; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-light); margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.ingredient-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ing-chip { padding: 5px 8px; background: var(--bg-card); border: 1.5px solid var(--border); border-radius: 8px; cursor: pointer; font-size: 0.75em; transition: all 0.15s; text-align: center; line-height: 1.3; }
.ing-chip:hover { border-color: var(--primary); background: #fef0ef; transform: translateY(-1px); }
.ing-chip.active, .ing-chip.detected { background: var(--primary); color: white; border-color: var(--primary); }
.ingredient-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(85px, 1fr)); gap: 4px; }
.selected-chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 40px; padding: 10px; background: var(--bg); border-radius: 10px; border: 2px dashed var(--border); }
.selected-chips:not(:empty) { border-style: solid; border-color: var(--primary); background: #fef0ef; }
.sel-chip { background: var(--primary); color: white; padding: 5px 12px; border-radius: 8px; font-size: 0.85em; display: flex; align-items: center; gap: 6px; font-weight: 500; }
.sel-chip button { background: none; border: none; color: rgba(255,255,255,0.7); cursor: pointer; font-size: 1.1em; padding: 0; line-height: 1; }
.sel-chip button:hover { color: white; }
.empty-hint { color: var(--text-light); font-size: 0.85em; font-style: italic; margin: 4px 0; }
.ingredient-input { width: 100%; padding: 10px 12px; border: 2px solid var(--border); border-radius: 8px; font-size: 0.9em; margin-top: 8px; }
.ingredient-input:focus { border-color: var(--primary); outline: none; }
.upload-area { border: 2px dashed var(--border); border-radius: var(--radius); padding: 20px; text-align: center; cursor: pointer; transition: all 0.2s; }
.upload-area:hover, .upload-area.drag-over { border-color: var(--primary); background: #fef0ef; }
.upload-icon { font-size: 2em; margin-bottom: 4px; }
.upload-area p { font-size: 0.85em; color: var(--text-light); margin: 0; }
.scan-result { margin-top: 12px; }
.scanning-indicator { display: flex; align-items: center; gap: 8px; padding: 10px; background: #f0f9ff; border-radius: 8px; font-size: 0.85em; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.detected-label { font-size: 0.85em; color: var(--text-light); margin-bottom: 6px; }
.detected-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.match-badge { position: absolute; top: 8px; right: 8px; padding: 3px 10px; border-radius: 12px; color: white; font-size: 0.8em; font-weight: 700; z-index: 1; }
.recipe-card { position: relative; }
.missing-ing { font-size: 0.8em; color: var(--text-light); margin-top: 4px; font-style: italic; }
.results-header { margin-bottom: 24px; }
.results-header p { color: var(--text-light); }

/* ========= AI ASSISTANT ========= */
.recipe-tools { max-width: 800px; margin: 32px auto; }
.recipe-tools h2 { margin-bottom: 4px; }
.tools-hint { color: var(--text-light); font-size: 0.85em; margin-bottom: 12px; }
.quick-questions { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.qq-btn { padding: 6px 14px; background: var(--bg-card); border: 1.5px solid var(--border); border-radius: 20px; cursor: pointer; font-size: 0.8em; transition: all 0.15s; }
.qq-btn:hover { border-color: var(--primary); background: #fef0ef; }
.ai-chat { background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.ai-messages { max-height: 400px; overflow-y: auto; padding: 16px; }
.ai-msg { padding: 10px 14px; margin: 6px 0; border-radius: 12px; max-width: 85%; line-height: 1.6; }
.ai-msg.user { background: var(--primary); color: white; margin-left: auto; text-align: right; }
.ai-msg.bot { background: #f0f9ff; }
.ai-msg.thinking { color: var(--text-light); font-style: italic; }
.ai-tips { margin: 8px 0 0; padding-left: 0; list-style: none; font-size: 0.9em; }
.ai-tips li { padding: 2px 0; }
.ai-input { display: flex; border-top: 1px solid var(--border); }
.ai-input input { flex: 1; padding: 14px 16px; border: none; outline: none; font-size: 0.95em; }
.ai-input button { padding: 14px 24px; background: var(--primary); color: white; border: none; cursor: pointer; font-weight: 600; }
.ai-tools-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 16px; }
.ai-tool-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 14px; text-align: center; color: var(--text); transition: transform 0.15s, border-color 0.15s; }
.ai-tool-card:hover { transform: translateY(-2px); border-color: var(--primary); color: var(--primary); }
.ai-tool-icon { font-size: 1.6em; display: block; margin-bottom: 4px; }
.ai-tool-card strong { font-size: 0.85em; display: block; }
.ai-tool-card p { font-size: 0.75em; color: var(--text-light); margin: 2px 0 0; }
@media (max-width: 768px) { .ai-tools-grid { grid-template-columns: repeat(2, 1fr); } }

/* ========= COMMENTS ========= */
.comments-section { max-width: 800px; margin: 32px auto; }
.comments-list { margin: 16px 0; }
.comment { padding: 16px; background: var(--bg-card); border-radius: var(--radius); margin: 8px 0; box-shadow: var(--shadow); }
.comment.ai-comment { background: #f0f9ff; border-left: 4px solid #3498db; }
.comment-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 0.9em; }
.comment-header time { color: var(--text-light); margin-left: auto; font-size: 0.85em; }
.comment-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.comment-avatar-placeholder { width: 32px; height: 32px; border-radius: 50%; background: var(--border); display: flex; align-items: center; justify-content: center; font-size: 1.2em; }
.comment-body { line-height: 1.6; }
.comment-form textarea { width: 100%; padding: 12px; border: 2px solid var(--border); border-radius: var(--radius); resize: vertical; font-family: inherit; font-size: 0.95em; }
.comment-form textarea:focus { border-color: var(--primary); outline: none; }
.comment-form-footer { display: flex; gap: 12px; margin-top: 8px; align-items: center; }
.comment-name { flex: 1; padding: 8px 12px; border: 2px solid var(--border); border-radius: var(--radius); }
.comment-hint { font-size: 0.85em; color: var(--text-light); margin-top: 6px; }
.no-comments, .loading-comments { color: var(--text-light); font-style: italic; }

/* Internal links in recipe steps */
a.internal-link { color: var(--primary); text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 2px; }
a.internal-link:hover { text-decoration-style: solid; }

/* ========= COOKING MODE BUTTON ========= */
.cooking-mode-btn { background: #27ae60 !important; color: white !important; border-color: #27ae60 !important; }
.cooking-mode-btn:hover { background: #219a52 !important; }

/* ========= PRINT BUTTON ========= */
.print-btn { }

/* ========= VIDEO EMBED ========= */
.recipe-video { margin: 24px 0; }
.recipe-video h2 { margin-bottom: 12px; }
.video-embed { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; border-radius: var(--radius); background: #000; }
.video-embed iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.video-badge { display: inline-block; background: #e74c3c; color: white; font-size: 0.7em; padding: 2px 6px; border-radius: 4px; margin-left: 4px; vertical-align: middle; }

/* ========= COOKSNAP ========= */
.cooksnap-section { max-width: 800px; margin: 32px auto; }
.cooksnap-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-top: 12px; }
.cooksnap-item { background: var(--bg-card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.cooksnap-item img { width: 100%; height: 180px; object-fit: cover; }
.cooksnap-note { padding: 8px 12px; font-size: 0.85em; line-height: 1.4; }
.cooksnap-meta { display: block; padding: 4px 12px 8px; font-size: 0.75em; color: var(--text-light); }

/* Cooksnap Modal */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6); z-index: 1000; justify-content: center; align-items: center; padding: 20px; }
.modal-content { background: var(--bg-card); border-radius: var(--radius); padding: 24px; max-width: 500px; width: 100%; position: relative; max-height: 90vh; overflow-y: auto; }
.modal-close { position: absolute; top: 12px; right: 16px; background: none; border: none; font-size: 1.5em; cursor: pointer; color: var(--text-light); }
.cooksnap-modal h3 { margin-bottom: 16px; }
.cooksnap-upload-area { border: 2px dashed var(--border); border-radius: var(--radius); padding: 24px; text-align: center; cursor: pointer; margin-bottom: 12px; min-height: 120px; display: flex; flex-direction: column; align-items: center; justify-content: center; transition: border-color 0.2s; }
.cooksnap-upload-area:hover, .cooksnap-upload-area.drag-over { border-color: var(--primary); background: #fef0ef; }
.cooksnap-upload-hint { color: var(--text-light); font-size: 0.95em; }
.cooksnap-preview img { max-height: 200px; border-radius: 8px; }
.cooksnap-modal textarea { width: 100%; padding: 10px; border: 2px solid var(--border); border-radius: 8px; resize: vertical; font-family: inherit; margin-bottom: 12px; }
.cooksnap-modal textarea:focus { border-color: var(--primary); outline: none; }
.cooksnap-form-actions { display: flex; gap: 8px; }
.cooksnap-form-actions .btn { flex: 1; text-align: center; }

/* ========= MASAK APA PAGE ========= */
.masak-apa-page { max-width: 700px; margin: 0 auto; padding: 32px 0; text-align: center; }
.masak-apa-header { margin-bottom: 24px; }
.masak-apa-header h1 { font-size: 2em; margin-bottom: 8px; }
.masak-apa-header p { color: var(--text-light); }
.masak-apa-filters { display: flex; gap: 12px; justify-content: center; margin-bottom: 32px; flex-wrap: wrap; }
.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-group label { font-size: 0.8em; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.5px; }
.filter-group select { padding: 8px 12px; border: 2px solid var(--border); border-radius: 8px; font-size: 0.9em; background: var(--bg-card); }
.spinner-area { margin-bottom: 32px; perspective: 800px; }
.spinner-card { background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 32px; min-height: 300px; display: flex; align-items: center; justify-content: center; margin-bottom: 20px; transform-style: preserve-3d; }
.spinner-front { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.spinner-emoji { font-size: 4em; }
.spin-result-img { width: 100%; max-height: 250px; object-fit: cover; border-radius: 8px; }
.spin-meta { display: flex; gap: 12px; font-size: 0.9em; color: var(--text-light); }
.spin-desc { font-size: 0.9em; color: var(--text-light); margin-top: 4px; text-align: left; }
.spin-btn { padding: 16px 48px; background: var(--primary); color: white; border: none; border-radius: 30px; font-size: 1.2em; cursor: pointer; font-weight: 700; }
.spin-btn:hover { background: var(--primary-dark); }
.spin-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.spin-result { text-align: center; }
.spin-actions { display: flex; gap: 12px; justify-content: center; margin-top: 20px; }
.spin-actions a, .spin-actions button { padding: 12px 28px; border-radius: 30px; font-size: 1em; font-weight: 600; }

/* ========= NAV DROPDOWN ========= */
.nav-dropdown { position: relative; }
.nav-dropdown-btn { background: none; border: none; cursor: pointer; font-size: inherit; font-family: inherit; color: var(--text); padding: 0; }
.nav-dropdown-menu { display: none; position: absolute; top: 100%; left: 0; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,0.12); min-width: 200px; z-index: 200; padding: 8px 0; }
.nav-dropdown:hover .nav-dropdown-menu { display: block; }
.nav-dropdown-menu a { display: block; padding: 10px 16px; color: var(--text); font-size: 0.9em; white-space: nowrap; transition: background 0.15s; }
.nav-dropdown-menu a:hover { background: var(--bg); color: var(--primary); }

/* ========= AI FEATURES HOME SECTION ========= */
.ai-features-section { text-align: center; }
.ai-features-subtitle { color: var(--text-light); margin-bottom: 20px; }
.ai-features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.ai-feature-card { background: var(--bg-card); border: 2px solid var(--border); border-radius: var(--radius); padding: 24px 16px; text-align: center; transition: all 0.2s; color: var(--text) !important; }
.ai-feature-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 4px 16px rgba(231,76,60,0.12); }
.ai-feature-icon { font-size: 2.5em; display: block; margin-bottom: 8px; }
.ai-feature-card h3 { font-size: 1.1em; margin-bottom: 6px; }
.ai-feature-card p { font-size: 0.85em; color: var(--text-light); line-height: 1.4; }

/* ========= AI PAGES — Shared ========= */
.ai-page { max-width: 1000px; margin: 0 auto; padding: 24px 0; }
.ai-page-header { text-align: center; margin-bottom: 32px; }
.ai-page-header h1 { font-size: 2em; margin-bottom: 8px; }
.ai-page-header p { color: var(--text-light); max-width: 600px; margin: 0 auto; }

.ai-box { background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; margin-bottom: 20px; }
.ai-box h3 { margin-bottom: 12px; font-size: 1.1em; }

.ai-box textarea, .ai-box input[type="text"], .ai-box input[type="number"] {
  width: 100%; padding: 12px; border: 2px solid var(--border); border-radius: 8px;
  font-family: inherit; font-size: 0.95em; resize: vertical; transition: border-color 0.2s;
}
.ai-box textarea:focus, .ai-box input[type="text"]:focus, .ai-box input[type="number"]:focus {
  border-color: var(--primary); outline: none;
}

.ai-submit-btn { width: 100%; margin-top: 16px; padding: 14px; font-size: 1.05em; font-weight: 600; }

.ai-examples { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; align-items: center; }
.ai-example-label { font-size: 0.85em; color: var(--text-light); }
.ai-example-chip { background: var(--bg); border: 1px solid var(--border); border-radius: 20px; padding: 6px 14px; font-size: 0.85em; cursor: pointer; transition: all 0.15s; }
.ai-example-chip:hover { border-color: var(--primary); color: var(--primary); }

.ai-loading { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 40px; color: var(--text-light); }
.ai-loading .spinner { display: inline-block; width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.ai-result-title { font-size: 1.4em; margin-bottom: 16px; }
.ai-no-result { color: var(--text-light); text-align: center; padding: 32px; }

/* ========= AI RECIPE CREATOR ========= */
.ai-creator-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.ai-recipe-header h2 { font-size: 1.5em; margin-bottom: 8px; }
.ai-recipe-desc { color: var(--text-light); margin-bottom: 12px; }
.ai-recipe-meta { display: flex; flex-wrap: wrap; gap: 12px; color: var(--text-light); font-size: 0.9em; margin-bottom: 16px; }
.ai-recipe-meta span { background: var(--bg); padding: 4px 10px; border-radius: 6px; }
.ai-recipe-content h3 { margin-top: 16px; margin-bottom: 8px; font-size: 1.1em; }
.ai-recipe-content ul, .ai-recipe-content ol { padding-left: 20px; }
.ai-recipe-content li { margin-bottom: 6px; line-height: 1.5; }
.ai-recipe-nutrition { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.ai-recipe-tips { margin-top: 16px; padding: 16px; background: #fffbe6; border-radius: 8px; }
.ai-recipe-tips h3 { margin-bottom: 8px; }
.ai-recipe-tips ul { padding-left: 20px; }
.ai-recipe-tips li { margin-bottom: 4px; font-size: 0.9em; }
.ai-recipe-actions { display: flex; gap: 12px; margin-top: 20px; }
.ai-recipe-actions .btn { flex: 1; text-align: center; padding: 12px; }

.ai-conversation { max-height: 200px; overflow-y: auto; margin-bottom: 12px; }
.ai-conv-msg { padding: 8px 12px; border-radius: 8px; margin-bottom: 6px; font-size: 0.9em; }
.ai-conv-msg.user { background: #e8f4fd; }
.ai-conv-msg.ai { background: #f0f0f0; }
.ai-refine-input { display: flex; gap: 8px; }
.ai-refine-input input { flex: 1; }
.ai-refine-input .btn { white-space: nowrap; }

/* ========= LEFTOVER SUGGESTER ========= */
.ai-leftover-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.chip-toggle { background: var(--bg); border: 1px solid var(--border); border-radius: 20px; padding: 6px 14px; font-size: 0.85em; cursor: pointer; transition: all 0.15s; }
.chip-toggle:hover { border-color: var(--primary); }
.chip-toggle.active { background: var(--primary); color: white; border-color: var(--primary); }

.ai-suggestion-cards { display: flex; flex-direction: column; gap: 16px; }
.ai-suggestion-card { background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.ai-suggestion-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.ai-suggestion-header h3 { font-size: 1.15em; }
.ai-suggestion-time { background: var(--bg); padding: 4px 10px; border-radius: 12px; font-size: 0.8em; color: var(--text-light); }
.ai-suggestion-why { font-size: 0.9em; color: var(--text-light); margin-bottom: 10px; }
.ai-suggestion-steps { font-size: 0.9em; margin-bottom: 10px; }
.ai-suggestion-steps ol { padding-left: 18px; }
.ai-suggestion-steps li { margin-bottom: 4px; }
.ai-suggestion-extra { font-size: 0.85em; color: var(--text-light); margin-bottom: 10px; }
.ai-suggestion-actions { text-align: right; }
.btn-sm { padding: 8px 16px; font-size: 0.85em; }
.ai-back-btn { background: none; border: none; color: var(--primary); cursor: pointer; font-size: 0.9em; margin-bottom: 16px; padding: 0; }
.ai-back-btn:hover { text-decoration: underline; }

/* ========= MEAL PLAN ========= */
.ai-mealplan-layout { display: grid; grid-template-columns: 380px 1fr; gap: 24px; align-items: start; }
.mealplan-form .form-group { margin-bottom: 20px; }
.mealplan-form label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.9em; }
.budget-slider-wrap { display: flex; gap: 12px; align-items: center; }
.budget-slider-wrap input[type="range"] { flex: 1; accent-color: var(--primary); }
.budget-display { display: flex; align-items: center; gap: 4px; font-weight: 600; }
.budget-display input { width: 110px; text-align: right; font-weight: 600; }
.budget-presets { display: flex; gap: 8px; margin-top: 8px; }
.budget-preset { background: var(--bg); border: 1px solid var(--border); border-radius: 20px; padding: 6px 14px; font-size: 0.8em; cursor: pointer; }
.budget-preset:hover, .budget-preset.active { background: var(--primary); color: white; border-color: var(--primary); }

.family-size-picker { display: flex; gap: 8px; }
.size-btn { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--border); background: var(--bg-card); font-size: 1em; font-weight: 600; cursor: pointer; transition: all 0.15s; }
.size-btn:hover, .size-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

.mealplan-summary { text-align: center; }
.mealplan-stats { display: flex; justify-content: center; gap: 32px; margin-top: 16px; }
.stat-item { display: flex; flex-direction: column; }
.stat-value { font-size: 1.4em; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 0.8em; color: var(--text-light); }

.mealplan-days { display: flex; flex-direction: column; gap: 12px; }
.mealplan-day { background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.mealplan-day-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.mealplan-day-header h3 { font-size: 1em; }
.day-cost { font-weight: 600; color: var(--primary); font-size: 0.9em; }
.mealplan-meals { display: flex; flex-direction: column; gap: 6px; }
.meal-item { display: flex; align-items: center; gap: 8px; font-size: 0.9em; padding: 6px 0; border-bottom: 1px solid var(--border); }
.meal-item:last-child { border-bottom: none; }
.meal-type { font-weight: 600; min-width: 100px; color: var(--text-light); font-size: 0.85em; }
.meal-name { flex: 1; }
.meal-cost { color: var(--text-light); font-size: 0.85em; }
.hemat-tip { margin-top: 8px; padding: 8px 12px; background: #fffbe6; border-radius: 6px; font-size: 0.85em; color: #856404; }

.mealplan-shopping { margin-top: 20px; }
.shopping-table { width: 100%; border-collapse: collapse; }
.shopping-table th, .shopping-table td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.9em; }
.shopping-table th { font-weight: 600; background: var(--bg); }
.shopping-table tfoot th { font-size: 1em; }

/* ========= FLAVOR MATCH ========= */
.ai-flavor-layout { display: grid; grid-template-columns: 380px 1fr; gap: 24px; align-items: start; }
.flavor-sliders { display: flex; flex-direction: column; gap: 10px; }
.flavor-row { display: flex; align-items: center; gap: 10px; }
.flavor-row label { min-width: 70px; font-size: 0.9em; font-weight: 500; }
.flavor-row input[type="range"] { flex: 1; accent-color: var(--primary); }
.flavor-val { min-width: 20px; text-align: center; font-weight: 600; font-size: 0.9em; }
.flavor-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; align-items: center; }
.flavor-match-card .flavor-score { font-size: 0.8em; font-weight: 700; color: var(--primary); margin-bottom: 4px; }
.flavor-reason { font-size: 0.8em; color: var(--text-light); line-height: 1.3; margin-bottom: 4px; }

/* ========= CULTURAL STORY ========= */
.cultural-story-section { margin: 20px 0; max-width: 800px; }
.cultural-story-toggle { display: flex; align-items: center; gap: 10px; width: 100%; padding: 14px 16px; background: var(--bg-card); border: 2px solid var(--border); border-radius: var(--radius); cursor: pointer; font-size: 1em; font-weight: 600; color: var(--text); transition: border-color 0.2s; }
.cultural-story-toggle:hover { border-color: var(--primary); }
.cultural-story-icon { font-size: 1.3em; }
.cultural-story-arrow { margin-left: auto; color: var(--text-light); }
.cultural-story-content { padding: 16px; background: var(--bg-card); border: 1px solid var(--border); border-top: none; border-radius: 0 0 var(--radius) var(--radius); }
.cultural-story-loading { display: flex; align-items: center; gap: 10px; color: var(--text-light); padding: 16px; }
.cultural-story-error { color: var(--text-light); font-style: italic; }
.cultural-origin { margin-bottom: 10px; color: var(--text-light); }
.cultural-text p { margin-bottom: 10px; line-height: 1.7; }
.cultural-significance { margin-top: 12px; padding: 12px; background: #f0f7ff; border-radius: 8px; line-height: 1.5; }
.cultural-facts, .cultural-variations { margin-top: 12px; }
.cultural-facts ul, .cultural-variations ul { padding-left: 20px; margin-top: 6px; }
.cultural-facts li, .cultural-variations li { margin-bottom: 4px; font-size: 0.9em; line-height: 1.5; }

/* ========= MOBILE RESPONSIVE — AI Pages ========= */
@media (max-width: 768px) {
  .ai-creator-layout, .ai-leftover-layout { grid-template-columns: 1fr; }
  .ai-mealplan-layout, .ai-flavor-layout { grid-template-columns: 1fr; }
  .ai-features-grid { grid-template-columns: repeat(2, 1fr); }
  .mealplan-stats { gap: 16px; }
  .stat-value { font-size: 1.1em; }
  .nav-dropdown-menu { position: static; box-shadow: none; border: none; padding: 0 0 0 16px; }
  .nav-dropdown:hover .nav-dropdown-menu { display: block; }
  .ai-page-header h1 { font-size: 1.5em; }
}

@media (max-width: 480px) {
  .ai-features-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .ai-feature-card { padding: 16px 12px; }
  .ai-feature-icon { font-size: 2em; }
  .mealplan-stats { flex-direction: column; gap: 8px; }
}

/* ========= PRINT STYLESHEET ========= */
@media print {
  .site-header, .nav-bar, .site-footer, .footer-grid, .footer-bottom,
  .share-bar, .recipe-actions, .recipe-tools, .comments-section,
  .ai-chat, .ai-messages, .ai-input, .quick-questions,
  .cooking-mode-btn, .print-btn,
  .donate-banner, .subscribe-form,
  .unit-toggle, .portion-control,
  .diet-banner, .recipe-tags,
  .cooksnap-section, .modal-overlay,
  .recipe-video, .voice-search-btn,
  .cultural-story-section, .ai-features-section,
  button, .btn, .nav-toggle,
  .section:has(.recipe-grid) { display: none !important; }

  body { background: white; color: black; font-size: 12pt; }
  .container { max-width: 100%; padding: 0; }
  .recipe-detail { padding: 0; }
  .recipe-header h1 { font-size: 1.5em; margin-bottom: 8px; }
  .recipe-meta { font-size: 0.9em; margin-bottom: 8px; }
  .recipe-image img { max-height: 300px; object-fit: cover; }
  .recipe-content { display: block; }
  .recipe-ingredients { margin-bottom: 16px; break-inside: avoid; }
  .recipe-ingredients h2, .recipe-steps h2 { font-size: 1.2em; margin-bottom: 8px; }
  .recipe-steps ol li { margin-bottom: 8px; }
  .recipe-nutrition { break-inside: avoid; }
  .recipe-cost { break-inside: avoid; }
  a { color: black; text-decoration: none; }
  img { max-width: 100%; }
  .recipe-source { font-size: 0.8em; color: #666; }
}

/* ========= SHOPPING LIST ========= */
.shopping-page { padding: 24px 0; }
.shopping-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.shopping-header h1 { font-size: 1.6em; }
.shopping-count { background: var(--primary); color: white; padding: 4px 12px; border-radius: 20px; font-size: 0.85em; font-weight: 600; }
.shopping-guest-notice { background: #fff3cd; border: 1px solid #ffc107; padding: 12px 16px; border-radius: var(--radius); margin-bottom: 20px; font-size: 0.9em; }
.shopping-guest-notice a { font-weight: 600; }
.shopping-add-form { display: flex; gap: 8px; margin-bottom: 24px; flex-wrap: wrap; }
.shopping-input { flex: 1; min-width: 200px; padding: 10px 14px; border: 2px solid var(--border); border-radius: 8px; font-size: 0.95em; }
.shopping-input:focus { border-color: var(--primary); outline: none; }
.shopping-input-sm { width: 90px; padding: 10px 12px; border: 2px solid var(--border); border-radius: 8px; font-size: 0.95em; }
.shopping-input-sm:focus { border-color: var(--primary); outline: none; }
.shopping-items { margin-bottom: 24px; }
.shopping-group { background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.shopping-group-title { font-size: 1em; color: var(--text-light); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.shopping-recipe-link { font-size: 0.8em; font-weight: 400; margin-left: auto; }
.shopping-list { list-style: none; }
.shopping-item { display: flex; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.shopping-item:last-child { border-bottom: none; }
.shopping-item.checked .shopping-item-text { text-decoration: line-through; opacity: 0.5; }
.shopping-checkbox { display: flex; align-items: center; gap: 10px; flex: 1; cursor: pointer; }
.shopping-checkbox input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }
.shopping-item-text strong { color: var(--primary); margin-right: 4px; }
.shopping-remove { background: none; border: none; color: var(--text-light); font-size: 1.3em; cursor: pointer; padding: 4px 8px; opacity: 0.5; }
.shopping-remove:hover { opacity: 1; color: #e74c3c; }
.shopping-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.btn-success { background: #25d366; color: white; border: none; padding: 10px 20px; border-radius: 8px; cursor: pointer; font-weight: 600; }
.btn-success:hover { background: #1da851; }
.btn-danger { background: #e74c3c; color: white; border: none; padding: 10px 20px; border-radius: 8px; cursor: pointer; font-weight: 600; }
.btn-danger:hover { background: #c0392b; }
.btn-outline { background: transparent; border: 2px solid var(--border); padding: 10px 20px; border-radius: 8px; cursor: pointer; font-weight: 600; color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

/* Empty state */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-icon { font-size: 3em; margin-bottom: 12px; }
.empty-state h3 { margin-bottom: 8px; }
.empty-state p { color: var(--text-light); margin-bottom: 20px; }

/* ========= MEAL PLANNER ========= */
.planner-page { padding: 24px 0; }
.planner-header { text-align: center; margin-bottom: 24px; }
.planner-header h1 { font-size: 1.6em; margin-bottom: 4px; }
.planner-date { color: var(--text-light); margin-bottom: 12px; }
.planner-actions-top { margin-bottom: 16px; }

/* Desktop grid */
.planner-grid { display: grid; grid-template-columns: 100px repeat(7, 1fr); gap: 2px; background: var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.planner-header-row { display: contents; }
.planner-day-header { background: var(--primary); color: white; text-align: center; padding: 10px 4px; font-weight: 600; font-size: 0.85em; }
.planner-row { display: contents; }
.planner-time-label { background: var(--bg-card); padding: 10px 8px; font-size: 0.8em; font-weight: 600; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center; }
.meal-icon { font-size: 1.3em; }
.planner-cell { background: var(--bg-card); padding: 8px; min-height: 80px; position: relative; display: flex; flex-direction: column; gap: 4px; }
.planner-item { display: flex; align-items: center; gap: 6px; background: #f8f9fa; border-radius: 6px; padding: 4px 6px; font-size: 0.8em; position: relative; }
.planner-item-img { width: 32px; height: 32px; border-radius: 4px; object-fit: cover; flex-shrink: 0; }
.planner-item-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.planner-item-actions { display: flex; gap: 2px; }
.planner-item-link { text-decoration: none; font-size: 0.9em; }
.planner-item-remove { background: none; border: none; cursor: pointer; font-size: 1em; color: var(--text-light); padding: 0 2px; }
.planner-item-remove:hover { color: #e74c3c; }
.planner-add-btn { background: none; border: 2px dashed var(--border); border-radius: 6px; padding: 6px; cursor: pointer; color: var(--text-light); font-size: 1.2em; margin-top: auto; transition: all 0.2s; }
.planner-add-btn:hover { border-color: var(--primary); color: var(--primary); background: rgba(231,76,60,0.05); }

/* Mobile: hidden on desktop */
.planner-mobile { display: none; }
.planner-day-tabs { display: flex; gap: 4px; margin-bottom: 16px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.planner-day-tab { padding: 8px 14px; border: 2px solid var(--border); border-radius: 20px; background: white; cursor: pointer; font-weight: 600; font-size: 0.85em; white-space: nowrap; }
.planner-day-tab.active { background: var(--primary); color: white; border-color: var(--primary); }
.planner-day-panel { display: none; }
.planner-day-panel.active { display: block; }
.planner-day-panel h3 { margin-bottom: 12px; }
.planner-mobile-slot { background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; margin-bottom: 12px; }
.planner-mobile-label { font-weight: 600; margin-bottom: 8px; font-size: 0.95em; }
.planner-mobile-items { display: flex; flex-direction: column; gap: 6px; }

/* Planner modal */
.planner-modal { max-width: 500px; }
.planner-search-results { max-height: 400px; overflow-y: auto; margin-top: 12px; }
.planner-search-item { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 8px; cursor: pointer; transition: background 0.2s; }
.planner-search-item:hover { background: #f8f9fa; }
.planner-search-img { width: 50px; height: 50px; border-radius: 6px; object-fit: cover; }
.planner-search-info { flex: 1; }
.planner-search-info strong { display: block; font-size: 0.95em; }
.planner-search-info small { color: var(--text-light); }
.planner-no-results { text-align: center; color: var(--text-light); padding: 20px; }

@media (max-width: 768px) {
  .planner-grid { display: none; }
  .planner-mobile { display: block; }
}

/* ========= COLLECTIONS ========= */
.collections-page { padding: 24px 0; }
.collections-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.collections-header h1 { font-size: 1.6em; }
.collections-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; margin-bottom: 32px; }
.collection-card { display: block; background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; transition: transform 0.2s, box-shadow 0.2s; text-decoration: none; color: var(--text); }
.collection-card:hover { transform: translateY(-3px); box-shadow: 0 4px 16px rgba(0,0,0,0.12); color: var(--text); }
.collection-card-cover { height: 160px; background-size: cover; background-position: center; background-color: #f0f0f0; position: relative; }
.collection-card-overlay { position: absolute; bottom: 0; left: 0; right: 0; padding: 8px; }
.collection-badge { background: rgba(0,0,0,0.6); color: white; padding: 2px 8px; border-radius: 12px; font-size: 0.75em; }
.collection-card-body { padding: 12px; }
.collection-card-body h3 { font-size: 1em; margin-bottom: 4px; }
.collection-desc { font-size: 0.85em; color: var(--text-light); margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.collection-count { font-size: 0.8em; color: var(--text-light); }

.collections-suggestions { margin-top: 32px; }
.collections-suggestions h3 { margin-bottom: 12px; }
.suggestion-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.suggestion-chip { padding: 8px 16px; border: 2px solid var(--border); border-radius: 20px; background: white; cursor: pointer; font-size: 0.9em; transition: all 0.2s; }
.suggestion-chip:hover { border-color: var(--primary); color: var(--primary); }

/* Collection detail */
.collection-detail-page { padding: 24px 0; }
.collection-detail-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; flex-wrap: wrap; gap: 16px; }
.collection-detail-info h1 { font-size: 1.6em; margin-bottom: 4px; }
.collection-detail-meta { display: flex; gap: 12px; color: var(--text-light); font-size: 0.9em; margin-top: 4px; }
.collection-detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.collection-edit-form { background: var(--bg-card); border-radius: var(--radius); padding: 16px; margin-bottom: 20px; box-shadow: var(--shadow); }
.collection-edit-form .shopping-input { margin-bottom: 8px; }
.edit-form-actions { display: flex; gap: 8px; margin-top: 8px; }
.collection-remove-btn { position: absolute; top: 4px; right: 4px; background: rgba(231,76,60,0.9); color: white; border: none; border-radius: 50%; width: 24px; height: 24px; font-size: 1em; cursor: pointer; display: none; line-height: 1; }
.recipe-card:hover .collection-remove-btn { display: block; }

/* Recipe card in collection needs relative positioning */
.collection-detail-page .recipe-card { position: relative; }

/* Collection picker modal on recipe page */
.collection-picker-modal { max-width: 400px; }
.collection-picker-item { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 8px; cursor: pointer; transition: background 0.2s; }
.collection-picker-item:hover { background: #f8f9fa; }
.collection-picker-item.active { background: #e8f5e9; }
.collection-picker-item input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary); }
.collection-picker-new { display: flex; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.collection-picker-new input { flex: 1; padding: 8px 12px; border: 2px solid var(--border); border-radius: 6px; font-size: 0.9em; }
.btn-sm { padding: 6px 14px; font-size: 0.85em; }

/* Save button wrapper with dropdown */
.save-btn-wrapper { display: inline-flex; align-items: stretch; }
.save-btn-wrapper .action-btn { border-radius: 8px 0 0 8px; }
.save-dropdown-btn { background: var(--bg-card); border: 1px solid var(--border); border-left: none; border-radius: 0 8px 8px 0; padding: 4px 8px; cursor: pointer; font-size: 0.7em; color: var(--text-light); }
.save-dropdown-btn:hover { background: #f0f0f0; }

/* Toast notification */
.dapur-toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(100px); background: #333; color: white; padding: 12px 24px; border-radius: 8px; font-size: 0.9em; font-weight: 500; z-index: 9999; opacity: 0; transition: all 0.3s ease; pointer-events: none; }
.dapur-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Form group */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 0.9em; }

/* Nav dropdown */
.nav-dropdown { position: relative; }
.nav-dropdown-btn { background: none; border: none; cursor: pointer; font-size: inherit; font-family: inherit; }
.nav-dropdown-menu { display: none; position: absolute; top: 100%; left: 0; background: white; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,0.12); min-width: 180px; z-index: 200; padding: 8px 0; }
.nav-dropdown:hover .nav-dropdown-menu { display: block; }
.nav-dropdown-menu a { display: block; padding: 8px 16px; color: var(--text); font-size: 0.9em; }
.nav-dropdown-menu a:hover { background: #f8f9fa; color: var(--primary); }

/* Shopping list items — table-like layout */
.shopping-list { list-style: none; padding: 0; margin: 0; }
.shopping-item { display: grid; grid-template-columns: 1fr auto auto auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.9em; }
.shopping-checkbox { display: flex; align-items: center; gap: 6px; }
.shopping-checkbox input[type="checkbox"] { accent-color: var(--primary); }
.shopping-item-name { font-weight: 500; }
.shopping-item-qty { color: var(--text-light); font-size: 0.85em; white-space: nowrap; min-width: 60px; text-align: right; }
.shopping-item-package { color: #2e7d32; font-size: 0.8em; white-space: nowrap; }
.shopping-item-price { font-weight: 600; color: var(--primary); font-size: 0.85em; white-space: nowrap; min-width: 80px; text-align: right; }
.shopping-group { margin-bottom: 16px; }
.shopping-group-title { display: flex; align-items: center; gap: 8px; font-size: 0.95em; margin-bottom: 8px; padding-bottom: 6px; border-bottom: 2px solid var(--border); }
.section-icon { font-size: 1.1em; }
.section-count { color: var(--text-light); font-size: 0.8em; }
.section-subtotal { margin-left: auto; font-weight: 600; color: var(--primary); font-size: 0.85em; }
.shopping-cost-summary { background: var(--bg); border-radius: 12px; padding: 16px; margin: 20px 0; text-align: center; }
.cost-total { display: flex; justify-content: space-between; align-items: center; }
.cost-label { font-size: 1em; }
.cost-amount { font-size: 1.4em; font-weight: 700; color: var(--primary); }
.cost-note { font-size: 0.8em; color: var(--text-light); margin-top: 4px; }

@media (max-width: 768px) {
  .shopping-item { grid-template-columns: 1fr auto; }
  .shopping-item-package { grid-column: 1 / -1; }
  .shopping-add-form { flex-direction: column; }
  .shopping-input { min-width: auto; }
  .shopping-input-sm { width: 100%; }
  .shopping-actions { flex-direction: column; }
  .collections-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .collection-card-cover { height: 120px; }
  .collection-detail-header { flex-direction: column; }
  .collection-detail-actions { width: 100%; }
  .save-btn-wrapper { display: inline-flex; }
}

/* Dietary preference banner */
.pref-banner {
  background: #e8f5e9;
  border: 1px solid #a5d6a7;
  border-radius: 8px;
  padding: 10px 20px;
  margin: 0 auto 16px;
  max-width: 1200px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
  color: #2e7d32;
}
.pref-banner a {
  color: #1b5e20;
  font-weight: 600;
  text-decoration: underline;
  white-space: nowrap;
  margin-left: 12px;
}

/* Tax/Nonprofit notice */
.tax-notice { background: #f0fdf4; border: 1px solid #86efac; border-radius: 10px; padding: 14px 18px; margin: 16px 0; }
.tax-notice strong { color: #166534; }
.tax-notice p { font-size: 0.85em; color: #166534; margin: 4px 0 0; }
.footer-nonprofit { font-size: 0.8em; color: #95a5a6; margin-top: 8px; }

/* ========= MOBILE NATIVE APP FEEL ========= */
.bottom-nav { display:none; position:fixed; bottom:0; left:0; right:0; background:white; border-top:1px solid var(--border); z-index:200; padding:4px 0; padding-bottom:env(safe-area-inset-bottom,0); box-shadow:0 -2px 10px rgba(0,0,0,0.06); }
.bottom-nav-inner { display:flex; justify-content:space-around; align-items:center; max-width:500px; margin:0 auto; }
.bottom-nav-item { display:flex; flex-direction:column; align-items:center; gap:1px; padding:6px 12px; color:var(--text-light)!important; font-size:0.65em; font-weight:500; text-decoration:none!important; -webkit-tap-highlight-color:transparent; }
.bottom-nav-item .bnav-icon { font-size:1.6em; line-height:1; }
.bottom-nav-item.active, .bottom-nav-item:active { color:var(--primary)!important; }

.hscroll { display:flex; overflow-x:auto; scroll-snap-type:x mandatory; -webkit-overflow-scrolling:touch; scrollbar-width:none; gap:12px; padding-bottom:4px; }
.hscroll::-webkit-scrollbar { display:none; }
.hscroll > * { scroll-snap-align:start; flex-shrink:0; }
.hscroll .recipe-card { width:260px; }
.hscroll .recipe-card .recipe-card-img img { height:160px; object-fit:cover; }

@media (max-width:768px) {
  .bottom-nav { display:block; }
  body { padding-bottom:64px; }
  .nav-links { display:none; }
  .nav-bar { padding:6px 10px; gap:6px; }
  .logo { font-size:1em; }
  .logo-text { display:none; } /* icon only on mobile */
  .nav-search { flex:1; }
  .nav-search input { padding:7px 10px; font-size:0.88em; border-radius:8px; }
  .nav-search button { padding:7px 10px; }

  /* ALL recipe grids → horizontal slide */
  .recipe-grid, .section .recipe-grid, main > .recipe-grid {
    display:flex !important; overflow-x:auto; scroll-snap-type:x mandatory;
    -webkit-overflow-scrolling:touch; scrollbar-width:none; gap:10px; padding-bottom:6px;
  }
  .recipe-grid::-webkit-scrollbar, .section .recipe-grid::-webkit-scrollbar, main > .recipe-grid::-webkit-scrollbar { display:none; }
  .recipe-grid .recipe-card, .section .recipe-grid .recipe-card, main > .recipe-grid .recipe-card {
    flex-shrink:0; width:200px; scroll-snap-align:start;
  }
  .recipe-grid .recipe-card .recipe-card-img img { height:140px; object-fit:cover; border-radius:10px 10px 0 0; }
  .recipe-grid .recipe-card h3 { font-size:0.85em; line-height:1.25; }
  .recipe-grid .recipe-card-desc { display:none; }
  .recipe-grid .recipe-card-meta { font-size:0.75em; }

  /* Category → compact horizontal chips */
  .category-grid { display:flex; overflow-x:auto; -webkit-overflow-scrolling:touch; scrollbar-width:none; gap:8px; padding:2px 0; }
  .category-grid::-webkit-scrollbar { display:none; }
  .category-grid .category-card { flex-shrink:0; min-width:auto; padding:6px 12px; flex-direction:column; text-align:center; gap:2px; border-radius:10px; }
  .category-grid .category-icon { font-size:1.5em; }
  .category-grid .category-name { font-size:0.72em; white-space:nowrap; }
  .category-grid .category-count, .category-grid .category-desc { display:none; }

  /* Hero → compact */
  .hero { padding:20px 14px; border-radius:14px; margin:6px; }
  .hero h1 { font-size:1.3em; margin-bottom:4px; }
  .hero p { font-size:0.85em; margin-bottom:8px; }
  .hero-random { margin-top:8px; }
  .hero-random-icon { font-size:2em !important; }
  .hero-random-text { font-size:0.8em !important; }

  /* Sections → tight spacing */
  .section { padding:0 0 10px; }
  .section h2 { font-size:1.05em; margin-bottom:6px; }
  .section-header { margin-bottom:4px; }
  .see-all { font-size:0.8em; }

  /* AI features → horizontal slide */
  .ai-features-grid { display:flex; overflow-x:auto; -webkit-overflow-scrolling:touch; scrollbar-width:none; gap:8px; }
  .ai-features-grid::-webkit-scrollbar { display:none; }
  .ai-feature-card { flex-shrink:0; width:140px; padding:12px 10px; }
  .ai-feature-icon { font-size:1.5em; margin-bottom:4px; }
  .ai-feature-card h3 { font-size:0.8em; margin-bottom:2px; }
  .ai-feature-card p { font-size:0.68em; line-height:1.3; }
  .ai-features-subtitle { font-size:0.8em; margin-bottom:8px; }

  /* Filter bar → horizontal scrollable row */
  .filter-bar { padding:8px 10px; margin-bottom:10px; }
  .filter-row { display:flex; overflow-x:auto; scrollbar-width:none; gap:6px; flex-wrap:nowrap; }
  .filter-row::-webkit-scrollbar { display:none; }
  .filter-row select { padding:5px 6px; font-size:0.75em; flex-shrink:0; min-width:0; white-space:nowrap; }
  .filter-dietary { display:flex; overflow-x:auto; scrollbar-width:none; gap:4px; flex-wrap:nowrap; padding-top:6px; }
  .filter-dietary::-webkit-scrollbar { display:none; }
  .diet-check { font-size:0.7em; padding:3px 7px; flex-shrink:0; white-space:nowrap; }
  .ai-search-bar { flex-wrap:nowrap; }
  .ai-search-bar input { font-size:0.8em; padding:8px 10px; }
  .ai-search-bar button { font-size:0.78em; padding:8px 14px; }

  /* Browse tags → horizontal scroll */
  .browse-header + div { overflow-x:auto; scrollbar-width:none; flex-wrap:nowrap !important; }
  .browse-header + div::-webkit-scrollbar { display:none; }
  .browse-header + div .tag { flex-shrink:0; white-space:nowrap; font-size:0.78em; padding:4px 10px; }

  /* Container → minimal padding */
  .container { padding:0 8px; }

  /* Bahan panel → full width */
  .bahan-panel { margin:0 -8px 12px; border-radius:0; }

  /* Recipe detail → compact */
  .recipe-content-grid { grid-template-columns:1fr !important; }
  .recipe-header h1 { font-size:1.2em; }
  .recipe-meta-bar { font-size:0.75em; gap:6px; }
  .recipe-image img { border-radius:0; max-height:250px; }
  .recipe-desc { font-size:0.85em; }

  /* Recipe actions + share → horizontal slide */
  .recipe-actions, .share-bar { display:flex; overflow-x:auto; -webkit-overflow-scrolling:touch; scrollbar-width:none; flex-wrap:nowrap; gap:6px; padding-bottom:4px; }
  .recipe-actions::-webkit-scrollbar, .share-bar::-webkit-scrollbar { display:none; }
  .recipe-actions .btn { flex-shrink:0; font-size:0.75em; white-space:nowrap; padding:6px 10px; }
  .share-bar a, .share-bar button { flex-shrink:0; }

  /* Ingredient list → compact */
  .ingredient-list li { font-size:0.88em; padding:4px 0; }
  .ing-amount { font-size:0.85em; }

  /* Steps → compact */
  .recipe-steps ol li { font-size:0.88em; margin-bottom:8px; }
  .step-tip { font-size:0.8em; }

  /* Nutrition → horizontal scroll */
  .nutrition-grid { display:flex; overflow-x:auto; scrollbar-width:none; gap:8px; }
  .nutrition-grid::-webkit-scrollbar { display:none; }
  .nutrition-grid .nutrition-item { flex-shrink:0; min-width:70px; }

  /* Related recipes → always horizontal */
  .recipe-related .recipe-grid { display:flex !important; }

  /* Comments → compact */
  .comments-section .comment { padding:8px 0; }
  .comment-form textarea { font-size:0.85em; }

  /* Collections → horizontal */
  .collections-grid { display:flex; overflow-x:auto; scrollbar-width:none; gap:10px; }
  .collections-grid::-webkit-scrollbar { display:none; }
  .collections-grid .collection-card { flex-shrink:0; width:200px; }

  /* Shopping → compact */
  .shopping-section { margin-bottom:8px; }

  /* Planner → horizontal days */
  .planner-grid { display:flex; overflow-x:auto; scrollbar-width:none; gap:10px; }
  .planner-grid::-webkit-scrollbar { display:none; }
  .planner-day { flex-shrink:0; width:280px; }

  /* Footer → hide on mobile, bottom nav replaces */
  .site-footer { display:none; }

  /* Donate banner → compact */
  .donate-banner { padding:16px 12px; margin:8px 0; }
  .donate-banner h2 { font-size:1.1em; }
  .donate-banner p { font-size:0.82em; }
}

/* Fold 3 folded screen (416px) — extra compact */
@media (max-width:440px) {
  .recipe-grid .recipe-card { width:170px; }
  .recipe-grid .recipe-card .recipe-card-img img { height:115px; }
  .ai-feature-card { width:120px; padding:10px 8px; }
  .ai-feature-icon { font-size:1.3em; }
  .ai-feature-card h3 { font-size:0.75em; }
  .ai-feature-card p { display:none; } /* hide description, icon+title enough */
  .category-grid .category-card { padding:5px 10px; }
  .category-grid .category-icon { font-size:1.3em; }
  .category-grid .category-name { font-size:0.68em; }
  .hero { padding:16px 12px; margin:4px; }
  .hero h1 { font-size:1.15em; }
  .hero p { font-size:0.78em; }
  .section h2 { font-size:0.95em; }
  .filter-row select { font-size:0.7em; padding:4px 5px; }
  .collections-grid .collection-card { width:170px; }
  .planner-day { width:250px; }
  .browse-header h1 { font-size:1.1em; }
  .results-count { font-size:0.8em; }
  .bottom-nav-item { font-size:0.58em; padding:5px 8px; }
  .bottom-nav-item .bnav-icon { font-size:1.4em; }
}
/* Galaxy Z Fold 3 — unfolded inner display (884px wide) */
@media (min-width: 580px) and (max-width: 900px) {
  .section .recipe-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    overflow-x: visible;
  }
  .section .recipe-grid .recipe-card { width: auto; }
  .ai-features-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    overflow-x: visible;
  }
  .ai-feature-card { width: auto; }
  .category-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    overflow-x: visible;
  }
  .category-grid .category-card { min-width: auto; }
  main > .recipe-grid { grid-template-columns: repeat(3, 1fr); }
  .filter-row { flex-wrap: nowrap; }
}
