/* Joey's Pizza — Nuevo Diseño: home redesign styles (Phase 1).
   Additive only — every rule is scoped to the new nd-* elements, plus
   two deliberate layout accommodations: page bottom padding for the
   fixed bottom nav, and lifting the app's own sticky cart bar above
   that nav so the two never overlap. Colors follow the app's own
   tokens (--lime, --lime-ink, --paper, --ink) with literal fallbacks. */

/* ---------- Search (fixed at the top of Home, sticky under the
   app's own sticky topbar; the exact top offset is set from the
   topbar's measured height by home-redesign.js) ---------- */
.nd-search {
  position: sticky;
  top: 64px;
  z-index: 55;
  margin: 0 -6px 0;
  padding: 10px 6px 6px;
  background: var(--paper, #f7f5ec);
  border-radius: 0;
  /* Opening-jump fix (Nov 23 2026, owner report «sigue abriendo
     chocando arriba»): the search bar no longer starts hidden in
     the markup — it renders with the page, and this reserved
     minimum height (the bar's exact rendered height: 16px of
     wrap padding + the 52px search box) means its space is
     already there on the very first paint, so nothing below it
     can be pushed down when the scripts run. */
  min-height: 68px;
  box-sizing: border-box;
}

/* ---------- Category chips LOCKED under the search bar
   (owner order 2026-11-18: «Lockea los tiles bajo del search
   bar»). Home only — the .catnav element lives only on Home.
   The chips row is sticky directly beneath the sticky search
   bar, so search + chips travel as ONE locked block at the top
   while the carousel and the menu cards scroll underneath.
   home-redesign.js sets the exact sticky top inline from the
   measured topbar + search heights (the top below is only a
   pre-JS fallback). The strip's background is the app's SOLID
   paper color — never translucent — so content scrolling
   underneath never shows through or overlaps. z-index 54 sits
   above scrolling home content, below the search bar itself
   (55, whose results dropdown must paint over the chips),
   below the topbar (60), the bottom nav (80) and every sheet /
   modal (95+). (The old 2×2 lime shortcut mosaic was removed
   from Home on 2026-11-18 — its destinations live in the bottom
   nav now; the chips themselves are untouched.) ---------- */
.catnav {
  position: sticky;
  top: 128px;
  z-index: 54;
  margin: 0 -6px;
  padding: 2px 6px 8px;
  background: var(--paper, #f7f5ec);
  border-radius: 0 0 18px 18px;
  /* Opening-jump fix (Nov 23 2026): reserve the chips row's
     exact rendered height (10px strip padding + 20px inner
     padding + the chips' 48px min-height = 78px) from the
     first paint, so the carousel below never jumps down when
     renderCatNav fills the chips in. */
  min-height: 78px;
  box-sizing: border-box;
}
.catnav .catnav-in {
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  padding: 6px 2px 2px;
}
/* While the search results dropdown is open, the chips hide
   cleanly (space retained, no layout jump) so the dropdown —
   rendered inside the search bar, above this strip — never
   fights them; they return the moment the search closes. Only
   the inner row hides: the strip itself keeps its solid paper
   background, so nothing shows through behind the dropdown.
   home-redesign.js toggles body.nd-results-open in step with
   the results box's hidden state. */
body.nd-results-open .catnav {
  pointer-events: none;
}
body.nd-results-open .catnav .catnav-in {
  visibility: hidden;
}
.nd-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 2px solid var(--lime, #84cc16);
  border-radius: 999px;
  padding: 6px 8px 6px 14px;
  box-shadow: 0 4px 16px #0000001f;
}
.nd-search-box svg { flex: 0 0 auto; color: var(--lime-ink, #3f6212); }
.nd-search-box input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 16px;
  color: var(--ink, #1c1c1e);
  min-height: 36px;
}
.nd-search-clear {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: var(--lime, #84cc16);
  color: #1a2e05;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.nd-results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 18px 44px #00000033;
  overflow: hidden;
  max-height: 60vh;
  overflow-y: auto;
}
/* Compact Amazon-style rows (owner request 2026-11-16: «Que salgan
   pequeños como estos en el search»): one thin row per result —
   small real-photo thumbnail on the left, name, price on the right. */
.nd-result {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  padding: 4px 14px 4px 6px;
  border: 0;
  border-bottom: 1px solid #00000010;
  background: #fff;
  font: inherit;
  text-align: left;
  cursor: pointer;
  color: var(--ink, #1c1c1e);
}
.nd-result:last-child { border-bottom: 0; }
.nd-result:active { background: #f0f9e0; }
.nd-result-thumb {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 10px;
  object-fit: cover;
  background: #fdfdf8;
  pointer-events: none;
}
.nd-result-name {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 600;
  font-size: 15px;
  line-height: 1.25;
}
.nd-result-price {
  flex: 0 0 auto;
  margin-left: auto;
  font-family: "Archivo Black", Archivo, sans-serif;
  font-size: 14.5px;
  color: var(--lime-ink, #3f6212);
  white-space: nowrap;
}
.nd-noresults { margin: 0; padding: 14px 16px; color: #555; font-size: 14px; }

/* ---------- Promo carousel ---------- */
.nd-carousel-wrap { margin: 12px 0 4px; }
.nd-carousel {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  /* Finding #25 fix (Optimization Center, 2026-11-23): snapped
     cards land on the same 16px inset the first card rests at, so
     every card — the last one included — sits fully inside the
     visible width when a swipe settles, never sliced at the
     carousel's right edge with its text truncated. */
  scroll-padding-left: 16px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin: 0 -16px;
  padding: 2px 16px 6px;
  touch-action: pan-x pan-y;
  /* Opening-jump fix (Nov 23 2026): the strip's box is reserved
     at its exact final height (230px cards + 8px of vertical
     padding) from the first paint — the wrap no longer starts
     hidden, so the carousel's space is already on the page
     before any card or photo loads and the hero below it
     never moves. */
  height: 238px;
  box-sizing: border-box;
}
.nd-carousel::-webkit-scrollbar { display: none; }
.nd-card {
  position: relative;
  /* Finding #8 fix (2026-11-22): cards span the carousel's full
     visible width. At 86% the next card peeked in from the right
     edge and the viewport sliced its title mid-word («DÚO
     COMPAR…» instead of «DÚO COMPARTIR»). Now no card is ever
     clipped at rest, and scroll-snap (mandatory, start) plus
     snap-stop land every swipe on the FULL next card; the dots
     below still signal that more cards follow. */
  flex: 0 0 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  border: 0;
  border-radius: 22px;
  overflow: hidden;
  padding: 0;
  /* Uniform size (Nov 23 2026, owner order «Pon las fotos que
     sean igual de grandes que se vea parejo»): EVERY card —
     the Fiestas card included, no taller exception — is the
     same fixed 230px tall, so the strip reads perfectly even
     and no card ever changes size as its photo loads. */
  height: 230px;
  background: var(--lime-ink, #3f6212);
  cursor: pointer;
  text-align: left;
  font: inherit;
  box-shadow: 0 10px 26px #0000002b;
}
.nd-card-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  /* Uniform photos (Nov 23 2026): cover, not contain — every
     photo fills the same 100% × 230px box edge to edge, so
     different photo shapes no longer letterbox into different
     visible sizes inside the strip. */
  object-fit: cover;
  background: #fdfdf8;
  pointer-events: none;
}
.nd-card-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, #101604d9 0%, #10160459 42%, transparent 68%);
  pointer-events: none;
}
.nd-card-body {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: #fff;
  pointer-events: none;
}
.nd-card-tag {
  align-self: flex-start;
  background: var(--lime, #84cc16);
  color: #1a2e05;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
}
.nd-card-name {
  font-family: "Archivo Black", Archivo, sans-serif;
  font-size: 21px;
  line-height: 1.12;
  text-shadow: 0 2px 10px #0009;
}
.nd-card-price {
  font-family: "Archivo Black", Archivo, sans-serif;
  font-size: 18px;
  color: #d9f99d;
}
/* Live countdown pill on the «Oferta de hoy» photo card only
   (Nov 19 2026): the element is a plain .oferta-timer — the app
   script's updateTdTimers() owns its text (⏳ Abrimos hoy a las 5:30 PM (en…) /
   🔥 Termina en…, same line as the green strip and the deal
   window). These rules only dress it as a small pill that reads
   over the photo, in the card's own palette: the price's pale
   lime on the shade's dark tone, ringed with the tag's lime.
   It sits under the price (the card body is a bottom-anchored
   flex column, so it never covers the deal name or the price),
   shrink-wrapped via align-self, and hidden while empty. */
.nd-card-timer {
  align-self: flex-start;
  margin-top: 3px;
  padding: 3px 10px;
  border: 1.5px solid var(--lime, #84cc16);
  border-radius: 999px;
  background: #101604d9;
  color: #d9f99d;
  font-size: 12.5px;
  font-weight: 800;
  line-height: 1.35;
  white-space: nowrap;
}
.nd-card-timer:empty { display: none; }
/* ♥ + share row on every carousel card (Nov 23 2026, owner
   report «esas no tienen el love & share todavía»): the same
   compact side-by-side row the menu cards carry — 34px ♥
   (favorites layer) + 34px share (share layer), rendered by
   home-redesign.js under the price with the item's own
   fav/share key, so the two layers' delegated handlers,
   painting and «Favoritos» window treat it exactly like a
   menu card's row. The card body is pointer-events:none (the
   whole card is the tap target), so the row re-enables
   pointer events for its two buttons only. */
.nd-card-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  align-self: flex-start;
  margin-top: 7px;
  pointer-events: auto;
}
.nd-dots { display: flex; justify-content: center; gap: 6px; padding: 2px 0 0; min-height: 9px; box-sizing: border-box; }
.nd-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #0000002e;
  transition: all 0.2s ease;
}
.nd-dot.on { width: 20px; background: var(--lime, #84cc16); }

/* ---------- Pide otra vez ---------- */
.nd-reorder { margin: 14px 0 4px; }
.nd-reorder-title {
  font-family: "Archivo Black", Archivo, sans-serif;
  font-size: 19px;
  margin: 0 0 8px;
  color: var(--ink, #1c1c1e);
}
.nd-reorder-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 -16px;
  padding: 2px 16px 6px;
  touch-action: pan-x pan-y;
}
.nd-reorder-strip::-webkit-scrollbar { display: none; }
.nd-again-card {
  position: relative;
  flex: 0 0 240px;
  background: #fff;
  border: 1.5px solid #84cc1659;
  border-radius: 16px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 4px 14px #00000012;
  /* Double-tap removes the card: no double-tap zoom side effects. */
  touch-action: manipulation;
}
/* Visible ✕ (owner request 2026-11-17: «no tiene la x para
   cerrar»): closes the card out of «Pide otra vez» — same
   persisted dismissal as the double-tap. A full 44px thumb
   target over the photo's top-right corner (or the card's, on
   text-only cards): a solid white disc with a lime-deep ring
   and a dark ✕, so it reads on ANY photo — the first version's
   small 30px dark disc vanished over dark photos (owner
   screenshot 1000154209) and was too small to hit reliably. */
.nd-again-x {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 5;
  width: 44px;
  height: 44px;
  border: 2px solid var(--lime-deep, #4d7c0f);
  border-radius: 999px;
  background: #fff;
  color: #1c1c1e;
  font: inherit;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 2px 9px #00000047;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.nd-again-x:active { transform: scale(0.92); }
/* The order item's REAL photo, whole and uncropped — same
   treatment as the compact search rows. Orders whose items have
   no photo render no img at all (clean text-only card). */
.nd-again-photo {
  width: 100%;
  height: 108px;
  /* Uniform photos (Nov 23 2026): cover at the same fixed
     108px height for every reorder card — fiesta orders
     included — so the strip's photos all read the same size. */
  object-fit: cover;
  background: #fdfdf8;
  border-radius: 10px;
  pointer-events: none;
}
.nd-again-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
/* Order number demoted (owner request 2026-11-17): a small,
   secondary label — the photo, items and total carry the card. */
.nd-again-num {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #8a8272;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nd-again-total { font-family: "Archivo Black", Archivo, sans-serif; color: var(--lime-ink, #3f6212); }
/* Finding #7 fix (2026-11-22): on a text-only card (no photo —
   e.g. a bottled-water order totalling $1.07) the ✕ disc,
   absolutely positioned at the card's top-right (44px wide at
   right:6px), sits directly over the .nd-again-top row and
   covers the total, leaving only «$» readable. Reserve the
   disc's footprint as right padding on that row in text-only
   cards only, so the price always gets its own clear space
   and can never slide under the ✕. Photo cards are untouched:
   there the ✕ overlays the photo's top-right corner by
   design, far above the price row. */
.nd-again-card:not(:has(.nd-again-photo)) .nd-again-top { padding-right: 52px; }
.nd-again-items {
  margin: 0;
  font-size: 13px;
  color: #555;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.nd-again-btn {
  margin-top: auto;
  min-height: 40px;
  border: 0;
  border-radius: 999px;
  background: var(--lime, #84cc16);
  color: #1a2e05;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

/* ---------- Bottom navigation ---------- */
.nd-bottomnav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 80;
  display: flex;
  background: #fffffffa;
  backdrop-filter: blur(10px);
  border-top: 1.5px solid #00000014;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -6px 22px #00000017;
}
/* Seven buttons since 2026-11-18 (Inicio · Menú · Reordenar ·
   Ofertas · Fiestas · Carrito · Mis órdenes): tighter padding,
   slightly smaller icons and 10.5px labels so every abbreviated
   label reads whole at 360–390px with nothing clipped. */
.nd-nav-btn {
  flex: 1 1 0;
  min-width: 0;
  min-height: 58px;
  border: 0;
  background: transparent;
  font: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: #6b7280;
  cursor: pointer;
  position: relative;
  padding: 6px 1px;
}
.nd-nav-btn svg { display: block; width: 21px; height: 21px; }
.nd-nav-btn span[data-nd-nav-label] { font-size: 10.5px; font-weight: 700; white-space: nowrap; letter-spacing: -0.01em; }
.nd-nav-btn.on { color: var(--lime-ink, #3f6212); }
.nd-nav-btn.on svg { color: var(--lime, #84cc16); }
.nd-nav-badge {
  position: absolute;
  top: 4px;
  left: calc(50% + 2px);
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 11.5px;
  font-weight: 800;
  line-height: 20px;
  text-align: center;
}

/* Room for the fixed bottom nav. */
body { padding-bottom: calc(96px + env(safe-area-inset-bottom)) !important; }

@media (prefers-color-scheme: dark) {
  .nd-search-box, .nd-results, .nd-result, .nd-again-card { background: #1d2016; color: #f0f0e6; }
  .nd-result { border-bottom-color: #ffffff1c; }
  .nd-result:active { background: #2a2e1e; }
  .nd-noresults, .nd-again-items { color: #b9bda9; }
  .nd-bottomnav { background: #14160ef2; border-top-color: #ffffff22; }
  .nd-nav-btn { color: #9ca38c; }
  .nd-nav-btn.on { color: #d9f99d; }
  .nd-card-img { background: #171a10; }
  .nd-result-thumb { background: #171a10; }
  .nd-again-photo { background: #171a10; }
  .nd-again-num { color: #9a9d88; }
}

/* Finding #21 fix (2026-11-23): the «Quitar de Pide otra vez» ✕
   was the same text glyph (U+2715) as the dialog close buttons —
   missing from the loaded fonts, it rendered as a thin rectangle.
   The button now carries an inline SVG ✕ (home-redesign JS);
   size it inside the 44px disc. And the Finding #7 reserve is
   extended from the price row to the items line: on a text-only
   card the disc (top:6px, 44px tall) also reaches the first
   items line, whose right end could slide under it — both lines
   now keep the disc's 52px footprint clear on the right. */
.nd-again-x svg { flex: none; width: 20px; height: 20px; }
.nd-again-card:not(:has(.nd-again-photo)) .nd-again-items { padding-right: 52px; }

/* Fiesta photos UNIFORM (Nov 23 2026, owner order «Pon las
   fotos que sean igual de grandes que se vea parejo» —
   supersedes the same-day «make the fiesta photos bigger»
   sizing on THIS layer's surfaces): the fiesta photos no
   longer get a bigger box than any other item here. Search
   rows keep the uniform 46px cover thumb, «Pide otra vez»
   photos keep the uniform 108px cover strip, and the
   carousel's Fiestas card is the same fixed 230px as every
   other card — so every strip reads perfectly even. The
   *-fiesta classes home-redesign.js still stamps are now
   inert markers on these surfaces; the fiesta photos stay
   LARGE where they headline their own section — the Fiestas
   y Cumpleaños menu tiles and the Fiestas window, whose
   uniform full-width photo box lives in the app stylesheet
   and the inline fiesta block in index.html. */
