/* WP Immo Search - Map Styles (from original frontend.css) */

/* Reset and Base Styles */
.wp-immo-map-container * {
    box-sizing: border-box;
}

/* Map Styles */
.wp-immo-map-container {
    position: relative;
    margin-bottom: 0;
    border-radius: 0;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    /* Niedriger z-index damit Navigation-Dropdowns darüber liegen */
    z-index: 1;
}

.wp-immo-map-wrapper {
    position: relative;
}

#wp-immo-map {
    position: relative;
    min-height: 400px;
    background: #f8f9fa;
    border-radius: 0;
}

.wp-immo-map-controls {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 12px 16px;
    border-radius: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.map-control-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #333;
}

.map-control-item label {
    font-weight: 500;
    margin: 0;
}

#search-radius-display {
    font-weight: 600;
    color: var(--wp-immo-ci-color);
    min-width: 50px;
    text-align: right;
}

.wp-immo-map-legend {
    position: absolute;
    bottom: 16px;
    left: 16px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 12px;
    border-radius: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 12px;
    color: #333;
}

.legend-item:last-child {
    margin-bottom: 0;
}

.legend-marker {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.legend-marker-exact {
    background: var(--wp-immo-ci-color);
}

.legend-marker-approximate {
    background: var(--wp-immo-ci-color);
    opacity: 0.6;
}

/* Leaflet Popup Customization */
.leaflet-popup-content-wrapper {
    border-radius: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    width: auto;
    min-width: 420px;
    max-width: 500px;
}

.leaflet-popup-content {
    margin: 0;
    padding: 0;
    width: 100%;
}

/* Leaflet Close Button - rechts oben */
.leaflet-container a.leaflet-popup-close-button {
    position: absolute;
    top: 8px;
    right: 6px;
    border: none;
    text-align: center;
    width: 30px;
    height: 30px;
    font: 24px / 24px Tahoma, Verdana, sans-serif;
    color: #757575;
    text-decoration: none;
    background: transparent;
}

.leaflet-container a.leaflet-popup-close-button:hover {
    color: #333;
}

/* Map Popups - Horizontal Layout */
.wp-immo-popup-container {
    display: flex;
    min-width: 420px;
    max-width: 500px;
    background: white;
}

/* Links: Foto passt sich Box-Höhe an */
.wp-immo-popup-left {
    width: 140px;
    flex-shrink: 0;
    overflow: hidden;
    align-self: stretch; /* Volle Höhe der Flex-Container */
}

.wp-immo-popup-left img {
    width: 140px;
    height: 100%;
    min-height: 100%;
    object-fit: cover; /* Zentriert und beschnitten */
    object-position: center;
    display: block;
}

/* Rechts: Info auf weißem Hintergrund */
.wp-immo-popup-right {
    flex: 1;
    padding: 13px 17px;
    background: white;
    display: flex;
    flex-direction: column;
}

/* PLZ/Ort oben */
.wp-immo-popup-location {
    font-size: 13px;
    color: #666;
    margin-bottom: 4px;
}

/* Headline direkt drunter (näher) */
.wp-immo-popup-container h4,
.wp-immo-popup-container .wp-immo-popup-title,
.leaflet-popup-content .wp-immo-popup-title {
    margin: 0 0 auto 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
}

/* Bottom: Preis + Pfeil */
.wp-immo-popup-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px !important;
}

/* Preis */
.wp-immo-popup-price {
    font-size: 19px;
    font-weight: 700;
    color: var(--wp-immo-ci-color);
    line-height: 1;
    padding-top: 2px;
}

/* Weißer Pfeil-Button rechtsbündig */
.wp-immo-popup-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--wp-immo-ci-color);
    
    text-decoration: none;
    border-radius: 0;
    
    
    transition: background 0.2s ease;
    flex-shrink: 0;
    
}

.wp-immo-popup-link:hover {
    background: var(--wp-immo-ci-color-hover);
}
.wp-immo-popup-link svg {
    width: 10px;
    height: 10px;
    transform: rotate(-90deg);
}


/* Search Radius Circle */
.search-radius-circle {
    fill: var(--wp-immo-ci-color);
    fill-opacity: 0.1;
    stroke: var(--wp-immo-ci-color);
    stroke-width: 2;
    stroke-dasharray: 5, 5;
}


/* CRITICAL: Fix for Leaflet tiles not showing */
.leaflet-container {
    background: #ddd;
}

.leaflet-tile {
    max-width: none;
}

.leaflet-tile-pane {
    z-index: 2;
}

.leaflet-objects-pane {
    z-index: 3;
}

/* Enhanced marker styles */
.wp-immo-marker {
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 12px;
    color: white;
    width: 24px;
    height: 24px;
}

.wp-immo-marker:hover {
    transform: scale(1.1);
    z-index: 1000;
}

