/* Höhe für Navbar und Footer */
:root {
    --navbar-height: 56px;
    --footer-height: 40px;
}

/* Hauptlayout – kein Flex-Body mehr */
html, body {
    height: 100%;
    margin: 0;
}

body {
    display: flex;
    flex-direction: column;
}

/* Sidebar + Karte in einer 100%-Höhen-Row */
.mm-layout-row {
    height: calc(100vh - var(--navbar-height) - var(--footer-height));
    overflow: hidden;
}

/* Sidebar */
.mm-main {
    flex: 1 1 auto;
    display: flex;
    height: calc(100vh - 50px); /* Footerhöhe */
    overflow: hidden;
}

.mm-sidebar {
    width: 280px;
    min-width: 220px;
    max-width: 350px;
    background: #ffffff;
    border-right: 1px solid #ddd;
    overflow-y: auto;
    transition: width 0.25s;
    padding: 15px;
}

/* Karte */
#map {
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
}

/* Sidebar einklappen */
body.sidebar-collapsed .mm-sidebar {
    width: 0;
    min-width: 0;
    overflow: hidden;
    padding: 0;
}

body.sidebar-collapsed .mm-mapcol {
    flex: 0 0 100% !important;
    max-width: 100% !important;
}

.mm-footer {
    height: 50px;
    background: #f8f9fa;
    border-top: 1px solid #ccc;
    display: flex;
    align-items: center;
    padding: 0 20px;
    justify-content: space-between;
}

/* Footer fix am unteren Rand */
footer.footerbar {
    height: var(--footer-height);
    line-height: var(--footer-height);
    background: #f8f9fa;
    border-top: 1px solid #ddd;
    padding: 0 1rem;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 20;
}

/* Mobile */
@media (max-width: 767px) {
    .mm-layout-row {
        height: calc(100vh - var(--navbar-height) - var(--footer-height));
        flex-direction: column;
    }

    #map {
        height: 60vh;
    }

    .mm-sidebar {
        height: auto;
        max-height: 40vh;
        border-right: none;
        border-bottom: 1px solid #ddd;
    }

    .mm-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1030; /* über der Karte/Sidebar, aber unter Navbar */
    }

    /* damit der Inhalt nicht unter dem Footer verschwindet */
    body {
        padding-bottom: 60px; /* an die reale Footer-Höhe anpassen */
    }
}

@media (min-width: 768px) {
    /* Keine feste Höhe für die ganze Row -> Footer bleibt sichtbar */
    /* .mm-layout-row { min-height: calc(100vh - 56px - 40px); } */

    .mm-sidebar > .p-3 {
        /* Sidebar scrollbar machen, falls Inhalt lang ist */
        max-height: calc(100vh - 120px); /* grob: Nav + Footer */
        overflow-y: auto;
    }

    /* Karte darf größer sein, aber nicht das ganze Viewport fressen */
    .mm-mapcol #map {
        min-height: calc(100vh - 120px);
    }
}

/* --- Layout-Fixes: Sidebar + Map + Footer --- */

/* Sidebar: feste Breite, kein dynamisches Resizing */
.mm-sidebar {
    flex: 0 0 320px;      /* ca. bisherige Breite */
    max-width: 340px;
    min-width: 260px;
}

/* Map-Spalte füllt den Rest */
.mm-mapcol {
    flex: 1 1 auto;
    position: relative;
}

/* Karte immer voll in ihrer Spalte */
#map {
    width: 100%;
    height: 100%;
}

/* Bei eingeklappter Sidebar: Sidebar ganz weg, Map 100% Breite */
body.sidebar-collapsed .mm-sidebar {
    display: none !important;
}

body.sidebar-collapsed .mm-mapcol {
    flex: 0 0 100% !important;
    max-width: 100% !important;
}

.mm-spot-icon {
    background: transparent;
    border: none;
}

.mm-spot-icon-inner {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    box-shadow: 0 0 4px rgba(0,0,0,.3);
}

.mm-spot-icon-inner span {
    line-height: 1;
}

/* Basis: klassischer Pin */
.mm-spot-pin {
    background: transparent;
    border: none;
}

.mm-spot-pin-inner {
    --mm-pin-color: #ff5722;

    position: relative;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--mm-pin-color);
    border: 2px solid #ffffff;
    box-shadow: 0 0 4px rgba(0,0,0,.4);

    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
}

.mm-spot-pin-inner::after {
    content: "";
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 8px 6px 0 6px;
    border-color: var(--mm-pin-color) transparent transparent transparent;
}

/* falls du Bootstrap Icons nutzt */
.mm-spot-pin-inner i {
    font-size: 14px;
    line-height: 1;
}

#mapFilterOverlay {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 500; /* über Karte, unter Leaflet-Popups */
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.mm-filter-panel {
    min-width: 220px;
    max-width: 260px;
    margin-bottom: 4px;
}

.mm-map-overlays {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 500;              /* über Karte, unter Leaflet-Popups */
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    pointer-events: none;      /* Klicks standardmäßig ignorieren */
}

/* Button-Gruppe oben rechts */
.mm-map-overlays-buttons {
    pointer-events: auto;      /* Buttons sollen anklickbar sein */
}

.mm-map-overlays-buttons > button > i{
    font-size: 26px;
}

/* Panels direkt unter der Button-Gruppe */
.mm-map-filter-panel {
    min-width: 220px;
    max-width: 260px;
    margin-top: 6px;
    pointer-events: auto;      /* Form-Elemente anklickbar */
}

/* auf kleineren Screens Panel eher mittig */
@media (max-width: 768px) {
    .mm-map-filter-panel {
        right: 0.5rem;
        left: 0.5rem;
        width: auto;
    }
}

.mm-mapcol #map {
    min-height: calc(100vh - 56px - 60px);
}
