/* static/style.css - Finale, bereinigte Fassung (v24) */

/* --- Globale Variablen --- */
:root {
  --map-height-desktop: 400px;
  --map-height-tablet: 45vh;
  --map-height-mobile: 40vh;
  --active-bg-color: #e9f5e9;
  --active-border-color: #c3e6cb;
  --active-text-color: #155724;
  --custom-dark-green: #157347;
  --navbar-height: 56px;
}

/* --- Globale Resets & Basis-Styling --- */
*, *::before, *::after { box-sizing: border-box; }
html, body { max-width: 100%; overflow-x: hidden !important; }
body > .container-fluid > .row { margin-left: 0; margin-right: 0; }
html { height: 100%; margin: 0; padding: 0; }
body {
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: var(--bs-body-bg, #fff);
  color: var(--bs-body-color, #212529);
  font-family: var(--bs-body-font-family, system-ui, -apple-system, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, Liberation Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji);
  line-height: var(--bs-body-line-height, 1.5);
}

/* ==========================================================================
   HAUPT-LAYOUT-STRUKTUR
   ========================================================================== */

#app-header { flex-shrink: 0; }
#app-container { flex-grow: 1; display: flex; overflow: hidden; }
.main-row { height: 100%; width: 100%; }

/* --- Linke Sidebar (Offcanvas) --- */
#sidebarOffcanvas {
  height: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
}
#sidebarOffcanvas .offcanvas-body {
  min-height: 0;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

/* --- Haupt-Inhaltsspalte (Mitte) --- */
#main-content-column {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}
#main-content-flex {
    flex-grow: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

/* --- Rechte Spalte ("Neueste Touren") --- */
#latest-tours-column {
    height: 100%;
    overflow-y: auto;
    background-color: #f8f9fa;
    border-left: 1px solid #dee2e6;
}
.latest-tours-container {
    padding: 15px;
}

/* ==========================================================================
   STYLING DER KOMPONENTEN
   ========================================================================== */

/* --- "Neueste Touren" Karten (Overlay-Design) --- */
#latest-tours-list .card {
    border-radius: 0.375rem;
    overflow: hidden;
    border: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    margin-bottom: 1rem !important;
    display: block;
    text-decoration: none;
}
#latest-tours-list .card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 12px rgba(0,0,0,0.15);
}
#latest-tours-list .card-img {
    height: 120px;
    object-fit: cover;
    transition: transform 0.3s ease;
}
#latest-tours-list .card:hover .card-img {
    transform: scale(1.05);
}
#latest-tours-list .card-img-overlay {
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.5) 50%, rgba(0,0,0,0) 100%);
    padding: 0.75rem;
}
#latest-tours-list .card-title {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.1rem;
    color: #fff;
}
#latest-tours-list .card-text {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.8);
}

/* --- Popup-Optimierung für ein sauberes, kompaktes Layout --- */

/* KORREKTUR: Stellt sicher, dass der Text auf blauen Buttons in Pop-ups weiß ist */
.leaflet-popup-content a.btn.btn-primary {
    color: #ffffff !important;
    text-decoration: none;
}

/* Allgemeines Popup-Layout */
.leaflet-popup-content {
    width: auto !important;
    min-width: 200px;
    text-align: center;
    margin: 10px 15px !important;
    font-size: 14px; /* Einheitliche Schriftgröße */
}

.leaflet-popup-content h6 {
    margin-bottom: 8px;
    font-size: 1.1em; /* Titel etwas größer */
}

.leaflet-popup-content .text-muted.small {
    font-size: 0.9em; /* Untertitel etwas kleiner */
    margin-bottom: 12px;
}

.leaflet-popup-content img {
    max-width: 160px !important; /* Bild etwas größer */
    margin: 0 auto 12px;
    border-radius: 4px;
}

/* NEU: Grid-Layout für Tour-Statistiken */
.leaflet-popup-content .tour-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Zwei Spalten */
    gap: 4px 10px; /* Abstand zwischen Zeilen und Spalten */
    text-align: left;
    max-width: 160px;
    margin: 0 auto; /* Zentriert das Grid */
}

.leaflet-popup-content .tour-stats-grid small {
    display: flex;
    align-items: center;
}

.leaflet-popup-content .tour-stats-grid .bi {
    margin-right: 6px; /* Abstand zwischen Icon und Text */
    color: #555;
}

/* Layout für den Button */
.leaflet-popup-content .btn {
    width: 100%;
    margin-top: 15px;
    padding: 6px 12px;
    font-size: 0.9rem;
}



/* In static/style.css */

