/* ============================================================
   NAV.CSS — Barre de navigation en bas
   ------------------------------------------------------------
   Ce fichier définit :
   - La structure de l'app (.app, .app-inner, .ecrans, .ecran)
     qui sert de conteneur principal à chaque page
   - La barre de navigation fixe en bas (.nav-bar, .nav-btn)
   - Le comportement responsive

   Doit être chargé APRÈS base.css et composants.css.
   ============================================================ */

/* ------------------------------------------------------------
   1. STRUCTURE DE L'APP
   ------------------------------------------------------------
   Chaque page HTML utilise cette structure :
   
   <div class="app">
     <div class="app-inner">
       <div class="ecrans">
         ...contenu de la page...
       </div>
       <nav class="nav-bar">...</nav>
     </div>
   </div>
   ------------------------------------------------------------ */
.app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.app-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  position: relative;
}

/* Conteneur des écrans (le contenu scrollable) */
.ecrans {
  position: relative;
  flex: 1;
  overflow: hidden;
}

/* ------------------------------------------------------------
   2. ÉCRAN (une page)
   ------------------------------------------------------------
   Chaque page contient un ou plusieurs ".ecran" empilés.
   Seul celui avec la classe ".actif" est visible.
   ------------------------------------------------------------ */
.ecran {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.5rem var(--padding-x) calc(var(--nav-height) + var(--safe-bottom) + 1.5rem);
  opacity: 0;
  visibility: hidden;
  transform: translateX(30px);
  transition:
    opacity .35s cubic-bezier(.4, 0, .2, 1),
    transform .35s cubic-bezier(.4, 0, .2, 1),
    visibility .35s;
  -webkit-overflow-scrolling: touch;
}

.ecran.actif {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}

/* Variantes pour les transitions d'entrée/sortie */
.ecran.entrant-droite  { transform: translateX(30px); }
.ecran.entrant-gauche  { transform: translateX(-30px); }
.ecran.sortant-gauche  { transform: translateX(-30px); opacity: 0; }
.ecran.sortant-droite  { transform: translateX(30px); opacity: 0; }

/* Scrollbar discrète dans les écrans */
.ecran::-webkit-scrollbar { width: 4px; }
.ecran::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
}

/* ------------------------------------------------------------
   3. BARRE DE NAVIGATION
   ------------------------------------------------------------ */
.nav-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  z-index: 100;
  box-shadow: 0 -2px 12px rgba(120, 90, 20, .05);
}

body.dark .nav-bar {
  box-shadow: 0 -2px 12px rgba(0, 0, 0, .3);
}

/* ------------------------------------------------------------
   4. BOUTON DE NAVIGATION
   ------------------------------------------------------------ */
.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .2rem;
  padding: .5rem .25rem;
  border: none;
  background: transparent;
  color: var(--text-faint);
  font-family: inherit;
  font-size: .68rem;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  transition: color .25s;
  text-decoration: none;
}

.nav-btn .material-symbols-outlined {
  font-size: 1.55rem;
  transition:
    transform .35s cubic-bezier(.34, 1.56, .64, 1),
    font-variation-settings .3s;
}

/* Onglet actif */
.nav-btn.actif { color: var(--gold); }

.nav-btn.actif .material-symbols-outlined {
  transform: translateY(-2px) scale(1.1);
  font-variation-settings: 'FILL' 1, 'wght' 600;
}

/* Petit trait doré au-dessus de l'onglet actif */
.nav-btn.actif::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 3px;
  background: var(--gold);
  border-radius: 0 0 4px 4px;
  animation: navSlide .4s cubic-bezier(.34, 1.56, .64, 1) both;
}

@keyframes navSlide {
  from { width: 0; opacity: 0; }
  to   { width: 28px; opacity: 1; }
}

/* Effet de pression sur mobile */
.nav-btn:active .material-symbols-outlined {
  transform: scale(.9);
}

/* ------------------------------------------------------------
   5. TRANSITION DE PAGE (fade-in au chargement)
   ------------------------------------------------------------
   Compense le "flash blanc" lors du passage d'une page à l'autre
   en HTML classique.
   ------------------------------------------------------------ */
body {
  opacity: 0;
  transition: opacity .2s ease;
}

body.pret {
  opacity: 1;
}