/*
# File: panel-legend.css - Styles pour les panneaux de légendes
# Desc: Styles spécifiques pour les légendes dépliables/repliables des symboles topologiques
# Version 1.4.0
# Logs:
#   - v1.4.0: #legendRightBtn — symbole ➻ (Transformations) à la place du triangle CSS
#   - v1.3.9: .legend-name revient en blanc — seuls les logos/symboles (.legend-symbol) sont jaunes
#   - v1.3.8: (annulé) .legend-name jaune — trop chargé avec le chip
#   - v1.3.7: .legend-symbol style « chip » jaune (intro / grille transformations) sur légende flottante
#   - v1.3.6: .legend-title-actions-right right 8px — flèche .triangle-right un peu décalée du bord
#   - v1.3.5: Retrait .title-carte global (fond jaune debug) — bandeau #titleCarte dans main.css
#   - v1.3.4: Retrait styles .topology-plain-toggle (bouton ♺ supprimé) ; .legend-title-actions-right = flèche seule
#   - v1.3.3: .legend-title-actions-right flex gap 5px (♺ + flèche Transformations)
#   - v1.3.2: ♺ blanc + rotation .active comme .triangle-right (pas sel-btn)
#   - v1.3.1: #topologyPlainToggleBtn (♺) à gauche de la flèche — même ligne titre Topologie
#   - v1.3.0: Légende + panel-floating = mêmes noir/blanc alpha que panel-manager (plus de rouge/jaune dédiés)
#   - v1.2.0: Thème bande titre Lanturlu pour panneaux légende (data-is-legend) — retiré au profit du style flottant commun
#   - v1.1.0: Ajout boutons triangles dans le titre
#   - v1.0.0: Initial version, styles pour les légendes
*/

