/* ==========================================================
   PAGE "LA CARTE" (utilise les variables de style.css)
   ========================================================== */
.intro-carte { text-align: center; max-width: 640px; margin: 0 auto 24px; }

/* ----- Recherche + filtres ----- */
.outils-carte {
  display: flex; flex-wrap: wrap; align-items: flex-end;
  gap: 14px 24px; margin-bottom: 16px;
}
.recherche { display: flex; flex-direction: column; gap: 4px; flex: 1 1 240px; max-width: 340px; }
.recherche label, .filtres-titre { font-size: 0.8rem; font-weight: 700; }
.recherche input {
  padding: 10px 12px;
  border: 2px solid var(--sombre); border-radius: 8px;
  background: var(--blanc); color: var(--sombre); font: inherit;
}
.recherche input:focus-visible { outline: 3px solid var(--vert); outline-offset: 2px; }
.filtres-bloc { display: flex; flex-direction: column; gap: 4px; flex: 2 1 320px; }
.filtres { display: flex; flex-wrap: wrap; gap: 6px; }
.filtre, .filtre-reset {
  padding: 6px 12px;
  border: 2px solid var(--couleur, var(--sombre)); border-radius: 999px;
  background: var(--blanc); color: var(--sombre);
  font: inherit; font-size: 0.85rem; font-weight: 600; cursor: pointer;
}
.filtre[aria-pressed="true"] { background: var(--couleur); color: var(--blanc); }
.filtre-reset { border-style: dashed; }
.filtre-reset[hidden] { display: none; }
.compte-carte { flex-basis: 100%; margin: 0; font-size: 0.85rem; font-weight: 600; color: var(--vert); }
.compte-carte:empty { display: none; }

/* ----- Cadre de la carte ----- */
.zone-carte {
  position: relative;
  height: 75vh; min-height: 520px; max-height: 760px;
  background: var(--blanc);
  border-radius: 14px;
  overflow: hidden;
}
.vue-carte { position: absolute; inset: 0; overflow: hidden; touch-action: none; cursor: grab; }
.vue-carte.glisse { cursor: grabbing; }

/* Plan : fond, grille, axes (traits d'épaisseur constante au zoom) */
.plan { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.plan-fond { fill: #fbfcfe; }
.plan-grille line { stroke: var(--fond); stroke-width: 1; vector-effect: non-scaling-stroke; }
.plan-axe line { stroke: var(--vert); stroke-width: 3; vector-effect: non-scaling-stroke; }

/* Chiffres 0, 2, 4... le long des axes */
.graduation {
  position: absolute; left: 0; top: 0; z-index: 0;
  font-size: 0.7rem; font-weight: 700; color: var(--vert);
  pointer-events: none; user-select: none;
}

/* ----- Carte métier ----- */
.carte-metier {
  position: absolute; left: 0; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 6px;
  max-width: 170px; padding: 6px 10px;
  background: var(--blanc); color: var(--sombre);
  border: 2px solid var(--couleur, var(--vert)); border-left-width: 6px;
  border-radius: 8px;
  font-family: inherit; font-size: 0.8rem; font-weight: 600; line-height: 1.2; text-align: left;
  box-shadow: 0 2px 6px rgba(31, 59, 63, 0.18);
  cursor: pointer; will-change: transform;
  transition: opacity 0.2s;
}
.carte-metier:hover, .carte-metier:focus-visible, .carte-metier.active {
  z-index: 5; background: var(--couleur, var(--rouille)); color: var(--blanc);
}
.carte-metier:focus-visible { outline: 3px solid var(--sombre); outline-offset: 2px; }
.carte-metier em {
  flex-shrink: 0; min-width: 20px; height: 20px; padding: 0 5px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--sombre); color: var(--blanc);
  border-radius: 999px; font-size: 0.7rem; font-style: normal;
}
.carte-metier i { flex-shrink: 0; font-style: normal; font-size: 0.8rem; }

/* Recherche / filtres : trouvée = mise en avant, estompée = les autres */
.carte-metier.trouvee { z-index: 4; box-shadow: 0 0 0 3px var(--blanc), 0 0 0 6px var(--sombre); }
.carte-metier.estompee { opacity: 0.2; }
.carte-metier.estompee:hover, .carte-metier.estompee:focus-visible { opacity: 1; }

/* Petits points : une entrée = un point (visibles quand une carte est ouverte) */
.point-entree {
  position: absolute; left: 0; top: 0; z-index: 1;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--couleur); border: 2px solid var(--blanc);
  box-shadow: 0 0 0 1px var(--couleur);
  will-change: transform;
}

/* ----- Légendes des axes ----- */
.axe {
  position: absolute; z-index: 3; padding: 4px 10px;
  background: rgba(255, 255, 255, 0.9); border-radius: 999px;
  font-size: 0.75rem; font-weight: 700; color: var(--sombre); pointer-events: none;
}
.axe-haut { top: 10px; left: 10px; }
.axe-bas { bottom: 44px; left: 10px; }
.axe-gauche { bottom: 10px; left: 10px; }
.axe-droite { bottom: 10px; right: 10px; }

