/* Fridge view. Kept separate from style.css so a reskin can swap this file
   without touching the shell. All colors come from the shared variables. */

.fridge-controls { margin-bottom: 12px; }

#inv-search {
  width: 100%;
  padding: 11px 13px;
  font-size: 16px; /* 16px or iOS zooms the page on focus */
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

.chips {
  display: flex;
  gap: 7px;
  margin-top: 9px;
  overflow-x: auto;
  padding-bottom: 3px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: none;
  padding: 6px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 550;
  cursor: pointer;
  white-space: nowrap;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.card h2 .count {
  float: right;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.85rem;
}
/* Only headings that are a raw lowercase database value -- a storage location,
   a category. It used to apply to every card heading in the app, which is how
   Settings ended up announcing "Speech To Text". */
.card h2.cap { text-transform: capitalize; }

.inv-list { list-style: none; margin: 0; padding: 0; }

.inv-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
}
.inv-row + .inv-row { border-top: 1px solid var(--border); }

/* A long press on a row opens the edit sheet, and iOS answers a long press
   with the text-selection callout unless it is told not to. */
.inv-row {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.inv-name { min-width: 0; line-height: 1.25; }
.inv-name small { display: block; color: var(--muted); font-size: 0.72rem; text-transform: capitalize; }
.staple { color: var(--low); margin-left: 5px; font-size: 0.8em; }

/* Tri-state control. Big enough to hit with a thumb while holding a fridge
   door open, which is the actual usage posture. */
.seg-group {
  display: flex;
  flex: none;
  border: 1px solid var(--border);
  border-radius: 9px;
  overflow: hidden;
}

.seg {
  border: 0;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 9px 11px;
  min-width: 52px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}
.seg + .seg { border-left: 1px solid var(--border); }
.seg.have.on { background: var(--have); color: #fff; }
.seg.low.on  { background: var(--low);  color: #fff; }
.seg.out.on  { background: var(--out);  color: #fff; }

/* ------------------------------------------------------------ edit mode */

.edit-hint {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

/* Sits where the tri-state control sits, at the same height, so turning edit
   mode on does not make the list jump. */
.row-actions { display: flex; flex: none; gap: 7px; }

.row-btn {
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 650;
  padding: 9px 12px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}
.row-btn.danger { color: var(--out); border-color: color-mix(in srgb, var(--out) 45%, var(--border)); }

/* ------------------------------------------------- destructive confirms */

.sheet .primary.destructive { background: var(--out); }

.sheet-danger,
.sheet-cancel {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 6px 0;
  border: 0;
  background: none;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.sheet-danger { color: var(--out); margin-top: 18px; }
.sheet-cancel { color: var(--accent); }

.warn-list {
  margin: 12px 0 0;
  padding-left: 20px;
  color: var(--text);
  font-size: 0.87rem;
  line-height: 1.45;
}
.warn-list li + li { margin-top: 5px; }

.sheet .fineprint { margin: 12px 0 0; font-size: 0.82rem; line-height: 1.45; }

/* --------------------------------------------------------------- buttons */

.fab-row {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 10px);
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 0 16px;
  pointer-events: none;
  z-index: 9;
}

.fab {
  pointer-events: auto;
  padding: 11px 15px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.87rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.16);
}

/* Three buttons don't fit a narrow phone at full padding. Tighten rather than
   wrap: a wrapped row would cover the list. */
@media (max-width: 400px) {
  .fab-row { gap: 7px; padding: 0 10px; }
  .fab { padding: 10px 12px; font-size: 0.81rem; }
}
.fab.primary-fab { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------------------------------------------------------------- sheet */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 20;
}

.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 21;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  padding: 16px 16px calc(20px + var(--safe-b));
  box-shadow: 0 -6px 28px rgba(0, 0, 0, 0.28);
}
@media (min-width: 640px) {
  .sheet { left: 50%; transform: translateX(-50%); width: 460px; border-radius: 16px; bottom: 5vh; }
}

.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.sheet-head h2 { margin: 0; font-size: 1.05rem; }

.sheet label { display: block; margin: 11px 0 0; font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.sheet input[type="text"],
.sheet input:not([type]),
.sheet input[type="search"],
.sheet select {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 11px 12px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
}
.sheet .row-label {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 14px;
  color: var(--text);
  font-weight: 500;
}
.sheet .row-label input { width: auto; margin: 0; }
.sheet .row-label small { color: var(--muted); }
.sheet .primary { margin-top: 16px; }

.sheet .err {
  margin: 10px 0 0;
  color: var(--out);
  font-size: 0.85rem;
}

#scan-video {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 12px;
  background: #000;
}
.scan-hint { color: var(--muted); font-size: 0.85rem; margin: 9px 0 0; }

/* ---------------------------------------------------------------- toast */

.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 70px);
  z-index: 30;
  max-width: 88vw;
  padding: 11px 16px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: 0.87rem;
  font-weight: 550;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}
