/* MIA Zonage — styles de mise en page (la charte est dans theme.css). */

.container { max-width: 1080px; margin: 0 auto; padding: 0 var(--sp-4); }
main.container { padding-top: var(--sp-6); padding-bottom: var(--sp-8); }
.muted { color: var(--gray-500); }
.small { font-size: .85rem; }
.mt-4 { margin-top: var(--sp-4); }
.mt-6 { margin-top: var(--sp-6); }

/* — Navigation secondaire — */
.nav { background: var(--white); border-bottom: 1px solid var(--gray-300); }
.nav-inner { display: flex; align-items: center; gap: var(--sp-4); height: 48px; }
.nav a { color: var(--gray-700); font-weight: 600; font-size: .95rem;
  padding: 4px 2px; border-bottom: 2px solid transparent; }
.nav a:hover { text-decoration: none; color: var(--rose-700); }
.nav a.actif { color: var(--rose-700); border-bottom-color: var(--rose-600); }
.nav a.nav-sec { color: var(--gray-500); font-weight: 500; font-size: .85rem; }
.nav-sep { flex: 1; }
.nav-user { display: flex; align-items: center; gap: var(--sp-2); margin-left: var(--sp-3);
  font-size: .82rem; color: var(--gray-700); font-weight: 700; }
.nav-user form { display: inline; margin: 0; }
.nav-logout { background: transparent; border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm); padding: 3px 9px; font: inherit; font-size: .78rem;
  font-weight: 600; color: var(--rose-700); cursor: pointer; }
.nav-logout:hover { background: var(--rose-50); }

/* — Flash — */
.flash { margin-bottom: var(--sp-4); }

/* — Écrans d'authentification — */
.auth-card { max-width: 480px; margin: var(--sp-8) auto; }
.auth-card .field { margin-bottom: var(--sp-3); }
.auth-card input { width: 100%; }
.auth-row { display: flex; gap: var(--sp-3); }
.auth-row .field { flex: 1; }
@media (max-width: 480px) { .auth-row { flex-direction: column; gap: 0; } }

/* — Delta de suivi sur Résultats — */
.delta { font-size: .8rem; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: var(--gray-100); color: var(--gray-700); }
.delta.up { background: #EBFBEE; color: var(--ok); }
.delta.down { background: #FFF0F0; color: var(--danger); }

/* — Bandeau cabinet — */
.bandeau-cabinet { display: flex; align-items: center; gap: var(--sp-8);
  flex-wrap: wrap; padding: var(--sp-3) var(--sp-6); margin-bottom: var(--sp-4); }
.bandeau-label { display: block; font-size: .7rem; text-transform: uppercase;
  letter-spacing: .5px; color: var(--gray-500); }

/* — Barres d'outils / champs — */
.toolbar { display: flex; align-items: flex-end; gap: var(--sp-6); flex-wrap: wrap;
  margin-bottom: var(--sp-4); }
.field label { display: block; font-size: .8rem; font-weight: 600;
  color: var(--gray-700); margin-bottom: var(--sp-1); }
.field input[type=text], .field input[type=number], .field select {
  padding: var(--sp-2) var(--sp-3); border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm); font: inherit; }

/* — Contrôle segmenté (rayon / pondération / calque) — */
.seg { display: inline-flex; border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm); overflow: hidden; }
.seg label { padding: var(--sp-2) var(--sp-4); cursor: pointer; font-weight: 600;
  font-size: .9rem; background: var(--white); border-right: 1px solid var(--gray-300); }
.seg label:last-child { border-right: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg input:checked + span { color: var(--white); }
.seg label:has(input:checked) { background: var(--rose-600); color: var(--white); }

/* — Liste de communes (Mode 1) — */
.commune-list td.dist { color: var(--gray-500); white-space: nowrap; }
.commune-list input.patients { width: 72px; text-align: center; }
.tag-ut { font-size: .75rem; font-weight: 700; }
.tag-ut.dans { color: var(--ok); }
.tag-ut.hors { color: var(--gray-500); }

/* — Mise en page Résultats (2 colonnes) — */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-6); }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }

/* — Jauge ratio — */
.gauge-wrap { text-align: center; }
.gauge-bar { height: 18px; border-radius: 999px; background: var(--gray-100);
  overflow: hidden; margin: var(--sp-3) 0; position: relative; }
.gauge-bar > span { display: block; height: 100%; border-radius: 999px; }
.gauge-bar.ok > span     { background: var(--ok); }
.gauge-bar.warn > span   { background: var(--warn); }
.gauge-bar.danger > span { background: var(--danger); }
.gauge-seuil { position: absolute; top: -4px; bottom: -4px; width: 2px;
  background: var(--ink); }
.gauge-seuil-label { font-size: .75rem; color: var(--gray-700); }

/* — Carte — */
#map { height: 420px; border-radius: var(--radius); border: 1px solid var(--gray-300); }
.legende { margin-top: var(--sp-3); font-size: .82rem; }
.legende .ligne { display: flex; align-items: center; gap: var(--sp-2);
  padding: 2px 0; }
.legende .pastille { width: 14px; height: 14px; border-radius: 3px;
  border: 1px solid rgba(0,0,0,.15); }

/* — Camembert — */
.pie-wrap { max-width: 260px; margin: 0 auto; }

/* — Courbe de suivi (Chart.js a besoin d'un conteneur à hauteur fixe) — */
.chart-box { position: relative; height: 280px; }

/* — Mapping import (tableau) — */
.apercu { overflow-x: auto; }
.apercu table { font-size: .8rem; }
.apercu th { white-space: nowrap; }

