/* ===========================
   Мобільна шапка, меню (mm-) і пошук на весь екран (msearch-)
   Розмітка — templates/includes/navbar.html, логіка — static/js/store/mobile-menu.js
   =========================== */

/* Кнопки шапки на телефоні: ☰ і лупа */
.mob-hd-btn { display: none; }
@media (max-width: 991px) {
  .main-navbar .navbar-content { gap: 2px; }
  .main-navbar .navbar-brand { margin-right: auto; margin-left: 2px; }
  .mob-hd-btn { flex: none; width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 12px; background: none; color: #1f2133; cursor: pointer; }
  .mob-hd-btn:active { background: #f2f3f8; }
  .mob-hd-btn svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
  .main-navbar .navbar-actions { gap: 0; }
  .main-navbar .navbar-actions .cart-link { width: 44px; height: 44px; padding: 0; display: grid; place-items: center; }
  .main-navbar .hide-mob { display: none !important; }
}
/* Вузькі телефони (320–374px): ☰ + логотип + 3 іконки інакше не влазять */
@media (max-width: 374px) {
  .mob-hd-btn, .main-navbar .navbar-actions .cart-link { width: 36px; height: 42px; }
  .main-navbar .navbar-brand .logo { height: 30px; }
}

/* ---------- Меню ---------- */
.mm { position: fixed; inset: 0; z-index: 2000; visibility: hidden; pointer-events: none; }
.mm.active { visibility: visible; pointer-events: auto; }
.mm-overlay { position: absolute; inset: 0; background: rgba(20, 16, 40, .45); opacity: 0; transition: opacity .25s; }
.mm.active .mm-overlay { opacity: 1; }
.mm-sheet { position: absolute; top: 0; bottom: 0; left: 0; width: 100%; max-width: 440px; overflow: hidden; background: #f6f7fb; color: #1f2133; transform: translateX(-100%); transition: transform .28s cubic-bezier(.2, .8, .2, 1); box-shadow: 12px 0 40px rgba(20, 16, 40, .2); }
.mm.active .mm-sheet { transform: none; }
.mm *, .mm *::before, .mm *::after { box-sizing: border-box; }
.mm a { color: inherit; text-decoration: none; }
.mm button { font: inherit; color: inherit; }
.mm a:focus-visible, .mm button:focus-visible { outline: 3px solid #667eea; outline-offset: 2px; }

.mm-panel { position: absolute; inset: 0; display: flex; flex-direction: column; background: #f6f7fb; transition: transform .25s ease; }
.mm-panel[hidden] { display: none; }
.mm-panel--root.is-behind { transform: translateX(-25%); }
.mm-panel.is-entering { animation: mmIn .25s ease; }
@keyframes mmIn { from { transform: translateX(100%); } to { transform: none; } }

.mm-h { flex: none; height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 0 8px 0 14px; padding-top: env(safe-area-inset-top, 0px); background: #fff; border-bottom: 1px solid #eceef5; }
.mm-logo { height: 32px; width: auto; display: block; }
.mm-h--l2 { padding-left: 6px; }
.mm-h--l2 b { flex: 1; min-width: 0; text-align: center; font-size: 16.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mm-btn { flex: none; width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 12px; background: none; cursor: pointer; }
.mm-btn:active { background: #f2f3f8; }
.mm-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.mm-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 12px 12px calc(24px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 10px; }
.mm-body > * { flex-shrink: 0; }

/* Акаунт */
.mm-acc { display: grid; gap: 10px; padding: 14px; border-radius: 18px; background: linear-gradient(135deg, #eef0ff, #f5f3ff); border: 1px solid #e0e4fb; }
.mm-acc-t { display: grid; min-width: 0; }
.mm-acc-t b { font-size: 16px; }
.mm-acc-t small { font-size: 12.5px; color: #6b6f86; }
.mm-acc-b { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mm-go, .mm-gh { height: 42px; display: grid; place-items: center; border-radius: 12px; font-weight: 800; font-size: 14.5px; }
.mm-go { color: #fff !important; background: linear-gradient(120deg, #667eea, #764ba2); box-shadow: 0 8px 18px rgba(102, 126, 234, .3); }
.mm-gh { background: #fff; border: 1.5px solid #dfe2f0; }
.mm-acc--in { display: flex; align-items: center; gap: 12px; background: #fff; border-color: #eceef5; }
.mm-acc--in .mm-acc-t { flex: 1; }
.mm-ava { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 800; font-size: 18px; background: linear-gradient(135deg, #667eea, #764ba2); }
.mm-chev { flex: none; font-size: 12px; color: #a3a7bd; }
/* Плитки підлаштовуються під текст і переносяться цілком — без переносу слів усередині */
.mm-quick { display: flex; flex-wrap: wrap; gap: 8px; }
.mm-quick a { flex: 1 1 auto; display: flex; align-items: center; gap: 8px; min-height: 46px; padding: 8px 12px; border-radius: 14px; background: #fff; border: 1px solid #eceef5; font-weight: 700; font-size: 13.5px; line-height: 1.2; white-space: nowrap; }
.mm-quick i { flex: none; width: 18px; text-align: center; color: #4f5bd5; }
.mm-bdg { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; display: grid; place-items: center; border-radius: 999px; font-style: normal; font-size: 11.5px; font-weight: 800; color: #fff; background: #667eea; }
.mm-bdg--r { background: #e74c3c; }
.mm-bdg--v { background: #7c3aed; }
.mm-bdg--y { background: #f59e0b; }

.mm-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.mm-pills::-webkit-scrollbar { display: none; }
.mm-pill { flex: 1 0 auto; padding: 9px 10px; text-align: center; white-space: nowrap; border-radius: 999px; background: #fff; border: 1px solid #eceef5; font-weight: 800; font-size: 13.5px; }
.mm-pill--hot { color: #fff !important; border: 0; background: linear-gradient(120deg, #f43f5e, #e11d48); }
.mm-pill--new { background: #ecfdf5; border-color: #a7f3d0; color: #047857 !important; }
.mm-label { margin: 6px 2px 0; font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: #8a8ea6; }

/* Розділи */
.mm-list { display: grid; border-radius: 18px; background: #fff; border: 1px solid #eceef5; overflow: hidden; }
.mm-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 12px; border: 0; border-bottom: 1px solid #f2f3f8; background: #fff; text-align: left; cursor: pointer; }
.mm-row:last-child { border-bottom: 0; }
.mm-row:active { background: #f8f9ff; }
.mm-th { flex: none; width: 42px; height: 42px; display: grid; place-items: center; overflow: hidden; border-radius: 12px; background: #fff; border: 1px solid #f0f1f6; }
.mm-th img { width: 100%; height: 100%; object-fit: contain; }
.mm-th--ic { border: 0; color: #fff; font-size: 18px; }
.mm-th--ph { border: 0; background: #f2f3f8; color: #b6b9cc; }
.mm-row-t { flex: 1; display: grid; min-width: 0; }
.mm-row-t b { font-size: 15px; font-weight: 700; line-height: 1.25; }
.mm-row-t small { font-size: 12px; color: #8a8ea6; }

/* Покупцям і контакти */
.mm-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.mm-grid a { flex: 1 1 auto; padding: 12px; border-radius: 14px; background: #fff; border: 1px solid #eceef5; font-weight: 700; font-size: 13.5px; line-height: 1.25; white-space: nowrap; text-align: center; }
.mm-contact { display: grid; gap: 10px; padding: 14px; border-radius: 18px; background: #fff; border: 1px solid #eceef5; }
.mm-phone { display: flex; align-items: center; gap: 12px; }
.mm-phone > i { color: #4f5bd5; font-size: 18px; }
.mm-phone > span { display: grid; }
.mm-phone b { font-size: 17px; }
.mm-phone small { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: #6b6f86; }
.mm .header-phone-dot { width: 8px; height: 8px; border-radius: 50%; background: #9ca3af; }
.mm .header-phone-dot.is-open { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .2); }
.mm-msgr { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mm-msgr a { height: 42px; display: flex; align-items: center; justify-content: center; gap: 6px; border-radius: 12px; font-weight: 800; font-size: 14px; }
.mm-tg { background: #e0f2fe; color: #0369a1 !important; }
.mm-vb { background: #ede9fe; color: #6d28d9 !important; }
.mm-mail { font-size: 13.5px; color: #6b6f86 !important; text-align: center; }
.mm-logout { padding: 12px; text-align: center; font-weight: 700; color: #dc2626 !important; }

/* Рівень 2 */
.mm-all { display: flex; justify-content: space-between; align-items: center; padding: 14px; border-radius: 16px; background: linear-gradient(120deg, #667eea, #764ba2); color: #fff !important; font-weight: 800; }
.mm-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mm-tile { display: grid; justify-items: center; align-content: start; gap: 6px; padding: 12px 8px 10px; border-radius: 16px; background: #fff; border: 1px solid #eceef5; text-align: center; }
.mm-tile:active { border-color: #c7cdf5; }
.mm-tile .mm-th { width: 64px; height: 64px; border: 0; font-size: 22px; }
.mm-tile > span:not(.mm-th) { font-size: 13px; font-weight: 700; line-height: 1.25; }
.mm-tile small { font-size: 11.5px; color: #8a8ea6; }

/* ---------- Пошук на весь екран ---------- */
.msearch { position: fixed; inset: 0; z-index: 2001; display: flex; flex-direction: column; background: #fff; color: #1f2133; animation: msIn .18s ease; }
.msearch[hidden] { display: none; }
@keyframes msIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.msearch-h { flex: none; display: flex; align-items: center; gap: 8px; margin: 0; padding: 10px 10px 10px 12px; padding-top: calc(10px + env(safe-area-inset-top, 0px)); border-bottom: 1px solid #eceef5; }
.msearch-in { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; height: 46px; margin: 0; padding: 0 12px; border-radius: 14px; background: #f2f3f8; border: 2px solid #667eea; }
.msearch-in svg { flex: none; width: 20px; height: 20px; fill: none; stroke: #4f5bd5; stroke-width: 2; stroke-linecap: round; }
.msearch-in input { flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: none; font-size: 16px; color: #1f2133; }
.msearch-x { flex: none; padding: 8px 4px; border: 0; background: none; color: #4f5bd5; font-weight: 700; font-size: 14.5px; cursor: pointer; }
.msearch-body { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 14px 24px; }
.msearch #live-search-results-mobile { position: static; max-height: none; margin: 0 0 12px; padding: 0; border: 0; box-shadow: none; background: none; }
.msearch #live-search-results-mobile .search-item { padding: 8px 0; border-bottom: 1px solid #f2f3f8; }
.msearch #live-search-results-mobile[style*="block"] + .msearch-hint { display: none; }
.msearch-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.msearch-chips a { padding: 8px 13px; border-radius: 999px; background: #f2f3f8; font-weight: 700; font-size: 13.5px; color: #1f2133; text-decoration: none; }

body.mm-lock { overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .mm-sheet, .mm-panel, .mm-overlay, .msearch { transition: none; animation: none; } }
