/* Cosa Cena v2 — settings screen styles */

.settings-screen {
  min-height: 100vh;
}

/* ── Header ───────────────────────────────────────────────────────────────── */
.settings-header {
  padding: 24px 20px 8px;
  border-bottom: 1px solid var(--sand);
}

.settings-title {
  font-family: 'Lora', serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--brown);
  letter-spacing: -0.01em;
}

/* ── Body ─────────────────────────────────────────────────────────────────── */
.settings-body {
  padding: 0 0 8px;
}

/* ── Sections ─────────────────────────────────────────────────────────────── */
.settings-section {
  padding: 20px 20px 4px;
}

.settings-section-label {
  font-family: 'Lora', serif;
  font-size: 17px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: -0.01em;
  color: var(--brown);
  margin-bottom: 12px;
}

.settings-section + .settings-section {
  border-top: 1px solid var(--sand-mid);
  padding-top: 24px;
}

.settings-section-desc {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13px;
  color: var(--brown-light);
  line-height: 1.5;
  margin-bottom: 12px;
}

/* ── List and rows ────────────────────────────────────────────────────────── */
.settings-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--white);
  border-radius: 12px;
  cursor: pointer;
  min-height: 56px;
  box-shadow: 0 0 0 1px rgba(46,31,18,0.05);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.1s;
}

.settings-row:active {
  background: var(--sand);
}

.settings-row-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
  padding-right: 12px;
}

.settings-row-label {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: var(--brown);
}

.settings-row-sub {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
  margin-top: 1px;
}

/* ── Toggle switch (reuses home.css .toggle-switch pattern) ───────────────── */
/* toggle-switch, toggle-knob, and .on state are inherited from home.css.     */
/* home.css is always loaded first (index.html link order).                   */

/* ── Pantry accordion ─────────────────────────────────────────────────────── */
.settings-section-pantry {
  padding-bottom: 0;
}

.pantry-accordion-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: var(--white);
  border: none;
  border-radius: 12px;
  box-shadow: 0 0 0 1px rgba(46,31,18,0.05);
  padding: 14px 16px;
  min-height: 56px;
  cursor: pointer;
  color: var(--brown);
  -webkit-tap-highlight-color: transparent;
  margin-bottom: 12px;
  transition: background 0.1s;
}

.pantry-accordion-btn:active {
  background: var(--sand);
}

.pantry-accordion-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--brown);
  text-align: left;
}

.pantry-accordion-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: 12px;
}

.pantry-accordion-hint {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}

.pantry-chevron {
  width: 12px;
  height: 8px;
  stroke: var(--muted);
  color: var(--muted);
  flex-shrink: 0;
  transition: transform 0.2s ease;
  transform: rotate(180deg);
}

.pantry-chevron.open {
  /* Pointing up (open) */
  transform: rotate(0deg);
}

/* ── Pantry content (accordion body) ─────────────────────────────────────── */
/* ── Pantry categories ────────────────────────────────────────────────────── */
.pantry-category {
  margin-bottom: 16px;
}

.pantry-category-label {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 8px;
}

/* ── Pantry chips ─────────────────────────────────────────────────────────── */
.pantry-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.pantry-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px 7px 8px;
  border-radius: 20px;
  border: 1.5px solid var(--sand-mid);
  background: var(--white);
  cursor: pointer;
  font-family: 'Plus Jakarta Sans', sans-serif;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  transition: border-color 0.12s, background 0.12s;
}

.pantry-chip.checked {
  background: var(--terracotta-pale);
  border-color: var(--terracotta);
}

.pantry-chip:active {
  opacity: 0.75;
}

.pantry-chip-box {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1.5px solid var(--sand-mid);
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.12s, border-color 0.12s;
}

.pantry-chip.checked .pantry-chip-box {
  background: var(--terracotta);
  border-color: var(--terracotta);
}

.pantry-chip-box svg {
  width: 10px;
  height: 10px;
  opacity: 0;
  transition: opacity 0.1s;
}

.pantry-chip.checked .pantry-chip-box svg {
  opacity: 1;
}

.pantry-chip-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--brown-light);
  white-space: nowrap;
}

.pantry-chip.checked .pantry-chip-label {
  color: var(--brown);
  font-weight: 600;
}

/* ── Reset to defaults ────────────────────────────────────────────────────── */
.pantry-reset-row {
  display: flex;
  justify-content: flex-end;
  padding: 12px 0 20px;
}

.pantry-reset-btn {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--terracotta);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 0;
  min-height: 32px;
  -webkit-tap-highlight-color: transparent;
}

.pantry-reset-btn:active {
  opacity: 0.7;
}

