/* ══════════════════════════════════════════════════════════════════════════
   03-responsive-print.css — PlantPure Kitchen stylesheet 3 of 6
   Extracted verbatim from index.html lines 1341-1682 (baseline fa8b59c).
   Contents: the comprehensive ≤640px mobile/responsive system (including
   the first duplicated Chef-Kim mobile override with its !important
   position fix), @media print, grocery satellite rules, equipment list.

   DO NOT REORDER these six CSS files, their <link> tags in index.html, or
   any rules within them: the cascade depends on source order. Do not edit
   or reformat the rules below — scripts/check-css.mjs byte-compares the
   concatenation of all six files (headers stripped) in <link> order
   against baseline fa8b59c lines 28-3410.
   ─── end header — verbatim baseline CSS begins on the next line ─── */
@media (max-width: 640px) {

  /* Font size — larger for readability */
  body { font-size: 17px; }
  .section-header h2 { font-size: 1.6rem; }
  .section-header p { font-size: 1rem; }

  /* Header — logo only, no title text */
  .header-titles { display: none; }
  /* PPK-1.1.16 — ROOT CAUSE FIX: Base .header-inner has padding: 1.2rem 2rem
     (32px horizontal). The gear's `position:absolute; right:4px` was anchoring
     to .header-inner (the positioned ancestor), but .header-inner's right edge
     sits 32px INSIDE the screen edge due to that padding. Result: gear was
     ~36px from the screen edge — right next to the centered logo.
     Fix: zero out horizontal padding on mobile so the gear's right:4px
     actually means 4px from the screen's right edge. */
  .header-inner {
    justify-content: center;
    padding-left: 0 !important;
    padding-right: 0 !important;
    /* Keep the taller header band on mobile — the slim desktop padding (set
       inline for the narrower desktop banner) is too tight for the top
       controls next to the notch on a phone. Restores the prior height. */
    padding-top: 1.1rem !important;
    padding-bottom: 1.5rem !important;
  }

  /* Hide the desktop nav entirely on mobile */
  .nav-bar { display: none; }

  /* PPK-1.1.7 — Mobile-only Admin button. PPK-1.1.15: restored. */
  .mobile-header-admin { display: block !important; }
  /* PPK-1.2.2 — Mobile-only Log in button, mirrors the gear's visibility so it
     always shows in the header on phones (the desktop login lives in .nav-bar,
     which is hidden on mobile). */
  .mobile-header-login { display: inline-flex !important; align-items: center; }
  /* PPK-1.1.15 — Shrink the logo on mobile to leave clear visual
     separation between the logo and the gear icon on the right. */
  .header img { height: 22px !important; }

  /* Mobile nav wrap — hidden on desktop, shown on mobile */
  .mobile-nav-wrap { display: block; }

  /* Mobile product bar */
  .mobile-product-bar {
    display: flex;
    background: var(--terra-deeper);
  }
  .mobile-product-tab {
    flex: 1;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: rgba(255,255,255,0.65);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    padding: 0.9rem 0.5rem;
    cursor: pointer;
    transition: all 0.15s;
  }
  .mobile-product-tab.active { color: white; border-bottom-color: #90CAE8; background: rgba(255,255,255,0.06); }
  .mobile-settings-tab { flex: 0 0 52px; font-size: 1.15rem; }
  .mobile-home-btn {
    flex: 1;
    background: none;
    border: none;
    color: rgba(255,255,255,0.9);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    padding: 0.9rem 1rem;
    cursor: pointer;
    text-align: left;
    letter-spacing: 0.01em;
  }
  .mm-section-label {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--terra);
    padding: 0.75rem 0 0.35rem;
    border-top: 1px solid var(--border);
    margin-top: 0.25rem;
  }
  .mm-section-label:first-child { border-top: none; margin-top: 0; padding-top: 0.25rem; }

  /* Mobile menu */
  .mobile-menu { background: var(--cream); padding: 0.75rem 1rem 1rem; }
  .mobile-menu-hidden { display: none; }
  .mobile-menu-btn {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    width: 100%;
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.1rem;
    margin-bottom: 0.55rem;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    box-shadow: 0 1px 4px rgba(107,37,16,0.07);
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-menu-btn:active { background: var(--terra-xlight); }
  .mm-icon { font-size: 1.4rem; flex-shrink: 0; }
  .mm-label { flex: 1; font-size: 1.05rem; font-weight: 600; color: var(--espresso); }
  .mm-arrow { font-size: 1.5rem; color: var(--terra); font-weight: 300; line-height: 1; }

/* Back button — full-width prominent bar */
  .mobile-back-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    background: var(--terra-xlight);
    border: none;
    border-bottom: 2px solid var(--border);
    color: var(--terra-dark);
    font-size: 1.05rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    padding: 0.9rem 1rem;
    margin: -1rem -1rem 1.25rem -1rem;
    width: calc(100% + 2rem);
    box-sizing: border-box;
    letter-spacing: 0.01em;
  }

  /* Bottom back button */
  .mobile-back-btn-bottom {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: calc(100% + 2rem);
    margin: 2rem -1rem -1rem -1rem;
    padding: 1rem;
    background: var(--terra-xlight);
    border: none;
    border-top: 2px solid var(--border);
    color: var(--terra-dark);
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    box-sizing: border-box;
  }

  /* Sticky floating back button */


  /* Nav */
  .product-btn { padding: 0.75rem 1rem; font-size: 0.85rem; }
  .nav-tab { padding: 0.6rem 0.75rem; font-size: 0.7rem; letter-spacing: 0.04em; }

  /* Main content */
  .main { padding: 1rem; }
  .section-header h2 { font-size: 1.4rem; }

  /* Plan settings */
  .plan-settings-row { gap: 1rem; }
  .plan-settings-hint { display: none; }

  /* Day cards */
  .plan-grid { grid-template-columns: 1fr; gap: 0.75rem; }
  .day-meals { grid-template-columns: 1fr; }

  /* Medical disclaimer */
  .medical-disclaimer { flex-direction: column; gap: 0.5rem; padding: 1rem; }

  /* Grocery lists */
  .grocery-tabs { flex-wrap: wrap; }
  .grocery-tab { font-size: 0.82rem; padding: 0.5rem 0.75rem; }
  .grocery-actions { flex-wrap: wrap; gap: 0.5rem; }

  /* Dry pack cards */
  .dry-pack-grid { grid-template-columns: 1fr; }
  .dry-pack-ingredients { grid-template-columns: 1fr; }

  /* Meal prep cards */
  .meal-prep-grid { grid-template-columns: 1fr; }

  /* Breakfast cards */
  .breakfast-grid { grid-template-columns: 1fr; }

  /* Immersion Prep */
  .setup-step { gap: 0.75rem; }
  .setup-step-number { width: 1.85rem; height: 1.85rem; font-size: 0.95rem; flex-shrink: 0; }
  .setup-welcome { padding: 1.25rem; }
  .setup-welcome h2 { font-size: 1.2rem; }
  .setup-shop-header { padding: 0.85rem 1rem; }
  .setup-backup-cols { grid-template-columns: 1fr; }

  /* Ask Chef Kim */
  .chefkim-layout { grid-template-columns: 1fr; }
  /* PPK-1.1.24 — Use !important here because the base .chefkim-intro
     rule (`position: sticky; top: 1rem`) is sourced AFTER this mobile
     override, so at equal specificity the sticky rule was winning on
     phones — causing the photo banner + chip card to stay pinned to
     the top of the viewport while the recipe scrolled underneath. */
  .chefkim-intro { position: static !important; top: auto !important; }
  .chefkim-profile { flex-direction: row; gap: 0.75rem; padding: 1rem; }
  .kim-photo { width: 48px; height: 48px; border-radius: 50%; }
  .kim-bio { display: none; }
  .kim-ai-note { display: none; }
  .kim-suggestions { display: none; }
  .kim-starter-chips { flex-wrap: wrap; padding: 0.5rem 0.75rem; }
  .kim-starter-chips-label { padding: 0.5rem 0.75rem 0; font-size: 0.75rem; }
  .chefkim-chat { min-height: 0; max-height: none; flex-shrink: 1; overflow: visible; }
  .chat-messages { min-height: 0; max-height: none; flex-shrink: 1; overflow-y: visible; overflow-x: hidden; }
  .chat-input-row { flex-direction: row; }
  .chat-send-btn { width: 44px; flex-shrink: 0; }

  /* Recipe Box */
  .ki-recipe-grid { grid-template-columns: 1fr; }
  .ki-filter-row { flex-wrap: wrap; gap: 0.35rem; }
  .ki-filter-btn { font-size: 0.75rem; padding: 0.35rem 0.65rem; }

  /* Weekly planner */
  .ki-week-grid { grid-template-columns: 1fr; }

  /* Settings */
  .settings-card { padding: 1rem; }
  .settings-actions { flex-direction: column; }
  .settings-actions button { width: 100%; }

  /* Modals */
  .modal { width: 95vw; max-height: 90vh; }
  .modal-body { padding: 1rem; }
  .modal-footer { justify-content: stretch; }
  .modal-footer .btn { flex: 1; text-align: center; font-size: 0.82rem; padding: 0.6rem 0.5rem; }

  /* Print section */
  .print-options-grid { grid-template-columns: 1fr; }

  /* General */
  .grocery-check-note { font-size: 0.82rem; padding: 0.6rem 0.75rem; }
  .breakfast-banner { flex-direction: column; gap: 0.5rem; align-items: flex-start; }
}

