/* ============================================================================
   BAUSTELLENAUSKUNFT DACHAU - HAUPTSTILE
   Bereinigte Version ohne Dubletten und Fehler
   ============================================================================ */

/* ============================================================================
   Z-INDEX HIERARCHIE (Übersicht)
   ============================================================================
   0    - Karte (map)
   100  - Hauptrouten-Pane
   200  - Mask-Pane
   210  - Stadtgrenze-Pane
   220  - Glow-Pane
   230  - Sperrungen-Pane
   240  - Marker-Pane
   ----
   800  - Title/Controls Overlay & Mobile Toggle Button
   900  - Legende & Footer
   ----
   1000 - Leaflet Controls (Standard)
   1100 - Leaflet Layer Control (erweitert)
   1200 - Geocoder
   ----
   9000 - Hover Tooltip
   9999 - Modal Overlay
   ============================================================================ */

/* ============================================================================
   1. GRUNDLEGENDE SEITEN- UND KARTENSTILE
   ============================================================================ */

html, body {
    overflow: hidden;
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
}

#map {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 0;
}


/* ============================================================================
   2. OVERLAY-KOMPONENTEN (Allgemein)
   ============================================================================ */

.overlay {
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    padding: 1rem;
    border-radius: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    border: 1px solid #1f2937;
    margin-left: 0.25rem;
}

#title-overlay {
    min-width: 460px;
}


/* ============================================================================
   3. WERKZEUG-OVERLAYS (Tooltip, Popups, Verkehrszeichen)
   ============================================================================ */

/* Hover-Tooltip */
#hover-tooltip {
    position: absolute;
    display: none;
    z-index: 9000;
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 8px 12px;
    border-radius: 1rem;
    pointer-events: none;
    white-space: nowrap;
    font-size: 0.9rem;
}

/* Leaflet Popup Content */
.leaflet-popup-content {
    font-size: 14px;
    line-height: 1.6;
}

/* Verkehrszeichen Icons */
.verkehrszeichen-icon {
    background: none;
    border: none;
    pointer-events: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}


/* ============================================================================
   4. Z-INDEX MANAGEMENT FÜR LEAFLET-ELEMENTE
   ============================================================================ */

.leaflet-bottom.leaflet-right {
    bottom: 0;
    z-index: 1000;
}

.leaflet-control-layers-expanded {
    z-index: 1100;
    padding: 0.75rem !important;
}

/* Vereinheitlichung rechter Rand - 0.75rem für alle Elemente */
.leaflet-right {
    right: 1.25rem !important;
}


/* ============================================================================
   5. GEOCODER-SUCHFELD (Adresssuche)
   ============================================================================ */

/* Basis-Styling für Geocoder-Control */
body .leaflet-control-geocoder {
    margin-top: 2rem;
    margin-right: 0;
    backdrop-filter: blur(8px);
    padding: 0.4rem;
    border-radius: 1rem;
    z-index: 1200;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2) !important;
    border: 1px solid #1f2937 !important;
    transition: transform 0.2s ease-in-out;
}

body .leaflet-control-geocoder:hover {
    transform: scale(1.1);
}

body .leaflet-control-geocoder.leaflet-control {
        margin-top: 0.75rem;
        margin-right: 0rem;
        transition: all 0.2s ease-in-out;
}
/* Geocoder-Formular Eingabefeld */
.leaflet-control-geocoder-form input {
    width: 250px;
    padding: 0.5rem 0.75rem;
    margin-right: 1.75rem;
    border-radius: 1rem;
    border: 1px solid #1f2937;
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    z-index: 1200;
}

/* Geocoder Such-Icon (Lupe) */
.leaflet-control-geocoder-icon {
    background-position: 50% 50%;
    background-size: 36px 36px;
}

/* Geocoder Vorschlagsliste */
.leaflet-control-geocoder-form-no-error {
    border-radius: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    border: 1px solid #ccc;
    max-height: 250px;
    overflow-y: auto;
}

.leaflet-control-geocoder-alternatives a {
    padding: 1rem 1.25rem;
    cursor: pointer;
    white-space: normal;
}

.leaflet-control-geocoder-alternatives a:hover,
.leaflet-control-geocoder-selected {
    background-color: #f0f0f0;
}



/* ============================================================================
   6. LAYER-CONTROL (Kartenebenen)
   ============================================================================ */