/* --- Styling für die Teilen-Buttons --- */
#share-buttons-container {
    border-top: 1px solid #eee;
    padding-top: 0.75rem;
    display: flex;
    gap: 0.5rem; /* Abstand zwischen den Buttons */
    align-items: center;
}

#share-buttons-container .share-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: #6c757d;
}

/* Spezifische Farben für die Marken */
.btn-whatsapp {
    background-color: #25D366;
    color: white;
}
.btn-whatsapp:hover {
    background-color: #1DA851;
    color: white;
}

.btn-facebook {
    background-color: #1877F2;
    color: white;
}
.btn-facebook:hover {
    background-color: #135dbb;
    color: white;
}



/* --- Sidebar-Elemente (Kategorien, Tracks) --- */
#track-list {
  flex-grow: 1;
  overflow-y: auto;
  min-height: 0;
  padding: 0.5rem;
}
#track-list .list-group-item-action {
  border-radius: 0.375rem;
  margin-bottom: 0.35rem;
  padding: 0.85rem 1rem;
  transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, transform 0.1s ease-in-out;
  border: 1px solid var(--bs-border-color-translucent);
  background-color: var(--bs-body-bg);
}
#track-list .list-group-item-action:hover {
  background-color: var(--bs-secondary-bg);
  border-color: var(--bs-secondary-bg-subtle);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
#track-list .category-item-bs {
  font-weight: 500;
  text-align: left;
}
#track-list .list-group-item-action.active {
  background-color: var(--active-bg-color) !important;
  border-color: var(--active-border-color) !important;
  color: var(--active-text-color) !important;
}
#track-list .list-group-item-action.active h6,
#track-list .list-group-item-action.active .small,
#track-list .list-group-item-action.active .text-muted,
#track-list .list-group-item-action.active i {
  color: var(--active-text-color) !important;
}

/* --- Hilfe-Button --- */
.hilfe-button {
  background-color: var(--custom-dark-green) !important;
  border-color: var(--custom-dark-green) !important;
}
.hilfe-button:hover, .hilfe-button:focus {
  background-color: #105232 !important;
  border-color: #0e462b !important;
}

/* --- Hauptinhalt (Details, Karte, Galerie) --- */
#track-details-header {
  background-color: rgba(255, 255, 255, 0.95);
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #dee2e6;
  z-index: 1040;
  flex-shrink: 0;
}
#track-detail-description, .track-detail-description {
  font-size: 0.9rem;
  color: #555;
  margin-bottom: 0;
  max-height: none !important;
  overflow-y: visible !important;
}
.track-detail-description p:last-child { margin-bottom: 0; }
.track-detail-description img {
  max-width: 100%;
  height: auto;
  border-radius: 3px;
  margin-top: 0.5em;
}

#map-wrapper {
  flex-shrink: 0;
  height: var(--map-height-desktop);
  display: flex;
  position: relative;
  min-height: 300px;
}
#map {
  width: 100%;
  height: 100%;
  background-color: #e0e0e0;
}

/* --- KORRIGIERT: Bildergalerie (Zurück zum ursprünglichen Grid-Layout) --- */
#thumbnail-gallery-container {
  flex-shrink: 0;
  padding: 1.5rem 1rem;
  background-color: var(--bs-light);
  border-top: 1px solid var(--bs-border-color-translucent);
}
#thumbnail-gallery-container > h3.h6 {
  font-weight: 600;
  color: var(--bs-emphasis-color, #333);
  text-align: left;
  padding-bottom: 0.5rem;
}
#thumbnail-items.thumbnails {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); /* Bilder auf Desktop größer */
  gap: 1rem;
  align-items: start;
}
#thumbnail-items.thumbnails > a {
  display: block;
  border-radius: var(--bs-border-radius, 0.25rem);
  overflow: hidden;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
  background-color: #fff;
  aspect-ratio: 1 / 1 !important;
  height: auto !important;
}
#thumbnail-items.thumbnails > a:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}
#thumbnail-items.thumbnails .gallery-thumbnail-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border: none !important;
}

/* ==========================================================================
   RESPONSIVE ANPASSUNGEN
   ========================================================================== */

@media (max-width: 991.98px) {
  #map-wrapper {
    height: var(--map-height-tablet);
  }
}

/* Handy */
@media (max-width: 767.98px) {
  #map-wrapper {
    height: var(--map-height-mobile);
  }

  /* KORRIGIERT: Spezifische Regel für den Umbruch der Galerie auf dem Handy */
  #thumbnail-items.thumbnails {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem;
  }

  #latest-tours-column {
      height: auto;
      overflow-y: visible;
      border-left: none;
      border-top: 1px solid #dee2e6;
  }
  .latest-tours-container {
      padding: 1rem 0.5rem;
  }
}