/* ── Action row (button, no toggle) ──────────────────────────────────────── */
.settings-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--white);
  border-radius: 12px;
  border: none;
  cursor: pointer;
  min-height: 56px;
  width: 100%;
  text-align: left;
  box-shadow: 0 0 0 1px rgba(46,31,18,0.05);
  -webkit-tap-highlight-color: transparent;
  transition: background 0.1s;
}

.settings-action-row:active {
  background: var(--sand);
}

.settings-action-row .settings-row-label {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: var(--terracotta);
}

.settings-action-row .settings-row-sub {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
  margin-top: 2px;
}

.confirm-flash {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--olive);
}

/* ── Data note ────────────────────────────────────────────────────────────── */
.settings-data-note {
  padding-top: 12px;
  padding-bottom: 20px;
}

.data-note-text {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  text-align: center;
}

/* ── Selective eater profiles ──────────────────────────────────────────────── */

.profile-card {
  background: var(--white);
  border-radius: 12px;
  border: 0.5px solid rgba(46,31,18,0.12);
  margin-bottom: 10px;
  overflow: hidden;
}

.profile-card--inactive .profile-name,
.profile-card--inactive .profile-avatar {
  opacity: 0.4;
}

.profile-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  cursor: pointer;
  user-select: none;
}

.profile-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--sand);
  border: 0.5px solid rgba(46,31,18,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  flex-shrink: 0;
}

.profile-header-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.profile-name {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: var(--brown);
}

.profile-off-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.profile-summary,
.profile-summary-empty {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-chevron {
  width: 14px;
  height: 14px;
  stroke: var(--muted);
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.profile-chevron.open {
  transform: rotate(180deg);
}

.profile-body {
  padding: 0 14px 14px;
  border-top: 0.5px solid rgba(46,31,18,0.12);
}

.profile-mode-toggle {
  display: flex;
  background: var(--sand);
  border-radius: 8px;
  padding: 2px;
  margin-bottom: 4px;
}

.profile-mode-btn {
  flex: 1;
  text-align: center;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13px;
  padding: 7px 4px;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  border: none;
  cursor: pointer;
}

.profile-mode-btn.active {
  background: var(--white);
  color: var(--brown);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(46,31,18,0.12);
}

.profile-food-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: var(--white);
  border: 0.5px solid rgba(46,31,18,0.12);
  border-radius: 12px;
  padding: 11px 12px;
  margin-top: 8px;
  cursor: pointer;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.1s;
}

.profile-food-row:active { background: var(--sand); }

.profile-food-row-label {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--brown);
  flex-shrink: 0;
  min-width: 64px;
}

.profile-food-row-value {
  flex: 1;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-food-summary-empty { color: var(--muted); font-style: italic; }
.profile-food-summary-text { }
.food-chip--like-text { color: #27500A; }
.food-chip--avoid-text { color: #791F1F; }

.profile-food-row-chevron {
  width: 8px;
  height: 14px;
  flex-shrink: 0;
  color: var(--sand-dark);
}

.food-chip {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13px;
  padding: 5px 10px;
  border-radius: 20px;
  border: 0.5px solid rgba(46,31,18,0.12);
  color: var(--brown);
  background: var(--white);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.food-chip--like {
  background: #EAF3DE;
  border-color: #3B6D11;
  color: #27500A;
}

.food-chip--avoid {
  background: #FCEBEB;
  border-color: #A32D2D;
  color: #791F1F;
}

.profile-footer {
  display: flex;
  justify-content: flex-end;
  padding-top: 14px;
  margin-top: 8px;
  border-top: 0.5px solid rgba(46,31,18,0.12);
}

.profile-delete-btn {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13px;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 0;
}

.profile-delete-btn.confirming {
  color: #A32D2D;
  font-weight: 500;
}

.profiles-add-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  background: var(--white);
  border-radius: 12px;
  border: 0.5px solid rgba(46,31,18,0.12);
  width: 100%;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 15px;
  color: var(--terracotta);
  cursor: pointer;
  text-align: left;
}

.profiles-add-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--terracotta) 12%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--terracotta);
}

/* ── Food selection sheet ──────────────────────────────────────────────────── */

.food-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.food-sheet {
  background: var(--cream);
  border-radius: 16px 16px 0 0;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.food-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 14px;
  border-bottom: 0.5px solid rgba(46,31,18,0.12);
  background: var(--white);
  flex-shrink: 0;
}

.food-sheet-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--brown);
}

.food-sheet-done {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--white);
  background: var(--terracotta);
  border: none;
  border-radius: 20px;
  padding: 7px 16px;
  cursor: pointer;
  min-height: 34px;
  -webkit-tap-highlight-color: transparent;
}

