/* =========================================================
   MOUNIR DIGITAL — Navigation mobile fixe (inspiration Instagram)
   Cinq onglets, cibles tactiles généreuses, safe-area iOS,
   indicateur animé et palette de la marque (marine · or).
   Visible uniquement <= 960px (breakpoint du site).
   ========================================================= */

:root {
  --bnav-h: 62px;
  --bnav-icon: 23px;
  --bnav-ease: cubic-bezier(0.22, 0.7, 0.24, 1);
}

/* ---------- Conteneur fixe ---------- */
.bottom-nav {
  --bnav-bg: rgba(255, 255, 255, 0.94);
  --bnav-ink: #5C6D84;
  --bnav-ink-strong: #041F42;
  --bnav-border: rgba(11, 26, 48, 0.10);
  --bnav-active: #8F5D0C;
  --bnav-pill: rgba(211, 147, 31, 0.14);

  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 120;
  display: none;
  background: var(--bnav-bg);
  color: var(--bnav-ink);
  border-top: 1px solid var(--bnav-border);
  box-shadow: 0 -18px 44px -30px rgba(4, 31, 66, 0.35);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  backdrop-filter: blur(22px) saturate(160%);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  transform: translateZ(0);
}

[data-theme="dark"] .bottom-nav {
  --bnav-bg: rgba(7, 20, 38, 0.94);
  --bnav-ink: #8194AD;
  --bnav-ink-strong: #EAF0F9;
  --bnav-border: rgba(255, 255, 255, 0.11);
  --bnav-active: #ECB94F;
  --bnav-pill: rgba(236, 185, 79, 0.14);
}

/* ---------- Indicateur glissant derrière l'icône active ---------- */
.bnav-indicator {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
  width: var(--bnav-w, 38px);
  height: 28px;
  border-radius: 10px;
  background: var(--bnav-pill);
  opacity: 0;
  transform: translate(var(--bnav-x, 0), var(--bnav-y, 6px));
  transition:
    transform 0.36s var(--bnav-ease),
    width 0.3s var(--bnav-ease),
    opacity 0.2s var(--bnav-ease),
    background-color 0.3s var(--bnav-ease);
  pointer-events: none;
}

.bottom-nav.has-indicator .bnav-indicator { opacity: 1; }

/* ---------- Liste ---------- */
.bnav-list {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  height: var(--bnav-h);
  margin: 0;
  padding: 0 4px;
  list-style: none;
}

.bnav-list li {
  flex: 1 1 0;
  display: flex;
  min-width: 0;
}

/* ---------- Item tactile ---------- */
.bnav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 100%;
  height: 100%;
  min-height: 48px;
  padding: 5px 2px 4px;
  color: var(--bnav-ink);
  font-size: 0.6rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.015em;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  outline: none;
  transition: color 0.2s var(--bnav-ease), opacity 0.18s var(--bnav-ease);
}

.bnav-item:focus-visible {
  outline: 2px solid var(--bnav-active);
  outline-offset: -3px;
  border-radius: 12px;
}

.bnav-item:active { opacity: 0.65; }

.bnav-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 28px;
  border-radius: 10px;
  line-height: 0;
  transition: transform 0.2s var(--bnav-ease), color 0.2s var(--bnav-ease);
}

.bnav-item svg {
  width: var(--bnav-icon);
  height: var(--bnav-icon);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke-width 0.22s var(--bnav-ease), transform 0.22s var(--bnav-ease);
}

.bnav-label {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.2s var(--bnav-ease);
}

/* ---------- État actif : pastille or + libellé contrasté ---------- */
.bnav-item.is-active {
  color: var(--bnav-active);
}

.bnav-item.is-active .bnav-icon-wrap {
  animation: bnav-pop 0.32s var(--bnav-ease);
}

.bnav-item.is-active svg { stroke-width: 2.15; }

.bnav-item.is-active .bnav-label { color: var(--bnav-active); }

.bnav-item:active .bnav-icon-wrap { transform: scale(0.9); }

@keyframes bnav-pop {
  0% { transform: scale(0.84); }
  55% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

/* ---------- Responsive : mobile + tablette uniquement ---------- */
@media (max-width: 960px) {
  .bottom-nav { display: block; }

  /* Réserve la hauteur de la barre pour que le footer reste visible */
  body {
    padding-bottom: calc(var(--bnav-h) + env(safe-area-inset-bottom, 0px));
  }

  /* Le bouton WhatsApp flotte au-dessus de la barre */
  .whatsapp-btn {
    bottom: calc(var(--bnav-h) + env(safe-area-inset-bottom, 0px) + 12px);
  }
}

@media (min-width: 561px) and (max-width: 960px) {
  :root {
    --bnav-h: 66px;
    --bnav-icon: 25px;
  }

  .bnav-label { font-size: 0.64rem; }
}

@media (max-width: 380px) {
  :root {
    --bnav-icon: 22px;
    --bnav-h: 60px;
  }

  .bnav-item { font-size: 0.57rem; }
  .bnav-icon-wrap { width: 34px; }
}

/* ---------- Accessibilité / impression ---------- */
@media (prefers-reduced-motion: reduce) {
  .bottom-nav,
  .bnav-indicator,
  .bnav-item,
  .bnav-icon-wrap,
  .bnav-item svg {
    transition: none !important;
    animation: none !important;
  }
}

@media print {
  .bottom-nav { display: none !important; }
  body { padding-bottom: 0; }
}
