@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700&display=swap');

/* ---------- GLOBAL THEME ---------- */
:root{
  --brand:#c55e24;      
  --brand-dark:#9c481c;   
  --text:#332c26;         
  --muted:#746b63;        
  --bg:#faf6f1;          
  --card:#ffffff;         
  --border:#e4dcd3;       
  --accent:#5a8c5a;       
  --shadow:0 10px 30px rgba(90, 60, 30, .08);
}

*{ box-sizing:border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Manrope", "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

h1, h2, h3 {
  letter-spacing: -0.01em;
}

/* ---------- LAYOUT HELPERS ---------- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}
.mealplanner.container {
  max-width: 1200px;
}

.small { font-size: .9rem; }
.muted { color: var(--muted); }

/* ---------- NAV / HEADER ---------- */
.topbar {
  background: var(--card);
  border-bottom: 2px solid var(--border);
  box-shadow: 0 2px 6px rgba(140, 100, 50, .08);
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--brand-dark);
}

.nav-links a {
  margin-left: 16px;
  text-decoration: none;
  font-weight: 500;
  color: var(--text);
}

.nav-links a:hover {
  color: var(--brand);
}

/* Header buttons keep readable text on hover */
.nav .btn-primary,
.nav .btn-primary:hover {
  color: #fff;
}

.nav .btn-secondary {
  color: var(--brand);
}

.nav .btn-secondary:hover {
  color: #fff;
}

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  border: 1px solid var(--border);
  transition: transform .1s ease-in-out;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1.2;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand-dark);
}

.btn-primary:hover {
  background: var(--brand-dark);
  transform: translateY(-1px);
}

.btn-secondary {
  background: #fff;
  color: var(--brand);
  border-color: var(--brand);
}

.btn-secondary:hover {
  background: var(--brand);
  color: #fff;
  transform: translateY(-1px);
}

.btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(197,94,36,.2);
}

button.btn {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--border);
}

.btn-ghost {
  background: transparent;
  color: var(--brand);
  border: 1px solid var(--border);
  padding: 8px 10px;
  border-radius: 8px;
}

.btn-ghost:hover {
  background: rgba(197,94,36,.08);
  color: var(--brand-dark);
}

/* ---------- LANDING PAGE CONTENT ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 30px;
  padding: 40px 0;
}

.hero-text h1 {
  font-size: 2.4rem;
  margin: 0 0 12px;
  color: var(--brand-dark);
}

.cta-row {
  display: flex;
  gap: 16px;
  margin-top: 16px;
}

.hero-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 4px 12px rgba(90, 60, 30, .12);
}

.bullets {
  margin: 8px 0 12px 18px;
}

/* ---------- FEATURE CARDS ---------- */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 18px;
  margin: 32px 0 48px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 4px 12px rgba(90, 60, 30, .08);
}

.card h3 {
  margin: 8px 0;
  color: var(--brand-dark);
}

/* ---------- LOGIN PAGE ---------- */
.auth {
  display: grid;
  place-items: center;
  min-height: 70vh;
}

.auth-card {
  max-width: 420px;
  width: 100%;
}

.form {
  display: grid;
  gap: 14px;
}

label { display: grid; gap: 4px; }

input, textarea, select {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease, transform .08s ease;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(197,94,36,.15);
  outline: none;
  transform: translateY(-1px);
}

.eyebrow {
  letter-spacing: .14rem;
  text-transform: uppercase;
  font-weight: 700;
  font-size: .8rem;
}

/* ---------- RECIPES LIST ---------- */
.recipes {
  padding: 30px 0 50px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 10px 0 20px;
}

.page-header h1 {
  margin: 6px 0 4px;
  color: var(--brand-dark);
}

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.recipe-card {
  display: grid;
  gap: 12px;
}

