/*
  SaloCart V4.8.2 — Five-button Home navigation & popup notices
  Final layer: keeps the public mobile navigation at five stable buttons and
  replaces floating toast messages with accessible centered notice popups.
*/

:root {
  --sc-layer-notice: 13050;
}

/* Five stable navigation buttons remain visible on Home, including Orders for guests.
   Guests are guided to the existing sign-in screen from the Orders route. */
@media (max-width: 991.98px) {
  body {
    padding-bottom: calc(78px + env(safe-area-inset-bottom));
  }

  .mobile-nav {
    z-index: var(--sc-layer-nav) !important;
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    align-items: stretch;
    gap: 2px;
    min-width: 320px;
    padding: 6px max(5px, env(safe-area-inset-left)) calc(7px + env(safe-area-inset-bottom)) max(5px, env(safe-area-inset-right));
    border-top: 1px solid color-mix(in srgb, var(--sc-line) 94%, transparent);
    background: color-mix(in srgb, var(--sc-surface) 93%, transparent);
    box-shadow: 0 -10px 25px rgba(7, 51, 37, .05);
    backdrop-filter: blur(18px) saturate(125%);
    -webkit-backdrop-filter: blur(18px) saturate(125%);
  }

  .mobile-nav .nav-item {
    min-width: 0;
    min-height: 58px;
    padding: 6px 2px;
    border: 1px solid transparent;
    border-radius: 15px;
    color: var(--sc-muted);
    font-family: var(--font-ui, inherit);
    font-size: clamp(.54rem, 2.2vw, .64rem);
    font-weight: 820;
    line-height: 1.1;
    letter-spacing: -.01em;
    transition: background .16s ease, color .16s ease, border-color .16s ease, transform .16s ease;
  }

  .mobile-nav .nav-item i {
    font-size: 1.14rem;
    line-height: 1;
  }

  .mobile-nav .nav-item span {
    display: inline-flex;
    min-width: 0;
    align-items: center;
    justify-content: center;
    gap: 3px;
    white-space: nowrap;
  }

  .mobile-nav .nav-item:active {
    transform: scale(.97);
  }

  .mobile-nav .nav-item:hover,
  .mobile-nav .nav-item:focus-visible {
    border-color: color-mix(in srgb, var(--sc-green) 18%, var(--sc-line));
    background: var(--sc-surface-alt);
    color: var(--sc-green);
    outline: none;
  }

  .mobile-nav .nav-item.active {
    border-color: color-mix(in srgb, var(--sc-green) 24%, var(--sc-line));
    background: var(--sc-mint);
    color: var(--sc-green);
  }

  .mobile-nav .nav-primary {
    margin: 0 !important;
    border-color: transparent !important;
    background: var(--sc-green) !important;
    color: #fff !important;
    box-shadow: 0 8px 17px color-mix(in srgb, var(--sc-green) 25%, transparent);
  }

  .mobile-nav .nav-primary:hover,
  .mobile-nav .nav-primary:focus-visible {
    background: var(--sc-green-deep) !important;
    color: #fff !important;
  }

  #mobile-cart-count {
    display: inline-grid;
    place-items: center;
    min-width: 15px;
    height: 15px;
    padding: 0 3px;
    border-radius: 999px;
    background: rgba(255,255,255,.24);
    color: #fff;
    font-size: .52rem;
    font-variant-numeric: tabular-nums;
  }
}

@media (max-width: 365px) {
  .mobile-nav { gap: 0; }
  .mobile-nav .nav-item { min-height: 55px; font-size: .52rem; }
  .mobile-nav .nav-item i { font-size: 1.07rem; }
}

/* Replaces toast messages with a centered popup that always sits above dialogs. */
#notice-root {
  position: fixed;
  z-index: var(--sc-layer-notice);
  inset: 0;
  display: grid;
  place-items: center;
  min-width: 0;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  background: rgba(3, 27, 19, 0);
  transition: opacity .16s ease, visibility .16s ease, background .16s ease;
}

