/* Shop menus: desktop category bar + mega menu, and the phone Categories sheet.
   Markup: em-public/includes/category-nav.php (desktop), bottom-nav.php (phone sheet). Behaviour: em-assets/js/layout/shop-menu.js */

/* ---------- desktop bar ---------- */
.cnav { position: relative; z-index: 1200; background: #fff; border-bottom: 1px solid #ECECF0; }
.cnav-in { position: relative; display: flex; align-items: center; gap: 6px; height: 52px; }
.cnav-all {
  flex: none; display: inline-flex; align-items: center; gap: 9px; height: 38px; padding: 0 18px; margin-right: 8px;
  border: 0; border-radius: 12px; background: var(--primary, #E97C43); color: var(--on-primary, #fff); font-size: 14px; font-weight: 700; cursor: pointer;
  transition: background .15s ease, box-shadow .15s ease;
}
.cnav-all:hover, .cnav-all[aria-expanded="true"] { background: var(--primary-dark, #C45A2A); box-shadow: 0 6px 16px color-mix(in srgb, var(--primary, #E97C43) 35%, transparent); }
.cnav-strip { flex: 1; min-width: 0; display: flex; gap: 2px; overflow-x: auto; scroll-behavior: smooth; scrollbar-width: none; }
.cnav-strip::-webkit-scrollbar { display: none; }
.cnav-i {
  position: relative; flex: none; display: inline-flex; align-items: center; height: 38px; padding: 0 14px; border-radius: 10px;
  color: #1F2937; font-size: 14px; font-weight: 600; white-space: nowrap; text-decoration: none; transition: background .12s ease, color .12s ease;
}
.cnav-i:hover, .cnav-i.is-on { background: color-mix(in srgb, var(--primary, #E97C43) 10%, #fff); color: var(--primary-dark, #C45A2A); }
.cnav-arrow {
  position: absolute; top: 8px; z-index: 2; width: 36px; height: 36px; display: grid; place-items: center;
  border: 1px solid #E5E7EB; border-radius: 50%; background: #fff; color: #374151; cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
}
.cnav-arrow[hidden] { display: none; }
#catPrev { left: 176px; }
#catNext { right: 0; }
.desktop-header.compact .cnav { height: 0; overflow: hidden; border: 0; visibility: hidden; }

/* ---------- desktop mega menu ---------- */
.sm-veil { position: fixed; inset: 0; z-index: 1100; background: rgba(15, 23, 42, .38); animation: smFade .15s ease both; }
.sm-veil[hidden] { display: none; }
.sm-wrap { position: relative; height: 0; padding: 0; }
.sm-panel {
  position: absolute; left: 12px; right: 12px; top: 0; z-index: 2; display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  max-height: min(600px, calc(100vh - 200px)); background: #fff; border: 1px solid #ECECF0; border-top: 0; border-radius: 0 0 22px 22px;
  box-shadow: 0 30px 60px rgba(15, 23, 42, .22); overflow: hidden; animation: smIn .16s ease both;
}
.sm-panel[hidden] { display: none; }
.sm-tabs { display: flex; gap: 8px; padding: 14px 20px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid #F0F1F4; background: #FAFAFB; }
.sm-tabs::-webkit-scrollbar { display: none; }
.sm-tabs a { flex: none; display: inline-flex; align-items: center; gap: 8px; padding: 5px 14px 5px 6px; border: 1px solid #E8EAEE; border-radius: 999px; background: #fff; color: #1F2937; font-size: 13.5px; font-weight: 600; text-decoration: none; transition: all .14s ease; }
.sm-ico { flex: none; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; overflow: hidden; background: color-mix(in srgb, var(--primary, #E97C43) 12%, #fff); color: var(--primary, #E97C43); font-size: 12px; }
.sm-ico img { width: 100%; height: 100%; object-fit: cover; }
.sm-nm { white-space: nowrap; }
.sm-tabs a:hover { border-color: var(--primary, #E97C43); }
.sm-tabs a.is-on { background: var(--primary, #E97C43); border-color: var(--primary, #E97C43); color: var(--on-primary, #fff); box-shadow: 0 6px 14px color-mix(in srgb, var(--primary, #E97C43) 32%, transparent); }
.sm-tabs a.is-on .sm-ico { background: rgba(255, 255, 255, .22); color: inherit; }
.sm-body { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 22px; padding: 20px 22px; overflow-y: auto; min-height: 0; }
.sm-hero { align-self: start; position: sticky; top: 0; display: grid; gap: 8px; padding: 22px 20px; border-radius: 18px; color: #fff; background: linear-gradient(150deg, var(--primary, #E97C43), var(--primary-dark, #C45A2A)); box-shadow: 0 14px 28px color-mix(in srgb, var(--primary, #E97C43) 28%, transparent); }
.sm-hero:empty { visibility: hidden; }
.sm-hero-ico { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 16px; overflow: hidden; background: rgba(255, 255, 255, .2); font-size: 22px; }
.sm-hero-ico img { width: 100%; height: 100%; object-fit: cover; }
.sm-hero h3 { margin: 6px 0 0; font-size: 1.35rem; font-weight: 800; line-height: 1.2; }
.sm-hero p { margin: 0; font-size: 13px; opacity: .9; }
.sm-hero-cta { margin-top: 8px; justify-self: start; display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 999px; background: #fff; color: var(--primary-dark, #C45A2A); font-size: 13px; font-weight: 800; text-decoration: none; }
.sm-hero-cta i { font-size: 11px; transition: transform .15s ease; }
.sm-hero-cta:hover i { transform: translateX(3px); }
.sm-main { min-width: 0; }
.sm-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.sm-card { padding: 14px; border: 1px solid #EEF0F3; border-radius: 16px; background: #fff; transition: box-shadow .15s ease, border-color .15s ease; }
.sm-card:hover { border-color: color-mix(in srgb, var(--primary, #E97C43) 40%, #fff); box-shadow: 0 10px 24px rgba(15, 23, 42, .08); }
.sm-card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 14.5px; font-weight: 800; color: #111827; text-decoration: none; }
.sm-card-i { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; overflow: hidden; background: #F3F4F6; color: var(--primary, #E97C43); font-size: 14px; }
.sm-card-i img { width: 100%; height: 100%; object-fit: cover; }
.sm-card-l { display: grid; gap: 2px; }
.sm-card-l a { padding: 3px 0 3px 2px; font-size: 13px; color: #4B5563; text-decoration: none; transition: color .12s ease, transform .12s ease; }
.sm-card-l a:hover { color: var(--primary-dark, #C45A2A); transform: translateX(3px); }
.sm-card-l .sm-more { font-size: 12.5px; font-weight: 700; color: var(--primary, #E97C43); }
.sm-empty { color: #6B7280; font-size: 14px; }
.sm-side { padding: 14px 22px 18px; background: #FAFAFB; border-top: 1px solid #F0F1F4; }
.sm-side[hidden] { display: none; }
.sm-side-t { margin-bottom: 10px; font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #6B7280; }
.sm-side-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.sm-p { display: grid; grid-template-columns: 52px 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; padding: 6px; border-radius: 12px; background: #fff; border: 1px solid #EEF0F3; text-decoration: none; transition: box-shadow .15s ease, transform .15s ease; }
.sm-p:hover { box-shadow: 0 8px 20px rgba(15, 23, 42, .1); transform: translateY(-1px); }
.sm-p-img { grid-row: 1 / 3; width: 52px; height: 52px; border-radius: 9px; overflow: hidden; background: #F1F2F5; }
.sm-p-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sm-p-name { align-self: end; font-size: 12.5px; line-height: 1.3; font-weight: 600; color: #1F2937; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.sm-p-price { align-self: start; margin-top: 2px; font-size: 13px; font-weight: 800; color: #111827; }
.sm-p-price s { margin-left: 4px; font-size: 11.5px; font-weight: 500; color: #9CA3AF; }

/* shared: loading + failure */
.sm-sk { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 26px; }
.sm-sk-col { display: grid; gap: 10px; align-content: start; }
.sm-fail { display: grid; justify-items: center; gap: 8px; padding: 40px 12px; text-align: center; color: #6B7280; }
.sm-fail i { font-size: 26px; color: #CBD0D8; }
.sm-fail p { margin: 0; }
.sm-retry { display: inline-block; padding: 8px 18px; border: 0; border-radius: 10px; background: var(--primary, #E97C43); color: var(--on-primary, #fff); font-weight: 700; text-decoration: none; cursor: pointer; }
@keyframes smIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes smFade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- phone sheet ---------- */
.sm-sheet { position: fixed; inset: 0 0 var(--bn-h, 0px) 0; z-index: 99990; display: flex; flex-direction: column; background: #fff; transform: translateY(100%); transition: transform .24s cubic-bezier(.2, .8, .2, 1); overscroll-behavior: contain; }
.sm-sheet[hidden] { display: none; }
.sm-sheet.is-open { transform: none; }
html.sm-lock { overflow: hidden; }
.sm-sheet-top { display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 8px; }
.sm-back { flex: none; width: 42px; height: 42px; display: grid; place-items: center; border: 0; border-radius: 50%; background: #F3F4F6; color: #111827; font-size: 15px; }
.sm-search { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 12px; margin: 0; border-radius: 14px; background: #F3F4F6; color: #6B7280; }
.sm-search:focus-within { background: #fff; box-shadow: 0 0 0 2px var(--primary, #E97C43); }
.sm-q { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font: inherit; font-size: 15px; color: #111827; -webkit-appearance: none; appearance: none; }
.sm-q::-webkit-search-cancel-button { display: none; }
.sm-qx { flex: none; width: 24px; height: 24px; border: 0; border-radius: 50%; background: #D1D5DB; color: #fff; font-size: 11px; display: grid; place-items: center; }
.sm-qx[hidden] { display: none; }
.sm-chips { flex: none; display: flex; gap: 8px; padding: 6px 12px 12px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid #F0F1F4; }
.sm-chips::-webkit-scrollbar { display: none; }
.sm-chips button { flex: none; display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 14px 0 6px; border: 1px solid #E5E7EB; border-radius: 999px; background: #fff; color: #374151; font: inherit; font-size: 13.5px; font-weight: 600; transition: all .15s ease; }
.sm-chips button em { font-style: normal; white-space: nowrap; }
.sm-chip-ico { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; overflow: hidden; background: color-mix(in srgb, var(--primary, #E97C43) 11%, #fff); color: var(--primary, #E97C43); font-size: 13px; }
.sm-chip-ico img { width: 100%; height: 100%; object-fit: cover; }
.sm-chips button.is-on { border-color: var(--primary, #E97C43); background: color-mix(in srgb, var(--primary, #E97C43) 10%, #fff); color: var(--primary-dark, #C45A2A); }
.sm-chips button.is-on .sm-chip-ico { background: var(--primary, #E97C43); color: var(--on-primary, #fff); }
.sm-body { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 14px 14px calc(28px + env(safe-area-inset-bottom, 0px)); }
.sm-banner { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 18px; color: var(--on-primary, #fff); text-decoration: none; background: linear-gradient(135deg, var(--primary, #E97C43), var(--primary-dark, #C45A2A)); box-shadow: 0 10px 24px color-mix(in srgb, var(--primary, #E97C43) 30%, transparent); }
.sm-banner b { display: block; font-size: 16px; }
.sm-banner small { display: block; opacity: .85; font-size: 12px; }
.sm-banner > span:nth-child(2) { flex: 1; min-width: 0; }
.sm-banner-ico { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; background: rgba(255, 255, 255, .2); font-size: 18px; overflow: hidden; }
.sm-banner-ico img { width: 100%; height: 100%; object-fit: cover; }
.sm-sec { margin-top: 20px; }
.sm-sec-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.sm-sec-h > a:first-child, .sm-sec-h > span { font-size: 15.5px; font-weight: 800; color: #111827; text-decoration: none; }
.sm-sec-all { font-size: 12.5px; font-weight: 700; color: var(--primary-dark, #C45A2A); text-decoration: none; }
.sm-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.sm-pills a { padding: 9px 14px; border: 1px solid #EEF0F3; border-radius: 999px; background: #F7F8FA; color: #374151; font-size: 13.5px; text-decoration: none; }
.sm-pills a:active { background: color-mix(in srgb, var(--primary, #E97C43) 12%, #fff); border-color: var(--primary, #E97C43); }
.sm-strip { display: flex; gap: 10px; overflow-x: auto; margin: 0 -14px; padding: 2px 14px 6px; scrollbar-width: none; scroll-snap-type: x proximity; }
.sm-strip::-webkit-scrollbar { display: none; }
.sm-pc { flex: none; width: 132px; scroll-snap-align: start; display: grid; gap: 6px; text-decoration: none; }
.sm-pc .sm-p-img { width: 132px; height: 132px; border-radius: 14px; }
.sm-pc .sm-p-name { font-size: 12.5px; }
.sm-pc .sm-p-price { margin: 0; font-size: 13.5px; }
.sm-res { display: grid; }
.sm-res a { display: flex; align-items: center; gap: 12px; padding: 12px 2px; border-bottom: 1px solid #F3F4F6; text-decoration: none; color: #111827; }
.sm-res a > span:nth-child(2) { flex: 1; min-width: 0; }
.sm-res b { display: block; font-size: 14.5px; }
.sm-res small { display: block; color: #6B7280; font-size: 12px; margin-top: 1px; }
.sm-res i.fa-chevron-right { color: #C0C5CE; font-size: 11px; }
.sm-res-ico { flex: none; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; overflow: hidden; background: color-mix(in srgb, var(--primary, #E97C43) 11%, #fff); color: var(--primary, #E97C43); }
.sm-res-ico img { width: 100%; height: 100%; object-fit: cover; }
.sm-sheet .sm-sk { grid-template-columns: 1fr; gap: 18px; }

/* phone sidebar entry */
.sb-cats-open { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid #F0F1F4; border-radius: 16px; background: #FAFAFB; text-align: left; }
.sb-cats-ico { flex: none; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: var(--primary, #E97C43); color: var(--on-primary, #fff); }
.sb-cats-txt { flex: 1; min-width: 0; }
.sb-cats-txt b { display: block; font-size: .95rem; color: #111827; }
.sb-cats-txt small { display: block; color: #6B7280; font-size: .78rem; }
.sb-cats-open > i { color: #A3A9B5; font-size: 12px; }

@media (max-width: 991px) { .cnav, .sm-veil { display: none !important; } }
@media (min-width: 992px) { .sm-sheet { display: none !important; } }
@media (prefers-reduced-motion: reduce) { .sm-panel, .sm-veil { animation: none; } .sm-sheet { transition: none; } }

html.sm-lock .mobile-bottom-nav { z-index: 99995; }

/* the bar above already lists the categories: the pills inside show only after "All categories" */
.sm-panel:not(.is-all) .sm-tabs { display: none; }
.sm-panel:not(.is-all) { grid-template-rows: minmax(0, 1fr) auto; }
.sm-card-l { max-height: 176px; overflow-y: auto; scrollbar-width: thin; }
.sm-hero-all { justify-self: start; margin-top: 4px; font-size: 12.5px; color: rgba(255,255,255,.9); text-decoration: underline; text-underline-offset: 3px; }
.sm-hero { box-shadow: none; }
.sm-tabs a.is-on { box-shadow: none; }
.sm-card:hover { box-shadow: none; }
.sm-panel { box-shadow: 0 12px 28px rgba(15, 23, 42, .12); border-radius: 0 0 14px 14px; }
