/* ============================================================
   BTP FINCOOP 1.7 — DOSSIERS TERRAIN, CARTES ET ORIENTATION
   Structure claire, palette bleue.
   ============================================================ */

/* ============================================================
   1. CARTES (NATIONALE & PROJET)
   ============================================================ */
.national-map-panel { margin-bottom: 22px; }

.national-map {
  height: 540px;
  background: #eaf0f4;
  position: relative;
  z-index: 0;
  isolation: isolate;
}

.project-map {
  display: block;
  width: 100%;
  height: 340px;
  border: 0;
  background: #eaf0f4;
  position: relative;
  z-index: 0;
  isolation: isolate;
}


/* ============================================================
   2. VITRINE PROJET (SHOWCASE)
   ============================================================ */
.project-showcase {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin: 0 0 22px;
}

.project-showcase > .panel { min-width: 0; }

.project-maquette {
  width: 100%;
  height: 340px;
  object-fit: contain;
  background: linear-gradient(135deg, #f6f8fa, #e9edf2);
  display: block;
}

.map-link { margin: 12px 18px; }

.presentation-actions {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 18px;
}

.feature-empty {
  padding: 60px 22px;
  color: var(--muted);
  text-align: center;
}


/* ============================================================
   3. POPUPS DE CARTE
   ============================================================ */
.map-popup strong,
.map-popup small { display: block; }

.map-popup strong {
  font-size: 15px;
  color: var(--navy);
}

.map-popup small {
  color: var(--muted);
  margin-top: 6px;
}

.map-popup p {
  max-height: 130px;
  overflow: auto;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.map-popup a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: #2563eb !important; /* Bleu (anciennement #087f8c) */
  font-weight: 700;
}


/* ============================================================
   4. GRILLE PROJETS PUBLICS
   ============================================================ */
.public-project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.public-project {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.public-project h2 {
  font-size: 18px;
  margin: 0;
  overflow-wrap: anywhere;
}

.public-project small {
  color: var(--muted);
  font-size: 12px;
}

.public-project p {
  margin: 0;
  color: #637186;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.public-project .button {
  align-self: flex-start;
  margin-top: auto;
}


/* ============================================================
   5. OUTILS DE LOCALISATION & PANNEAU FONCTIONNALITÉS
   ============================================================ */
.location-tools {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.feature-panel { margin-top: 20px; }


/* ============================================================
   6. PIÈCES JOINTES
   ============================================================ */
.attachment-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding: 0 20px 20px;
}

.attachment-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fcfdff;
}

.attachment-card > img,
.attachment-pdf {
  height: 180px;
  width: 100%;
  object-fit: cover;
  border-radius: 7px;
  background: #f2f5fa;
}

.attachment-pdf {
  display: grid;
  place-items: center;
  font-size: 32px;
  font-weight: 800;
  color: #2563eb; /* Bleu (anciennement #087f8c) */
}

.attachment-card strong {
  font-size: 14px;
  overflow-wrap: anywhere;
}

.attachment-card small {
  color: var(--muted);
  font-size: 12px;
}

.attachment-card .toolbar-actions {
  margin-top: auto;
  flex-wrap: wrap;
}


/* ============================================================
   7. ROUTAGE / ORIENTATION
   ============================================================ */
.routing-item {
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.routing-item > div:first-child {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.routing-item > small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.routing-item form {
  max-width: 650px;
  margin-top: 12px;
}

.routing-item .button { justify-self: start; }

.routing-form {
  padding: 22px;
  border-top: 1px solid var(--line);
  background: #eff6ff; /* Bleu clair (anciennement #f2fafb) */
  display: grid;
  gap: 16px;
}

.routing-form h3 { margin: 0; }
.routing-form p { margin: 0; line-height: 1.6; }

.routing-form #id_destinataires {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.routing-form #id_destinataires label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 13px;
  line-height: 1.5;
}

.routing-form input[type=checkbox] {
  flex: none;
  width: 20px;
  min-height: 20px;
  height: 20px;
}

.routing-form > .button { justify-self: start; }


/* ============================================================
   8. NOTE CARTE VIDE
   ============================================================ */
.map-empty-note {
  margin: 0;
  padding: 0 20px 16px;
  color: var(--muted);
  font-size: 13px;
}


/* ============================================================
   9. MEDIA QUERIES
   ============================================================ */

/* --- Tablettes (≤1199px) --- */
@media (max-width: 1199px) {
  .public-project-grid,
  .attachment-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .project-showcase { grid-template-columns: minmax(0, 1fr); }
  .national-map { height: 480px; }
}

/* --- Mobile (≤740px) --- */
@media (max-width: 740px) {
  .public-project-grid,
  .attachment-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .national-map { height: 390px; }
  .project-map,
  .project-maquette { height: 300px; }
  .routing-form { padding: 16px; }
  .routing-form #id_destinataires { grid-template-columns: minmax(0, 1fr); }
  .attachment-grid { padding: 0 14px 14px; }
  .public-project { padding: 18px; }
}