/* ============================================================
   ONIONARY — Design System
   Light mode · Orange & Green accents · Warm & organic feel
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

/* ── Tokens ─────────────────────────────────────────────────── */
:root {
  /* warm cream background */
  --bg:           #FDF6EC;
  --bg-card:      #FFFFFF;
  --bg-surface:   #FFF8F0;
  --bg-muted:     #F5EDE1;

  /* text */
  --text:         #2D2A26;
  --text-muted:   #7A7267;
  --text-light:   #A69D92;

  /* orange accent — warm, appetizing */
  --orange:       #E8722A;
  --orange-light: #F5A35C;
  --orange-pale:  #FDE8D4;
  --orange-dark:  #C45A1A;

  /* green accent — fresh, natural */
  --green:        #4A9C5F;
  --green-light:  #7BC88D;
  --green-pale:   #DFF2E3;
  --green-dark:   #367B48;

  /* misc */
  --border:       #E8DFD3;
  --shadow-sm:    0 1px 3px rgba(45,42,38,0.06);
  --shadow-md:    0 4px 16px rgba(45,42,38,0.08);
  --shadow-lg:    0 8px 32px rgba(45,42,38,0.12);
  --radius-sm:    8px;
  --radius-md:    14px;
  --radius-lg:    22px;
  --radius-pill:  999px;

  /* typography */
  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body:    'DM Sans', -apple-system, system-ui, sans-serif;
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* ── Subtle texture background ──────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    radial-gradient(circle at 20% 20%, var(--orange-pale) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, var(--green-pale) 0%, transparent 50%);
  opacity: 0.4;
}

/* ── Layout ─────────────────────────────────────────────────── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Navigation ─────────────────────────────────────────────── */
.top-nav {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.nav-links {
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 1;
}

.nav-auth-mount {
  margin-left: auto;
}

.lang-switcher {
  margin-left: auto;
  padding: 4px 8px;
  border-radius: var(--radius-sm, 6px);
  border: 1px solid var(--border);
  background: var(--bg-soft);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s ease;
}

.lang-switcher:focus,
.lang-switcher:hover {
  border-color: var(--orange-dark);
}

.burger-btn {
  display: none;
  background: none;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1.4rem;
  width: 40px;
  height: 40px;
  padding: 0;
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
}

.burger-btn:hover {
  background: var(--orange-pale);
  color: var(--orange-dark);
  border-color: var(--orange-light);
}

.nav-link {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.nav-link:hover {
  background: var(--bg-surface);
  color: var(--orange-dark);
}

.nav-link.active {
  color: var(--orange-dark);
  background: var(--orange-pale);
}

/* ── Header ─────────────────────────────────────────────────── */
.site-header {
  padding: 28px 0 20px;
  text-align: center;
  position: relative;
}

.site-header h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.2rem);
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.site-header h1 .accent-orange { color: var(--orange); }
.site-header h1 .accent-green  { color: var(--green); }

.site-header .tagline {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-top: 6px;
  font-weight: 400;
}

/* ── Controls Panel ─────────────────────────────────────────── */
.controls {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  box-shadow: var(--shadow-md);
  margin: 24px 0 32px;
}

.controls-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  align-items: end;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 0 auto;
  min-width: 160px;
}

.control-group label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.control-group input[type="number"],
.control-group input[type="text"],
.control-group input[type="url"],
.control-group input[type="email"],
.control-group input[type="password"],
.control-group textarea,
.control-group select {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.95rem;
  background: var(--bg-surface);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  width: 100%;
}

.control-group input:focus,
.control-group textarea:focus,
.control-group select:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-pale);
}

.control-group textarea {
  resize: vertical;
  min-height: 120px;
}

/* Tag pills */
.tag-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-surface);
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.tag-pill:hover {
  border-color: var(--green-light);
  color: var(--green-dark);
}

.tag-pill.active {
  background: var(--green-pale);
  border-color: var(--green);
  color: var(--green-dark);
  font-weight: 600;
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border: none;
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--orange), var(--orange-dark));
  color: #FFF;
  box-shadow: 0 4px 14px rgba(232,114,42,0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(232,114,42,0.45);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  border-color: var(--orange-light);
  color: var(--orange);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.82rem;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
  font-size: 1.1rem;
  background: var(--bg-surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-icon:hover {
  background: var(--orange-pale);
  color: var(--orange);
  border-color: var(--orange-light);
}

.controls-actions {
  display: flex;
  gap: 12px;
  align-items: end;
  margin-top: 18px;
}

/* ── Section headers ────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-header h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--text);
}

.section-header .badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--orange-pale);
  color: var(--orange-dark);
  margin-left: 10px;
}

/* ── Search Bar ─────────────────────────────────────────────── */
.search-input {
  width: 100%;
  padding: 12px 18px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 0.95rem;
  background: var(--bg-card);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.search-input:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-pale);
}

.search-input::placeholder {
  color: var(--text-light);
}

/* ── Recipe Cards ───────────────────────────────────────────── */
.recipes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
  margin-bottom: 40px;
}