/* — Bannière MIA Écosystème (footer "pub") — */
.eco-banner { margin-top: var(--sp-8); color: #fff; padding: var(--sp-8) var(--sp-6);
  background: linear-gradient(135deg, #0B2A6B, #133E8C 55%, #1A4FA3); }
.eco-wrap { max-width: 1180px; margin: 0 auto; }

.eco-top { display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--sp-6); flex-wrap: wrap; margin-bottom: var(--sp-6); }
.eco-brand { display: flex; align-items: center; gap: var(--sp-4); }
.eco-logo { font-weight: 900; font-size: 1.6rem; letter-spacing: .5px; line-height: 1;
  display: flex; flex-direction: column; }
.eco-logo small { font-weight: 700; font-size: .58rem; letter-spacing: 3px; color: #9DBDF5; }
.eco-brand h3 { margin: 0; color: #fff; font-size: 1.15rem; }
.eco-brand p { margin: 2px 0 0; color: #C9DBFB; font-size: .9rem; }
.eco-heart { color: #FF7AA8; }
.eco-badges { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.eco-badge { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.28);
  color: #fff; font-size: .72rem; font-weight: 700; padding: 5px 10px; border-radius: 999px;
  white-space: nowrap; }

.eco-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: var(--sp-3); }
@media (max-width: 1080px) { .eco-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 680px)  { .eco-grid { grid-template-columns: 1fr 1fr; } }

.eco-card { display: flex; flex-direction: column; background: #fff; color: var(--ink);
  border-radius: var(--radius); padding: var(--sp-4); border-top: 4px solid var(--gray-300);
  transition: .15s; }
.eco-card:hover { text-decoration: none; transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(0,0,0,.25); }
.eco-nom { font-weight: 800; font-size: .98rem; margin-bottom: 2px; }
.eco-nom em { font-style: normal; font-weight: 700; font-size: .68rem; color: var(--rose-600); }
.eco-tag { font-size: .76rem; color: var(--gray-700); line-height: 1.3; min-height: 2.4em; }
.eco-points { list-style: none; padding: 0; margin: var(--sp-2) 0; font-size: .72rem;
  color: var(--gray-700); }
.eco-points li { padding-left: 15px; position: relative; margin-bottom: 2px; line-height: 1.3; }
.eco-points li::before { content: "✓"; position: absolute; left: 0; font-weight: 800; }
.eco-url { margin-top: auto; font-weight: 700; font-size: .76rem; word-break: break-all; }
.eco-card.actuel { outline: 2px solid #fff; outline-offset: 1px; }

/* Accents par produit (couleurs de la bannière officielle) */
.accent-miaidel    { border-top-color: #2563EB; }
.accent-miaidel .eco-nom, .accent-miaidel .eco-points li::before, .accent-miaidel .eco-url { color: #2563EB; }
.accent-medecin    { border-top-color: #7C3AED; }
.accent-medecin .eco-nom, .accent-medecin .eco-points li::before, .accent-medecin .eco-url { color: #7C3AED; }
.accent-pharmacien { border-top-color: #0F9D8C; }
.accent-pharmacien .eco-nom, .accent-pharmacien .eco-points li::before, .accent-pharmacien .eco-url { color: #0C7E70; }
.accent-zonage     { border-top-color: var(--rose-600); }
.accent-zonage .eco-nom, .accent-zonage .eco-points li::before, .accent-zonage .eco-url { color: var(--rose-700); }
.accent-easycom    { border-top-color: #F59E0B; }
.accent-easycom .eco-nom, .accent-easycom .eco-points li::before, .accent-easycom .eco-url { color: #B5740A; }
.accent-easynet    { border-top-color: #0EA5A4; }
.accent-easynet .eco-nom, .accent-easynet .eco-points li::before, .accent-easynet .eco-url { color: #0C8281; }

.eco-legal { display: flex; justify-content: space-between; gap: var(--sp-6); flex-wrap: wrap;
  margin-top: var(--sp-6); padding-top: var(--sp-4); border-top: 1px solid rgba(255,255,255,.2);
  font-size: .72rem; color: #B9CCEC; line-height: 1.5; }
.eco-legal a { color: #fff; }
.eco-legal-right { text-align: right; }
@media (max-width: 680px) { .eco-legal-right { text-align: left; } }
.eco-purge { margin-top: var(--sp-4); }
.eco-purge .btn-ghost { color: #fff; border-color: rgba(255,255,255,.4); }
.eco-purge .btn-ghost:hover { background: rgba(255,255,255,.12); }

/* — Bandeau cookie — */
.cookie-banner { position: fixed; bottom: 0; left: 0; right: 0; z-index: 9999;
  background: var(--ink); color: #fff; padding: var(--sp-3) var(--sp-4); font-size: .82rem;
  display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap;
  justify-content: center; box-shadow: 0 -2px 8px rgba(0,0,0,.25); }
.cookie-banner a { color: #fff; text-decoration: underline; }
.cookie-banner .btn-primary { padding: 4px 16px; }

/* — Disclaimer — */
.disclaimer { font-size: .8rem; color: var(--gray-700); background: var(--gray-100);
  border-left: 3px solid var(--gray-500); border-radius: var(--radius-sm);
  padding: var(--sp-3) var(--sp-4); }

/* — Impression du rapport — */
@media print {
  .mia-banner, .nav, .eco-banner, .no-print { display: none !important; }
  main.container { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 1px solid #ccc; }
}
