.hamburger-menu {
  position: relative;
}

.hamburger-button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
}

.bar {
  width: 25px;
  height: 3px;
  background-color: var(--color-text, #333);
  margin: 5px 0;
}

/* === NAV MENU: contenimento, scroll e z-index sopra la bottom bar === */
.nav-menu {
  box-sizing: border-box;
  position: fixed;
  top: 62px;
  right: max(8px, env(safe-area-inset-right));
  width: min(92vw, 390px);
  max-width: 390px;
  max-height: calc(100dvh - var(--menu-header-height, 72px) - var(--menu-bottom-height, 64px) - 20px);
  min-height: calc(100dvh - var(--menu-header-height, 72px) - var(--menu-bottom-height, 64px) - 20px);
  overflow-y: auto;
  height: auto;

  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  box-shadow: var(--shadow-soft);
  display: none;
  z-index: 3000;
  backdrop-filter: blur(8px);
  transition: transform 0.25s ease, opacity 0.25s ease;
  /* padding-top: calc(var(--menu-header-height, 72px) + max(12px, env(safe-area-inset-top))); */
  padding-top: 40px;
  padding-bottom: calc(var(--menu-bottom-height, 64px) + max(16px, env(safe-area-inset-bottom)));
  flex-direction: column;
}



.nav-menu.active {
  display: flex;
  flex-direction: column;
  animation: slideIn 0.25s ease forwards;
}

.notif-icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;

  color: inherit;
}

.notif-count {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 18px;
  text-align: center;
  background: #c62828; /* 17/10/2026 come il carrello: il bianco su #d9534f dava 3,96 */
  color: #fff;
  border: 2px solid #fff;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.nav-menu .close-form {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  left: auto;
  margin: 0;
  cursor: pointer;
}

/* === CONTENUTO === */
.menu-items {
  box-sizing: border-box;
  list-style: none;
  width: 100%;
  max-width: 100%;
  padding: 0 12px 12px;
  margin: 0;
  color: var(--color-text, #2b2b2b);
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
}

@media (max-width: 768px) {
  .nav-menu {
    right: 0;
    left: 0;
    width: 100vw;
    max-width: none;
    border-radius: 0;
    /* 5 ottobre: dall'alto fino alla barra in basso (prima lasciava ~100px di pagina visibili sotto) */
    bottom: calc(var(--footer-height, 64px) + env(safe-area-inset-bottom, 0px));
    max-height: none;
    min-height: 0;
    padding-bottom: 16px;
  }
}

/* menu ☰ aperto: la pagina sotto non scorre */
body:has(.nav-menu.active) {
  overflow: hidden;
}

.menu-items li {
  box-sizing: border-box;
  max-width: 100%;
  padding: 2px;
}

.menu-items li ul {
  list-style: none;
}

.subcategory-closed {
  height: 0;
  overflow: hidden;
}

.subcategory-open {
  height: auto;
  overflow: visible;
}

/* === CATEGORIE === */
.nav-category {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--color-text);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease;
}

.nav-category:hover {
  /* 17/10/2026 temi PORTATA: col bianco al 90% nei temi scuri il fondo diventava chiaro e il testo zafferano/menta non si leggeva */
  background: var(--color-primary-light, var(--color-muted));
  color: var(--color-text);
}

.nav-sub-category {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 20px 6px 32px;
  border-left: 2px solid transparent;
  border-radius: 6px;
  font-weight: 500;
  color: var(--color-text-weak);
  cursor: pointer;
  transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

.nav-sub-category:hover {
  background: var(--color-primary-light, var(--color-muted)); /* 17/10/2026 come .nav-category:hover */
  border-left-color: var(--color-primary);
  color: var(--color-text);
}

.arrow-espandi {
  cursor: pointer;
}

.rotate {
  transform: rotate(90deg);
}

/* === LINK AI PIATTI === */
.li-piatto-items {
  margin: 4px 36px;
  font-weight: 600;
  color: var(--color-text-weak);
  cursor: pointer;
  transition: color 0.25s ease;
}

.li-piatto-items:hover {
  color: var(--color-primary);
}

/* === BARRA DI RICERCA === */
.serch-container {
  width: calc(100% - 24px);
  height: 40px;
  margin: 10px 12px;
  border-radius: 20px;
  border: 1px solid var(--color-border);
  background: var(--color-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.serch-container:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--color-primary), white 80%);
}

.icona-search {
  position: absolute;
  left: 24px;
  color: var(--color-text-weak);
  font-size: 16px;
}

/* === TESTO E STRUTTURA === */
.menu-items,
.menu-items li,
.nav-category,
.nav-sub-category {
  box-sizing: border-box;
  max-width: 390px;
  width: 100%;
  overflow-x: hidden;
}

.arrow-espandi {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  margin-left: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-text-weak);
  transition: transform 0.3s ease;
  transition: transform 0.25s ease, color 0.25s ease;
  flex-shrink: 0;
}

.arrow-espandi::before {
  content: "";
  position: absolute;
  inset: -12px;
  /* allarga l’area cliccabile di 12px attorno all’icona */
  border-radius: 8px;
}

.arrow-espandi:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
  border-radius: 6px;
}

.arrow-espandi:hover {
  color: var(--color-primary);
}

.arrow-espandi.rotate {
  transform: rotate(90deg);
}

.arrow-sub {
  opacity: 0.7;
  width: 16px;
  height: 16px;
}

.arrow-sub.rotate {
  transform: rotate(90deg);
  opacity: 1;
}

.is-disabled {
  opacity: 0.4;
  pointer-events: none;
  cursor: default;
}

.history-nav-btn {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform .15s ease, opacity .2s ease, background .2s ease, box-shadow .2s ease;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
  padding: 0;
}

.history-nav-btn svg {
  width: 18px;
  height: 18px;
  stroke: #1b2240;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.history-nav-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  background: #ffffff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .16);
}

.history-nav-btn:active:not(:disabled) {
  transform: scale(0.96);
}

.history-nav-btn:disabled,
.history-nav-btn.is-disabled {
  opacity: 0.38;
  cursor: default;
  box-shadow: none;
}