/* 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-columns: 276px minmax(0, 1fr) 272px;
  height: min(540px, calc(100vh - 210px)); background: #fff; border: 1px solid #ECECF0; border-top: 0; border-radius: 0 0 20px 20px;
  box-shadow: 0 30px 60px rgba(15, 23, 42, .22); overflow: hidden; animation: smIn .16s ease both;
}
.sm-panel[hidden] { display: none; }
.sm-rail { margin: 0; padding: 12px 10px; list-style: none; background: #FAFAFB; border-right: 1px solid #F0F1F4; overflow-y: auto; }
.sm-rail a { position: relative; display: flex; align-items: center; gap: 12px; padding: 8px 10px; margin-bottom: 2px; border-radius: 12px; color: #1F2937; font-size: 14px; font-weight: 600; text-decoration: none; }
.sm-ico { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; overflow: hidden; background: color-mix(in srgb, var(--primary, #E97C43) 11%, #fff); color: var(--primary, #E97C43); font-size: 14px; }
.sm-ico img { width: 100%; height: 100%; object-fit: cover; }
.sm-nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sm-go { font-size: 10px; color: #A3A9B5; opacity: 0; transform: translateX(-4px); transition: all .15s ease; }
.sm-rail a:hover, .sm-rail a.is-on { background: #fff; box-shadow: 0 1px 6px rgba(15, 23, 42, .08); color: var(--primary-dark, #C45A2A); }
.sm-rail a.is-on .sm-go, .sm-rail a:hover .sm-go { opacity: 1; transform: none; color: var(--primary, #E97C43); }
.sm-main { padding: 22px 30px; overflow-y: auto; min-width: 0; }
.sm-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-bottom: 12px; margin-bottom: 18px; border-bottom: 1px solid #F0F1F4; }
.sm-head h3 { margin: 0; font-size: 1.3rem; font-weight: 800; color: #111827; }
.sm-all { font-size: 13px; font-weight: 700; color: var(--primary-dark, #C45A2A); text-decoration: none; white-space: nowrap; }
.sm-all i { font-size: 11px; margin-left: 4px; transition: transform .15s ease; }
.sm-all:hover i { transform: translateX(3px); }
.sm-cols { columns: 3 200px; column-gap: 30px; }
.sm-col { display: flex; flex-direction: column; gap: 4px; break-inside: avoid; margin-bottom: 22px; }
.sm-col a { padding: 2px 0; font-size: 13.5px; color: #4B5563; text-decoration: none; transition: color .12s ease, transform .12s ease; }
.sm-col a:hover { color: var(--primary-dark, #C45A2A); transform: translateX(2px); }
.sm-col .sm-h { margin-bottom: 4px; padding-bottom: 6px; border-bottom: 2px solid color-mix(in srgb, var(--primary, #E97C43) 18%, #fff); font-size: 14px; font-weight: 800; color: #111827; }
.sm-col .sm-more { font-size: 12.5px; font-weight: 700; color: var(--primary, #E97C43); }
.sm-empty { color: #6B7280; font-size: 14px; }
.sm-side { padding: 22px 20px; background: #FAFAFB; border-left: 1px solid #F0F1F4; overflow-y: auto; }
.sm-side-t { margin-bottom: 14px; font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #6B7280; }
.sm-side-list { display: grid; gap: 12px; }
.sm-p { display: grid; grid-template-columns: 64px 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; padding: 8px; border-radius: 14px; 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: 64px; height: 64px; border-radius: 10px; 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: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sm-p-price { align-self: start; margin-top: 3px; 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; }
