/* =========================
   Frontend Map Styles (final optimized version)
   ========================= */

/* ---------- 🌍 Algemene kaartopmaak ---------- */

.dbms-kaart-container {
    position: relative;         /* zorgt dat interne elementen absoluut gepositioneerd kunnen worden */
    width: 100%;
    max-width: 100%;
    height: auto;               /* standaard hoogte, pas aan naar wens */
    border-radius: 8px;
    overflow: hidden;           /* voorkomt dat controls buiten de rand vallen */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    background: #f8f9fa;        /* lichte achtergrond terwijl de kaart laadt */
}


.dbms-kaart {
    position: relative;
    width: 100%;
    height: 600px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.dbms-frontend-map-mode-switcher {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2000;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.16);
    font-size: 13px;
}

.dbms-frontend-map-mode-switcher select {
    max-width: 190px;
    min-height: 30px;
    font-size: 13px;
}

.dbms-kaart-container[data-display-mode="2d"] .flyby-controls {
    display: none;
}

.maplibregl-canvas-container {
    overflow: visible !important; /* zorgt dat ballonnen niet worden afgesneden */
}

/* ---------- 📋 Legenda ---------- */


.dbms-kaart-container .dbms-legend {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #fff;
    padding: 6px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    font-size: 13px;
    max-width: 220px;
    max-height: calc(100% - 60px);

    box-sizing: border-box;
}

.dbms-kaart-container .dbms-legend-inner {
    overflow-y: auto;
}

/* Kleurstrook onderaan legenda */
.dbms-legend:before {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    height: 5px;
    width: 100%;
    background: linear-gradient(
            to right,
            #08BAEE 0%,
            #08BAEE 25%,
            #019839 25%,
            #019839 50%,
            #F18C00 50%,
            #F18C00 75%,
            #CD0637 75%,
            #CD0637 100%
    );
}

/* Header + toggle */
.dbms-legend-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    margin-bottom: 4px;
    padding: 5px 0;
    cursor: pointer;
}

.dbms-legend-toggle {
    background: none;
    border: none;
    font-size: 15px;
    line-height: 1;
    width: 100%;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dbms-legend-toggle span {
    font-weight: bold;
    font-size: 14px;
}



.dbms-legend-cat {
    margin-bottom: 6px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 6px;
}
.dbms-legend-cat strong {
    display: block;
    cursor: move;
    margin-bottom: 4px;
}
.dbms-legend-sub {
    list-style: none;
    margin: 0;
    padding: 0 0 0 10px;
}
.dbms-legend-item {
    margin: 2px 0;
    cursor: move;
    transition: background-color 0.3s ease;
}
.dbms-legend-item.highlight-anim {
    background-color: #fff7c2;
}
.dbms-legend-item.highlight-anim:hover {
    background-color: #ffe880;
}


.dbms-legend-list {
    max-height: 500px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}
.dbms-legend-list.collapsed {
    max-height: 0 !important;
    overflow: hidden;
}

/* Items */
.dbms-legend-item {
    display: flex;
    align-items: center;
    padding: 0;
    cursor: pointer;
    font-size: 85%;
}

.dbms-legend-item:hover {
    background: rgba(0,0,0,0.05);
}

.dbms-legend-row {
    display: flex;
    line-height: normal;
    align-items: center;
    gap: 6px;
}

.dbms-legend-row > :first-child {
    flex: 0 0 22px;  /* vaste breedte */
}

.dbms-legend-row > :not(:first-child) {
    flex: 1;        /* overige items vullen de ruimte */
}

.dbms-legend-marker-icon {
    width: 18px !important;
    height: 18px !important;
    margin: 0 !important;
    object-fit: contain;
    border-radius: 3px;
}

.dbms-legend-symbol {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 3px;
}

/* Subcategorie-titel */
.dbms-legend-cat-title {
    display: block;
    font-weight: bold;
    margin: 6px 0 3px;
    font-size: 90%;
    color: #444;
    border-bottom: 1px solid #ddd;
    padding-bottom: 2px;
}

/* Scrollbar */
.dbms-legend::-webkit-scrollbar {
    width: 6px;
}
.dbms-legend::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.3);
    border-radius: 3px;
}
.dbms-legend::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.5);
}

