/* ============================================
   MAP.CSS - STYLES SPÉCIFIQUES À LA CARTE
   
   Ce fichier surcharge /assets/css/map.css de Lizmap
   
   CONTEXTE : Ce fichier s'applique UNIQUEMENT sur :
   - Les pages de visualisation de carte
   - PAS sur le portail d'accueil
   
   ÉLÉMENTS STYLISÉS :
   - Popups sur la carte (mode tableau)
   - Tables attributaires dans les popups
   - Barre d'outils d'édition (feature-toolbar)
   - Docks et panneaux latéraux
   ============================================ */

/* ============================================
   POPUPS - Conteneur principal dans les docks
   ============================================ */
#dock div.lizmapPopupDiv,
#mini-dock div.lizmapPopupDiv,
#right-dock div.lizmapPopupDiv,
#bottom-dock div.lizmapPopupDiv {
  background-color: var(--color-background-primary-content) !important;
  padding: 0;
  border-radius: var(--border-radius);
}

/* ============================================
   POPUPS - Style modernisé OpenLayers
   ============================================ */
.lizmapPopup.olPopup,
#map-content .lizmapPopup {
  background-color: var(--color-background-primary) !important;
  border: none !important;
  border-radius: var(--border-radius-lg) !important;
  box-shadow: var(--shadow-lg), 0 2px 8px rgba(0, 0, 0, 0.1) !important;
  color: var(--color-text-primary) !important;
  overflow: hidden;
}

/* ============================================
   POPUP - Titre principal (bandeau supérieur)
   ============================================ */
