/* ---------- Base ---------- */

:root {
  --bg-light: #f0f6ff;
  --bg-dark: #121a2b;

  --text-light: #1b1f24;
  --text-dark: #e6edf7;

  --card-light: #ffffff;
  --card-dark: #1c2538;

  --border-light: #d0d9e8;
  --border-dark: #2a3550;

  --accent-light: #4f8ef7;
  --accent-dark: #7fb3ff;

  --radius: 10px;
  --shadow-light: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-dark: 0 2px 12px rgba(0,0,0,0.4);

  --font-body: 'Nunito', system-ui, sans-serif;
}

/* DARK MODE DEFAULT */
body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg-dark);
  color: var(--text-dark);
}

/* LIGHT MODE OVERRIDE */
body.theme-light {
  background: var(--bg-light);
  color: var(--text-light);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* ---------- Header ---------- */

.site-header {
  background: var(--card-dark);
  border-bottom: 1px solid var(--border-dark);
  backdrop-filter: blur(10px);
}

body.theme-light .site-header {
  background: var(--card-light);
  border-bottom: 1px solid var(--border-light);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.theme-toggle {
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border-dark);
  background: var(--card-dark);
  color: var(--text-dark);
  cursor: pointer;
}

body.theme-light .theme-toggle {
  border: 1px solid var(--border-light);
  background: var(--card-light);
  color: var(--text-light);
}

/* ---------- Search ---------- */

.search-section {
  margin: 1.5rem 0 1rem 0;
  display: flex;
}

#searchInput {
  width: 100%;
  max-width: 100%;
  padding: 0.8rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-dark);
  background: var(--card-dark);
  color: var(--text-dark);
  font-size: 1rem;
  box-sizing: border-box;
}

body.theme-light #searchInput {
  background: var(--card-light);
  border: 1px solid var(--border-light);
  color: var(--text-light);
}

/* ---------- Grid ---------- */

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

/* ---------- Collapse Mode (2 columns) ---------- */

.recipe-grid.collapse {
  grid-template-columns: 240px 1fr;
}

/* Viewer sits in column 2 */
.recipe-viewer {
  grid-column: 2;
}

/* ---------- Cards ---------- */

.recipe-card {
  background: var(--card-dark);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow-dark);
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;

  height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

body.theme-light .recipe-card {
  background: var(--card-light);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-light);
}

.recipe-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.12);
}

.recipe-card h3 {
  margin: 0 0 0.4rem;
  line-height: 1.2;
  max-height: 2.4em;
  overflow: hidden;
}

.recipe-card p {
  margin: 0.2rem 0;
  font-size: 0.9rem;
  line-height: 1.2;
  max-height: 2.4em;
  overflow: hidden;
}

.recipe-tags {
  font-size: 0.8rem;
  opacity: 0.7;
  margin-top: auto;
}

/* Hide cards except selected */
.card-hidden {
  display: none;
}

/* ---------- Viewer ---------- */

.recipe-viewer {
  background: var(--card-dark);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius);
  box-shadow: var(--shadow-dark);
  padding: 1.5rem;
}

body.theme-light .recipe-viewer {
  background: var(--card-light);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-light);
}

.hidden {
  display: none;
}

.recipe-viewer h2 {
  margin-top: 0;
}

.ingredients-list,
.method-list {
  padding-left: 1.2rem;
  margin-top: 0.5rem;
}

.method-list li {
  margin-bottom: 0.6rem;
}

/* ---------- Footer ---------- */

.site-footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-dark);
  font-size: 0.8rem;
  opacity: 0.7;
}

body.theme-light .site-footer {
  border-top: 1px solid var(--border-light);
}

/* ---------- Mobile ---------- */

@media (max-width: 600px) {
  .recipe-grid.collapse {
    grid-template-columns: 1fr;
  }

  .recipe-viewer {
    grid-column: 1;
  }

  .recipe-card {
    height: auto;
  }
}