/* Boutons triangles dans le titre */
.legend-btn {
  position: absolute;
  border: none;
  cursor: pointer;
  background: transparent;
  padding: 4px;
  border-radius: 3px;
  transition: filter 0.2s ease, opacity 0.2s ease;
  opacity: 0.85;
}
.legend-btn:hover {
  opacity: 1;
  filter: drop-shadow(0 0 5px var(--topology-selected, #fbc02d));
}
.legend-btn:active {
  filter: drop-shadow(0 0 8px var(--topology-selected, #fbc02d)) brightness(1.2);
}

.legend-btn-left {
  left: 0px;
}

.legend-btn-right {
  right: 0px;
}

/* Flèche Transformations : alignée à droite du titre Topologie (marge intérieure au bord du panneau) */
.legend-title-actions-right {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 5px;
  z-index: 2;
}

.legend-title-actions-right .legend-btn {
  position: static;
  margin-top: 0;
}

.legend-title-actions-right .legend-btn-right {
  right: auto;
  font-size: 1.15em;
  line-height: 1;
  color: var(--topology-selected, #fbc02d);
  padding: 2px 4px;
  transition: transform 0.3s ease, filter 0.2s ease, opacity 0.2s ease;
}

.legend-btn.active.legend-btn-right {
  transform: rotate(180deg);
}

/* Triangles sobres */
.triangle-left, .triangle-right {
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 6px;
  transition: transform 0.3s ease;
}

.triangle-left {
  border-right-color: var(--topology-selected, #fbc02d);
  border-left: none;
}

.triangle-right {
  border-left-color: var(--topology-selected, #fbc02d);
  border-right: none;
}

/* Rotation des triangles quand actifs */
.legend-btn.active .triangle-left {
  transform: rotate(180deg);
}

.legend-btn.active .triangle-right {
  transform: rotate(180deg);
}

/* #titleCarte : bandeau rouge + padding dans main.css (#titleCarte.title-carte) */
#titleCarte.title-carte {
  position: relative;
}

/* Position relative pour le panel-title du shapePanel */
.panel-title {
  position: relative;
}

/* Panneau de légende spécifique */
.legend-panel {
  min-width: 200px;
  max-width: 250px;
  height: 300px; /* Hauteur fixe */
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(15px);
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 4px 20px rgba(0,0,0,0.15), 0 2px 10px rgba(0,0,0,0.1);
  position: fixed;
  top: 0; /* Aligner au TOP */
  transform: none; /* Pas de centrage vertical */

  z-index: 1000;
  pointer-events: none; /* Désactive tous les événements souris */
  user-select: none; /* Empêche la sélection de texte */
  overflow: auto; /* Scroll si contenu trop long */
}

/* Zone de drag gérée par panel-manager — pas de surcouche couleur sur data-is-legend */

/* Même « verre » noir alpha que .panel-floating (panel-manager.css charge avant : on réécrit le fond blanc de .legend-panel) */
.legend-panel.panel-floating {
  background: rgb(0 0 0 / 15%);
  backdrop-filter: blur(10px);
  border: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15), 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Textes lisibles sur fond sombre translucide (comme .panel-title #eee des autres fenêtres) */
.legend-panel.panel-floating .legend-content {
  background: transparent;
  color: rgba(255, 255, 255, 0.92);
}

/* v1.3.9 : texte « nom » en blanc (seuls les logos/symboles sont jaunes) */
.legend-panel.panel-floating .legend-name {
  color: rgba(255, 255, 255, 0.88);
}

.legend-panel.panel-floating .legend-symbol {
  color: var(--theme-band-text, #fbc02d);
  font-family: 'Courier New', monospace;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  border: 1px solid rgba(251, 192, 45, 0.28);
  background: rgba(251, 192, 45, 0.07);
  min-width: 1.6rem;
  box-sizing: border-box;
}

.legend-panel.panel-floating .legend-item:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

/* Icône livre légende : taille lisible, couleurs = .drag-handle générique (pas d’override) */
.panel-floating[data-is-legend="true"] .drag-handle {
  font-size: 16px;
}

/* Ajuster le contenu pour la zone de drag */
.legend-content {
  padding: 15px;
  padding-top: 15px; /* Espace normal, le drag handle est géré par panel-manager */
  font-family: 'Arial', sans-serif;
  height: auto;
  min-height: 0;
  max-height: none;
}

/* États de positionnement des légendes */
.legend-panel.legend-offscreen-left {
  left: -25%;
  right: auto;
  pointer-events: none;
  visibility: hidden;
  display: none;
}

.legend-panel.legend-offscreen-right {
  right: -25%;
  left: auto;
  pointer-events: none;
  visibility: hidden;
  display: none;
}

.legend-panel.legend-visible.legend-left {
  left: 0; /* Coller à gauche */
  right: auto;
}

.legend-panel.legend-visible.legend-right {
  right: 0; /* Coller à droite */
  left: auto;
}

/* Permettre les événements sur le contenu si nécessaire */
.legend-panel .legend-content {
  pointer-events: auto; /* Réactiver pour le contenu si besoin */
}

/* Contenu de la légende */
.legend-content {
  padding: 15px;
  font-family: 'Arial', sans-serif;
  height: auto;
  min-height: 0;
  max-height: none;
}

/* Titre de la légende */
.legend-title {
  font-size: 14px;
  font-weight: bold;
  color: #2c3e50;
  text-align: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #3498db;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Liste des légendes */
.legend-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Item de légende */
.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px;
  border-radius: 6px;
  transition: background-color 0.2s ease;
}

.legend-item:hover {
  background-color: rgba(52, 152, 219, 0.1);
}

/* Symbole de la légende (sur fond clair : lisible sans chip ; sur .panel-floating → chip jaune ci-dessus) */
.legend-symbol {
  font-size: 18px;
  min-width: 25px;
  text-align: center;
  font-weight: bold;
  color: #2c3e50;
}

/* Nom de la légende */
.legend-name {
  font-size: 12px;
  color: #34495e;
  font-weight: 500;
  line-height: 1.3;
}

/* États repliés/dépliés spécifiques aux légendes */
.legend-panel.collapsed {
  pointer-events: none;
  height: 0;
  overflow: hidden;
}

.legend-panel:not(.collapsed) {
  pointer-events: auto;
  height: auto;
}

/* Légendes sans data-is-legend : ancien thème bleu en locked (rétrocompat) */
.legend-panel:not([data-is-legend="true"]).locked .drag-handle {
  background-color: #34495e !important;
  color: white !important;
  border: none !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 3px rgba(0, 0, 0, 0.3) !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5) !important;
}

.legend-panel:not([data-is-legend="true"]).locked .drag-handle:hover {
  background-color: #2c3e50 !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 2px 6px rgba(0, 0, 0, 0.4) !important;
}

/* Responsive pour petits écrans */
@media (max-width: 768px) {
  .legend-panel {
    min-width: 180px;
    max-width: 200px;
  }
  
  .legend-symbol {
    font-size: 16px;
    min-width: 20px;
  }
  
  .legend-name {
    font-size: 11px;
  }
  
  .legend-btn {
    width: 20px;
    height: 20px;
    font-size: 10px;
  }
}

 