/* ============================================================
   BISTRO — template 5. Printed menu-book aesthetic: warm paper
   canvas, deep forest-green accent, Cormorant Garamond display
   (Amiri for Arabic), centered reading column and classic
   dot-leader rows (name ……… price). List-first, not cards.
   Scoped under [data-template="bistro"] — never collides.
   ============================================================ */

[data-template="bistro"] {
  --bs-paper:   #faf8f3;
  --bs-card:    #ffffff;
  --bs-ink:     #232620;
  --bs-ink-2:   #5a5e54;
  --bs-ink-3:   #8e9187;
  --bs-line:    rgba(35, 38, 32, 0.12);
  --bs-dots:    rgba(35, 38, 32, 0.28);
  --bs-acc:     #1e5c41;
  --bs-acc-ink: #ffffff;
  --bs-acc-soft: rgba(30, 92, 65, 0.08);
  --bs-shadow:  0 1px 2px rgba(35, 38, 32, 0.05), 0 8px 24px rgba(35, 38, 32, 0.06);
  --bs-wa:      #1fad53;
  --sx-top-accent: #1e5c41;
  background: var(--bs-paper);
}
[data-template="bistro"][data-theme="dark"] {
  --bs-paper:   #141813;
  --bs-card:    #1d221c;
  --bs-ink:     #edefe8;
  --bs-ink-2:   #b2b6aa;
  --bs-ink-3:   #7f837a;
  --bs-line:    rgba(237, 239, 232, 0.12);
  --bs-dots:    rgba(237, 239, 232, 0.3);
  --bs-acc:     #6fbf95;
  --bs-acc-ink: #0c1f15;
  --bs-acc-soft: rgba(111, 191, 149, 0.1);
  --bs-shadow:  0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 26px rgba(0, 0, 0, 0.28);
}

[data-template="bistro"] body {
  background: var(--bs-paper);
  color: var(--bs-ink);
  font-family: "Manrope", "Segoe UI", sans-serif;
}
[data-template="bistro"][data-lang="ar"] body {
  font-family: "Tajawal", "IBM Plex Sans Arabic", sans-serif;
}

/* ---------------- hero (centered menu-book cover) ---------------- */
[data-template="bistro"] .bs-hero {
  position: relative; text-align: center;
  max-width: 860px; margin: 0 auto;
  padding: calc(54px + env(safe-area-inset-top, 0px)) 20px 26px;
}
[data-template="bistro"] .bs-tools {
  position: absolute; top: calc(14px + env(safe-area-inset-top, 0px)); inset-inline-end: 14px;
  display: flex; align-items: center; gap: 8px;
}
[data-template="bistro"] .bs-tool {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--bs-card); border: 1px solid var(--bs-line);
  box-shadow: var(--bs-shadow); color: var(--bs-ink);
  transition: transform 0.15s ease;
}
[data-template="bistro"] .bs-tool:active { transform: scale(0.92); }
[data-template="bistro"] .bs-tool svg { width: 16px; height: 16px; }
[data-template="bistro"] .bs-lang { width: auto; padding: 0 12px; border-radius: 999px; font-size: 12px; font-weight: 700; }

[data-template="bistro"] .bs-logo {
  width: 72px; height: 72px; margin: 0 auto 16px;
  border-radius: 50%; overflow: hidden;
  display: grid; place-items: center;
  background: var(--bs-card); border: 1px solid var(--bs-line);
  box-shadow: var(--bs-shadow);
  font-family: "Cormorant Garamond", serif; font-weight: 600; font-size: 26px;
  color: var(--bs-acc);
}
[data-template="bistro"] .bs-logo img { width: 100%; height: 100%; }
[data-template="bistro"] .bs-name {
  margin: 0;
  font-family: "Cormorant Garamond", "Amiri", serif; font-weight: 600;
  font-size: clamp(32px, 7vw, 48px); line-height: 1.1; letter-spacing: 0.01em;
  color: var(--bs-ink);
}
[data-template="bistro"][data-lang="ar"] .bs-name { font-family: "Amiri", "Cairo", serif; }
[data-template="bistro"] .bs-flourish {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  margin-top: 14px; color: var(--bs-acc);
}
[data-template="bistro"] .bs-flourish i { width: 64px; height: 1px; background: var(--bs-line); }
[data-template="bistro"] .bs-flourish b { font-size: 11px; font-weight: 400; }