/* Basis-Styling */
body .leaflet-control-layers {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    border-radius: 1rem;
    border: 1px solid #1f2937 !important;
    transition: transform 0.2s ease-in-out;
}

body .leaflet-control-layers:hover {
    transform: scale(1.1);
}

/* Positionierung */
body .leaflet-control-layers.leaflet-control {
    bottom: 0.75rem !important;
    margin-bottom: 0.75rem !important;
    margin-right: 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}


/* ============================================================================
   7. LEGENDE
   ============================================================================ */

/* Legende Wrapper */
/*#legend-wrapper {
    position: absolute;
    right: 1.25rem;
    top: 300px;
    z-index: 900;
}*/

 #legend-wrapper {
    position: absolute;
    right: 1.25rem;
    bottom: auto;
    top: 45%;
    transform: translateY(-50%);
    z-index: 900;
    }

/* Legende Icon-Button */
#legend-icon {
    width: 44px;
    height: 44px;
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    border-radius: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 1px solid #1f2937 !important;
    transition: transform 0.2s ease-in-out;
}

#legend-icon:hover {
    transform: scale(1.1);
}

/* Legende Content (ausgeklappt) */
#legend-content {
    position: absolute;
    right: calc(100% + 20px);
    top: 0;
    bottom: auto;
    height: auto;
    min-height: min-content;
    width: 224px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(10px);
    transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out, visibility 0.2s;
}

#legend-content.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Legende gestrichelte Linie */
.legend-dashed {
    background-image: linear-gradient(to right, currentColor 50%, transparent 50%);
    background-position: top;
    background-size: 8px 2px;
    background-repeat: repeat-x;
}

/* Legende Glow-Effekt (für Verkehrsbedeutung) */
.legend-glow {
    position: relative;
    box-shadow: 0 0 5px 2px #000;
}


/* ============================================================================
   8. DESKTOP-LAYOUT
   ============================================================================ */

/* Titel-Overlay */
#title-overlay {
    position: absolute;
    top: 0.75rem;
    left: 1rem;
    z-index: 800;
}

/* Controls-Overlay (Zeitraum-Filter) */
#controls-overlay {
    position: absolute;
    top: 7rem;
    left: 1rem;
    width: 16rem;
    z-index: 800;
}

/* Mobile Controls Toggle (Standard ausgeblendet) */
#mobile-controls-toggle {
    display: none;
}


/* ============================================================================
   9. FUSSZEILE & INFO-MODAL
   ============================================================================ */

/* Fußzeile */
#page-footer {
    position: absolute;
    left: 50%;
    bottom: 30px;
    margin-left: -150px;
    padding: 5px 15px;
    text-align: center;
    background-color: rgba(255, 255, 255, 0.6);
    border-radius: 1rem;
    z-index: 900;
}

#page-footer a {
    color: #343b45;
    text-decoration: none;
    margin: 0 10px;
    font-size: 0.9rem;
}

#page-footer a:hover {
    text-decoration: underline;
}

/* Info-Modal Overlay */
#info-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: none;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    z-index: 9999;
}

/* Info-Modal Container */
#info-modal {
    background-color: white;
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    border-radius: 1rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Info-Modal Header */
#info-modal-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#info-modal-title {
    font-size: 1.25rem;
    font-weight: bold;
    color: #1f2937;
}

#info-modal-close-btn {
    font-size: 1.5rem;
    line-height: 1;
    color: #6b7280;
    background: none;
    border: none;
    cursor: pointer;
}

/* Info-Modal Content */
#info-modal-content {
    overflow-y: auto;
    padding: 1.5rem;
    line-height: 1.6;
}

#info-modal-content h1 {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 1rem;
    padding-left: 0.5rem;
    padding-right: 0.75rem;
}

#info-modal-content h3 {
    font-size: 1.1rem;
    font-weight: bold;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

#info-modal-content ul {
    list-style-position: inside;
    list-style-type: disc;
    margin-left: 1rem;
}


/* ============================================================================
   10. MEDIA QUERIES - MOBILE ANPASSUNGEN (max-width: 767px)
   ============================================================================ */