/* ---------- 🪶 Waypoints ---------- */
.waypoint-icon {
    width: 22px;
    height: 22px;
    border: 2px solid #333;
    border-radius: 50%;
    background: #fff;
    color: #000;
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 0 4px rgba(0,0,0,0.2);
    transition: transform 0.2s;
}
.waypoint-icon:hover {
    transform: scale(1.15);
}

/* Actieve waypoint */
.waypoint-icon.nearest-waypoint {
    background: #ffe600 !important;
    border-color: #ff0000 !important;
    animation: pulse 1.2s infinite ease-in-out;
}
@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 0 6px rgba(255,0,0,0.6); }
    50% { transform: scale(1.3); box-shadow: 0 0 12px rgba(255,0,0,0.9); }
    100% { transform: scale(1); box-shadow: 0 0 6px rgba(255,0,0,0.6); }
}

/* ---------- 💬 Waypoint-ballonnen ---------- */
.waypoint-balloon,
.flyover-balloon {
    position: absolute;
    transform: translate(-50%, -100%);
    min-width: 160px;
    max-width: 240px;
    padding: 10px 14px;
    background: white;
    border: 2px solid #333;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    color: #222;
    text-align: left;
    line-height: 1.4;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: auto;
}
.waypoint-balloon.show,
.flyover-balloon.show {
    opacity: 1;
}

/* pijltje onderaan ballon */
.waypoint-balloon::after,
.flyover-balloon::after {
    content: "";
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 10px solid #333;
}
.waypoint-balloon::before,
.flyover-balloon::before {
    content: "";
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-top: 9px solid white;
    z-index: 1;
}

/* Tekst in ballon */
.waypoint-balloon .balloon-text strong,
.flyover-balloon .balloon-text strong {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 14px;
}



.distance-marker {
    display: inline-block;
    background: rgba(0, 112, 0, 0.75);
    border: 2px solid rgba(0,0,0,0.8);
    border-radius: 3px;
    font-family: sans-serif;
    font-weight: bold;
    font-size: 11px;
    color: #fff;
    text-align: center;
    padding: 2px 4px; /* bepaalt nu de breedte */
    line-height: 1.2;
    box-shadow: 0 1px 2px rgba(0,0,0,0.4);
    white-space: nowrap; /* laat de tekst altijd in één regel */
    min-width: 0; /* of helemaal weglaten */
}


/* ---------- 📍 Waypoints ---------- */
/*.waypoint-marker {*/
/*    background: #fff;*/
/*    border: 2px solid #333;*/
/*    border-radius: 50%;*/
/*    width: 22px;*/
/*    height: 22px;*/
/*    display: grid;*/
/*    place-items: center;*/
/*    font-weight: 700;*/
/*    font-size: 12px;*/
/*    cursor: pointer;*/
/*}*/
/*.waypoint-marker:hover {*/
/*    background: #111;*/
/*    !*color: #fff;*!*/
/*}*/


.waypoint-marker {
    background: #fff;
    border: 2px solid #333;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.waypoint-popup {
    position: absolute;
    background: #fff;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 13px;
    font-family: inherit;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    transform: translate(-50%, -100%);
    z-index: 999;
    width: 250px;
    transition: opacity 0.3s ease;
    opacity: 0;

}

.waypoint-popup[style*="display: block"] {
    opacity: 1;
}

.balloon-text strong {
    display: block;
    margin-bottom: 2px;
}














/* ---------- 🪶 Route polyline highlight ---------- */
.maplibregl-canvas-container canvas {
    outline: none;
}