.wp-immo-marker.exact {
    background-color: var(--wp-immo-ci-color);
}

.wp-immo-marker.approximate {
    background-color: var(--wp-immo-ci-color);
    opacity: 0.6;
}

.marker-label {
    font-size: 12px;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    line-height: 1;
}


/* Enhanced cluster styles */
.marker-cluster {
    background-color: var(--wp-immo-ci-color);
    opacity: 0.8;
    border-radius: 50%;
    text-align: center;
    color: white;
    font-weight: bold;
    font-size: 12px;
    line-height: 40px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    border: 2px solid white;
}

.marker-cluster div {
    background-color: var(--wp-immo-ci-color);
    opacity: 0.9;
    border-radius: 50%;
    text-align: center;
    color: white;
    font-weight: bold;
    line-height: 36px;
    width: 36px;
    height: 36px;
    margin: 2px;
    padding-bottom: 9px;
}

.marker-cluster-small {
    background-color: var(--wp-immo-ci-color);
    opacity: 0.8;
}

.marker-cluster-small div {
    background-color: var(--wp-immo-ci-color);
    opacity: 0.9;
}

.marker-cluster-medium {
    background-color: var(--wp-immo-ci-color);
    opacity: 0.85;
}

.marker-cluster-medium div {
    background-color: var(--wp-immo-ci-color);
    opacity: 0.95;
}

.marker-cluster-large {
    background-color: var(--wp-immo-ci-color);
    opacity: 0.7;
}

.marker-cluster-large div {
    background-color: var(--wp-immo-ci-color);
    opacity: 0.75;
}

/* Map loading and error states */
.wp-immo-map-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: #333;
}

.wp-immo-map-loading .spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-top: 2px solid var(--wp-immo-ci-color);
    border-radius: 50%;
    animation: mapSpin 1s linear infinite;
}

@keyframes mapSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.wp-immo-map-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    background: #f8d7da;
    color: #721c24;
    padding: 20px;
    border-radius: 0;
    border: 1px solid #f5c6cb;
    max-width: 300px;
    text-align: center;
}

.wp-immo-map-error h4 {
    margin: 0 0 8px 0;
    color: #721c24;
}

/* CRITICAL: Leaflet control fixes */
.leaflet-control-container {
    position: relative;
}

.leaflet-control-zoom {
    position: relative;
    z-index: 1000;
}

.leaflet-control-zoom a {
    background-color: white;
    color: #333;
    border: 1px solid #ccc;
}

.leaflet-control-zoom a:hover {
    background-color: #f4f4f4;
}

/* CRITICAL: Fix for popup positioning */
.leaflet-popup {
    z-index: 1010;
}


/* Responsive fixes */
@media (max-width: 768px) {
    .wp-immo-marker {
        width: 20px;
        height: 20px;
        font-size: 10px;
    }
    
    .marker-cluster {
        line-height: 32px;
    }
    
    .marker-cluster div {
        width: 28px;
        height: 28px;
        line-height: 28px;
    }
    
    .wp-immo-map-loading {
        padding: 15px;
        font-size: 13px;
    }

    .wp-immo-map-controls {
        top: 12px;
        right: 12px;
        padding: 8px 12px;
    }

    .wp-immo-map-legend {
        display: none;
    }
}
/* Map error reload button */
.wp-immo-map-error-button {
    margin-top: 10px;
    padding: 8px 16px;
    background: var(--wp-immo-ci-color);
    color: white;
    border: none;
    border-radius: 0;
    cursor: pointer;
    font-size: 14px;
}

.wp-immo-map-error-button:hover {
    background: var(--wp-immo-ci-color-hover);
}

/* Noscript fallback */
.wp-immo-map-noscript {
    padding: 40px;
    text-align: center;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 0;
}

.wp-immo-map-noscript h4 {
    margin: 0 0 8px 0;
}

.wp-immo-map-noscript p {
    margin: 0;
}

/* Map preset info */
.map-preset-info {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 12px;
    border-radius: 0;
    font-size: 12px;
    color: #666;
    z-index: 1000;
}

.map-preset-info strong {
    font-weight: 600;
}

/* ==========================================================================
   MOBILE ANPASSUNGEN FÜR POPUPS
   ========================================================================== */

@media (max-width: 768px) {
    /* Popup: Bild auf Mobile ausblenden */
    .wp-immo-popup-left {
        display: none !important;
    }

    /* Leaflet Popup-Wrapper schmaler auf Mobile */
    .leaflet-popup-content-wrapper {
        min-width: 280px !important;
        max-width: 320px !important;
    }

    /* Popup Container ohne Bild-Breite (original 420px - 140px Bild = 280px) */
    .wp-immo-popup-container {
        min-width: 280px;
        max-width: 320px;
    }

    /* Rechte Seite volle Breite */
    .wp-immo-popup-right {
        width: 100%;
        padding: 14px 16px;
    }
}