.recipe-card__body h3 {
  margin: 8px 0 6px;
  color: var(--text);
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.pill {
  background: rgba(197,94,36,.1);
  color: var(--brand-dark);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: .9rem;
}

.recipe-card__actions {
  display: flex;
  gap: 10px;
}

.empty-state {
  text-align: center;
  display: grid;
  gap: 10px;
  justify-items: center;
}

.recipe-detail {
  padding: 30px 0 50px;
  display: grid;
  gap: 18px;
}

.back-link {
  text-decoration: none;
  color: var(--brand);
  font-weight: 600;
}

.back-link:hover { color: var(--brand-dark); }

.recipe-hero {
  display: grid;
  gap: 12px;
}

.recipe-hero h1 {
  margin: 6px 0;
  color: var(--brand-dark);
}

.recipe-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.recipe-section {
  display: grid;
  gap: 10px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.bullet-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.ingredient-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(197,94,36,.05), rgba(197,94,36,.02));
}

.ingredient-name { font-weight: 700; }
.ingredient-qty { color: var(--muted); text-align: right; min-width: 90px; }

.ingredient-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ingredient-form {
  display: grid;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.ingredient-form__fields {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 12px;
}

.ingredient-form input,
.ingredient-form select {
  width: 100%;
}

.ingredient-form input[list] {
  appearance: none;
}

.form-grid {
  display: grid;
  gap: 14px;
  max-width: 720px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 999;
}

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

.modal-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  box-shadow: var(--shadow);
  max-width: 520px;
  width: 100%;
}

.step-list {
  padding-left: 20px;
  margin: 0;
  display: grid;
  gap: 12px;
}

.step-title {
  font-weight: 700;
  color: var(--brand-dark);
}

.alert {
  background: #fff7f3;
  border: 1px solid #f4c7a7;
}

.notice {
  background: #f0fbf4;
  border: 1px solid #b6e3c6;
}

/* ---------- MEAL PLANNER ---------- */
.mealplanner {
  padding: 30px 0 50px;
  display: grid;
  gap: 18px;
}

.plan-grid {
  display: grid;
  gap: 16px;
}

.plan-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.plan-card__actions {
  display: grid;
  gap: 8px;
}

.plan-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.plan-days {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

.plan-day {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: linear-gradient(135deg, rgba(197,94,36,.04), rgba(197,94,36,.01));
}

.plan-day__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.plan-day__date {
  font-weight: 700;
  color: var(--brand-dark);
}

.meal-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: grid;
  gap: 10px;
}

.meal-line {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
}

.meal-line.js-recipe-entry {
  cursor: pointer;
}

.meal-line.js-recipe-entry:hover {
  border-color: var(--brand);
  box-shadow: 0 3px 10px rgba(197,94,36,.12);
}

.meal-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(197,94,36,.1);
  display: grid;
  place-items: center;
  font-size: .9rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}

.meal-line__info {
  flex: 1;
  display: grid;
  gap: 4px;
}

.meal-line__title {
  font-weight: 700;
  color: var(--text);
  font-size: .9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meal-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.calendar {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  padding: 12px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(140px, 1fr));
  gap: 10px;
}

.calendar-day {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(197,94,36,.03), rgba(197,94,36,.01));
  padding: 10px;
  display: grid;
  gap: 8px;
}

.calendar-day__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.calendar-day__dow {
  font-weight: 700;
  color: var(--brand-dark);
}

.calendar-day__dot {
  min-width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(197,94,36,.1);
  color: var(--brand-dark);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: .9rem;
  border: 1px solid var(--border);
}

.calendar-day__body {
  display: grid;
  gap: 8px;
}

/* ---------- FOOTER ---------- */
.footer {
  border-top: 1px solid var(--border);
  padding: 20px 0;
  margin-top: 40px;
  text-align: center;
  background: var(--card);
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .recipe-card__actions { flex-direction: column; }
  .section-header { flex-direction: column; }
  .ingredient-line { flex-direction: column; gap: 4px; }
  .recipe-actions { flex-direction: column; align-items: flex-start; }
  .plan-card__header { flex-direction: column; }
  .plan-card__actions { width: 100%; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .plan-day__header { align-items: flex-start; }
  .meal-line { flex-direction: column; }
  .meal-actions { width: 100%; }
  .calendar-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
}

@media (max-width: 700px) {
  .ingredient-form__fields {
    grid-template-columns: 1fr;
  }
}