.lizmapPopup.olPopup .lizmapPopupContent h4,
#map-content .lizmapPopupContent h4,
#popupcontent .lizmapPopupContent h4,
h4.lizmapPopupTitle {
  color: var(--color-contrasted-text) !important;
  background: linear-gradient(135deg, var(--color-contrasted-elements) 0%, #61B3E3 100%);
  border: none !important;
  border-radius: 0 !important;
  padding: 16px 20px !important;
  margin: 0 !important;
  font-size: 1.1em !important;
  font-weight: 600 !important;
  letter-spacing: 0.3px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* ============================================
   POPUP - Contenu (suppression du padding)
   ============================================ */
.lizmapPopup.olPopup .lizmapPopupContent,
#map-content .lizmapPopupContent,
#popupcontent .lizmapPopupContent {
  padding: 0;
}

/* ============================================
   POPUP - Tableaux de données (mode tableau)
   ============================================ */
.lizmapPopup.olPopup .lizmapPopupTable,
#map-content .lizmapPopupTable,
#popupcontent .lizmapPopupTable,
#liz-atlas-item-detail .lizmapPopupTable,
div.attribute-layer-feature-panel .lizmapPopupTable {
  background-color: white;
  border: 2px solid var(--color-contrasted-elements);
  border-radius: 0;
  overflow: hidden;
  box-shadow: none;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

/* ============================================
   POPUP - Masquage de l'en-tête du tableau
   Le H4 remplace les colonnes Champ / Valeur
   ============================================ */
.lizmapPopup.olPopup .lizmapPopupTable thead,
#map-content .lizmapPopupTable thead,
#popupcontent .lizmapPopupTable thead,
#liz-atlas-item-detail .lizmapPopupTable thead,
div.attribute-layer-feature-panel .lizmapPopupTable thead {
  display: none;
  height: 0;
  line-height: 0;
}

.lizmapPopup.olPopup .lizmapPopupTable thead th,
#map-content .lizmapPopupTable thead th,
#popupcontent .lizmapPopupTable thead th,
#liz-atlas-item-detail .lizmapPopupTable thead th,
div.attribute-layer-feature-panel .lizmapPopupTable thead th {
  padding: 0 !important;
  height: 0 !important;
  line-height: 0 !important;
}

/* ============================================
   POPUP - Cellules TH (Labels / Champs)
   ============================================ */
.lizmapPopup.olPopup .lizmapPopupTable th,
#map-content .lizmapPopupTable th,
#popupcontent .lizmapPopupTable th,
#liz-atlas-item-detail .lizmapPopupTable th,
div.attribute-layer-feature-panel .lizmapPopupTable th {
  padding: 6px 16px;
  font-weight: 600;
  text-align: left;
  border: none !important;
  border-bottom: 1px solid #e8e8e8 !important;
  font-size: 0.9em;
  color: #555;
  background-color: transparent !important;
  width: 180px;
  vertical-align: top;
}

/* ============================================
   POPUP - Cellules TD (Valeurs / Contenu)
   ============================================ */
.lizmapPopup.olPopup .lizmapPopupTable td,
#map-content .lizmapPopupTable td,
#popupcontent .lizmapPopupTable td,
#liz-atlas-item-detail .lizmapPopupTable td,
div.attribute-layer-feature-panel .lizmapPopupTable td {
  padding: 6px 16px;
  border: none !important;
  border-bottom: 1px solid #e8e8e8;
  transition: background-color 0.15s ease;
  color: #222;
  font-size: 0.9em;
}

/* ============================================
   POPUP - Effet hover sur les lignes
   ============================================ */
.lizmapPopup.olPopup .lizmapPopupTable tbody tr:hover th,
.lizmapPopup.olPopup .lizmapPopupTable tbody tr:hover td,
#map-content .lizmapPopupTable tbody tr:hover th,
#map-content .lizmapPopupTable tbody tr:hover td,
#popupcontent .lizmapPopupTable tbody tr:hover th,
#popupcontent .lizmapPopupTable tbody tr:hover td,
#liz-atlas-item-detail .lizmapPopupTable tbody tr:hover th,
#liz-atlas-item-detail .lizmapPopupTable tbody tr:hover td,
div.attribute-layer-feature-panel .lizmapPopupTable tbody tr:hover th,
div.attribute-layer-feature-panel .lizmapPopupTable tbody tr:hover td {
  background-color: #f8f9fa !important;
}

/* ============================================
   POPUP - Suppression bordure dernière ligne
   ============================================ */
.lizmapPopup.olPopup .lizmapPopupTable tbody tr:last-child th,
.lizmapPopup.olPopup .lizmapPopupTable tbody tr:last-child td,
#map-content .lizmapPopupTable tbody tr:last-child th,
#map-content .lizmapPopupTable tbody tr:last-child td,
#popupcontent .lizmapPopupTable tbody tr:last-child th,
#popupcontent .lizmapPopupTable tbody tr:last-child td,
#liz-atlas-item-detail .lizmapPopupTable tbody tr:last-child th,
#liz-atlas-item-detail .lizmapPopupTable tbody tr:last-child td,
div.attribute-layer-feature-panel .lizmapPopupTable tbody tr:last-child th,
div.attribute-layer-feature-panel .lizmapPopupTable tbody tr:last-child td {
  border-bottom: none !important;
}

/* ============================================
   POPUP - Zebra striping (lignes alternées)
   ============================================ */
.lizmapPopup.olPopup .lizmapPopupTable tbody tr:nth-child(even) th,
.lizmapPopup.olPopup .lizmapPopupTable tbody tr:nth-child(even) td,
#map-content .lizmapPopupTable tbody tr:nth-child(even) th,
#map-content .lizmapPopupTable tbody tr:nth-child(even) td,
#popupcontent .lizmapPopupTable tbody tr:nth-child(even) th,
#popupcontent .lizmapPopupTable tbody tr:nth-child(even) td,
#liz-atlas-item-detail .lizmapPopupTable tbody tr:nth-child(even) th,
#liz-atlas-item-detail .lizmapPopupTable tbody tr:nth-child(even) td,
div.attribute-layer-feature-panel .lizmapPopupTable tbody tr:nth-child(even) th,
div.attribute-layer-feature-panel .lizmapPopupTable tbody tr:nth-child(even) td {
  background-color: #f8f9fa !important;
}

.lizmapPopup.olPopup .lizmapPopupTable tbody tr:nth-child(odd) th,
.lizmapPopup.olPopup .lizmapPopupTable tbody tr:nth-child(odd) td,
#map-content .lizmapPopupTable tbody tr:nth-child(odd) th,
#map-content .lizmapPopupTable tbody tr:nth-child(odd) td,
#popupcontent .lizmapPopupTable tbody tr:nth-child(odd) th,
#popupcontent .lizmapPopupTable tbody tr:nth-child(odd) td,
#liz-atlas-item-detail .lizmapPopupTable tbody tr:nth-child(odd) th,
#liz-atlas-item-detail .lizmapPopupTable tbody tr:nth-child(odd) td,
div.attribute-layer-feature-panel .lizmapPopupTable tbody tr:nth-child(odd) th,
div.attribute-layer-feature-panel .lizmapPopupTable tbody tr:nth-child(odd) td {
  background-color: white !important;
}

/* ============================================
   POPUP ENFANTS - Masquage des titres
   Les popups enfants sont utilisés pour afficher
   les objets liés (relations 1-N)
   ============================================ */
.lizmapPopup.olPopup .lizmapPopupDiv .lizmapPopupChildren h4,
#map-content .lizmapPopupDiv .lizmapPopupChildren h4,
#popupcontent .lizmapPopupDiv .lizmapPopupChildren h4,
.lizmapPopupChildren h4 {
  display: none !important;
}

/* ============================================
   FEATURE TOOLBAR - Barre d'outils d'édition
   ============================================ */
lizmap-feature-toolbar div.feature-toolbar {
  margin-bottom: 10px;
  padding: 8px;
  background: #f8f9fa;
  border-radius: var(--border-radius);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

lizmap-feature-toolbar button.btn,
.attribute-layer-action-bar button.btn:not(.dropdown-toggle) {
  border-radius: var(--border-radius);
  /*padding: 8px 16px; taille du bouton définie par styles défaut*/
  font-size: 0.9em;
  font-weight: 500;
  transition: all var(--transition-speed) ease;
  border: 1px solid transparent;
  box-shadow: var(--shadow-sm);
}

/* ============================================
   DIVERS - Ajustements spécifiques
   ============================================ */
#theme-selector button.dropdown-toggle {
  width: 50px;
}

/* ============================================
   RESPONSIVE - Adaptations mobile
   ============================================ */
@media (max-width: 768px) {
  .lizmapPopup.olPopup .lizmapPopupContent h4,
  #map-content .lizmapPopupContent h4 {
    font-size: 1em !important;
    padding: 12px 16px !important;
  }
  
  .lizmapPopup.olPopup .lizmapPopupTable th,
  .lizmapPopup.olPopup .lizmapPopupTable td,
  #map-content .lizmapPopupTable th,
  #map-content .lizmapPopupTable td {
    padding: 10px 12px;
    font-size: 0.85em;
  }
  
  .lizmapPopup.olPopup .lizmapPopupTable th,
  #map-content .lizmapPopupTable th {
    width: 140px;
  }
}