/* =============================================================================
   TerraTrack — Menu « Plus » mobile (TD-030)
   ----------------------------------------------------------------------------
   Onglet « Plus » dans la barre du bas (≤1023px) + bottom-sheet regroupant les
   écrans secondaires (Simulation, Qualification, Bilan, Carte, Réglages) et la
   déconnexion. Barre mobile = Recherche · Clients · Tournée · Agenda · Plus.

   TD-028 : aucune règle ajoutée dans design_v2.css. Fichier chargé en dernier
   (cf. index.html) → précédence sur les god files à spécificité égale.
   ============================================================================= */

/* Onglet Plus : caché par défaut (la sidebar desktop liste déjà tout). */
#n-more {
  display: none !important;
}

@media (max-width: 1023px) {
  /* Simulation + Boîte à outils quittent la barre (place au profit de « Plus »)
     → accessibles via le sheet. Les autres écrans secondaires sont déjà masqués
     par design_v2. */
  .bnav.sidebar #n-simulation,
  .bnav.sidebar #n-toolbox {
    display: none !important;
  }

  /* « Plus » prend le 5e emplacement de la barre. */
  .bnav.sidebar #n-more {
    display: flex !important;
    flex: 1 1 0 !important;
    min-width: 0 !important;
  }
}

/* Garde-fou : le sheet ne doit jamais apparaître en desktop (cas resize alors
   qu'il est ouvert). */
@media (min-width: 1024px) {
  .mm-backdrop {
    display: none !important;
  }
}

/* ----------------------------- Backdrop ----------------------------- */
.mm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(10, 11, 13, 0);
  transition: background 0.28s ease;
  -webkit-tap-highlight-color: transparent;
}

.mm-backdrop.open {
  background: rgba(10, 11, 13, 0.44);
}

.mm-backdrop[hidden] {
  display: none;
}

/* ------------------------------- Sheet ------------------------------ */
.mm-sheet {
  width: 100%;
  max-width: 520px;
  background: var(--tt-surface);
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
  box-shadow: var(--tt-shadow-pop);
  padding: 8px 14px calc(16px + env(safe-area-inset-bottom, 0px));
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  will-change: transform;
}

.mm-backdrop.open .mm-sheet {
  transform: translateY(0);
}

.mm-handle {
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: var(--tt-border-strong);
  margin: 4px auto 12px;
  cursor: pointer;
}

/* ------------------------------ Identité ---------------------------- */
.mm-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 6px 14px;
  border-bottom: 1px solid var(--tt-divider);
  margin-bottom: 8px;
}

.mm-avatar {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 50%;
  background: var(--tt-accent-soft);
  color: var(--tt-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 15px;
  text-transform: uppercase;
}

.mm-identity-meta {
  min-width: 0;
}

.mm-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--tt-fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mm-email {
  font-size: 12px;
  color: var(--tt-fg-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* -------------------------------- Liste ----------------------------- */
.mm-list {
  display: flex;
  flex-direction: column;
}

.mm-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 8px;
  min-height: 52px;
  background: transparent;
  border: 0;
  border-radius: var(--tt-r-3);
  font-size: 15px;
  font-weight: 500;
  color: var(--tt-fg);
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.mm-row:active {
  background: var(--tt-surface-2);
}

.mm-row-icon {
  flex: 0 0 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--tt-fg-2);
}

.mm-row-icon svg {
  width: 22px;
  height: 22px;
  /* Les icônes clonées depuis la barre nav sont des <svg> nus (sans attribut
     fill/stroke) : elles héritent du style de la barre. Hors de ce contexte il
     faut réimposer le tracé Lucide, sinon les <rect>/<path> se remplissent en
     noir (carrés pleins) ou disparaissent (paths ouverts). */
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mm-row-label {
  flex: 1 1 auto;
}

.mm-row-chev {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  color: var(--tt-fg-3);
}

/* ----------------------------- Déconnexion -------------------------- */
.mm-row-danger {
  margin-top: 8px;
  border-top: 1px solid var(--tt-divider);
  color: var(--red);
}

.mm-row-danger .mm-row-icon {
  color: var(--red);
}

.mm-row-danger:active {
  background: var(--red-dim);
}