/* search — minimal editorial underline */
[data-template="bistro"] .bs-search {
  margin: 22px auto 0; max-width: 380px;
  display: flex; align-items: center; gap: 9px;
  border-bottom: 1px solid var(--bs-line);
  padding: 6px 4px;
  transition: border-color 0.2s ease;
}
[data-template="bistro"] .bs-search:focus-within { border-color: var(--bs-acc); }
[data-template="bistro"] .bs-search .ic { display: grid; place-items: center; color: var(--bs-ink-3); flex: none; }
[data-template="bistro"] .bs-search .ic svg { width: 15px; height: 15px; }
[data-template="bistro"] .bs-search input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  color: var(--bs-ink); font: inherit; font-size: 14px; text-align: center;
}
[data-template="bistro"] .bs-search input::placeholder { color: var(--bs-ink-3); font-style: italic; }

/* ---------------- sticky nav (small caps + underline) ---------------- */
[data-template="bistro"] .bs-nav {
  position: sticky; top: 0; z-index: 50;
  display: flex;gap: 4px; overflow-x: auto;
  justify-content: safe center;
  padding: 6px 16px 0;
  background: color-mix(in srgb, var(--bs-paper) 88%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--bs-line);
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
[data-template="bistro"] .bs-nav::-webkit-scrollbar { display: none; }
[data-template="bistro"] .bs-link {
  flex: none; padding: 10px 14px 12px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--bs-ink-3); white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color 0.18s ease, border-color 0.18s ease;
}
[data-template="bistro"][data-lang="ar"] .bs-link { text-transform: none; letter-spacing: 0; font-size: 13.5px; }
[data-template="bistro"] .bs-link.on { color: var(--bs-ink); border-bottom-color: var(--bs-acc); }
@media (hover: hover) { [data-template="bistro"] .bs-link:hover { color: var(--bs-ink); } }

/* ---------------- sections ---------------- */
[data-template="bistro"] .bs-main {
  max-width: 960px; margin: 0 auto;
  padding: 6px 20px 120px;
}
[data-template="bistro"] .bs-sec { padding-top: 40px; }
[data-template="bistro"] .bs-sec-head { text-align: center; margin-bottom: 10px; }
[data-template="bistro"] .bs-sec-img {
  width: 64px; height: 64px; border-radius: 50%; object-fit: cover;
  margin: 0 auto 14px; display: block;
  border: 1px solid var(--bs-line); box-shadow: var(--bs-shadow);
}
[data-template="bistro"][data-img-cat="s"] .bs-sec-img { width: 50px; height: 50px; }
[data-template="bistro"][data-img-cat="l"] .bs-sec-img { width: 84px; height: 84px; }
[data-template="bistro"][data-images-cat="off"] .bs-sec-img { display: none; }
[data-template="bistro"] .bs-sec-rule {
  display: flex; align-items: center; gap: 16px;
}
[data-template="bistro"] .bs-sec-rule i { flex: 1; height: 1px; background: var(--bs-line); }
[data-template="bistro"] .bs-sec-title {
  margin: 0; flex: none; max-width: 70%;
  font-family: "Cormorant Garamond", "Amiri", serif; font-weight: 600;
  font-size: clamp(24px, 5vw, 32px); line-height: 1.2;
  color: var(--bs-ink);
}
[data-template="bistro"][data-lang="ar"] .bs-sec-title { font-family: "Amiri", "Cairo", serif; }