/* SEARCH HIDDEN: restore these rules when re-enabling the search input.
.food-sheet-search-wrap {
  padding: 10px 12px;
  background: var(--white);
  border-bottom: 0.5px solid rgba(46,31,18,0.12);
  flex-shrink: 0;
}

.food-sheet-search {
  width: 100%;
  background: var(--sand);
  border: 0.5px solid rgba(46,31,18,0.12);
  border-radius: 8px;
  padding: 8px 12px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 14px;
  color: var(--brown);
  -webkit-appearance: none;
}
*/

.food-sheet-list {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 1rem;
  -webkit-overflow-scrolling: touch;
}

.food-sheet-category {
  padding: 14px 12px 0;
}

.food-sheet-cat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 12px;
}

.food-sheet-cat-label {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--brown-mid);
  letter-spacing: 0;
  text-transform: none;
}

.food-sheet-select-all-btn {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--terracotta);
  background: none;
  border: 1px solid var(--terracotta);
  border-radius: 20px;
  cursor: pointer;
  padding: 4px 10px;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
  min-height: 28px;
}

.food-sheet-select-all-btn:active {
  opacity: 0.7;
}

.food-sheet-cat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.food-sheet-chip {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13px;
  padding: 5px 12px;
  border-radius: 20px;
  border: 0.5px solid rgba(46,31,18,0.12);
  color: var(--brown);
  background: var(--white);
  cursor: pointer;
}

/* Selected state must be declared after .food-sheet-chip to win the specificity tie. */
.food-sheet-chip.food-chip--like {
  background: #EAF3DE;
  border-color: #3B6D11;
  color: #27500A;
}

.food-sheet-chip.food-chip--avoid {
  background: #FCEBEB;
  border-color: #A32D2D;
  color: #791F1F;
}

.food-sheet-no-results {
  padding: 24px 12px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 14px;
  color: var(--muted);
  text-align: center;
}


/* ── Name entry sheet ──────────────────────────────────────────────────────── */

.name-sheet {
  /* Shorter than the food sheet -- just a header + one input */
  max-height: 50vh;
}

.name-sheet-body {
  padding: 20px 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.name-sheet-input {
  width: 100%;
  background: var(--white);
  border: 1.5px solid rgba(46,31,18,0.12);
  border-radius: 12px;
  padding: 12px 14px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 17px;
  color: var(--brown);
  -webkit-appearance: none;
  outline: none;
}

.name-sheet-input:focus {
  border-color: var(--terracotta);
}

.name-sheet-hint {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

/* ── About row ─────────────────────────────────────────────────────────────── */

/* ── Feedback + legal rows ─────────────────────────────────────────────────── */

.settings-feedback-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 1rem 1.25rem;
  background: none;
  border: none;
  border-bottom: 0.5px solid var(--sand);
  cursor: pointer;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.settings-feedback-row:active { background: rgba(0,0,0,0.03); }

.settings-feedback-label { color: var(--terracotta) !important; }

/* ── Version line ─────────────────────────────────────────────────────────── */

.settings-version {
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.625rem;
  color: var(--sand-mid);
  letter-spacing: 0.05em;
  padding: 10px 0 4px;
}

/* ── Shared sheet chrome (used by legal sheet) ─────────────────────────────── */

.about-sheet-handle {
  width: 36px; height: 4px;
  background: var(--sand-mid);
  border-radius: 2px;
  margin: 12px auto 0;
}

.about-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px;
  border-bottom: 0.5px solid var(--sand);
}

.about-sheet-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--brown);
}

/* ── Legal text sheet ──────────────────────────────────────────────────────── */

.legal-sheet {
  position: fixed;
  inset: 0;
  z-index: 201;
  display: flex;
  align-items: flex-end;
  pointer-events: none;
}

.legal-sheet.is-open { pointer-events: none; }

.legal-sheet.is-open .legal-sheet-inner { pointer-events: auto; }

.legal-sheet-inner {
  width: 100%;
  background: var(--white);
  border-radius: 16px 16px 0 0;
  transform: translateY(100%);
  transition: transform 0.25s cubic-bezier(0.32,0,0.15,1);
  max-height: 80dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.legal-sheet.is-open .legal-sheet-inner { transform: translateY(0); }

.legal-sheet-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--terracotta);
  -webkit-tap-highlight-color: transparent;
}

.legal-sheet-body {
  overflow-y: auto;
  padding: 16px;
  flex: 1;
}

.legal-sheet-body p {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 15px;
  line-height: 1.65;
  color: var(--brown-mid);
  margin: 0 0 16px;
}

.legal-sheet-body p:last-child { margin-bottom: 0; }
