/* Page MNT et orthophotos (prefixe .mo pour ne pas gener le style de GeoNode) */
.mo, .mo-fond {
  --mo-mnt: #f9a825;
  --mo-ortho: #1565c0;
  --mo-les2: #2e7d32;
  --mo-accent: #e87722;
  --mo-telecharger: #397aab;   /* boutons Telecharger de la fenetre d'une dalle : bleu GeoNode/MapStore standard */
  --mo-bleu: #0b3c5d;
  --mo-vert: #1f7a4d;
  --mo-texte: #1f2937;
  --mo-doux: #5b6472;
  --mo-bord: #e3e7ee;
  --mo-carte-fond: #ffffff;
  --mo-ombre: 0 1px 2px rgba(16, 24, 40, .06), 0 6px 20px rgba(16, 24, 40, .08);
}
.mo {
  font-size: 15px;
  color: var(--mo-texte);
  max-width: 1240px;
  margin: 0 auto;
  padding: 20px 16px 32px;
  box-sizing: border-box;
}
.mo *, .mo-fond * { box-sizing: border-box; }
.mo h1, .mo h2 { color: inherit; }

/* ---------- Bandeau ---------- */
.mo-hero {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: 1fr; gap: 18px 24px; align-items: center;
  padding: 26px 28px; border-radius: 16px; color: #fff;
  background:
    radial-gradient(1200px 300px at 100% 0%, rgba(255,255,255,.10), transparent 60%),
    linear-gradient(120deg, var(--mo-bleu) 0%, #14557c 45%, var(--mo-vert) 100%);
  box-shadow: var(--mo-ombre);
}
.mo-hero::after { /* fine grille de tuiles en filigrane */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .10;
  background-image: linear-gradient(rgba(255,255,255,.7) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,.7) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(90deg, transparent 0%, #000 70%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 70%);
}
.mo-hero-texte { position: relative; z-index: 1; min-width: 0; }
.mo-hero h1 { margin: 0 0 6px; font-size: clamp(22px, 3vw, 32px); line-height: 1.15; font-weight: 700; color: #fff; }
.mo-sous-titre { margin: 0; max-width: 62ch; line-height: 1.5; opacity: .95; }

.mo-chiffres {
  position: relative; z-index: 1; grid-column: 1 / -1;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 6px 0 0;
}
.mo-chiffres div {
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.22);
  border-radius: 12px; padding: 10px 14px; backdrop-filter: blur(2px);
}
.mo-chiffres dd { margin: 0; font-size: 24px; font-weight: 700; line-height: 1.1; }
.mo-chiffres dt { margin: 2px 0 0; font-size: 13px; opacity: .9; }

/* ---------- Etapes ---------- */
.mo-etapes {
  list-style: none; margin: 18px 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px;
}
.mo-etapes li {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px;
  background: var(--mo-carte-fond); border: 1px solid var(--mo-bord); border-radius: 12px;
}
.mo-num {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: #fff3e8; color: var(--mo-accent); font-weight: 700;
}
.mo-etapes strong { display: block; margin-bottom: 2px; }
.mo-etapes p { margin: 0; color: var(--mo-doux); font-size: 14px; line-height: 1.45; }

/* ---------- Carte ---------- */
.mo-carte-bloc {
  background: var(--mo-carte-fond); border: 1px solid var(--mo-bord); border-radius: 14px;
  box-shadow: var(--mo-ombre); overflow: clip;   /* clip et non hidden : hidden empeche la barre de selection (sticky) de rester collee a l'ecran */
}
.mo-barre {
  display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--mo-bord);
}
.mo-legende { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; font-size: 13px; }
.mo-legende li {
  display: inline-flex; align-items: center; white-space: nowrap;
  padding: 4px 10px; border: 1px solid var(--mo-bord); border-radius: 999px; background: #fafbfc;
}
.mo-pastille { width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; display: inline-block; }
.mo-vide { border: 1.5px solid #9aa3ad; background: transparent; }
.mo-mnt { background: var(--mo-mnt); }
.mo-ortho { background: var(--mo-ortho); }
.mo-les2 { background: var(--mo-les2); }

.mo-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mo-recherche { display: flex; gap: 6px; }
.mo-recherche input {
  width: 15em; padding: 7px 10px; border: 1px solid #cfd6df; border-radius: 8px; font: inherit; font-size: 14px;
}
.mo-bouton {
  padding: 7px 14px; border: 1px solid var(--mo-accent); border-radius: 8px; background: var(--mo-accent);
  color: #fff; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: filter .15s ease, background .15s ease;
}
.mo-bouton.mo-secondaire { background: #fff; color: var(--mo-accent); }
.mo-bouton:hover { filter: brightness(.95); }
.mo-bouton.mo-secondaire:hover { background: #fff3e8; }
.mo-bouton:focus-visible, .mo-recherche input:focus-visible, .mo-fermer:focus-visible, .mo-lien:focus-visible {
  outline: 3px solid #93c5fd; outline-offset: 2px;
}

.mo-carte-cadre { position: relative; }
.mo-carte { height: min(68vh, 620px); min-height: 380px; width: 100%; }
/* Leaflet utilise des z-index de 200 a 1000 (volets, controles) : sans contexte d'empilement propre, la carte passe au-dessus
   de l'en-tete fixe de GeoNode (z-index 150) quand on defile. isolation: isolate enferme ces z-index dans la carte. */
.mo-carte { isolation: isolate; }

/* Leaflet dans le gabarit de GeoNode : la feuille de style de MapStore (active sur toute page GeoNode, classe .msgapi du body)
   deplace et rend transparent le controle d'echelle de Leaflet (right: 55px, fond transparent). On remet les valeurs de Leaflet
   pour cette carte seulement ; la specificite (3 classes) l'emporte sur .msgapi .leaflet-control-scale (2 classes). */
.mo-carte.leaflet-container { background: #ddd; }
.mo-carte.leaflet-container .leaflet-control-scale { right: auto; bottom: auto; clear: both; z-index: 800; }
.mo-carte.leaflet-container .leaflet-control-scale-line {
  background: rgba(255, 255, 255, 0.8); border-color: #777; color: #333; text-align: left;
  text-shadow: 1px 1px #fff; font-size: 11px; line-height: 1.1;
}
.mo-chargement {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); margin: 0; z-index: 500;
  padding: 8px 14px; border-radius: 999px; background: rgba(255,255,255,.95); box-shadow: var(--mo-ombre); font-size: 14px;
}
.mo-chargement[hidden] { display: none; }
.mo-maj { margin: 0; padding: 8px 14px; font-size: 13px; color: var(--mo-doux); border-top: 1px solid var(--mo-bord); }
.mo-maj:empty { display: none; }

/* ---------- Informations ---------- */
.mo-infos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.mo-infos article {
  padding: 16px 18px; background: var(--mo-carte-fond); border: 1px solid var(--mo-bord); border-radius: 12px;
  border-top: 4px solid var(--mo-accent);
}
.mo-infos article:nth-child(1) { border-top-color: var(--mo-mnt); }
.mo-infos article:nth-child(2) { border-top-color: var(--mo-ortho); }
.mo-infos article:nth-child(3) { border-top-color: var(--mo-les2); }
.mo-infos h2 { font-size: 16px; margin: 0 0 6px; }
.mo-infos p { margin: 0; font-size: 14px; color: var(--mo-doux); line-height: 1.5; }

.mo-cache { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mo-bulle { font-size: 13px; }

/* ---------- Fenetre de telechargement ---------- */
.mo-fond {
  position: fixed; inset: 0; z-index: 9999; background: rgba(15, 23, 42, .55);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.mo-fond[hidden] { display: none; }
.mo-fenetre {
  width: min(440px, 100%); background: #fff; border-radius: 14px; padding: 18px 20px;
  box-shadow: 0 20px 50px rgba(0,0,0,.3); color: #1f2937; font-size: 15px;
}
.mo-fenetre-tete { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mo-fenetre h2 { font-size: 1.15em; margin: 0; }
.mo-fermer { border: 0; background: transparent; font-size: 26px; line-height: 1; cursor: pointer; color: #5b6472; }
.mo-coords { margin: 4px 0 14px; font-family: ui-monospace, monospace; font-size: 13px; color: #5b6472; }
.mo-fichiers { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.mo-fichier {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px; border: 1px solid #e3e7ee; border-left: 4px solid #9aa3ad; border-radius: 10px;
}
.mo-fichier-mnt { border-left-color: #f9a825; }
.mo-fichier-ortho { border-left-color: #1565c0; }
.mo-fichier.mo-absent { opacity: .55; }
.mo-fichier strong { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mo-format {
  font-size: 11px; font-weight: 700; letter-spacing: .03em; padding: 2px 7px; border-radius: 999px;
  background: #eef2f7; color: #334155; border: 1px solid #d9dee5;
}
.mo-fichier small { color: #5b6472; font-size: 12px; word-break: break-all; }
.mo-lien {
  padding: 7px 14px; border-radius: 8px; background: var(--mo-telecharger, #397aab); color: #fff !important; font-weight: 600;
  text-decoration: none !important; white-space: nowrap;
}
.mo-lien:hover { filter: brightness(.95); }
/* La feuille MapStore de GeoNode impose .msgapi * { background: transparent !important } : sans cette regle plus precise, le bouton
   Telecharger reste transparent (texte blanc invisible). */
.mo .mo-lien, .mo-fond .mo-lien { background: var(--mo-telecharger, #397aab) !important; }
.mo .mo-lien:hover, .mo-fond .mo-lien:hover { background: #2f6590 !important; filter: none; }
.mo-note { font-size: 12px; color: #5b6472; margin: 12px 0 0; }

/* ---------- Petits ecrans ---------- */
@media (max-width: 900px) {
  .mo-chiffres { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mo-etapes, .mo-infos { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .mo { padding: 12px 10px 24px; }
  .mo-hero { grid-template-columns: 1fr; padding: 20px; text-align: left; }
  .mo-chiffres dd { font-size: 20px; }
  .mo-recherche { width: 100%; }
  .mo-recherche input { flex: 1; width: auto; min-width: 0; }
}

/* ---------- Selection multiple et aide des apercus ---------- */
.mo-bascule[aria-pressed="true"], .mo-bascule.mo-actif { background: #6a1b9a; border-color: #6a1b9a; color: #fff; }
.mo-carte.mo-multi .leaflet-interactive { cursor: copy; }
/* Focus des dalles : pas de cadre du navigateur au clic ; au clavier, contour gris assorti a la grille */
.mo-carte path.leaflet-interactive:focus { outline: none; }
.mo-carte path.leaflet-interactive:focus-visible { outline: 2px solid #8c8c8c; outline-offset: 0; }
.mo-aide-apercu { margin: 6px 0 0; max-width: 220px; font-size: 12px; line-height: 1.3; color: #5b6472; }
.mo-aide-apercu[hidden] { display: none; }
.leaflet-control-layers label:has(input:disabled) { color: #9aa3ad; }

/* Selection multiple : barre collee en bas de l'ecran tant que la carte est visible (la liste detaillee se deplie vers le haut) */
.mo-selection { position: sticky; bottom: 0; z-index: 800; margin: 12px 0 0; padding: 10px 14px; background: #fff !important; border: 1px solid var(--mo-bord); border-radius: 12px; box-shadow: 0 -6px 22px rgba(16, 24, 40, .14); }
.mo-selection[hidden], .mo-sel-msg[hidden], .mo-sel-detail[hidden] { display: none; }
.mo-sel-barre { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.mo-sel-resume { margin: 0 auto 0 0; min-width: 200px; font-size: 14px; }
.mo-sel-compte { margin-right: 10px; color: #6a1b9a; }
.mo-sel-total { color: var(--mo-doux); }
.mo-selection label { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; cursor: pointer; }
.mo-sel-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.mo-selection .mo-bouton { padding: 6px 12px; }
.mo-selection .mo-bouton:disabled { opacity: .5; cursor: not-allowed; }
.mo-sel-msg { margin: 8px 0 0; padding: 8px 12px; border-radius: 8px; background: #fff3e8 !important; color: #8a4b12; font-size: 13px; }
.mo-sel-detail { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--mo-bord); }
.mo-sel-liste { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 6px 14px; max-height: 38vh; overflow: auto; }
.mo-sel-liste li { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border: 1px solid var(--mo-bord); border-left: 4px solid #6a1b9a; border-radius: 8px; font-size: 13px; }
.mo-sel-liste strong { font-weight: 700; flex: 0 0 auto; }
.mo-sel-fichier { flex: 1 1 auto; color: var(--mo-doux); white-space: nowrap; }
.mo-sel-retirer { flex: 0 0 auto; width: 26px; height: 26px; border: 0; border-radius: 50%; background: #eef0f4 !important; color: #374151; font-size: 16px; line-height: 1; cursor: pointer; }
/* Lots de 16 tuiles au plus */
.mo-lots { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 6px 12px; max-height: 30vh; overflow: auto; }
.mo-lots[hidden] { display: none; }
.mo-lot { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border: 1px solid var(--mo-bord); border-left: 4px solid #9aa3ad; border-radius: 8px; font-size: 13px; }
.mo-lot-info { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mo-lot-detail { color: var(--mo-doux); }
.mo-lot-etat { font-weight: 600; color: #374151; }
.mo-lot-contenu summary { cursor: pointer; color: var(--mo-doux); }
.mo-lot-contenu p { margin: 4px 0 0; word-break: break-word; color: var(--mo-doux); }
.mo-lot-actions { flex: 0 0 auto; display: flex; flex-direction: column; gap: 4px; }
.mo-lot-actions .mo-bouton { padding: 4px 10px; font-size: 13px; }
.mo-lot-demande, .mo-lot-file, .mo-lot-fileUtil { border-left-color: #f9a825; }
.mo-lot-envoi, .mo-lot-envoye { border-left-color: #1565c0; }
.mo-lot-termine { border-left-color: #2e7d32; }
.mo-lot-termine .mo-lot-etat { color: #2e7d32; }
.mo-lot-erreur { border-left-color: #c62828; }
.mo-lot-erreur .mo-lot-etat { color: #c62828; }
@media (max-width: 640px) { .mo-sel-resume { flex: 1 1 100%; } .mo-sel-actions .mo-bouton { flex: 1 1 auto; } .mo-lots { grid-template-columns: 1fr; } }

/* ---------- Selection par zone (limites administratives, routes, rivieres, bassins, rectangle) ---------- */
.mo-zones { border-bottom: 1px solid var(--mo-bord); padding: 0 14px; }
.mo-zones[hidden] { display: none; }
.mo-zones > summary { padding: 12px 0; font-weight: 700; cursor: pointer; }
.mo-z-onglets { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--mo-bord); }
.mo-z-onglets button {
  padding: 7px 12px; border: 0; border-bottom: 3px solid transparent; margin-bottom: -1px; background: none !important;
  font: inherit; font-size: 14px; font-weight: 600; color: var(--mo-doux); cursor: pointer;
}
.mo-z-onglets button[aria-selected="true"] { color: var(--mo-accent); border-bottom-color: var(--mo-accent); }
.mo-z-onglets button:focus-visible { outline: 3px solid #93c5fd; outline-offset: 1px; }
.mo-z-panneau { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; padding: 12px 0; }
.mo-z-panneau[hidden] { display: none; }
.mo-z-panneau label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--mo-texte); }
.mo-z-panneau label.mo-z-case { flex-direction: row; align-items: center; padding-bottom: 8px; }
.mo-z-panneau select, .mo-z-panneau input[type="number"], .mo-z-panneau input[type="search"] {
  min-width: 13em; padding: 6px 8px; border: 1px solid #cfd6df; border-radius: 8px; font: inherit; font-size: 14px; font-weight: 400;
  background: #fff !important;
}
.mo-z-panneau input[type="number"] { min-width: 0; width: 8em; }
.mo-z-panneau .mo-z-large input { min-width: 20em; }
.mo-z-panneau select:disabled { opacity: .55; }
.mo-z-panneau .mo-bouton:disabled { opacity: .6; cursor: progress; }
.mo-z-aide { margin: 0; max-width: 70ch; font-size: 14px; color: var(--mo-doux); }
.mo-z-msg { margin: 0 0 12px; padding: 8px 12px; border-radius: 8px; background: #eef7ee !important; color: #1f5f2a; font-size: 13px; }
.mo-z-msg.mo-z-erreur { background: #fff3e8 !important; color: #8a4b12; }
.mo-z-msg[hidden] { display: none; }
.mo-carte.mo-dessin, .mo-carte.mo-dessin .leaflet-interactive { cursor: crosshair; }
@media (max-width: 640px) { .mo-z-panneau label, .mo-z-panneau select, .mo-z-panneau .mo-z-large input { width: 100%; min-width: 0; } }