.recipe-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.25s, transform 0.25s;
  position: relative;
  animation: cardIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.recipe-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.recipe-card.cooked-card {
  opacity: 0.55;
  filter: grayscale(60%);
  background: var(--bg-surface);
}

.recipe-card-header {
  padding: 18px 20px 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.recipe-card-header h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  line-height: 1.25;
  flex: 1;
  margin-right: 10px;
}

.recipe-card-meta {
  display: flex;
  gap: 12px;
  padding: 0 20px 12px;
  flex-wrap: wrap;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--text-muted);
  background: var(--bg-muted);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

.meta-chip .icon { font-size: 0.9rem; }

.recipe-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 20px 14px;
}

.recipe-tag {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  background: var(--green-pale);
  color: var(--green-dark);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.recipe-card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
}

/* ── Expandable steps ───────────────────────────────────────── */
.recipe-steps-toggle {
  font-size: 0.82rem;
  color: var(--orange);
  cursor: pointer;
  font-weight: 600;
  background: none;
  border: none;
  font-family: var(--font-body);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.recipe-steps-toggle:hover { text-decoration: underline; }

.recipe-steps {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.recipe-steps.open {
  max-height: 500px;
}

.recipe-steps-inner {
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border);
}

.step-item {
  display: flex;
  gap: 10px;
  padding: 6px 0;
  font-size: 0.88rem;
  line-height: 1.5;
}

.step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--orange-pale);
  color: var(--orange-dark);
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.step-dur {
  color: var(--text-light);
  font-size: 0.78rem;
  margin-left: auto;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Shopping List ──────────────────────────────────────────── */
.shopping-section {
  margin-bottom: 48px;
}

.shopping-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.shopping-card-header {
  padding: 20px 24px;
  background: linear-gradient(135deg, var(--green-pale), #f0faf2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.shopping-card-header h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--green-dark);
  margin: 0;
}

.btn-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(86, 155, 110, 0.15); /* light green border */
  color: var(--green-dark);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-copy:hover {
  background: #FFF;
  border-color: rgba(86, 155, 110, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(86, 155, 110, 0.1);
}

.btn-copy:active {
  transform: translateY(0);
}

.shopping-list {
  list-style: none;
  padding: 8px 0;
}

.shopping-item {
  display: flex;
  align-items: center;
  padding: 10px 24px;
  gap: 12px;
  font-size: 0.92rem;
  transition: background 0.15s;
}

.shopping-item:hover {
  background: var(--bg-surface);
}

.shopping-item .checkbox {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: transparent;
  font-size: 0.75rem;
}

.shopping-item .checkbox:hover {
  border-color: var(--green);
}

.shopping-item .checkbox.checked {
  background: var(--green);
  border-color: var(--green);
  color: #FFF;
}

.shopping-item.checked-item .item-name {
  text-decoration: line-through;
  color: var(--text-light);
}

.shopping-item .item-qty {
  font-weight: 600;
  color: var(--orange-dark);
  min-width: 60px;
}

.shopping-item .item-name {
  flex: 1;
}

/* ── Empty states ───────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.empty-state .icon {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 1.05rem;
  max-width: 420px;
  margin: 0 auto;
}

/* ── Modals & Forms ─────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(45, 42, 38, 0.4);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  animation: modalIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-lg { max-width: 800px; }
.modal-sm { max-width: 400px; }

@keyframes modalIn {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--text);
  margin: 0;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Modal Form Specifics */
.form-row {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.add-tag-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  align-items: center;
}

.add-tag-row input {
  padding: 6px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.85rem;
  background: var(--bg-surface);
  color: var(--text);
  flex: 1;
  max-width: 180px;
  outline: none;
}

.add-tag-row input:focus {
  border-color: var(--orange);
}

.list-editor {
  margin-top: 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 16px;
  border-radius: var(--radius-md);
}

.list-editor h3 {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.editor-row {
  display: flex;
  gap: 12px;
  margin-bottom: 10px;
  align-items: flex-start;
}

.editor-row input {
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.9rem;
  background: var(--bg-card);
  outline: none;
}
.editor-row input:focus { border-color: var(--green); }

/* ── Loading spinner ────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2.5px solid var(--border);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Footer ─────────────────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 32px 0;
  color: var(--text-light);
  font-size: 0.82rem;
  border-top: 1px solid var(--border);
  margin-top: 24px;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* ── Burger menu ─────────────────────────────── */
  .burger-btn {
    display: flex;
    position: relative;
    z-index: 101;
  }

  .nav-auth-mount {
    position: relative;
    z-index: 101;
  }

  .nav-container {
    flex-wrap: nowrap;
  }

  .nav-links {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-card);
    z-index: 90;
    flex-direction: column;
    align-items: flex-start;
    padding: 84px 24px 32px;
    gap: 16px;
    border-top: none;
    overflow-y: auto;
    margin-top: 0;
  }

  .nav-links.open {
    display: flex;
    animation: menuIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }

  @keyframes menuIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .nav-links .nav-link {
    font-family: var(--font-display);
    padding: 8px 0;
    border-radius: 0;
    font-size: 2.2rem;
    font-weight: 700;
    border-bottom: none;
    text-transform: uppercase;
    color: var(--text);
    width: 100%;
    line-height: 1.1;
  }

  .nav-links .nav-link:hover,
  .nav-links .nav-link.active {
    background: transparent;
    color: var(--orange-dark);
  }

  .nav-auth-mount {
    margin-left: auto;
    padding: 0;
    border-top: none;
    width: auto;
  }

  .nav-links .lang-switcher {
    margin-left: 0;
    margin-top: 16px;
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    border: none;
    font-family: var(--font-display);
    font-size: 2.2rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text);
    padding: 8px 0;
    width: 100%;
    cursor: pointer;
  }

  .nav-links .lang-switcher:focus,
  .nav-links .lang-switcher:active {
    color: var(--orange-dark);
    outline: none;
    background: transparent;
  }

  /* ── Layout ─────────────────────────────────── */
  .container {
    padding: 0 16px;
  }

  .site-header {
    padding: 20px 0 14px;
  }

  .site-header h1 {
    font-size: 1.6rem;
  }

  .site-header .tagline {
    font-size: 0.9rem;
  }

  /* ── Controls panel ─────────────────────────── */
  .controls {
    padding: 20px 18px;
    border-radius: var(--radius-md);
  }

  .controls-row {
    flex-direction: column;
  }

  .control-group {
    min-width: 0;
  }

  /* Remove max-width overrides on mobile */
  .controls-row .control-group {
    max-width: none !important;
  }

  .controls-actions {
    flex-direction: column;
  }

  .controls-actions .btn {
    width: 100%;
  }

  /* ── Recipe grid ────────────────────────────── */
  .recipes-grid {
    grid-template-columns: 1fr;
  }

  /* ── Section header (Manage Recipes page) ──── */
  .section-header {
    gap: 12px;
  }

  .section-header > div {
    flex-wrap: wrap;
    gap: 10px;
  }

  .section-header .btn {
    font-size: 0.85rem;
    padding: 10px 18px;
  }

  /* ── Modals on mobile ───────────────────────── */
  .modal-overlay {
    padding: 12px;
    align-items: flex-start;
    padding-top: 24px;
  }

  .modal {
    max-height: 85vh;
    border-radius: var(--radius-md);
  }

  .modal-lg {
    max-width: 100%;
  }

  .modal-header {
    padding: 16px 18px;
  }

  .modal-header h2 {
    font-size: 1.2rem;
  }

  .modal-body {
    padding: 16px 18px;
  }

  .modal-footer {
    padding: 12px 18px;
    flex-wrap: wrap;
  }

  .modal-footer .btn {
    flex: 1;
    min-width: 120px;
  }

  /* ── Form rows inside modals ────────────────── */
  .form-row {
    flex-direction: column;
    gap: 12px;
  }

  .form-row .control-group {
    flex: none !important;
    width: 100%;
  }

  /* ── Editor rows (ingredients / steps) ──────── */
  .editor-row {
    flex-wrap: wrap;
    gap: 8px;
  }

  .editor-row input {
    min-width: 0;
    font-size: 0.85rem;
  }

  /* Ingredient rows: name full-width, qty+unit+delete on second line */
  .editor-row.ingredient-row {
    flex-wrap: wrap;
  }

  .editor-row.ingredient-row input.ing-name {
    flex: 1 1 100% !important;
    width: 100%;
  }

  .editor-row.ingredient-row input.ing-qty {
    flex: 1 1 0 !important;
    max-width: none;
  }

  .editor-row.ingredient-row input.ing-unit {
    flex: 1 1 0 !important;
    max-width: none;
  }

  /* Step rows: description full-width, time+delete on second line */
  .editor-row.step-row {
    flex-wrap: wrap;
  }

  .editor-row.step-row input.step-desc {
    flex: 1 1 100% !important;
    width: 100%;
  }

  .editor-row.step-row input.step-dur {
    max-width: none !important;
    flex: 1 1 0;
  }

  .list-editor {
    padding: 12px;
  }

  .list-editor h3 {
    font-size: 0.82rem;
  }

  /* ── Import panel ───────────────────────────── */
  #import-panel {
    padding: 14px !important;
  }

  #import-panel .form-row {
    flex-direction: column;
  }

  #import-panel .control-group {
    flex: none !important;
  }

  /* ── Tag selector / pills ───────────────────── */
  .tag-selector {
    gap: 6px;
  }

  .tag-pill {
    font-size: 0.78rem;
    padding: 5px 10px;
  }

  .add-tag-row {
    flex-wrap: wrap;
  }

  .add-tag-row input {
    max-width: none;
    flex: 1;
  }

  /* ── Toast ──────────────────────────────────── */
  .toast {
    left: 16px;
    right: 16px;
    bottom: 16px;
    text-align: center;
  }

  /* ── Shopping list ──────────────────────────── */
  .shopping-item {
    padding: 10px 16px;
  }

  .shopping-card-header {
    padding: 16px 18px;
  }

  .btn-copy .btn-text {
    display: none;
  }

  .btn-copy {
    padding: 6px 8px; /* Tighter padding for icon-only button */
  }

  /* ── Recipe card footer buttons ─────────────── */
  .recipe-card-footer {
    padding: 10px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .recipe-card-footer .btn {
    font-size: 0.78rem;
    padding: 6px 12px;
  }
}

