/**
 * styles.css
 * ==========
 * Zentrale Styling-Datei für den Befahrer Mapper
 * 
 * Diese Datei definiert das gesamte visuelle Erscheinungsbild der Anwendung.
 * Sie ist in logische Abschnitte unterteilt, die jeweils unterschiedliche
 * Aspekte der Benutzeroberfläche steuern.
 * 
 * Hauptbereiche:
 * 1. Grundlegendes Layout (Karte und Container)
 * 2. KML-Listendarstellung und Interaktionen
 * 3. Projekt-Auswahl und Navigation
 * 4. Farbauswahl und visuelle Rückmeldungen
 * 5. Kontextmenü und spezielle Effekte
 * 
 * Designprinzipien:
 * - Klare visuelle Hierarchie
 * - Konsistente Abstände und Farben
 * - Responsive Layouts für verschiedene Bildschirmgrößen
 * - Deutliche Nutzer-Feedback-Effekte
 */

/* ============================
   Grundlegendes Layout
   ============================ */

/* Basis-Reset für konsistentes Erscheinungsbild */
body {
  margin: 0; /* Entfernt Standard-Außenabstand */
}

/* Kartenbehälter - Hauptelement der Anwendung */
#map {
  height: 100vh; /* Volle Bildschirmhöhe */
}

/* Projekt-Anzeige im Kopfbereich
   Zeigt den aktuell ausgewählten Projektordner an */
#selected-project-display {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%); /* Zentriert horizontal */
  padding: 10px 20px;
  background-color: rgba(255, 255, 255, 0.5); /* 50% Transparenz */
  border-radius: 5px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); /* Subtiler Schatten */
  z-index: 1000; /* Über der Karte */
  font-size: 1.2em;
  font-weight: bold;
  font-family: Arial, sans-serif; /* Serifenlose Schrift */
}

#username-display::after {
  content: " ";
  margin-right: 8em; /* Größerer Abstand zwischen Benutzer und Projekt */
  display: inline-block;
}

#username-display,
#projectname-display {
  display: inline-block;
  color: #808080;
}

/* ============================
   KML-Listendarstellung
   ============================ */

/* Container für die KML-Liste
   Positioniert am rechten Bildschirmrand */
#kml-list {
  position: absolute;
  top: 10px;
  right: 10px;
  background: white;
  padding: 10px;
  z-index: 1000;
  box-shadow: 0 0 10px rgba(0,0,0,0.2);
  max-height: 90vh; /* Maximale Höhe mit Scrolling */
  overflow-y: auto;
  width: 345px;
}

/* Projekt-Auswahlmenü
   Dropdown für verschiedene Befahrungsprojekte */
#project-selector {
  width: 100%;
  padding: 8px;
  margin-bottom: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
  font-size: 1em;
}

/* Labels für Dropdown-Menüs */
.dropdown-label {
  font-family: Arial, sans-serif;
  font-size: 10px;
  color: #808080;
  margin-bottom: 4px;
  display: block;
}

/* User-Auswahlmenü 
   Soll dem Projekt-Dropdown entsprechen */
#user-selector {
  width: 100%;
  padding: 8px;
  margin-bottom: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
  font-size: 1em;
}

/* Formular für neue Projekte */
#new-project-form {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

#new-project-name {
  flex: 1;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1em;
}

#create-project-btn {
  padding: 8px 16px;
  background-color: #0078d4;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1em;
}

#create-project-btn:hover {
  background-color: #005ba1;
}

/* ============================
   Ordner-Verwaltung
   ============================ */

/* Eingabefeld für neue Ordnernamen */
#folder-name {
  width: 100%;
  padding: 8px;
  margin-bottom: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
}

/* Button zum Erstellen neuer Ordner */
#create-folder-btn {
  width: 100%;
  padding: 8px;
  margin-bottom: 10px;
  background-color: #0078d4; /* Microsoft Blau */
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

/* Hover-Effekt für den Erstellen-Button */
#create-folder-btn:hover {
  background-color: #005ba1; /* Dunkleres Blau */
}

/* ============================
   KML-Listeneinträge
   ============================ */

/* Einzelner KML-Listeneintrag
   Flexbox für optimale Ausrichtung der Elemente */
.kml-item {
  position: relative;
  margin: 5px 0;
  padding: 5px 5px 5px 16px;
  border-bottom: 1px solid #ddd;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none; /* Verhindert Textauswahl */
}

/* Farbstreifen zur visuellen Identifikation
   Zeigt die aktuelle Farbe der KML an */
.color-stripe {
  position: absolute;
  left: 0;
  top: 0;
  width: 6px;
  height: 100%;
}

/* Interaktive Zustände für Listeneinträge */
.kml-item:hover {
  background: #f0f0f0; /* Heller Hintergrund beim Hover */
}

