/* 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;
}

/* ---------- 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;
}
.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;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin: 0 -16px;
  padding: 2px 16px 6px;
  touch-action: pan-x pan-y;
}
.nd-carousel::-webkit-scrollbar { display: none; }
.nd-card {
  position: relative;
  flex: 0 0 86%;
  scroll-snap-align: start;
  border: 0;
  border-radius: 22px;
  overflow: hidden;
  padding: 0;
  height: 218px;
  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%;
  object-fit: contain;
  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 (⏳ Empieza 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; }
.nd-dots { display: flex; justify-content: center; gap: 6px; padding: 2px 0 0; }
.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;
  object-fit: contain;
  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); }
.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; }
}
