/*
 * Mobile bottom tab bar (inc/mobile-bottom-nav.php), below 900px: Home · Products · Cart · Zalo · Call.
 * On phones it takes over from the header cart button and the floating Zalo / call buttons;
 * back-to-top and the cart toast sit above it. The VI/EN switcher moves into the header row.
 */

.bottom-nav {
  display: none;
}

@media (max-width: 899px) {
  :root {
    --bottom-nav-height: 3.75rem;
  }

  body {
    padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
  }

  .bottom-nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 95; /* over page and floating buttons, under the side menu (100) */
    display: grid;
    grid-auto-columns: 1fr;
    grid-auto-flow: column;
    height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid var(--color-border);
    background: var(--color-surface);
    box-shadow: 0 -10px 30px -18px rgb(58 44 35 / 0.35);
  }

  .bottom-nav__item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    color: var(--color-text-muted);
    font-size: 0.6875rem;
    font-weight: var(--font-weight-medium);
    text-decoration: none;
  }

  .bottom-nav__item:hover,
  .bottom-nav__item[aria-current='page'] {
    color: var(--color-primary);
  }

  /* Current tab: bold label + a short bar on top (colour alone is too close to the muted grey). */
  .bottom-nav__item[aria-current='page'] {
    font-weight: var(--font-weight-bold);
  }

  .bottom-nav__item[aria-current='page']::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 30%;
    right: 30%;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: var(--color-primary);
  }

  .bottom-nav__icon {
    width: 1.5rem;
    height: 1.5rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  /* Zalo wordmark in the same box as the icons. */
  .bottom-nav__zalo {
    display: grid;
    place-items: center;
    height: 1.5rem;
    padding-inline: 0.3rem;
    border-radius: var(--radius-sm);
    background: #0068ff; /* Zalo brand blue */
    color: #fff;
    font-size: 0.625rem;
    font-weight: var(--font-weight-bold);
  }

  .bottom-nav__badge {
    position: absolute;
    top: 0.35rem;
    left: calc(50% + 0.35rem);
    min-width: 1.1rem;
    height: 1.1rem;
    padding-inline: 0.25rem;
    border-radius: var(--radius-pill);
    background: var(--button-bg);
    color: var(--button-text);
    font-size: 0.6875rem;
    font-weight: var(--font-weight-bold);
    line-height: 1.1rem;
    text-align: center;
  }

  .bottom-nav__badge[hidden] {
    display: none;
  }

  /* The bar replaces these on phones. */
  .site-header .nav__item--cart,
  .floating-actions__button--zalo,
  .floating-actions__button--call {
    display: none;
  }

  /* No side menu on phones: the language switcher sits at the end of the header row. */
  .site-header__inner > .lang-switcher {
    display: block;
    order: 3;
  }

  /* Back-to-top and the add-to-cart toast float above the bar. */
  .floating-actions {
    bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom) + var(--space-3));
  }

  .cart-toast {
    inset-block-end: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom) + var(--space-3));
  }
}