@media (max-width: 767px) {
    
    /* Tap Highlight deaktivieren */
    body {
        -webkit-tap-highlight-color: transparent;
    }

    /* ---------- Title Overlay - Mobile ---------- */
    #title-overlay {
        top: 0.75rem;
        left: 1rem;
        right: 1.25rem;
        width: auto;
        min-width: 100px;
        height: 44px;
        padding: 0.25rem 0.75rem 0.25rem;
        z-index: 800;
    }

    #title-overlay h1 {
        font-size: 1rem;
    }

    #title-overlay p {
        display: none;
    }

    /* ---------- Controls Overlay - Mobile ---------- */
    #controls-overlay {
        width: 100%;
        max-width: 100%;
        position: fixed;
        z-index: 1500;
        top: auto;
        left: 0;
        bottom: 0;
        border-radius: 1.0rem 1.0rem 0 0;
        transform: translateY(100%);
        transition: transform 0.3s ease-in-out;
        padding: 1.5rem 1rem 1rem 1rem;
        margin-left: 0rem;
    }

    #controls-overlay.is-visible {
        transform: translateY(0);
    }

    /* ---------- Mobile Controls Toggle (Kalender-Button) ---------- */
    #mobile-controls-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        z-index: 900;
        left: 1.25rem;
        bottom: auto;
        top: 45%;
        transform: translateY(-50%);
        width: 44px;
        height: 44px;
        background-color: rgba(255, 255, 255, 0.85);
        backdrop-filter: blur(8px);
        border-radius: 1.0rem;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
        border: 1px solid #1f2937;
        cursor: pointer;
        transition: transform 0.2s ease-in-out;
    }

    #mobile-controls-toggle:hover {
        transform: translateY(-50%) scale(1.1);
    }

    /* ---------- Legende - Mobile ---------- */
    #legend-wrapper {
        right: 1.25rem;
        bottom: auto;
        top: 45%;
        transform: translateY(-50%);
    }

    #legend-content {
        position: absolute;
        right: calc(100% + 20px);
        top: 0;
        bottom: auto;
        height: auto;
        min-height: min-content;
        width: 224px;
        opacity: 0;
        visibility: hidden;
        transform: translateX(10px);
        transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out, visibility 0.2s;
    }

    #legend-content.is-visible {
        opacity: 1;
        visibility: visible;
        transform: translateX(0);
    }

    /* ---------- Fußzeile - Mobile ---------- */
    #page-footer {
        position: absolute;
        width: 100%;
        max-width: 270px;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        bottom: 35px;
        z-index: 800;
        left: 50%;
        margin-left: -140px;
    }

    #page-footer a {
        width: 50%;
        margin: 2px 0;
        font-size: 0.7rem;
    }

    /* ---------- Geocoder (Suche) - Mobile ---------- */
    
    /* Such-Icon (zugeklappt) */
    body .leaflet-control-geocoder.leaflet-control {
        margin-top: 0.75rem;
        margin-right: 0rem;
        transition: all 0.2s ease-in-out;
    }

    /* Suche (ausgeklappt) - Nimmt volle Breite ein */
    body .leaflet-control-geocoder-expanded.leaflet-control {
        top: 0.75rem;
        left: 0.75rem;
        right: 0.75rem;
        margin-top: 3.75rem;
        margin-left: 1rem;
        margin-right: 0.75rem;
        background: rgba(255, 255, 255, 0.85);
        width: auto;
        backdrop-filter: blur(8px);
        box-shadow: -2px 4px 6px rgba(0, 0, 0, 0.2);
        z-index: 1020 !important;
    }

    /* Eingabefeld im ausgeklappten Zustand */
    .leaflet-control-geocoder-form input {
        width: auto;
    }
    
    /* Vorschlagsliste im ausgeklappten Zustand */
    .leaflet-control-geocoder-expanded .leaflet-control-geocoder-form-no-error {
        left: 0;
        right: 0;
        width: auto;
        margin-top: 0.25rem;
        background: rgba(255, 255, 255, 0.85);
    }

    /* ---------- Layer Control - Mobile ---------- */
    body .leaflet-control-layers.leaflet-control {
        bottom: 0.75rem !important;
        margin-bottom: 0.75rem !important;
        z-index: 1000 !important;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    }

    /* Ausgeklapptes Layer-Menü */
    body .leaflet-control-layers.leaflet-control.leaflet-control-layers-expanded {
        z-index: 1005 !important;
        bottom: 0.75rem !important;
        right: 0.75rem !important;
    }

    /* Container für ausgeklappte Inhalte */
    body .leaflet-control-layers-list {
        z-index: 1005 !important;
    }
}


/* ============================================================================
   ENDE DER STYLESHEET-DATEI
   ============================================================================ */