/* =========================================================
   header_food.css  —  LocalBazar Food site header
   Loaded by partials/header_food.ejs itself, so every page that
   includes the header gets it. Self-contained (own --hd-* tokens).
   Do NOT also load the old /header.css on pages using this header.
   ========================================================= */
.lb-header, .lb-subnav, .lb-drawer, .lb-drawer-overlay {
  --hd-leaf-900: #0b3d2c;
  --hd-leaf-700: #0f5c3f;
  --hd-leaf-600: #138556;
  --hd-leaf-100: #e3f3ea;
  --hd-mango: #ffb81c;
  --hd-ink: #17211c;
  --hd-ink-2: #4a5a52;
  --hd-ink-3: #7c8b83;
  --hd-line: #e3e9e5;
  --hd-bg: #f5f8f6;
  --hd-wrap: 1240px;
  font-family: var(--font-body, "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
}
/* resets use :where() so they have zero specificity and never beat the component rules below */
:where(.lb-header, .lb-subnav, .lb-drawer), :where(.lb-header, .lb-subnav, .lb-drawer) *,
:where(.lb-header, .lb-drawer) *::before, :where(.lb-header, .lb-drawer) *::after { box-sizing: border-box; }
:where(.lb-header, .lb-subnav, .lb-drawer) a { color: inherit; text-decoration: none; }
:where(.lb-header, .lb-subnav, .lb-drawer) ul { list-style: none; margin: 0; padding: 0; }
:where(.lb-header, .lb-drawer) button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
.lb-header :focus-visible, .lb-drawer :focus-visible { outline: 3px solid var(--hd-leaf-600); outline-offset: 2px; }

/* ---------------------------------------------------------
   Top bar
   --------------------------------------------------------- */
header.lb-header {
  position: sticky; top: 0; z-index: 90;       /* below page modals (100) so they cover it */
  display: block; margin: 0; padding: 0; height: auto;
  background: #fff; color: var(--hd-ink);
  border-bottom: 1px solid var(--hd-line);
  box-shadow: 0 4px 18px rgba(15, 60, 44, .06);
}
.lb-header__row {
  width: min(100% - 32px, var(--hd-wrap)); margin-inline: auto;
  min-height: 72px;
  display: flex; align-items: center; gap: 16px;
}

.lb-logo { flex: none; display: flex; align-items: center; }
.lb-logo img { height: 44px; width: auto; max-width: 150px; object-fit: contain; display: block; }

/* ---------------------------------------------------------
   Delivery location
   --------------------------------------------------------- */
.lb-location { position: relative; flex: 0 1 auto; min-width: 0; }
.lb-location__trigger {
  display: flex; align-items: center; gap: 10px;
  max-width: 260px; padding: 6px 14px 6px 6px;
  background: var(--hd-bg); border: 1px solid var(--hd-line); border-radius: 999px;
  color: var(--hd-ink); text-align: left;
  transition: border-color .15s, background .15s;
}
.lb-location__trigger:hover,
.lb-location.active .lb-location__trigger { background: #fff; border-color: var(--hd-leaf-600); }
.lb-location__pin {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; font-size: 15px;
  background: var(--hd-leaf-100); color: var(--hd-leaf-700);
}
.lb-location__labels { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
#locationText {
  display: block; max-width: 170px;
  font-size: 13px; font-weight: 700; color: var(--hd-ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.location-header-status {
  display: block; margin-top: 2px; max-width: 170px;
  font-size: 11px; font-weight: 700; line-height: 1.25; color: var(--hd-ink-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.location-header-status.is-yes { color: #16834a; }
.location-header-status.is-no { color: #d0382b; }
.lb-location__caret { flex: none; font-size: 11px; color: var(--hd-ink-3); transition: transform .2s; }
.lb-location.active .lb-location__caret { transform: rotate(180deg); }

/* dropdown panel */
.lb-location__panel {
  display: none;
  position: absolute; top: calc(100% + 10px); left: 0;
  width: 340px; max-width: calc(100vw - 24px);
  z-index: 99999;
  background: #fff; color: #222;
  border: 1px solid var(--hd-line); border-radius: 16px;
  box-shadow: 0 16px 40px rgba(11, 61, 44, .2);
}
.lb-location.active .lb-location__panel { display: block; }
.lb-location__panel * { box-sizing: border-box; }

.delivery-location-panel { width: 100%; min-width: 0; max-width: 100%; max-height: min(78vh, 600px); overflow: hidden; display: flex; flex-direction: column; gap: 12px; padding: 18px; }
.delivery-location-heading { font-weight: 700; font-size: 16px; line-height: 1.35; color: #222; overflow-wrap: anywhere; }
.delivery-location-current { font-size: 12px; color: #666; display: flex; flex-direction: column; gap: 5px; min-width: 0; overflow-wrap: anywhere; }
.delivery-current-name { font-weight: 600; color: #333; line-height: 1.4; }
.delivery-status { display: inline-block; width: fit-content; max-width: 100%; font-size: 12px; font-weight: 700; line-height: 1.4; white-space: normal; overflow-wrap: anywhere; }
.delivery-status--yes { color: #16803c; }
.delivery-status--no { color: #c62828; }
.delivery-location-list { width: 100%; min-width: 0; overflow-x: hidden; overflow-y: auto; max-height: min(42vh, 340px); min-height: 0; display: flex; flex-direction: column; gap: 8px; padding: 2px; }
.delivery-location-option { width: 100%; min-width: 0; display: flex; align-items: flex-start; gap: 10px; text-align: left; padding: 12px; border: 1px solid #e8e8e8; border-radius: 12px; background: #fff; cursor: pointer; color: #222; white-space: normal; transition: border-color .15s, background .15s; }
.delivery-location-option:hover, .delivery-location-option.is-selected { border-color: #25864a; background: #f1faf4; }
.delivery-location-option .delivery-pin { font-size: 18px; flex: 0 0 auto; }
.delivery-location-option .delivery-location-info { display: flex; flex: 1 1 auto; flex-direction: column; gap: 3px; min-width: 0; overflow-wrap: anywhere; }
.delivery-location-option strong { font-size: 13px; line-height: 1.35; font-weight: 600; white-space: normal; overflow-wrap: anywhere; }
.delivery-location-option small { font-size: 11px; line-height: 1.35; color: #777; white-space: normal; overflow-wrap: anywhere; }
.delivery-location-option .delivery-check { flex: 0 0 auto; max-width: 82px; font-size: 11px; line-height: 1.3; color: #25864a; font-weight: 700; white-space: normal; text-align: right; overflow-wrap: anywhere; }
.delivery-location-message { padding: 14px 8px; font-size: 13px; line-height: 1.45; color: #666; text-align: center; white-space: normal; overflow-wrap: anywhere; }
.lb-btn-reset {
  width: 100%; min-height: 42px; flex: 0 0 auto; white-space: normal;
  border-radius: 999px; background: var(--hd-leaf-700); color: #fff;
  font-size: 13px; font-weight: 700; transition: background .15s;
}
.lb-btn-reset:hover { background: var(--hd-leaf-600); }

/* ---------------------------------------------------------
   Search (markup comes from searchbar_food.ejs + searchbar.css)
   --------------------------------------------------------- */
.lb-search { position: relative; flex: 1 1 auto; min-width: 0; }
.lb-search > *:not(#results) { width: 100%; margin: 0; }
.lb-search:focus-within input { box-shadow: 0 0 0 4px rgba(19, 133, 86, .16); }

.lb-search #results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 120;
  max-height: 340px; overflow-y: auto;
  background: #fff; border: 1px solid var(--hd-line); border-radius: 14px;
  box-shadow: 0 16px 40px rgba(11, 61, 44, .16);
}
.lb-search #results:empty { display: none; }
.lb-search #results > div { padding: 11px 16px; font-size: 14px; cursor: pointer; color: var(--hd-ink); }
.lb-search #results > div:hover { background: var(--hd-leaf-100); }

/* ---------------------------------------------------------
   Login + action buttons
   --------------------------------------------------------- */
.lb-login {
  flex: none; height: 42px; padding: 0 22px;
  display: inline-flex; align-items: center;
  border-radius: 999px; background: var(--hd-leaf-700); color: #fff;
  font-size: 14px; font-weight: 700; transition: background .15s;
}
.lb-login:hover { background: var(--hd-leaf-600); }

.lb-actions { flex: none; display: flex; align-items: center; gap: 4px; }
.lb-actions li { display: flex; }

.lb-action {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  min-width: 62px; height: 56px; padding: 0 10px;
  border-radius: 14px;
  font-size: 11.5px; font-weight: 600; line-height: 1; white-space: nowrap;
  color: var(--hd-ink-2);
  transition: background .15s, color .15s, filter .15s;
}
.lb-action i { font-size: 18px; line-height: 1; }
.lb-action:hover { background: var(--hd-leaf-100); color: var(--hd-leaf-700); }

/* the one loud element: mango Cart */
.lb-action--cart { background: var(--hd-mango); color: var(--hd-leaf-900); }
.lb-action--cart:hover { background: #ffc43d; color: var(--hd-leaf-900); }

/* seller: outlined pill, icon + text on one line */
.lb-action--seller {
  flex-direction: row; gap: 8px; height: 42px; padding: 0 16px; margin-right: 10px;
  border: 1.5px solid var(--hd-line); border-radius: 999px;
  font-size: 13px; color: var(--hd-leaf-700);
}
.lb-action--seller i { font-size: 14px; }
.lb-action--seller:hover { border-color: var(--hd-leaf-600); }

/* hamburger (mobile only) */
.lb-menu-btn {
  display: none; flex: none; width: 42px; height: 42px; border-radius: 12px;
  background: var(--hd-bg); border: 1px solid var(--hd-line);
  place-items: center; font-size: 18px; color: var(--hd-ink);
}

/* ---------------------------------------------------------
   Sub navbar — slim dark-green strip
   --------------------------------------------------------- */
nav.lb-subnav { display: block; position: static; margin: 0; padding: 0; background: var(--hd-leaf-900); }
.lb-subnav__list {
  width: min(100% - 32px, var(--hd-wrap)); margin-inline: auto;
  display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none;
}
.lb-subnav__list::-webkit-scrollbar { display: none; }
.lb-subnav a {
  position: relative; display: block; padding: 11px 14px;
  font-size: 14px; font-weight: 600; white-space: nowrap;
  color: rgba(255, 255, 255, .78); transition: color .15s;
}
.lb-subnav a:hover, .lb-subnav a[aria-current="page"] { color: #fff; }
.lb-subnav a::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 0; height: 3px;
  border-radius: 3px 3px 0 0; background: var(--hd-mango);
  transform: scaleX(0); transform-origin: left; transition: transform .2s;
}
.lb-subnav a:hover::after, .lb-subnav a[aria-current="page"]::after { transform: scaleX(1); }
.lb-subnav a:focus-visible { outline: 3px solid var(--hd-mango); outline-offset: -3px; border-radius: 6px; }

/* ---------------------------------------------------------
   Mobile drawer
   --------------------------------------------------------- */
.lb-drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: min(86vw, 320px);
  z-index: 1901; display: flex; flex-direction: column;
  background: #fff; color: var(--hd-ink);
  box-shadow: -12px 0 40px rgba(8, 24, 18, .2);
  transform: translateX(100%); visibility: hidden;
  transition: transform .28s ease, visibility .28s;
}
.lb-drawer.active { transform: none; visibility: visible; }
.lb-drawer__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--hd-line);
  font-family: var(--font-head, "Bricolage Grotesque", "Trebuchet MS", system-ui, sans-serif);
  font-size: 19px; font-weight: 800;
}
.lb-drawer__close { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--hd-bg); font-size: 16px; }
.lb-drawer__links { padding: 10px 0; overflow-y: auto; }
.lb-drawer__link {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 13px 20px; font-size: 15px; font-weight: 600; text-align: left; color: var(--hd-ink);
  transition: background .15s;
}
.lb-drawer__link:hover { background: var(--hd-leaf-100); }
.lb-drawer__link i {
  flex: none; width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center; font-size: 15px;
  background: var(--hd-leaf-100); color: var(--hd-leaf-700);
}
.lb-drawer-overlay {
  position: fixed; inset: 0; z-index: 1900;
  background: rgba(8, 24, 18, .5); backdrop-filter: blur(3px);
  opacity: 0; visibility: hidden; transition: opacity .25s, visibility .25s;
}
.lb-drawer-overlay.active { opacity: 1; visibility: visible; }

/* ---------------------------------------------------------
   Tablet: icon-only actions (labels stay for screen readers)
   --------------------------------------------------------- */
@media (max-width: 1199px) {
  .lb-header__row { gap: 12px; }
  .lb-action span {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  .lb-action, .lb-action--seller {
    min-width: 0; width: 44px; height: 44px; padding: 0; margin: 0;
    border-radius: 50%; border-width: 0; position: relative;
  }
  .lb-action--seller { background: var(--hd-bg); }
  .lb-action--seller i { font-size: 16px; }
}

/* ---------------------------------------------------------
   Mobile
   --------------------------------------------------------- */
@media (max-width: 860px) {
  .lb-header__row { flex-wrap: wrap; min-height: 0; padding: 10px 0; gap: 10px; }
  .lb-logo { order: 1; }
  .lb-logo img { height: 36px; max-width: 120px; }
  .lb-location { order: 2; flex: 1 1 0; }
  .lb-location__trigger { width: 100%; max-width: 100%; }
  #locationText, .location-header-status { max-width: min(48vw, 190px); }
  .lb-login { order: 3; height: 40px; padding: 0 16px; }
  .lb-actions { order: 3; }
  .lb-actions li:not(.lb-actions__keep) { display: none; }   /* rest lives in the drawer */
  .lb-menu-btn { order: 4; display: grid; }
  .lb-search { order: 5; flex: 1 0 100%; }
  .lb-subnav__list { width: min(100% - 24px, var(--hd-wrap)); }
}
@media (max-width: 600px) {
  /* keep the location selector centered in the viewport, independent of the trigger position */
  .lb-location__panel {
    position: fixed; top: 50%; bottom: auto; left: 50%; right: auto;
    transform: translate(-50%, -50%);
    width: calc(100vw - 24px); min-width: 0; max-width: 420px;
    max-height: calc(100dvh - 32px); overflow: auto;
  }
  .delivery-location-panel { max-height: calc(100dvh - 34px); padding: 15px; }
  .delivery-location-list { max-height: min(38dvh, 300px); }
  .location-header-status { font-size: 10px; }
}
@media (max-width: 400px) {
  .lb-logo img { max-width: 96px; }
  .lb-location__caret { display: none; }
}
@media (max-width: 360px) {
  .lb-location__panel { width: calc(100vw - 16px); }
  .delivery-location-panel { padding: 12px; gap: 9px; }
  .delivery-location-option { padding: 10px; gap: 7px; }
}
@media (prefers-reduced-motion: reduce) {
  .lb-header *, .lb-subnav *, .lb-drawer, .lb-drawer-overlay { transition-duration: .01ms !important; }
}