/* ---------- 💬 FLYOVER BALLOONS ---------- */
.flyover-balloon {
    position: absolute;
    transform: translate(-50%, -100%);
    min-width: 180px;
    max-width: 240px;
    padding: 10px 14px;
    background: white;
    border: 2px solid #333;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    color: #222;
    text-align: left;
    line-height: 1.4;
    z-index: 9999;
    pointer-events: auto;
    opacity: 0;
    display: none;           /* 👈 voorkomt dat ze zichtbaar zijn vóór activatie */
    transition: opacity 0.4s ease;
}

.flyover-balloon.show {
    opacity: 1;
    display: block;          /* 👈 maakt ze echt zichtbaar */
}

.flyover-balloon::after {
    content: "";
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 10px solid #333;
}
.flyover-balloon::before {
    content: "";
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-top: 9px solid white;
    z-index: 1;
}



/* ---------------------------------------
   🎮 Nieuwe Flyby Controls
--------------------------------------- */

#controls-[id] {} /* wordt dynamisch, safe om leeg te laten */

/* ------------------------------
   🎮 Floating Flyby Controls
   ------------------------------ */

.flyby-controls {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) translateY(60px); /* start: verstopt */
    width: fit-content;

    display: flex;
    gap: 12px;
    padding: 12px 18px;

    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(6px);

    border-radius: 14px 14px 0 0;
    box-shadow: 0 4px 18px rgba(0,0,0,0.25);

    transition: transform 0.35s ease;
    z-index: 20000 !important;
}

/* In fullscreen ook boven alles */
.dbms-map-fullscreen .flyby-controls {
    position: fixed !important;
    bottom: 22px !important;
    z-index: 20001 !important;
}

/* Uitgeschoven */
.flyby-controls.expanded {
    transform: translateX(-50%) translateY(0);
}

/* Kleine handle om aan te trekken */
.flyby-controls .flyby-handle {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 45px;
    height: 6px;
    background: rgba(255,255,255,0.9);
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    cursor: pointer;
}

/* Buttons */
.flyby-controls button {
    background: #fff;
    border: 1px solid #ccc;
    width: 44px;
    height: 44px;
    font-size: 18px;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all .2s ease;
    cursor: pointer;
}

.flyby-controls button:hover {
    background: #f3f3f3;
}

/* Play/Pause speciale kleur */
.flyby-controls .dbms-btn-play,
.flyby-controls .dbms-btn-pause {
    background: #2b7bff;
    color: white;
    border-color: #1f5fd6;
}

.flyby-controls .dbms-btn-play:hover,
.flyby-controls .dbms-btn-pause:hover {
    background: #1f5fd6;
}

/* Mobiel: controls groter en iets hoger */
@media (max-width: 768px) {
    .flyby-controls {
        bottom: 10px;
    }
}


.flyby-controls button:hover {
    transform: translateY(-2px);
}

/* Waypoint items */
.waypoint-legend-item {
    padding: 4px 6px;
    cursor: pointer;
    transition: background 0.2s ease;
}



.waypoint-legend-item:hover {
    background: rgba(0,0,0,0.08);
}

.waypoint-legend-item.active {
    background: #dbe8ff;
    border-left: 3px solid #2b7bff;
}