/* ── Notification toast ─────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--text);
  color: #FFF;
  padding: 14px 22px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1000;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* ── Household Cards ───────────────────────────────────────── */
.hh-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
  margin-bottom: 48px;
}

.hh-card {
  position: relative;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.3s, transform 0.3s, border-color 0.3s;
  animation: cardIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.hh-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.hh-card--active {
  border-color: var(--green);
  box-shadow: 0 4px 20px rgba(74, 156, 95, 0.15);
}

.hh-card--active:hover {
  box-shadow: 0 6px 28px rgba(74, 156, 95, 0.22);
}

.hh-card-glow {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--border);
  transition: background 0.3s;
}

.hh-card--active .hh-card-glow {
  background: linear-gradient(90deg, var(--green), var(--green-light));
}

.hh-card-content {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px 24px 16px;
}

.hh-card-icon {
  font-size: 2.2rem;
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-muted);
  border-radius: var(--radius-md);
}

.hh-card--active .hh-card-icon {
  background: var(--green-pale);
}

.hh-card-info {
  flex: 1;
  min-width: 0;
}

.hh-card-name {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--text);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hh-card-id {
  font-size: 0.78rem;
  color: var(--text-light);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.hh-badge {
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
  flex-shrink: 0;
}

.hh-badge--active {
  background: var(--green-pale);
  color: var(--green-dark);
  border: 1px solid var(--green-light);
}

.hh-card-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-top: 1px solid var(--border);
}

