/* =====================================================================
   NotrePacte — coquille d'application mobile
   Compléments à Tailwind CDN 2.2.19, chargés après lui pour primer.

   L'application est pensée pour le téléphone. Sur un écran large, elle
   n'est pas bloquée : la même colonne est simplement centrée, ce qui
   garde l'admin utilisable au clavier.
   ===================================================================== */

:root {
  --np-largeur: 430px;      /* largeur maximale de la colonne */
  --np-topbar: 52px;
  --np-tabbar: 58px;
  --np-fond: #f3f4f6;
  --np-sombre: #111827;
  --np-haut: env(safe-area-inset-top, 0px);
  --np-bas: env(safe-area-inset-bottom, 0px);
}

html { height: 100%; }

body {
  margin: 0;
  min-height: 100dvh;             /* pas 100vh : la barre d'URL le fait sauter */
  background: #e5e7eb;            /* visible autour de la colonne sur grand écran */
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: contain; /* pas de rebond élastique sous la coquille */
}

/* ---------------------------------------------------------------------
   Barres fixes. `position: fixed` se cale sur la fenêtre, pas sur la
   colonne : sans ce recentrage, elles s'étaleraient sur tout l'écran.
   --------------------------------------------------------------------- */

.np-topbar,
.np-tabbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--np-largeur);
  z-index: 40;
}

.np-topbar {
  top: 0;
  padding-top: var(--np-haut);   /* la barre d'état iOS passe par-dessus */
  background: var(--np-sombre);
  color: #fff;
}

.np-topbar-contenu {
  height: var(--np-topbar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
}

.np-tabbar {
  bottom: 0;
  padding-bottom: var(--np-bas);  /* barre d'accueil iPhone */
  background: #fff;
  border-top: 1px solid #e5e7eb;
  display: flex;
}

.np-main {
  max-width: var(--np-largeur);
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--np-fond);
  padding: calc(var(--np-topbar) + var(--np-haut) + 1rem) 1rem
           calc(var(--np-tabbar) + var(--np-bas) + 1.5rem);
}

/* ---------------------------------------------------------------------
   Onglets
   --------------------------------------------------------------------- */

.np-tab {
  flex: 1 1 0;
  min-height: var(--np-tabbar);   /* cible tactile confortable */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 2px;
  color: #9ca3af;
  text-decoration: none;
  font-size: 10px;
  line-height: 1.1;
  position: relative;
  background: none;
  border: 0;
  font-family: inherit;
  cursor: pointer;
}

.np-tab svg { width: 22px; height: 22px; stroke-width: 1.8; }
.np-tab.actif { color: var(--np-sombre); font-weight: 600; }
.np-tab:active { background: #f3f4f6; }

.np-tab-pastille {
  position: absolute;
  top: 4px;
  left: 50%;
  margin-left: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 9999px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------------------------------------------------------------------
   Feuille « Plus »
   --------------------------------------------------------------------- */

.np-voile {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  z-index: 50;
}

.np-feuille {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: var(--np-largeur);
  z-index: 51;
  background: #fff;
  border-radius: 16px 16px 0 0;
  padding-bottom: calc(var(--np-bas) + .5rem);
  animation: np-monte .18s ease-out;
}

@keyframes np-monte { from { transform: translate(-50%, 100%); } to { transform: translate(-50%, 0); } }

@media (prefers-reduced-motion: reduce) {
  .np-feuille { animation: none; }
}

.np-poignee {
  width: 36px; height: 4px;
  background: #d1d5db;
  border-radius: 9999px;
  margin: 10px auto 4px;
}

.np-feuille a {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .875rem 1.25rem;
  color: #374151;
  text-decoration: none;
  font-size: .9375rem;
  border-top: 1px solid #f3f4f6;
}
.np-feuille a:active { background: #f9fafb; }
.np-feuille a.actif { color: var(--np-sombre); font-weight: 600; }
.np-feuille svg { width: 20px; height: 20px; stroke-width: 1.8; color: #9ca3af; }

/* ---------------------------------------------------------------------
   Confort tactile
   --------------------------------------------------------------------- */

/* Le zoom reste autorisé : 16px suffit à empêcher le zoom automatique
   d'iOS à la mise au point, sans sacrifier l'accessibilité. */
input, select, textarea { font-size: 16px; }

/* Toute zone cliquable garde une cible d'au moins 44px. */
button, .np-bouton, input[type="submit"] { min-height: 44px; }

/* Le survol ne veut rien dire au doigt : on répond à l'appui. */
@media (hover: none) {
  a:hover, button:hover { background-color: inherit; }
}

a, button { -webkit-touch-callout: none; }

.tabulaire { font-variant-numeric: tabular-nums; }

.pastille { display: inline-block; width: .625rem; height: .625rem; border-radius: 9999px; }

/* Rien ne doit déborder latéralement sur un écran de 320px. */
img, canvas, table { max-width: 100%; }
.np-main { overflow-x: hidden; }

/* Écran de connexion : pas de barres, la colonne occupe tout. */
.np-main.np-nu {
  padding-top: calc(var(--np-haut) + 2rem);
  padding-bottom: calc(var(--np-bas) + 2rem);
}