.wp-num {
    display: inline-block;
    width: 22px;
    font-weight: bold;
    text-align: center;
    background: #fff;
    border: 2px solid #333;
    border-radius: 50%;
    /*display: grid;*/
    /*place-items: center;*/
    font-weight: 700;
    font-size: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* ------------------------------
   🎯 Flyby Step Indicator + Progress
------------------------------ */

.flyby-info {
    width: 100%;
    text-align: center;
    margin-bottom: 6px;
    padding: 0 4px;
}

.flyby-step {
    font-size: 13px;
    font-weight: 600;
    color: #222;
    margin-bottom: 4px;
}

/* Progressbar container */
.flyby-progress {
    width: 100%;
    height: 6px;
    background: rgba(0,0,0,0.1);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

/* Active bar */
.flyby-progress-bar {
    height: 100%;
    width: 0%;
    background: #2b7bff;
    transition: width 0.3s ease;
    border-radius: 4px;
}


.maplibregl-ctrl .dbms-maplibre-fullscreen-btn {
    background: white;
    width: 30px;
    height: 30px;
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: 15px;

    display: flex;
    justify-content: center;
    align-items: center;

    transition: background 0.2s ease;
}

.maplibregl-ctrl .dbms-maplibre-fullscreen-btn:hover {
    background: #eee;
}

/* ---------- 🖥️ Fullscreen ---------- */
.dbms-map-fullscreen .dbms-kaart {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 19999 !important;
}

.dbms-map-fullscreen #breadcrumbsbar {

}

.maplibregl-ctrl .dbms-maplibre-fullscreen-btn {
    background: white;
    width: 30px;
    height: 30px;
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: 15px;

    display: flex;
    justify-content: center;
    align-items: center;

    transition: background 0.2s ease;
}

.maplibregl-ctrl .dbms-maplibre-fullscreen-btn:hover {
    background: #eee;
}
.dbms-map-fullscreen .dbms-legend {
    position: fixed !important;
    z-index: 20000 !important;
}


.dbms-map-fullscreen header,
.dbms-map-fullscreen #wpadminbar {
    display: none !important;
}

/* ---------- 📱 Responsiviteit ---------- */
@media (max-width: 768px) {
    .dbms-legend {
        max-width: 80%;
        font-size: 14px;
        max-height: 50%;
    }
    .flyover-controls {
        bottom: 10px;
        padding: 6px 8px;
    }
    .flyover-controls button {
        font-size: 14px;
        padding: 4px 8px;
    }
}


/*.dbms-3d-controls {*/
/*    position: absolute;*/
/*    bottom: 20px;*/
/*    left: 50%;*/
/*    transform: translateX(-50%);*/
/*    display: flex;*/
/*    gap: 10px;*/
/*    z-index: 2000;*/
/*    background: rgba(255, 255, 255, 0.8);*/
/*    border-radius: 12px;*/
/*    padding: 8px 12px;*/
/*    box-shadow: 0 2px 6px rgba(0,0,0,0.2);*/
/*}*/

/*.dbms-ctrl-btn {*/
/*    background: #fff;*/
/*    border: 1px solid #ccc;*/
/*    border-radius: 50%;*/
/*    width: 40px;*/
/*    height: 40px;*/
/*    font-size: 18px;*/
/*    cursor: pointer;*/
/*    transition: all 0.2s ease;*/
/*}*/

/*.dbms-ctrl-btn:hover {*/
/*    background: #eee;*/
/*}*/


.dbms-marker {
    position: relative;
    width: 28px;
    height: 28px;
    /*box-shadow: 0 2px 5px rgba(0,0,0,0.3);*/
    /*background: #fff;*/
    /*border: 1px solid #333;*/
/*padding: 1px;*/
}

.dbms-marker:hover {
    transform: scale(1.4);
}

.dbms-waypoint {
    position: relative;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #333;
    background: #fff;
    text-align: center;
    line-height: 26px;
    font-weight: bold;
    color: #111;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}
.dbms-waypoint:hover {
    transform: scale(1.1);
    z-index: 200;
}

/* ---------- Frontend UI refinements ---------- */
.dbms-kaart-container {
    isolation: isolate;
    border: 1px solid rgba(15, 23, 42, 0.08);
}

.dbms-kaart-container .maplibregl-canvas-container {
    overflow: hidden !important;
}

.dbms-kaart-container .maplibregl-ctrl-top-right {
    top: 76px;
    right: 12px;
}

.dbms-kaart-container .maplibregl-ctrl-group,
.dbms-kaart-container .leaflet-bar {
    border: 1px solid rgba(15, 23, 42, 0.14);
    border-radius: 10px;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.16);
    overflow: hidden;
}

.dbms-kaart-container .maplibregl-ctrl button,
.dbms-kaart-container .leaflet-bar a {
    width: 40px;
    height: 40px;
}

.dbms-frontend-map-mode-switcher {
    min-height: 44px;
    padding: 8px 10px;
    border-color: rgba(15, 23, 42, 0.12);
    border-radius: 12px;
    color: #1f2937;
    backdrop-filter: blur(10px);
}