.hh-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
  animation: dotPulse 2s ease-in-out infinite;
}

@keyframes dotPulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(74, 156, 95, 0.4); }
  50%      { opacity: 0.7; box-shadow: 0 0 0 6px rgba(74, 156, 95, 0); }
}

.hh-switch-btn {
  flex-shrink: 0;
}

.hh-leave-btn:hover {
  border-color: #d32f2f !important;
  color: #d32f2f !important;
}

@media (max-width: 640px) {
  .hh-grid { grid-template-columns: 1fr; }
  .hh-card-content { padding: 18px 16px 12px; }
  .hh-card-footer { padding: 10px 16px; }
}

/* Onionary palette follows the device appearance across the whole web kitchen. */
:root { color-scheme: light dark; --orange: #7a3057; --orange-dark: #642244; --orange-light: #ab6286; --orange-pale: #f5e0e9; }
@media (prefers-color-scheme: dark) {
  :root { --bg: #211b20; --bg-card: #2b242a; --bg-surface: #352c33; --bg-muted: #40333c;
    --text: #f7eee4; --text-muted: #d0bdc8; --text-light: #baa3b1; --border: #67505e;
    --orange: #f5a6c9; --orange-dark: #ffc4dc; --orange-light: #f5a6c9; --orange-pale: #492b3c;
    --green: #9fd4a4; --green-dark: #b5e4b9; --green-pale: #253c2a; }
  .btn-primary { color: #321523; }
  input, textarea, select { background: var(--bg-card); color: var(--text); }
}