.kml-item.selected {
  background-color: #e3f2fd; /* Helles Blau für Auswahl */
}

/* ============================
   Icons und Buttons
   ============================ */

/* Lösch-Icon für KML-Einträge */
.delete-icon {
  color: #ff4444; /* Warnendes Rot */
  cursor: pointer;
  margin-left: 10px;
}

.delete-icon:hover {
  color: #cc0000; /* Dunkleres Rot beim Hover */
}

/* Sichtbarkeits-Icons (Auge) */
.fa-eye,
.fa-eye-slash {
  color: #0078d4; /* Microsoft Blau */
  cursor: pointer;
  margin-right: 5px;
}

.fa-eye-slash {
  color: #ccc; /* Grau für ausgeblendete Elemente */
}

/* ============================
   Textformatierung
   ============================ */

/* Allgemeiner Text in Listeneinträgen */
.kml-item span {
  font-family: Arial, sans-serif;
  font-size: 0.7em;
  white-space: normal;
  word-wrap: break-word;
  max-width: 230px;
  user-select: none; /* Verhindert Textauswahl */
}

/* Große Nummern-Anzeige
   Für schnelle visuelle Identifikation */
.kml-number {
  font-family: 'Courier New', Courier, monospace;
  font-size: 8em;
  margin-right: 4px;
  margin-left: 2px;
  font-weight: bold;
  color: #0078d4; /* Microsoft Blau */
  user-select: none;
}

/* ============================
   Kontextmenü
   ============================ */

/* Container für das Kontextmenü */
#kml-context-menu {
  font-family: Arial, sans-serif;
  font-size: 0.8em;
  background: white;
  border: 1px solid #ddd;
  box-shadow: 2px 2px 5px rgba(0,0,0,0.1);
  border-radius: 3px;
  min-width: 180px;
  padding: 8px;
}

/* Menüeinträge im Kontextmenü */
#kml-context-menu div {
  padding: 8px 12px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  color: #333;
}

#kml-context-menu div:hover {
  background-color: #f5f5f5;
}

/* Farbauswahl-Sektion */
.context-menu-colors {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin: 8px 0;
  padding: 8px 0;
  border-top: 1px solid #eee;
}

/* Einzelne Farbkästchen */
.context-menu-color {
  width: 24px;
  height: 24px;
  border-radius: 3px;
  cursor: pointer;
  border: 1px solid #ddd;
  transition: transform 0.1s ease;
}

.context-menu-color:hover {
  transform: scale(1.1);
  box-shadow: 0 0 5px rgba(0,0,0,0.2);
}

/* Stile für die "neues Projekt" Option */
option.new-project-option {
  color: black !important;
  font-weight: normal;
}

option.new-project-option::before {
  content: "➕";
  color: green;
  font-weight: bold;
  margin-right: 5px;
  display: inline-block;
}

/* Bounding Box und Info-Label */
.leaflet-interactive.bbox {
  stroke: #ff7800;
  stroke-width: 2;
  stroke-opacity: 1;
  fill-opacity: 0.1;
  pointer-events: none;
}

.bbox-info-label {
  /* Schriftart und -stil */
  font-family: Arial, sans-serif; /* Verwendet Arial oder ähnliche serifenlose Schrift */
  font-size: 20px !important; /* Größere Schrift mit höherer Priorität */
  font-weight: bold; /* Fettschrift für bessere Lesbarkeit */
  
  /* Textfarbe */
  color: #333; /* Dunkelgraue Schriftfarbe */
  
  /* Hintergrund mit Transparenz */
  background: rgba(255, 255, 255, 0.95); /* Weißer Hintergrund mit 95% Deckkraft */
  
  /* Innenabstand */
  padding: 4px 8px; /* 4px oben/unten, 8px links/rechts */
  
  /* Abgerundete Ecken */
  border-radius: 3px; /* Leichte Rundung der Ecken */
  
  /* Interaktion */
  pointer-events: none; /* Verhindert Mausinteraktionen mit dem Label */
  
  /* Textausrichtung */
  text-align: center; /* Zentriert den Text horizontal */
  
  /* Zeilenumbruch */
  white-space: nowrap; /* Verhindert automatischen Zeilenumbruch */
  
  /* Positionierung */
  transform: translate(-50%, 50%); /* Zentriert das Label relativ zu seinem Ursprung */
  
  /* Schatteneffekt */
  box-shadow: 0 1px 3px rgba(0,0,0,0.2); /* Leichter Schatten für Tiefe */
  
  /* Flexbox-Layout */
  display: inline-flex; /* Flexbox-Layout für einfache Zentrierung */
  align-items: center; /* Zentriert den Inhalt vertikal */
  justify-content: center; /* Zentriert den Inhalt horizontal */
  
  /* Mindestbreite */
  min-width: 50px; /* Verhindert zu kleine Labels bei kurzem Text */
}