@media print {
  .header, .nav-bar, .btn, button, .grocery-actions,
  .meal-slot-actions, .dry-pack-card-footer, .meal-prep-footer,
  .print-section-controls { display: none !important; }
  body { background: white; }
  .main { padding: 0; max-width: 100%; }
  .day-card, .dry-pack-card, .meal-prep-card, .grocery-list-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ddd;
  }
  .section { display: block !important; }
  .print-cover {
    text-align: center;
    padding: 4rem 2rem;
    break-after: page;
  }
  .print-cover h1 { font-family: 'Playfair Display', serif; font-size: 2.5rem; color: var(--terra-dark); }
}

/* ── TOAST ── */
/* ── SOURCING TIP ── */
.sourcing-tip {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 8px rgba(107,37,16,0.06);
}
.sourcing-tip-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}
.sourcing-tip-header h4 {
  font-family: 'Playfair Display', serif;
  font-size: 0.95rem;
  color: var(--terra-dark);
}
.sourcing-tip p {
  font-size: 0.93rem;
  color: var(--warm-gray);
  line-height: 1.6;
  margin-bottom: 0.75rem;
}
.sourcing-tip p:last-child { margin-bottom: 0; }
.online-items {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}
.online-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--terra-xlight);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.25rem 0.7rem;
  font-size: 0.78rem;
  color: var(--terra-dark);
  font-weight: 500;
}
.online-badge .badge-icon { font-size: 0.7rem; }
.grocery-item-name.online { color: var(--terra-dark); }
.online-tag-link {
  text-decoration: none !important;
  cursor: pointer;
}
.online-tag-link:hover {
  background: var(--terra);
  color: white;
  border-color: var(--terra);
}
.grocery-item-name .online-tag {
  font-size: 0.68rem;
  background: var(--terra-xlight);
  color: var(--terra);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.1rem 0.45rem;
  margin-left: 0.4rem;
  font-weight: 600;
  vertical-align: middle;
  white-space: nowrap;
}
.equipment-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.88rem;
}
.equipment-item:last-child { border-bottom: none; }
.equipment-icon { font-size: 1rem; flex-shrink: 0; margin-top: 0.05rem; }
.equipment-item-text { flex: 1; }
.equipment-item-text strong { display: block; color: var(--espresso); font-size: 0.88rem; }
.equipment-item-text span { color: var(--espresso-light); font-size: 0.9rem; }
