/* ==========================================================================
   ASUNA PARFUMERIE — Barre de navigation mobile inférieure
   Dépend de tokens.css. Comportement : assets/js/tabbar.js
   Visible sous 1024px (même seuil que le header mobile), masquée sur ordinateur.
   ========================================================================== */

.tabbar {
  --tabbar-bg: #fff9f1;
  --tabbar-ink: #27130d;
  --tabbar-active: #3a190d;
  --tabbar-line: #ead8c2;
  --tabbar-height: 60px;

  display: none;
}

@media (max-width: 1023.98px) {
  /* Réserve la place de la barre en bas de page : rien n'est masqué (footer, boutons d'achat) */
  body.has-tabbar {
    padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px));
  }

  /* Fixée à l'écran (viewport), jamais au contenu : enfant direct de <body>, aucun parent transformé */
  .tabbar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 9999;
    display: block;
    width: 100%;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
    border-top: 1px solid var(--tabbar-line);
    border-radius: 14px 14px 0 0;
    background: var(--tabbar-bg);
    box-shadow: 0 -4px 18px rgba(39, 19, 13, 0.05);
    transition: transform 0.25s var(--asuna-ease);
  }

  /* Clavier virtuel ouvert : la barre s'efface pour ne pas recouvrir le champ */
  body.keyboard-open .tabbar {
    transform: translateY(110%);
  }

  .tabbar__list {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    height: var(--tabbar-height);
    max-width: 640px;
    margin: 0 auto;
    padding: 0 4px;
    list-style: none;
  }

  .tabbar__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 44px;
    height: 100%;
    min-height: 44px;
    color: var(--tabbar-ink);
    font-family: var(--asuna-font-ui);
    font-size: 10.5px;
    font-weight: 400;
    line-height: 1.1;
    letter-spacing: 0.01em;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  .tabbar__icon {
    width: 23px;
    height: 23px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 0.2s var(--asuna-ease);
  }

  .tabbar__item:active .tabbar__icon {
    transform: scale(0.92);
  }

  /* Élément actif : trait plus marqué, léger remplissage, libellé chocolat */
  .tabbar__item[aria-current="page"] {
    color: var(--tabbar-active);
    font-weight: 600;
  }

  .tabbar__item[aria-current="page"] .tabbar__icon {
    stroke-width: 2.1;
  }

  .tabbar__item[aria-current="page"] .tabbar__fill {
    fill: currentColor;
    fill-opacity: 0.16;
  }

  .tabbar__item:focus-visible {
    outline: 2px solid var(--asuna-champagne);
    outline-offset: -4px;
    border-radius: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tabbar,
  .tabbar__icon {
    transition: none;
  }
}