/* ---------------- dot-leader rows ---------------- */
[data-template="bistro"] .bs-list { display: grid; grid-template-columns: 1fr; }
@media (min-width: 1024px) {
  [data-template="bistro"] .bs-list { grid-template-columns: 1fr 1fr; column-gap: 56px; }
}
[data-template="bistro"] .bs-row {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 0; border-bottom: 1px solid var(--bs-line);
}
[data-template="bistro"] .bs-thumb {
  width: 60px; height: 60px; flex: none;
  border-radius: 12px; overflow: hidden; cursor: zoom-in;
  box-shadow: var(--bs-shadow);
}
[data-template="bistro"][data-img="s"] .bs-thumb { width: 46px; height: 46px; border-radius: 9px; }
[data-template="bistro"][data-img="l"] .bs-thumb { width: 80px; height: 80px; border-radius: 14px; }
[data-template="bistro"][data-images="off"] .bs-thumb { display: none; }
[data-template="bistro"] .bs-thumb img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.3s ease;
}
@media (hover: hover) and (pointer: fine) {
  [data-template="bistro"] .bs-thumb:hover img { transform: scale(1.07); }
}
[data-template="bistro"] .bs-info { flex: 1; min-width: 0; }
[data-template="bistro"] .bs-line { display: flex; align-items: baseline; gap: 10px; }
[data-template="bistro"] .bs-nm {
  margin: 0; flex: none; max-width: 65%;
  font-size: 15.5px; font-weight: 700; line-height: 1.35; color: var(--bs-ink);
}
[data-template="bistro"] .bs-offer {
  font-style: italic; font-weight: 600; font-size: 11.5px;
  color: var(--bs-acc); margin-inline-start: 7px; white-space: nowrap;
}
[data-template="bistro"] .bs-dots {
  flex: 1; min-width: 24px; align-self: flex-end; margin-bottom: 5px;
  border-bottom: 2px dotted var(--bs-dots);
}
[data-template="bistro"] .bs-price {
  flex: none; font-size: 15.5px; font-weight: 800; color: var(--bs-acc); letter-spacing: -0.01em;
}
[data-template="bistro"] .bs-price small {
  font-size: 10.5px; font-weight: 600; color: var(--bs-ink-3); margin-inline-start: 3px;
}
[data-template="bistro"] .bs-price.po {
  font-size: 12px; font-weight: 600; font-style: italic; color: var(--bs-ink-3);
}
[data-template="bistro"] .bs-desc {
  margin: 4px 0 0; font-size: 12.5px; line-height: 1.6; color: var(--bs-ink-2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* add button / qty stepper (shared actionEl markup) */
[data-template="bistro"] .bs-act { flex: none; }
[data-template="bistro"] .add-btn {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1.5px solid var(--bs-acc); color: var(--bs-acc); background: var(--bs-acc-soft);
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
[data-template="bistro"] .add-btn:active { transform: scale(0.9); }
@media (hover: hover) {
  [data-template="bistro"] .add-btn:hover { background: var(--bs-acc); color: var(--bs-acc-ink); }
}
[data-template="bistro"] .add-btn svg { width: 15px; height: 15px; stroke-width: 2.4; }
[data-template="bistro"] .qty {
  display: inline-flex; align-items: center; gap: 2px;
  border: 1.5px solid var(--bs-acc); border-radius: 999px; padding: 2px;
}
[data-template="bistro"] .qty button {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 15px; font-weight: 700; color: var(--bs-acc);
}
[data-template="bistro"] .qty button:active { background: var(--bs-acc); color: var(--bs-acc-ink); }
[data-template="bistro"] .qty .n {
  min-width: 20px; text-align: center; font-size: 13px; font-weight: 800; color: var(--bs-ink);
}

/* ---------------- cart FAB ---------------- */
[data-template="bistro"] .fab {
  position: fixed; bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  inset-inline: 16px; max-width: 440px; margin-inline: auto; z-index: 60;
  display: none; align-items: center; gap: 12px;
  background: var(--bs-acc); color: var(--bs-acc-ink);
  border-radius: 999px; padding: 13px 22px;
  font-size: 14px; font-weight: 800;
  box-shadow: 0 10px 28px rgba(30, 92, 65, 0.4);
  transition: transform 0.15s ease;
}
[data-template="bistro"] .fab.show { display: flex; }
[data-template="bistro"] .fab:active { transform: scale(0.98); }
[data-template="bistro"] .fab .ct {
  width: 23px; height: 23px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--bs-acc-ink); color: var(--bs-acc);
  font-size: 11.5px; font-weight: 800;
}
[data-template="bistro"] .fab .lbl { flex: 1; text-align: start; }
[data-template="bistro"] .fab .tot { flex: none; }

/* ---------------- cart drawer (bottom sheet, dir-safe) ---------------- */
[data-template="bistro"] .scrim {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(20, 22, 18, 0.5);
  opacity: 0; pointer-events: none; transition: opacity 0.25s ease;
}
[data-template="bistro"] .scrim.show { opacity: 1; pointer-events: auto; }
[data-template="bistro"] aside.cart {
  position: fixed; z-index: 80;
  inset-inline: 0; bottom: 0; margin-inline: auto;
  width: 100%; max-width: 540px; max-height: 86dvh;
  display: flex; flex-direction: column;
  background: var(--bs-card); color: var(--bs-ink);
  border-radius: 22px 22px 0 0;
  border: 1px solid var(--bs-line); border-bottom: 0;
  transform: translateY(105%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0.2, 1);
}
[data-template="bistro"] aside.cart.show { transform: translateY(0); }
[data-template="bistro"] .cart-handle {
  width: 40px; height: 4px; border-radius: 999px;
  background: var(--bs-line); margin: 10px auto 0; flex: none;
}
[data-template="bistro"] .cart-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; flex: none;
}
[data-template="bistro"] .cart-title {
  margin: 0;
  font-family: "Cormorant Garamond", "Amiri", serif; font-weight: 600;
  font-size: 22px;
}
[data-template="bistro"][data-lang="ar"] .cart-title { font-family: "Amiri", "Cairo", serif; }
[data-template="bistro"] .cart-close {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--bs-acc-soft); color: var(--bs-ink);
}
[data-template="bistro"] .cart-close svg { width: 15px; height: 15px; }
[data-template="bistro"] .cart-list { flex: 1; overflow-y: auto; padding: 2px 20px; }
[data-template="bistro"] .cart-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--bs-line);
}
[data-template="bistro"] .cart-item:last-child { border-bottom: 0; }
[data-template="bistro"] .cart-item img {
  width: 50px; height: 50px; border-radius: 10px; object-fit: cover; flex: none;
}
[data-template="bistro"] .cart-item > div:not(.qty) { flex: 1; min-width: 0; }
[data-template="bistro"] .cart-item .nm {
  font-size: 14px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
[data-template="bistro"] .cart-item .pr { font-size: 12.5px; color: var(--bs-ink-3); margin-top: 2px; }
[data-template="bistro"] .cart-empty { text-align: center; padding: 38px 16px; color: var(--bs-ink-3); }
[data-template="bistro"] .cart-empty .ico { font-size: 34px; margin-bottom: 8px; }
[data-template="bistro"] .cart-empty h3 { margin: 0 0 4px; font-size: 16px; color: var(--bs-ink); }
[data-template="bistro"] .cart-empty p { margin: 0; font-size: 13px; }
[data-template="bistro"] .cart-foot {
  flex: none; padding: 14px 20px calc(18px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--bs-line);
}
[data-template="bistro"] .cart-totals {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px;
}
[data-template="bistro"] .cart-totals .lbl { font-size: 13.5px; font-weight: 700; color: var(--bs-ink-2); }
[data-template="bistro"] .cart-totals .val { font-size: 19px; font-weight: 800; color: var(--bs-acc); }
[data-template="bistro"] .cart-eta {
  display: flex; align-items: center; gap: 7px;
  margin: 0 0 12px; font-size: 12.5px; font-weight: 600; color: var(--bs-ink-2);
}
[data-template="bistro"] .cart-eta svg { width: 14px; height: 14px; flex: none; }
[data-template="bistro"] .btn-whatsapp {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--bs-wa); color: #fff;
  border-radius: 999px; padding: 14px; font-size: 14.5px; font-weight: 800;
  transition: filter 0.15s ease, transform 0.15s ease;
}
[data-template="bistro"] .btn-whatsapp:active { transform: scale(0.98); }
@media (hover: hover) { [data-template="bistro"] .btn-whatsapp:hover { filter: brightness(1.07); } }
[data-template="bistro"] .btn-whatsapp.clipboard-mode { background: var(--bs-ink); color: var(--bs-paper); }
[data-template="bistro"] .btn-whatsapp .wa-icon { display: grid; place-items: center; }
[data-template="bistro"] .btn-whatsapp .wa-icon svg { width: 19px; height: 19px; }

