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

:root {
  --bg:         #0f0f1a;
  --bg2:        #1a1a2e;
  --bg3:        #16213e;
  --accent:     #e8a020;
  --accent2:    #f0c060;
  --red:        #c0392b;
  --text:       #e8e8f0;
  --muted:      #888;
  --radius:     10px;
  --font:       -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent2); }

/* ── Header ── */
header {
  background: var(--bg2);
  border-bottom: 2px solid var(--accent);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.02em;
}

nav { display: flex; gap: 1.5rem; }
nav a { color: var(--muted); font-weight: 500; transition: color 0.15s; }
nav a:hover, nav a.active { color: var(--accent); }

/* ── Main ── */
main {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* ── Typography ── */
h1 { font-size: 2rem; color: var(--accent); margin-bottom: 0.5rem; }
h2 { font-size: 1.3rem; color: var(--accent2); margin-bottom: 1rem; }
h3 { font-size: 1.1rem; margin-bottom: 0.5rem; }

.subtitle { color: var(--muted); margin-bottom: 1.5rem; }

/* ── Page Hero ── */
.page-hero {
  text-align: center;
  padding: 3rem 1rem;
}
.page-hero h1 { font-size: 2.5rem; }
.page-hero .subtitle { font-size: 1.1rem; margin-bottom: 2rem; }

.page-header { margin-bottom: 2rem; }

/* ── Buttons ── */
.btn {
  display: inline-block;
  padding: 0.55rem 1.3rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  transition: opacity 0.15s, transform 0.1s;
}
.btn:hover { opacity: 0.88; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary  { background: var(--accent);  color: #000; }
.btn-secondary { background: var(--bg3); color: var(--text); border: 1px solid #444; }
.btn-reveal   { background: var(--red);    color: #fff; }
.btn-large    { padding: 0.8rem 2rem; font-size: 1.1rem; }
.btn-danger   { background: rgba(192,57,43,0.2); color: #f88; border: 1px solid var(--red); }
.btn-danger:hover { background: rgba(192,57,43,0.4); }

.btn-icon {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.btn-icon:hover { color: var(--red); background: rgba(192,57,43,0.1); }

/* ── Cards ── */
.card-list { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.5rem; }

.card {
  background: var(--bg2);
  border: 1px solid #2a2a4a;
  border-radius: var(--radius);
  padding: 1.2rem 1.5rem;
}

.card-link { display: block; transition: border-color 0.15s, background 0.15s; }
.card-link:hover { border-color: var(--accent); background: var(--bg3); color: var(--text); }

.card-date { font-size: 0.85rem; color: var(--muted); margin-bottom: 0.6rem; }

.course-summary {
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
  margin-bottom: 0.25rem;
}
.course-label {
  font-weight: 600;
  color: var(--accent2);
  min-width: 80px;
  font-size: 0.9rem;
}
.course-ings { color: var(--text); font-size: 0.95rem; }

/* ── Badges ── */
.badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 20px;
  margin-left: 0.4rem;
  vertical-align: middle;
}
.badge-main       { background: rgba(232,160,32,0.2); color: var(--accent); }
.badge-cooldown-days { background: rgba(232,160,32,0.15); color: var(--accent); font-size: 0.7rem; }
.badge-on-cooldown   { background: rgba(192,57,43,0.2);  color: #f88; }
.badge-ai         { background: rgba(100,100,220,0.25); color: #aaf; }
.badge-revealed   { background: rgba(40,180,80,0.2); color: #6f6; margin-top: 0.5rem; }
.badge-unrevealed { background: rgba(192,57,43,0.2); color: #f88; margin-top: 0.5rem; }

/* ── Stats ── */
.stats-bar {
  display: flex;
  gap: 2rem;
  margin-bottom: 2.5rem;
  justify-content: center;
}
.stat { text-align: center; }
.stat-number { display: block; font-size: 2.5rem; font-weight: 700; color: var(--accent); }
.stat-label  { font-size: 0.85rem; color: var(--muted); }

/* ── Section ── */
.section { margin-bottom: 2.5rem; }

/* ── Forms ── */
.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  background: var(--bg2);
  padding: 1.2rem;
  border-radius: var(--radius);
}

.generate-form {
  background: var(--bg2);
  padding: 1.5rem;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.form-group { display: flex; flex-direction: column; gap: 0.5rem; }
.form-group label { color: var(--accent2); font-weight: 600; }

input[type=text], select, textarea {
  background: var(--bg3);
  border: 1px solid #333;
  color: var(--text);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  font-family: var(--font);
}
input[type=text]:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}

input[type=range] {
  accent-color: var(--accent);
  width: 200px;
}

textarea { resize: vertical; width: 100%; }

.checkbox-group { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  color: var(--text);
}
.checkbox-label input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }

/* ── Ingredients List ── */
.category-group { margin-bottom: 1.5rem; }
.category-heading {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.5rem;
  border-bottom: 1px solid #2a2a4a;
  padding-bottom: 0.3rem;
}
.ingredient-items { display: flex; flex-direction: column; gap: 0.3rem; }

.ingredient-item {
  background: var(--bg2);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #2a2a4a;
  transition: border-color 0.15s;
}
.ingredient-item[open] { border-color: var(--accent); }

.ingredient-summary {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.ingredient-summary::-webkit-details-marker { display: none; }
.ingredient-summary:hover { background: var(--bg3); }
.ing-name { flex: 1; font-size: 0.95rem; }

/* Detail panel */
.ingredient-detail {
  display: flex;
  gap: 1.2rem;
  padding: 1rem 1rem 1rem 0.75rem;
  border-top: 1px solid #2a2a4a;
  background: var(--bg3);
}
.detail-image { flex-shrink: 0; }
.detail-img {
  width: 100px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}
.detail-img-placeholder {
  width: 100px;
  height: 80px;
  background: var(--bg2);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}
.detail-fields { flex: 1; display: flex; flex-direction: column; gap: 0.75rem; }
.detail-row { display: flex; flex-direction: column; gap: 0.25rem; }
.detail-row label { font-size: 0.8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.img-url-row { display: flex; gap: 0.5rem; }
.img-url-row input { flex: 1; font-size: 0.85rem; }
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.85rem; }

/* ── Photo Options (multi-image chooser) ── */
.img-options-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.img-option {
  width: 80px;
  height: 64px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid transparent;
  opacity: 0.7;
  transition: opacity 0.15s, border-color 0.15s;
}
.img-option:hover { opacity: 1; border-color: var(--accent2); }
.img-option.img-option-active { opacity: 1; border-color: var(--accent); }
.ing-name { flex: 1; }

.basket-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.basket-header h2 { margin-bottom: 0; }
.label-hint { font-size: 0.8rem; color: var(--muted); font-weight: 400; margin-left: 0.4rem; }

/* ── Basket ── */
.basket-course {
  background: var(--bg2);
  border-radius: var(--radius);
  padding: 1.2rem 1.5rem;
  margin-bottom: 1rem;
}
.basket-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0.75rem;
}
.ingredient-card {
  background: var(--bg3);
  border-radius: var(--radius);
  overflow: hidden;
  width: 130px;
  text-align: center;
  border: 1px solid #2a2a4a;
  transition: border-color 0.15s;
}
.ingredient-card.ai-added { border-color: #44f; }
.ingredient-card:hover { border-color: var(--accent); }
.ingredient-img {
  width: 130px;
  height: 100px;
  object-fit: cover;
  display: block;
}
.ingredient-img-placeholder {
  width: 130px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  background: var(--bg2);
}
.ingredient-card-name {
  padding: 0.4rem 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.3;
}

/* ── Ingredient thumbnail (ingredients page) ── */
.ing-thumb {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}
.ing-thumb-placeholder {
  width: 36px;
  height: 36px;
  background: var(--bg3);
  border-radius: 4px;
  flex-shrink: 0;
}

/* Legacy list view (history/night pages) */
.basket-ingredients {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.5rem;
}
.basket-ingredients li {
  padding: 0.4rem 0.75rem;
  background: var(--bg3);
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.basket-ingredients li.ai-added { border-left: 3px solid #88f; }

/* ── Reveal ── */
.reveal-area {
  text-align: center;
  padding: 2rem;
  background: var(--bg2);
  border-radius: var(--radius);
  border: 1px dashed var(--red);
  margin-top: 1.5rem;
}
.reveal-hint { color: var(--muted); margin-bottom: 1rem; }

.suggestion-card {
  background: var(--bg3);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.2rem 1.5rem;
  margin-bottom: 1rem;
}
.suggestion-card h3 { color: var(--accent2); margin-bottom: 0.5rem; }
.suggestion-card em { color: var(--accent); font-style: normal; font-weight: 700; }

/* ── Callout ── */
.callout {
  border-radius: var(--radius);
  padding: 0.85rem 1.2rem;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}
.callout-info  { background: rgba(232,160,32,0.1); border-left: 4px solid var(--accent); }
.callout-error { background: rgba(192,57,43,0.1);  border-left: 4px solid var(--red); color: #f88; }

/* ── Star Rating ── */
.star-row { display: flex; gap: 0.3rem; margin: 0.5rem 0; }
.star-btn {
  background: none;
  border: none;
  font-size: 2rem;
  color: #444;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.1s, transform 0.1s;
}
.star-btn:hover, .star-btn.star-on { color: var(--accent); }
.star-btn:active { transform: scale(1.2); }

.rating-card {
  background: var(--bg2);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-top: 1rem;
  text-align: center;
  border: 1px solid #2a2a4a;
}
.rating-card h2 { margin-bottom: 0.5rem; }
.rating-card .star-row { justify-content: center; }

/* ── Cuisine badge ── */
.badge-cuisine {
  background: rgba(100,180,100,0.15);
  color: #8d8;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
}

/* ── Card meta row ── */
.card-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
}
.card-date { font-size: 0.85rem; color: var(--muted); }
.card-stars { color: var(--accent); font-size: 0.9rem; letter-spacing: 0.05em; }

.page-header-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

/* ── Misc ── */
.admin-bar { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.muted-msg { color: var(--muted); font-size: 0.9rem; }
.link-subtle { color: var(--muted); font-size: 0.9rem; }
.link-subtle:hover { color: var(--accent); }

.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--muted);
}

/* ── Mobile ── */
@media (max-width: 600px) {
  .header-inner { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  nav { gap: 1rem; }
  h1 { font-size: 1.6rem; }
  .page-hero h1 { font-size: 2rem; }
  .inline-form { flex-direction: column; align-items: stretch; }
}