/* ----- Boutons de zoom ----- */
.zoom-boutons {
  position: absolute; z-index: 4; left: 10px; top: 48px;
  display: flex; flex-direction: column; gap: 6px;
}
.zoom-boutons button {
  width: 38px; height: 38px;
  border: 2px solid var(--sombre); border-radius: 8px;
  background: var(--blanc); color: var(--sombre);
  font-family: inherit; font-size: 1.2rem; font-weight: 700; cursor: pointer;
}
.zoom-boutons button:hover { background: var(--sombre); color: var(--blanc); }
.zoom-boutons { align-items: flex-start; }
.zoom-boutons .zoom-reset {
  width: auto; height: auto; padding: 6px 12px;
  font-size: 0.8rem; border-radius: 999px;
}

.message-carte { position: absolute; z-index: 2; top: 50%; left: 0; right: 0; margin: 0; padding: 0 20px; text-align: center; }
.message-carte:empty { display: none; }

/* ----- Panneau latéral ----- */
.panneau {
  position: absolute; z-index: 6; top: 0; right: 0; bottom: 0;
  width: min(520px, 100%); padding: 20px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 12px;
  background: var(--blanc); border-left: 4px solid var(--vert);
  box-shadow: -6px 0 20px rgba(31, 59, 63, 0.15);
  transform: translateX(100%); visibility: hidden;
  transition: transform 0.3s, visibility 0.3s;
}
.panneau.ouvert { transform: none; visibility: visible; }
.panneau [hidden] { display: none !important; }
.panneau-fermer {
  position: absolute; top: 10px; right: 12px; width: 32px; height: 32px;
  border: 0; border-radius: 50%; background: var(--fond); color: var(--sombre);
  font-size: 1rem; cursor: pointer;
}
.panneau-titre { margin: 0 40px 0 0; color: var(--rouille); font-size: 1.25rem; }
.panneau-cat {
  margin: 0; align-self: flex-start; padding: 3px 12px; border-radius: 999px;
  background: var(--couleur); color: var(--blanc); font-size: 0.8rem; font-weight: 700;
}

/* Moyennes */
.moyennes { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 0; }
.moyennes dt { font-size: 0.75rem; font-weight: 600; color: var(--vert); }
.moyennes dd { margin: 0; font-weight: 700; }

/* Détail des entrées (replié) */
.entrees summary { cursor: pointer; font-size: 0.85rem; font-weight: 600; color: var(--vert); }
.entrees table { width: 100%; margin-top: 8px; border-collapse: collapse; font-size: 0.8rem; }
.entrees th, .entrees td { padding: 5px 6px; text-align: left; border-bottom: 1px solid var(--fond); }
.entrees th { font-weight: 700; }

/* Fiches PDF */
.fiches { display: flex; flex-direction: column; gap: 8px; flex: 1 1 auto; min-height: 380px; }
.onglets { display: flex; flex-wrap: wrap; gap: 6px; }
.onglets:empty { display: none; }
.onglets button {
  padding: 6px 12px; border: 2px solid var(--vert); border-radius: 999px;
  background: var(--blanc); color: var(--sombre);
  font-family: inherit; font-weight: 600; cursor: pointer;
}
.onglets button.actif { background: var(--vert); color: var(--blanc); }
.fiche-lien { font-size: 0.85rem; font-weight: 600; color: var(--rouille); }
.fiche-pdf {
  display: block; flex: 1 1 auto; width: 100%; min-height: 340px;
  border: 1px solid var(--fond); border-radius: 8px; background: var(--fond);
}
.fiche-vide { margin: 0; font-style: italic; color: var(--vert); }

/* ----- Mobile : le panneau monte du bas ----- */
@media (max-width: 700px) {
  .zone-carte { height: 80vh; }
  .axe { font-size: 0.7rem; padding: 3px 8px; }
  .panneau {
    top: auto; width: 100%; height: 75%;
    border-left: 0; border-top: 4px solid var(--vert);
    transform: translateY(100%);
  }
}
@media (prefers-reduced-motion: reduce) { .panneau, .carte-metier { transition: none; } }
/* Liste déroulante des sessions */
.choix-session {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.6rem 0;
  font-weight: 600;
}
.choix-session select {
  font: inherit;
  font-weight: 400;
  padding: 0.4rem 0.7rem;
  border: 1px solid #c9c9c9;
  border-radius: 8px;
  background: #fff;
  max-width: 100%;
}
/* ===== Cartes plus compactes ===== */
.carte-metier {
  white-space: nowrap !important;
  max-width: none !important;
  font-size: 0.78rem !important;
  padding: 0.2rem 0.55rem !important;
}
.carte-metier:hover { z-index: 5 !important; }
.carte-metier.active { z-index: 4 !important; }