/* ---------------- lightbox / toast ---------------- */
[data-template="bistro"] .bs-lightbox {
  position: fixed; inset: 0; z-index: 90;
  display: none; align-items: center; justify-content: center; padding: 24px;
  background: rgba(20, 22, 18, 0.85);
}
[data-template="bistro"] .bs-lightbox.show { display: flex; }
[data-template="bistro"] .bs-lightbox img {
  max-width: min(92vw, 620px); max-height: 84vh;
  border-radius: 16px; object-fit: contain;
}
[data-template="bistro"] .bs-lb-close {
  position: absolute; top: calc(18px + env(safe-area-inset-top, 0px)); inset-inline-end: 18px;
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.14); color: #fff;
}
[data-template="bistro"] .bs-lb-close svg { width: 17px; height: 17px; }
[data-template="bistro"] .toast {
  position: fixed; bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  inset-inline: 16px; margin-inline: auto; width: fit-content; max-width: 90vw; z-index: 100;
  background: var(--bs-ink); color: var(--bs-paper);
  font-size: 13px; font-weight: 700;
  padding: 11px 18px; border-radius: 999px;
  opacity: 0; transform: translateY(8px); pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
[data-template="bistro"] .toast.show { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  [data-template="bistro"] * { transition: none !important; }
}