#notice-root.is-open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  background: rgba(3, 27, 19, .34);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.notice-popup {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 34px;
  gap: 12px;
  width: min(430px, 100%);
  min-width: 0;
  padding: 16px;
  border: 1px solid color-mix(in srgb, var(--sc-green) 18%, var(--sc-line));
  border-radius: 22px;
  background: var(--sc-surface);
  color: var(--sc-ink);
  box-shadow: 0 28px 72px rgba(0, 29, 18, .30);
  transform: translateY(8px) scale(.98);
  animation: sc-notice-popup-in .18s cubic-bezier(.2,.8,.2,1) forwards;
}

.notice-popup__icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 15px;
  background: var(--sc-mint);
  color: var(--sc-green);
  font-size: 1.3rem;
}

.notice-popup__body { min-width: 0; padding-top: 2px; }
.notice-popup__eyebrow {
  display: block;
  color: var(--sc-green);
  font-family: var(--font-display, inherit);
  font-size: .67rem;
  font-weight: 800;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.notice-popup__body p {
  margin: 3px 0 0;
  color: var(--sc-ink);
  font-family: var(--font-ui, inherit);
  font-size: .84rem;
  font-weight: 720;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.notice-popup__close {
  display: grid;
  place-items: center;
  align-self: start;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 11px;
  background: var(--sc-surface-alt);
  color: var(--sc-ink-soft);
  font-size: .86rem;
}
.notice-popup__close:hover,
.notice-popup__close:focus-visible {
  background: var(--sc-mint);
  color: var(--sc-green);
  outline: none;
}
.notice-popup__footer {
  grid-column: 2 / 4;
  display: flex;
  justify-content: flex-end;
  margin-top: -1px;
}
.notice-popup__action {
  min-height: 38px !important;
  padding: 7px 15px !important;
  font-size: .72rem !important;
}

.notice-popup--danger {
  border-color: color-mix(in srgb, var(--sc-coral) 42%, var(--sc-line));
}
.notice-popup--danger .notice-popup__icon {
  background: color-mix(in srgb, var(--sc-coral) 13%, var(--sc-surface));
  color: var(--sc-coral);
}
.notice-popup--danger .notice-popup__eyebrow { color: var(--sc-coral); }
.notice-popup--danger .notice-popup__action { background: var(--sc-coral); }
.notice-popup--info .notice-popup__icon {
  background: var(--sc-blue-soft);
  color: var(--sc-blue);
}
.notice-popup--info .notice-popup__eyebrow { color: var(--sc-blue); }
.notice-popup--info .notice-popup__action { background: var(--sc-blue); }

html[data-theme="dark"] .notice-popup {
  border-color: color-mix(in srgb, var(--sc-line) 85%, var(--sc-green));
  box-shadow: 0 28px 72px rgba(0, 0, 0, .48);
}
html[data-theme="dark"] #notice-root.is-open { background: rgba(0, 0, 0, .52); }
html[data-theme="dark"] .mobile-nav { background: color-mix(in srgb, var(--sc-surface) 90%, transparent); }
html[data-theme="dark"] .mobile-nav .nav-item.active { background: color-mix(in srgb, var(--sc-green) 19%, var(--sc-surface)); }

@media (max-width: 575.98px) {
  .notice-popup {
    grid-template-columns: 42px minmax(0, 1fr) 32px;
    gap: 10px;
    padding: 14px;
    border-radius: 20px;
  }
  .notice-popup__icon { width: 42px; height: 42px; border-radius: 14px; font-size: 1.15rem; }
  .notice-popup__body p { font-size: .8rem; }
  .notice-popup__footer { grid-column: 1 / -1; margin-top: 2px; }
  .notice-popup__action { width: 100%; min-height: 42px !important; }
}

@keyframes sc-notice-popup-in {
  to { transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  #notice-root, .notice-popup, .mobile-nav .nav-item { transition: none !important; animation: none !important; }
}