/* ===== Carte réduite à un simple point (quand elle en chevauche une autre) ===== */
.carte-metier.reduite {
  z-index: 6 !important;               /* toujours au-dessus des étiquettes */
  width: 14px !important;
  height: 14px !important;
  min-width: 0 !important;
  padding: 0 !important;
  gap: 0 !important;
  border: 2px solid #fff !important;
  border-radius: 50% !important;
  background: var(--couleur) !important;
  box-shadow: 0 0 0 1px var(--couleur) !important;
}
.carte-metier.reduite > span,
.carte-metier.reduite > em,
.carte-metier.reduite > i { display: none !important; }
/* Le point au survol passe devant tout, et sa zone cliquable est plus large que le point visible */
.carte-metier.reduite:hover { z-index: 8 !important; }
.carte-metier.reduite::before {
  content: "";
  position: absolute;
  inset: -6px;                          /* +6 px tout autour du point : plus facile à viser */
}

/* Le nom apparaît au survol du point */
.carte-metier.reduite:hover::after {
  content: attr(data-nom);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 0.2rem 0.55rem;
  background: #fff;
  color: #222;
  border: 2px solid var(--couleur);
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  pointer-events: none;
}

/* ===== Menu déroulant des catégories ===== */
.menu-categories { position: relative; display: inline-block; }
.menu-categories-bouton {
  font: inherit;
  font-weight: 600;
  padding: 0.45rem 0.9rem;
  border: 1px solid #c9c9c9;
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
}
.menu-categories-liste {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 40;
  min-width: 280px;
  max-height: 320px;
  overflow-y: auto;
  padding: 0.4rem;
  background: #fff;
  border: 1px solid #c9c9c9;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}
.menu-categories-liste[hidden] { display: none; }
.menu-categories-choix {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
}
.menu-categories-choix:hover { background: #f3f3f3; }
.menu-categories-choix .pastille {
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--couleur);
}
/* Ordre des couches : étiquettes < points < légendes < boutons de zoom < panneau de détails */
.axe { z-index: 10 !important; }
.zoom-boutons { z-index: 20 !important; }
.panneau { z-index: 30 !important; }
/* Titre de l'axe vertical, écrit de bas en haut sur le côté gauche */
.axe-titre-y {
  left: 8px;
  top: 50%;
  bottom: auto;
  transform: translateY(-50%) rotate(180deg);
  writing-mode: vertical-rl;
  max-height: 55%;                 /* reste entre "▲ Plus" et "▼ Moins" */
  font-size: 0.7rem;
  line-height: 1.25;
  text-align: center;
}
/* Boutons de zoom déplacés à droite (sous "Plein écran") pour libérer le côté gauche */
.zoom-boutons {
  left: auto !important;
  right: 10px !important;
  top: 10px !important;
  bottom: auto !important;
}

/* Évite que le texte des cartes se surligne en bleu quand on clique ou double-clique dessus */
.vue-carte,
.carte-metier {
  -webkit-user-select: none;
  user-select: none;
}
.bouton-plein-ecran { right: 66px !important; }
/* Les légendes ne passent jamais à la ligne (sinon "Beaucoup de changements" est coupée près du bord) */
.axe { white-space: nowrap !important; }
/* ===== Bouton plein écran ===== */
.bouton-plein-ecran {
  position: absolute;
  top: 10px;
  right: 66px;                     /* à gauche des boutons de zoom */
  z-index: 12;
  padding: 0.4rem 0.9rem;
  border: 2px solid var(--sombre, #1f3b3f);
  border-radius: 999px;
  background: #fff;
  color: var(--sombre, #1f3b3f);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}
.bouton-plein-ecran:hover { background: var(--fond, #f0f1f6); }

/* En plein écran, le cadre remplit tout l'écran */
.zone-carte:fullscreen,
.zone-carte.plein-ecran-simule {
  width: 100% !important;
  height: 100% !important;
  aspect-ratio: auto !important;
  max-height: none !important;
  border-radius: 0;
  margin: 0;
}
/* Version "simulée" (iPhone) : le cadre se colle à l'écran */
.zone-carte.plein-ecran-simule {
  position: fixed !important;
  inset: 0;
  z-index: 1000;
}
body.plein-ecran-actif { overflow: hidden; }
/* Le titre vertical, lui, peut passer à la ligne (2 colonnes) */
.axe.axe-titre-y { white-space: normal !important; }


/* Défilement de la page : au doigt, on peut défiler verticalement sur la carte tant qu'elle n'est pas zoomée */
.vue-carte { touch-action: pan-y; }
.vue-carte.zoomee,
.zone-carte:fullscreen .vue-carte,
.zone-carte.plein-ecran-simule .vue-carte { touch-action: none; }