.dbms-frontend-map-mode-switcher select {
    min-height: 36px;
    border-radius: 8px;
}

.dbms-kaart-container .dbms-legend {
    max-width: min(320px, calc(100% - 24px));
    padding: 0;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 12px;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.18);
    overflow: hidden;
}

.dbms-kaart-container .dbms-legend-inner {
    max-height: min(440px, calc(100vh - 220px));
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(10px);
}

.dbms-legend-header {
    margin: 0;
    padding: 10px 12px;
}

.dbms-legend-toggle {
    min-height: 32px;
    padding: 0;
    color: #111827;
    cursor: pointer;
}

.dbms-legend-list {
    max-height: 360px;
    overflow: auto;
    padding: 0 10px 12px;
}

.dbms-legend-item {
    min-height: 32px;
    padding: 5px 6px;
    border-radius: 7px;
}

.dbms-legend-row {
    width: 100%;
    min-width: 0;
}

.dbms-legend-row span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
}

.waypoint-marker,
.waypoint-icon {
    will-change: transform;
}

.waypoint-popup {
    display: none !important;
}

.dbms-waypoint-maplibre-popup {
    z-index: 30;
}

.dbms-waypoint-maplibre-popup .maplibregl-popup-content {
    max-width: min(320px, calc(100vw - 32px));
    padding: 0;
    border: 1px solid rgba(15, 23, 42, 0.32);
    border-radius: 8px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.24);
    overflow: hidden;
}

.dbms-waypoint-maplibre-popup .maplibregl-popup-tip {
    border-top-color: rgba(15, 23, 42, 0.32);
}

.dbms-waypoint-popup {
    display: grid;
    gap: 4px;
    padding: 11px 13px;
    color: #374151;
    font-size: 14px;
    line-height: 1.45;
}

.dbms-waypoint-popup strong {
    color: #111827;
    font-size: 15px;
}

.flyby-controls {
    align-items: center;
    max-width: calc(100% - 28px);
    border: 1px solid rgba(15, 23, 42, 0.1);
}

.flyby-controls button {
    min-width: 44px;
    min-height: 44px;
}

.flyby-info {
    min-width: 150px;
}

.dbms-map-touch-hint {
    position: absolute;
    left: 50%;
    bottom: 88px;
    z-index: 20002;
    transform: translateX(-50%);
    padding: 9px 13px;
    border: 1px solid rgba(15, 23, 42, 0.16);
    border-radius: 999px;
    background: rgba(17, 24, 39, 0.88);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.24);
    cursor: pointer;
}

@media (max-width: 768px) {
    .dbms-kaart-container {
        border-radius: 12px;
    }

    .dbms-kaart {
        min-height: 66vh;
        border-radius: 12px;
    }

    .dbms-frontend-map-mode-switcher {
        top: auto;
        right: 10px;
        bottom: 78px;
        left: auto;
        max-width: calc(100% - 20px);
        padding: 7px;
    }

    .dbms-frontend-map-mode-switcher label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .dbms-frontend-map-mode-switcher select {
        max-width: 168px;
        font-size: 14px;
    }

    .dbms-kaart-container .maplibregl-ctrl-top-right {
        top: 12px;
        right: 10px;
    }

    .dbms-kaart-container .dbms-legend {
        top: 10px;
        left: 10px;
        right: 68px;
        max-width: none;
        max-height: min(58vh, 420px);
    }

    .dbms-kaart-container .dbms-legend-inner {
        max-height: min(58vh, 420px);
    }

    .dbms-legend-list {
        max-height: 42vh;
    }

    .flyby-controls {
        bottom: 10px;
        width: calc(100% - 24px);
        justify-content: center;
        gap: 8px;
        padding: 10px;
        border-radius: 14px;
    }

    .flyby-controls .flyby-info {
        min-width: 112px;
        flex: 1 1 112px;
    }

    .flyby-controls button {
        width: 42px;
        height: 42px;
        min-width: 42px;
    }
}



