/**
 * Ensemble Maps Pro - Frontend Styles
 * 
 * @package Ensemble
 * @subpackage Addons/Maps Pro
 * @version 2.3.6
 */


/* =========================================
   CSS Variables Note
   =========================================
   Uses --ensemble-* Designer variables directly.
   Dark/Light mode handled by Designer system.
   See CSS-ARCHITECTURE.md for variable reference.
   ========================================= */

/* =========================================
   Single Map Container
   ========================================= */
.es-map-container {
    margin: 30px 0;
    background: var(--ensemble-card-bg, #ffffff);
    border-radius: var(--ensemble-card-radius, 12px);
    overflow: hidden;
    box-shadow: var(--ensemble-shadow, 0 2px 8px rgba(0, 0, 0, 0.1));
}

.es-map-embed {
    width: 100%;
    height: 400px;
    position: relative;
    background: var(--ensemble-card-border, #e2e8f0);
}

.es-map-address {
    padding: 15px 20px;
    background: var(--ensemble-bg, #f7fafc);
    border-top: 1px solid var(--ensemble-card-border, #e2e8f0);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: var(--ensemble-small-size, 14px);
    color: var(--ensemble-text, #1a202c);
}

.es-map-address .dashicons {
    color: var(--ensemble-text-secondary, #718096);
    font-size: var(--ensemble-lg-size, 18px);
    width: 18px;
    height: 18px;
}

/* Route Button */
.es-map-route-button {
    margin: 20px 0;
}

.es-button-route {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--ensemble-primary, #667eea);
    color: var(--ensemble-button-text, #ffffff);
    text-decoration: none;
    border-radius: var(--ensemble-radius, 8px);
    font-weight: var(--ensemble-body-weight, 400);
    transition: all var(--ensemble-transition, all 0.3s ease);
    border: none;
    cursor: pointer;
}

.es-button-route:hover {
    background: var(--ensemble-button-hover-bg, #5568d3);
    color: var(--ensemble-button-text, #ffffff);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.es-button-route .dashicons {
    font-size: var(--ensemble-h4-size, 20px);
    width: 20px;
    height: 20px;
}

/* =========================================
   Locations Overview Map
   ========================================= */
.es-locations-map-wrapper {
    position: relative;
    background: var(--ensemble-card-bg, #ffffff);
    border-radius: var(--ensemble-card-radius, 12px);
    overflow: hidden;
    box-shadow: var(--ensemble-shadow, 0 2px 8px rgba(0, 0, 0, 0.1));
    margin: 30px 0;
}

/* Toolbar */
.es-map-toolbar {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    background: var(--ensemble-card-bg, #ffffff);
    border-bottom: 1px solid var(--ensemble-card-border, #e2e8f0);
    flex-wrap: wrap;
}

.es-map-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.es-map-filter-group {
    position: relative;
}

.es-map-filter {
    padding: 8px 32px 8px 12px;
    border: 1px solid var(--ensemble-card-border, #e2e8f0);
    border-radius: var(--ensemble-radius, 8px);
    background: var(--ensemble-card-bg, #ffffff);
    font-size: var(--ensemble-small-size, 14px);
    color: var(--ensemble-text, #1a202c);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    min-width: 150px;
}

.es-map-filter:focus {
    outline: none;
    border-color: var(--ensemble-primary, #667eea);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Search */
.es-map-search {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 300px;
}

.es-map-search-input {
    width: 100%;
    padding: 8px 36px 8px 12px;
    border: 1px solid var(--ensemble-card-border, #e2e8f0);
    border-radius: var(--ensemble-radius, 8px);
    font-size: var(--ensemble-small-size, 14px);
    color: var(--ensemble-text, #1a202c);
}

.es-map-search-input:focus {
    outline: none;
    border-color: var(--ensemble-primary, #667eea);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.es-map-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    padding: 4px;
    border: none;
    background: none;
    cursor: pointer;
    opacity: 0;
    transition: opacity var(--ensemble-transition, all 0.3s ease);
}

.es-map-search-input:not(:placeholder-shown) + .es-map-search-clear {
    opacity: 0.5;
}

.es-map-search-clear:hover {
    opacity: 1;
}

.es-map-search-clear svg {
    width: 16px;
    height: 16px;
    color: var(--ensemble-text-secondary, #718096);
}

.es-map-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--ensemble-card-bg, #ffffff);
    border: 1px solid var(--ensemble-card-border, #e2e8f0);
    border-radius: var(--ensemble-radius, 8px);
    margin-top: 4px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 100;
    display: none;
    box-shadow: var(--ensemble-shadow, 0 2px 8px rgba(0, 0, 0, 0.1));
}

.es-map-search-results.active {
    display: block;
}

.es-map-search-result {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--ensemble-card-border, #e2e8f0);
    transition: background var(--ensemble-transition, all 0.3s ease);
}

.es-map-search-result:last-child {
    border-bottom: none;
}

.es-map-search-result:hover {
    background: var(--ensemble-bg, #f7fafc);
}

.es-map-search-result-name {
    font-weight: var(--ensemble-body-weight, 400);
    font-size: var(--ensemble-small-size, 14px);
}

.es-map-search-result-address {
    font-size: var(--ensemble-xs-size, 12px);
    color: var(--ensemble-text-secondary, #718096);
    margin-top: 2px;
}

/* Actions */
.es-map-actions {
    margin-left: auto;
}

.es-map-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid var(--ensemble-card-border, #e2e8f0);
    border-radius: var(--ensemble-radius, 8px);
    background: var(--ensemble-card-bg, #ffffff);
    color: var(--ensemble-text, #1a202c);
    font-size: var(--ensemble-small-size, 14px);
    cursor: pointer;
    transition: all var(--ensemble-transition, all 0.3s ease);
}

.es-map-btn:hover {
    background: var(--ensemble-bg, #f7fafc);
    border-color: var(--ensemble-text-secondary, #718096);
}

.es-map-btn svg {
    width: 16px;
    height: 16px;
}

/* Map Canvas */
.es-locations-map-wrapper .es-map-container {
    margin: 0;
    box-shadow: none;
    border-radius: 0;
}

.es-map-canvas {
    width: 100%;
    height: 100%;
}

/* ===================================================================
   Uebersichtskarte — [ensemble_map]
   ===================================================================

   06.10.2026: Die Vorlage map-overview.php nennt sechs Klassen, zu denen es
   in dieser Datei nie eine einzige Regel gab. Folge: .es-map-overview-embed
   war 1152 x 0 Pixel gross. Google Maps und Leaflet zeichnen in null Pixel
   Hoehe nichts — ohne Fehler, ohne Meldung. Im Protokoll stand „Standard
   marker created successfully", und zu sehen war trotzdem nichts.

   Die Hoehe aus dem Attribut height steht als Inline-Stil am AEUSSEREN
   Element. Mit Flex in der Spalte nimmt die Karte den uebrigen Platz und die
   Legende ihren eigenen — zusammen genau die angegebene Hoehe.

   Nicht zu verwechseln mit [ensemble_locations_map]: dessen Vorlage benutzt
   .es-map-container und .es-map-canvas, beide seit jeher gestylt. Deshalb lief
   die Uebersichtskarte und die Einzelkarte nicht.
   =================================================================== */

.es-map-overview {
    display: flex;
    flex-direction: column;
    margin: 30px 0;
}

.es-map-overview-embed {
    position: relative;
    flex: 1 1 auto;
    width: 100%;
    min-height: 240px;
    border-radius: var(--ensemble-card-radius, 12px);
    overflow: hidden;
    background: var(--ensemble-card-bg, #f2f2f2);
}

.es-map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    flex: 0 0 auto;
    padding: 12px 2px 0;
}

.es-map-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 14px;
    line-height: 1.4;
    cursor: pointer;
}

.es-map-legend-item .es-map-marker {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--ensemble-primary, #2271b1);
    flex: 0 0 auto;
}

.es-map-legend-item .es-map-location-name {
    color: var(--ensemble-text, inherit);
}

/* Loading Overlay */
.es-map-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--ensemble-card-bg, rgba(255, 255, 255, 0.9));
    z-index: 1000;
    transition: opacity var(--ensemble-transition, all 0.3s ease);
}

.es-map-loading.hidden {
    opacity: 0;
    pointer-events: none;
}

.es-map-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--ensemble-card-border, #e2e8f0);
    border-top-color: var(--ensemble-primary, #667eea);
    border-radius: 50%;
    animation: es-map-spin 0.8s linear infinite;
    margin-bottom: 10px;
}

.es-map-loading-text {
    font-size: var(--ensemble-small-size, 14px);
    color: var(--ensemble-text-secondary, #718096);
}

.es-map-error {
    color: var(--ensemble-error, #ef4444);
    font-size: var(--ensemble-small-size, 14px);
    text-align: center;
    padding: 20px;
}

@keyframes es-map-spin {
    to { transform: rotate(360deg); }
}

/* Stats Bar */
.es-map-stats {
    padding: 10px 20px;
    background: var(--ensemble-bg, #f7fafc);
    border-top: 1px solid var(--ensemble-card-border, #e2e8f0);
    font-size: var(--ensemble-small-size, 14px);
    color: var(--ensemble-text-secondary, #718096);
}

.es-map-stats-filtered {
    margin-left: 5px;
    color: var(--ensemble-primary, #667eea);
}

/* =========================================
   Sidebar
   ========================================= */
.es-map-sidebar {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 350px;
    background: var(--ensemble-card-bg, #ffffff);
    box-shadow: -4px 0 20px rgba(0,0,0,0.1);
    z-index: 1000;
    transform: translateX(100%);
    transition: var(--ensemble-transition, all 0.3s ease);
    overflow-y: auto;
}

.es-map-sidebar.active {
    transform: translateX(0);
}

.es-map-sidebar-close {
    position: absolute;
    top: 15px;
    right: 15px;
    padding: 8px;
    border: none;
    background: var(--ensemble-bg, #f7fafc);
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    transition: background var(--ensemble-transition, all 0.3s ease);
}

.es-map-sidebar-close:hover {
    background: var(--ensemble-card-border, #e2e8f0);
}

.es-map-sidebar-close svg {
    width: 20px;
    height: 20px;
    color: var(--ensemble-text, #1a202c);
}

.es-map-sidebar-content {
    padding: 20px;
}

.es-map-sidebar-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: var(--ensemble-card-radius, 12px);
    margin-bottom: 20px;
}

.es-map-sidebar-title {
    font-size: var(--ensemble-h4-size, 20px);
    font-weight: var(--ensemble-button-weight, 600);
    margin: 0 0 10px;
    color: var(--ensemble-text, #1a202c);
}

.es-map-sidebar-address {
    font-size: var(--ensemble-small-size, 14px);
    color: var(--ensemble-text-secondary, #718096);
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.es-map-sidebar-address svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin-top: 2px;
}

.es-map-sidebar-events {
    margin-bottom: 20px;
}

.es-map-sidebar-events-title {
    font-size: var(--ensemble-small-size, 14px);
    font-weight: var(--ensemble-button-weight, 600);
    margin-bottom: 12px;
    color: var(--ensemble-text, #1a202c);
}

.es-map-sidebar-event {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--ensemble-bg, #f7fafc);
    border-radius: var(--ensemble-radius, 8px);
    margin-bottom: 8px;
    text-decoration: none;
    color: inherit;
    transition: all var(--ensemble-transition, all 0.3s ease);
}

.es-map-sidebar-event:hover {
    background: var(--ensemble-card-border, #e2e8f0);
    transform: translateX(4px);
}

.es-map-sidebar-event-date {
    flex-shrink: 0;
    text-align: center;
    padding: 8px;
    background: var(--ensemble-primary, #667eea);
    color: var(--ensemble-button-text, #ffffff);
    border-radius: var(--ensemble-radius, 8px);
    min-width: 50px;
}

.es-map-sidebar-event-day {
    font-size: var(--ensemble-lg-size, 18px);
    font-weight: var(--ensemble-heading-weight, 700);
    line-height: 1;
}

.es-map-sidebar-event-month {
    font-size: var(--ensemble-xs-size, 12px);
    text-transform: uppercase;
    margin-top: 2px;
}

.es-map-sidebar-event-info {
    flex: 1;
    min-width: 0;
}

.es-map-sidebar-event-title {
    font-weight: var(--ensemble-body-weight, 400);
    font-size: var(--ensemble-small-size, 14px);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.es-map-sidebar-event-time {
    font-size: var(--ensemble-xs-size, 12px);
    color: var(--ensemble-text-secondary, #718096);
}

.es-map-sidebar-actions {
    display: flex;
    gap: 10px;
}

.es-map-sidebar-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    border-radius: var(--ensemble-radius, 8px);
    font-size: var(--ensemble-small-size, 14px);
    font-weight: var(--ensemble-body-weight, 400);
    text-decoration: none;
    transition: all var(--ensemble-transition, all 0.3s ease);
    cursor: pointer;
    border: none;
}

.es-map-sidebar-btn-primary {
    background: var(--ensemble-primary, #667eea);
    color: var(--ensemble-button-text, #ffffff);
}

.es-map-sidebar-btn-primary:hover {
    background: var(--ensemble-button-hover-bg, #5568d3);
    color: var(--ensemble-button-text, #ffffff);
}

.es-map-sidebar-btn-secondary {
    background: var(--ensemble-bg, #f7fafc);
    color: var(--ensemble-text, #1a202c);
    border: 1px solid var(--ensemble-card-border, #e2e8f0);
}

.es-map-sidebar-btn-secondary:hover {
    background: var(--ensemble-card-border, #e2e8f0);
}

.es-map-sidebar-btn svg {
    width: 18px;
    height: 18px;
}

/* =========================================
   Popup Styles
   ========================================= */
.es-map-popup {
    min-width: 280px;
    max-width: 320px;
}

.es-map-popup-image {
    width: 100%;
    height: 120px;
    background-size: cover;
    background-position: center;
    border-radius: 6px 6px 0 0;
    margin: -15px -15px 15px;
    width: calc(100% + 30px);
}

.es-map-popup-image:empty {
    display: none;
}

.es-map-popup-content {
    padding: 0;
}

.es-map-popup-title {
    font-size: var(--ensemble-body-size, 16px);
    font-weight: var(--ensemble-button-weight, 600);
    margin: 0 0 8px;
    color: var(--ensemble-text, #1a202c);
}

.es-map-popup-address {
    font-size: var(--ensemble-small-size, 14px);
    color: var(--ensemble-text-secondary, #718096);
    margin: 0 0 12px;
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.es-map-popup-events {
    font-size: var(--ensemble-xs-size, 12px);
    padding: 8px 10px;
    background: var(--ensemble-bg, #f7fafc);
    border-radius: var(--ensemble-badge-radius, 4px);
    margin-bottom: 12px;
}

.es-map-popup-events:empty {
    display: none;
}

.es-map-popup-events-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--ensemble-primary, #667eea);
    font-weight: var(--ensemble-body-weight, 400);
}

.es-map-popup-actions {
    display: flex;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--ensemble-card-border, #e2e8f0);
}

.es-map-popup-link {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--ensemble-primary, #667eea);
    color: var(--ensemble-button-text, #ffffff) !important;
    border-radius: var(--ensemble-badge-radius, 4px);
    font-size: var(--ensemble-small-size, 14px);
    font-weight: var(--ensemble-body-weight, 400);
    text-decoration: none;
    transition: all var(--ensemble-transition, all 0.3s ease);
}

.es-map-popup-link:hover {
    background: var(--ensemble-button-hover-bg, #5568d3);
}

.es-map-popup-link svg {
    width: 14px;
    height: 14px;
}

.es-map-popup-route {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--ensemble-bg, #f7fafc);
    color: var(--ensemble-text, #1a202c);
    border: 1px solid var(--ensemble-card-border, #e2e8f0);
    border-radius: var(--ensemble-badge-radius, 4px);
    font-size: var(--ensemble-small-size, 14px);
    cursor: pointer;
    transition: all var(--ensemble-transition, all 0.3s ease);
}

.es-map-popup-route:hover {
    background: var(--ensemble-card-border, #e2e8f0);
}

.es-map-popup-route svg {
    width: 14px;
    height: 14px;
}

/* =========================================
   Custom Markers
   ========================================= */
/* Eine Markerfarbe je Seite, nicht zehn nach Ortstyp.
   Bis 05.09.2026 lieferte das PHP eine fest verdrahtete Palette (#e74c3c,
   #9b59b6, #3498db …) als Inline-Farbe mit. Die Karte hatte damit ihre eigene
   Farbwelt, unabhaengig vom Brand Tuner. Jetzt kommt die Farbe hier aus
   --ensemble-primary; --es-marker-color setzt das Skript nur noch, wenn ueber
   den Filter `ensemble_map_marker_icons` bewusst eine Farbe je Typ vergeben
   wurde. */
.es-marker {
    --es-marker-farbe: var(--es-marker-color, var(--ensemble-primary, #e74c3c));
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--es-marker-farbe);
    color: var(--ensemble-button-text, #ffffff);
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
    transition: all var(--ensemble-transition, all 0.3s ease);
}

.es-marker-inner {
    transform: rotate(45deg);
    font-size: var(--ensemble-lg-size, 18px);
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: inherit;
}

/* Die Symbole kommen als Inline-SVG aus ES_Icons und tragen `currentColor`.
   Groesse hier, Farbe von der Nadel. (05.09.2026) */
.es-marker-inner svg,
.es-marker-thumbnail-fallback svg {
    width: 18px;
    height: 18px;
    display: block;
    stroke: currentColor;
    fill: none;
}

/* WordPress ersetzt Emoji im Text durch ein <img class="emoji"> von s.w.org.
   Damit wurde aus dem Markersymbol ein Bild — und Bilder in der Leaflet-
   Markerebene bekommen von Leaflet `width:auto; max-width:none !important`.
   Das Symbol lag deshalb in Originalgroesse schief neben der Nadel statt
   mittig darin. Hier bekommt es eine feste Groesse. (Befund 05.09.2026)
   MERKE: Das behebt die Darstellung, nicht den externen Aufruf — das Bild wird
   weiterhin von s.w.org geladen. Die saubere Loesung waere, statt Emoji das
   eigene Icon-Set (ES_Icons) zu benutzen; siehe Projektdokument. */
.es-marker-inner img,
.es-marker-inner img.emoji,
.leaflet-container .leaflet-marker-pane .es-marker-inner img,
.es-marker-thumbnail-fallback img,
.leaflet-container .leaflet-marker-pane .es-marker-thumbnail-fallback img {
    width: 1em;
    height: 1em;
    max-width: none;
    margin: 0;
    padding: 0;
    display: block;
    vertical-align: middle;
}

.es-marker:hover {
    transform: rotate(-45deg) scale(1.15);
    z-index: 1000 !important;
}

.es-marker-cluster {
    background: var(--ensemble-primary, #667eea);
    color: var(--ensemble-button-text, #ffffff);
    font-weight: var(--ensemble-button-weight, 600);
    border-radius: 50%;
    box-shadow: 0 3px 10px rgba(59, 130, 246, 0.3);
}

.es-marker-cluster-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* =========================================
   Leaflet Overrides
   ========================================= */
.leaflet-popup-content-wrapper {
    border-radius: var(--ensemble-card-radius, 12px);
    box-shadow: var(--ensemble-shadow, 0 2px 8px rgba(0, 0, 0, 0.1));
    padding: 0;
}

.leaflet-popup-content {
    margin: 15px;
    font-family: inherit;
}

.leaflet-popup-tip {
    box-shadow: var(--ensemble-shadow, 0 2px 8px rgba(0, 0, 0, 0.1));
}

/* Fullscreen */
.leaflet-control-fullscreen a {
    background-color: var(--ensemble-card-bg, #ffffff);
}

/* Locate Control */
.leaflet-control-locate a {
    background-color: var(--ensemble-card-bg, #ffffff);
}

.leaflet-control-locate.active a {
    color: var(--ensemble-primary, #667eea);
}

/* Routing */
.leaflet-routing-container {
    background: var(--ensemble-card-bg, #ffffff);
    border-radius: var(--ensemble-card-radius, 12px);
    box-shadow: var(--ensemble-shadow, 0 2px 8px rgba(0, 0, 0, 0.1));
    max-height: 300px;
    overflow-y: auto;
}

.leaflet-routing-alt {
    padding: 10px;
}

.leaflet-routing-alt h2 {
    font-size: var(--ensemble-small-size, 14px);
    margin: 0 0 10px;
}

.leaflet-routing-alt h3 {
    font-size: var(--ensemble-xs-size, 12px);
    margin: 5px 0;
    color: var(--ensemble-text-secondary, #718096);
}

/* Cluster
   Der Ring stand hier mit fest verdrahtetem Blau (rgba(59,130,246,…)) — er
   blieb also blau, egal welche Marke die Seite hat. Der innere Kreis nahm zwar
   --ensemble-primary, fiel ohne Brand Tuner aber auf ein blauviolettes #667eea
   zurueck. Beides zusammen war der blaue Punkt auf sonst roten Karten.
   Jetzt leitet sich der Ring aus derselben Farbe ab wie der Kreis; die Zeile
   davor ist der Rueckfall fuer Browser ohne color-mix. (05.09.2026) */
.marker-cluster {
    background: rgba(0, 0, 0, 0.15);
    background: color-mix(in srgb, var(--ensemble-primary, #e74c3c) 25%, transparent);
}

.marker-cluster div {
    background: var(--ensemble-primary, #e74c3c);
    color: var(--ensemble-button-text, #ffffff);
    font-weight: var(--ensemble-button-weight, 600);
}

.marker-cluster-small {
    background: rgba(0, 0, 0, 0.18);
    background: color-mix(in srgb, var(--ensemble-primary, #e74c3c) 30%, transparent);
}

.marker-cluster-medium {
    background: rgba(0, 0, 0, 0.22);
    background: color-mix(in srgb, var(--ensemble-primary, #e74c3c) 38%, transparent);
}

.marker-cluster-large {
    background: rgba(0, 0, 0, 0.26);
    background: color-mix(in srgb, var(--ensemble-primary, #e74c3c) 46%, transparent);
}

/* =========================================
   Distance Badge
   ========================================= */
.es-map-distance {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: var(--ensemble-primary, #667eea);
    color: var(--ensemble-button-text, #ffffff);
    border-radius: var(--ensemble-card-radius, 12px);
    font-size: var(--ensemble-xs-size, 12px);
    font-weight: var(--ensemble-body-weight, 400);
}

.es-map-distance svg {
    width: 12px;
    height: 12px;
}

/* =========================================
   No Locations Message
   ========================================= */
.es-map-no-locations {
    padding: 40px 20px;
    text-align: center;
    color: var(--ensemble-text-secondary, #718096);
    font-size: var(--ensemble-small-size, 14px);
}

/* =========================================
   Responsive
   ========================================= */
@media (max-width: 768px) {
    .es-map-embed {
        height: 300px;
    }
    
    .es-map-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .es-map-filters {
        width: 100%;
    }
    
    .es-map-filter {
        flex: 1;
        min-width: auto;
    }
    
    .es-map-search {
        max-width: none;
    }
    
    .es-map-actions {
        margin-left: 0;
        display: flex;
        justify-content: flex-end;
    }
    
    .es-map-sidebar {
        width: 100%;
        height: 60%;
        top: auto;
        transform: translateY(100%);
    }
    
    .es-map-sidebar.active {
        transform: translateY(0);
    }
    
    .es-button-route {
        width: 100%;
        justify-content: center;
    }
    
    .es-map-popup {
        min-width: 240px;
        max-width: 280px;
    }
}

/* =========================================
   Dark Mode Support
   ========================================= */
    
    .es-map-loading {
        background: rgba(30, 30, 30, 0.9);
    }
    
    .leaflet-popup-content-wrapper {
        background: var(--ensemble-card-bg, #ffffff);
    }
    
    .leaflet-popup-tip {
        background: var(--ensemble-card-bg, #ffffff);
    }
    
    .leaflet-container a.leaflet-popup-close-button {
        color: var(--ensemble-text, #1a202c);
    }
}

/* =========================================
   Google Maps Specific Styles
   ========================================= */

/* Google Maps Info Window */
.gm-style .gm-style-iw {
    padding: 0 !important;
}

.gm-style .gm-style-iw-d {
    overflow: auto !important;
    max-height: none !important;
}

.gm-style .gm-style-iw-c {
    padding: 0 !important;
    border-radius: var(--ensemble-card-radius, 12px) !important;
    box-shadow: var(--ensemble-shadow, 0 2px 8px rgba(0, 0, 0, 0.1)) !important;
}

.gm-style .gm-style-iw-tc::after {
    background: var(--ensemble-card-bg, #ffffff) !important;
}

/* Google Maps Controls */
.gm-style .gm-bundled-control button {
    background: var(--ensemble-card-bg, #ffffff) !important;
}

/* Geolocation Control for Google Maps */
.es-google-locate-control {
    margin: 10px;
}

.es-google-locate-control button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--ensemble-card-bg, #ffffff);
    border: none;
    border-radius: var(--ensemble-badge-radius, 4px);
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    cursor: pointer;
    transition: var(--ensemble-transition, all 0.3s ease);
}

.es-google-locate-control button:hover {
    background: var(--ensemble-bg, #f7fafc);
}

.es-google-locate-control button .dashicons {
    font-size: var(--ensemble-h4-size, 20px);
    width: 20px;
    height: 20px;
    color: var(--ensemble-text-secondary, #718096);
}

.es-google-locate-control button:hover .dashicons {
    color: var(--ensemble-primary, #667eea);
}

/* Route Info Panel */
.es-route-info {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 12px 20px;
    background: var(--ensemble-card-bg, #ffffff);
    border-radius: var(--ensemble-radius, 8px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    z-index: 1000;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.es-route-info-content {
    display: flex;
    align-items: center;
    gap: 20px;
}

.es-route-distance,
.es-route-duration {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--ensemble-small-size, 14px);
    font-weight: var(--ensemble-body-weight, 400);
    color: var(--ensemble-text, #1a202c);
}

.es-route-distance .dashicons,
.es-route-duration .dashicons {
    color: var(--ensemble-primary, #667eea);
    font-size: var(--ensemble-lg-size, 18px);
    width: 18px;
    height: 18px;
}

.es-route-info-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    border-radius: 50%;
    font-size: var(--ensemble-lg-size, 18px);
    color: var(--ensemble-text-secondary, #718096);
    cursor: pointer;
    transition: var(--ensemble-transition, all 0.3s ease);
}

.es-route-info-close:hover {
    background: var(--ensemble-bg, #f7fafc);
    color: var(--ensemble-text, #1a202c);
}

/* Google Maps Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .gm-style .gm-style-iw-c {
        background: var(--ensemble-card-bg, #ffffff) !important;
    }
    
    .gm-style .gm-style-iw-tc::after {
        background: var(--ensemble-card-bg, #ffffff) !important;
    }
    
    .es-google-locate-control button {
        background: var(--ensemble-card-bg, #2d2d2d);
    }
    
    .es-google-locate-control button:hover {
        background: var(--ensemble-bg, #404040);
    }
    
    .es-google-locate-control button .dashicons {
        color: var(--ensemble-text-secondary, #9ca3af);
    }
    
    .es-route-info {
        background: var(--ensemble-card-bg, #2d2d2d);
    }
}

/* =========================================
   Compact Popup Styles (v2.2.0)
   ========================================= */
.es-map-popup-compact {
    position: relative;
    min-width: 260px;
    max-width: 300px;
    padding: 16px;
}

/* Close Button */
.es-map-popup-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    background: var(--ensemble-bg, #f7fafc);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ensemble-text-secondary, #718096);
    transition: var(--ensemble-transition, all 0.3s ease);
    z-index: 10;
}

.es-map-popup-close:hover {
    background: var(--ensemble-primary, #667eea);
    color: var(--ensemble-button-text, #ffffff);
}

.es-map-popup-close svg {
    width: 14px;
    height: 14px;
}

.es-map-popup-header {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    padding-right: 24px; /* Space for close button */
}

.es-map-popup-thumb {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: var(--ensemble-radius, 8px);
    overflow: hidden;
}

.es-map-popup-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.es-map-popup-header-content {
    flex: 1;
    min-width: 0;
}

.es-map-popup-compact .es-map-popup-title {
    font-size: var(--ensemble-body-size, 16px);
    font-weight: var(--ensemble-button-weight, 600);
    margin: 0 0 4px;
    line-height: 1.3;
}

.es-map-popup-compact .es-map-popup-title a {
    color: var(--ensemble-text, #1a202c);
    text-decoration: none;
}

.es-map-popup-compact .es-map-popup-title a:hover {
    color: var(--ensemble-primary, #667eea);
}

.es-map-popup-compact .es-map-popup-address {
    font-size: var(--ensemble-xs-size, 12px);
    color: var(--ensemble-text-secondary, #718096);
    margin: 0;
    line-height: 1.4;
}

/* Next Event in Compact Popup */
.es-map-popup-next-event {
    background: var(--ensemble-bg, #f7fafc);
    border-radius: var(--ensemble-radius, 8px);
    padding: 10px 12px;
    margin-bottom: 12px;
}

.es-map-popup-next-event .es-event-label {
    display: block;
    font-size: var(--ensemble-xs-size, 12px);
    color: var(--ensemble-text-secondary, #718096);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.es-map-popup-next-event .es-event-link {
    display: block;
    text-decoration: none;
    color: var(--ensemble-text, #1a202c);
}

.es-map-popup-next-event .es-event-link:hover {
    color: var(--ensemble-primary, #667eea);
}

.es-map-popup-next-event .es-event-title {
    display: block;
    font-weight: var(--ensemble-body-weight, 400);
    font-size: var(--ensemble-small-size, 14px);
    line-height: 1.3;
    margin-bottom: 2px;
}

.es-map-popup-next-event .es-event-date {
    display: block;
    font-size: var(--ensemble-xs-size, 12px);
    color: var(--ensemble-primary, #667eea);
}

.es-no-events {
    font-size: var(--ensemble-xs-size, 12px);
    color: var(--ensemble-text-secondary, #718096);
    text-align: center;
    padding: 8px;
    margin: 0 0 12px;
}

/* Compact Route Button (now a link) */
.es-popup-route-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    background: var(--ensemble-primary, #667eea);
    color: var(--ensemble-button-text, #ffffff) !important;
    border: none;
    border-radius: var(--ensemble-radius, 8px);
    font-size: var(--ensemble-small-size, 14px);
    font-weight: var(--ensemble-body-weight, 400);
    text-decoration: none;
    cursor: pointer;
    transition: var(--ensemble-transition, all 0.3s ease);
    box-sizing: border-box;
}

.es-popup-route-btn:hover {
    background: var(--ensemble-button-hover-bg, #5568d3);
    transform: translateY(-1px);
    color: var(--ensemble-button-text, #ffffff) !important;
    text-decoration: none;
}

.es-popup-route-btn svg {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

/* =========================================
   Thumbnail Markers (v2.2.1 - CSS based)
   ========================================= */
.es-marker-thumbnail-icon {
    background: transparent !important;
    border: none !important;
}

/* Die Markerfarbe kommt als eigene Eigenschaft vom Skript, NICHT mehr als
   inline `border-color`.
   Grund (Befund 05.09.2026): WordPress gibt seit 6.1 eine Kernregel aus —
   `html :where([style*="border-color"]) { border-style: solid; }`. Ein Element
   mit inline border-color bekam dadurch eine sichtbare Kante, und weil keine
   border-width gesetzt war, griff der Anfangswert `medium` = 3px. Ergebnis: ein
   farbiger Kasten um jeden Marker. Mit einer eigenen Eigenschaft trifft die
   Kernregel nicht mehr zu. */
.es-marker-thumbnail {
    --es-marker-farbe: var(--es-marker-color, var(--ensemble-primary, #e74c3c));
    width: 46px;
    height: 56px;
    position: relative;
    cursor: pointer;
    transition: var(--ensemble-transition, all 0.3s ease);
}

.es-marker-thumbnail::before {
    content: '';
    position: absolute;
    top: 0;
    left: 3px;
    width: 40px;
    height: 40px;
    background: var(--ensemble-card-bg, #ffffff);
    border: 3px solid var(--es-marker-farbe);
    border-radius: 50%;
    box-shadow: 0 3px 10px rgba(0,0,0,0.25);
}

.es-marker-thumbnail::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 14px solid var(--es-marker-farbe);
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.2));
}

/* Leaflet setzt fuer ALLE Bilder in der Marker-Ebene `width: auto` — und zwar
   mit `.leaflet-container .leaflet-marker-pane img`, also zwei Klassen gegen
   die eine hier. Der Selektor gewann, das Bild behielt sein Seitenverhaeltnis
   und wurde bei einem 300x103-Logo zur 87px breiten Ellipse, die aus dem Kreis
   lief. Die Regel unten steht deshalb einmal normal (Google-Overlay, dort gibt
   es keine Leaflet-Ebene) und einmal mit hoeherer Spezifitaet. Kein
   !important — es reicht, den Selektor gleich stark zu machen.
   (Befund 05.09.2026) */
.es-marker-thumbnail img,
.leaflet-container .leaflet-marker-pane .es-marker-thumbnail img {
    position: absolute;
    top: 5px;
    left: 8px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    z-index: 1;
}

.es-marker-thumbnail-fallback {
    position: absolute;
    top: 5px;
    left: 8px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Der Hintergrund kam bis 05.09.2026 inline aus der Typ-Palette. */
    background: var(--es-marker-farbe);
    font-size: var(--ensemble-small-size, 14px);
    color: var(--ensemble-button-text, #ffffff);
    z-index: 0;
}

.es-marker-thumbnail img + .es-marker-thumbnail-fallback {
    display: none;
}

.es-marker-thumbnail:hover {
    transform: scale(1.15);
    z-index: 1000 !important;
}

/* Google Maps Custom Overlay Marker */
.es-gmap-thumbnail-marker {
    transform: translateZ(0);
}

.es-gmap-thumbnail-marker .es-marker-thumbnail {
    pointer-events: auto;
}

/* Events Loading Spinner in Popup */
.es-map-popup-events-loading {
    display: flex;
    justify-content: center;
    padding: 10px;
}

.es-map-popup-events-loading .spinner,
.es-map-popup-events-loading .es-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--ensemble-card-border, #e2e8f0);
    border-top-color: var(--ensemble-primary, #667eea);
    border-radius: 50%;
    animation: es-spin 0.8s linear infinite;
}

.es-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--ensemble-card-border, #e2e8f0);
    border-top-color: var(--ensemble-primary, #667eea);
    border-radius: 50%;
    animation: es-spin 0.8s linear infinite;
}

@keyframes es-spin {
    to { transform: rotate(360deg); }
}

/* Hide old popup image style for compact mode */
.es-map-popup-compact .es-map-popup-image {
    display: none;
}

/* Responsive Popup */
@media (max-width: 480px) {
    .es-map-popup-compact {
        min-width: 220px;
        max-width: 280px;
    }
    
    .es-map-popup-thumb {
        width: 50px;
        height: 50px;
    }
    
    .es-map-popup-compact .es-map-popup-title {
        font-size: var(--ensemble-small-size, 14px);
    }
}

/* =========================================
   Route Button Click Protection (v2.3.6)
   Prevents accidental clicks when popup opens
   ========================================= */
.es-popup-route-btn[style*="pointer-events: none"] {
    opacity: 0.7;
    cursor: default;
}

/* Ensure popup content doesn't receive marker click */
.es-map-popup,
.es-map-popup-compact {
    pointer-events: auto;
}

/* Leaflet popup specific fixes */
.leaflet-popup-content {
    margin: 0 !important;
}

.leaflet-popup-content-wrapper {
    padding: 0 !important;
    border-radius: var(--ensemble-card-radius, 12px) !important;
    overflow: hidden;
}

.leaflet-popup-close-button {
    display: none !important; /* We use our own close button */
}

/* Google Maps InfoWindow fixes */
.gm-style-iw-d {
    overflow: visible !important;
}

.gm-style-iw-c {
    padding: 0 !important;
    border-radius: var(--ensemble-card-radius, 12px) !important;
}

/* Hide Google's close button - we use our own */
.gm-style-iw-chr {
    display: none !important;
}
