/* ============================================
   ImmoMatch – Interaktive Regionenkarte
   ============================================ */

.immomatch-map-wrap {
    position: relative;
    margin: 0;
}

#immomatch-map {
    width: 100%;
    height: 600px !important;
    border-radius: 3px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    z-index: 1;
}

/* Loading Spinner */
.immomatch-map-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #6b7280;
    font-size: 14px;
}
.immomatch-map-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e5e7eb;
    border-top-color: #b8a98e;
    border-radius: 50%;
    animation: immomatch-spin 0.8s linear infinite;
    margin-bottom: 12px;
}
@keyframes immomatch-spin {
    to { transform: rotate(360deg); }
}

/* Region Labels */
.immomatch-region-label {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}
.immomatch-region-label-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    pointer-events: none;
}
.immomatch-region-label-inner .region-name {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    text-shadow:
        0 0 4px rgba(0, 0, 0, 0.7),
        0 0 8px rgba(0, 0, 0, 0.5),
        1px 1px 2px rgba(0, 0, 0, 0.6),
        -1px -1px 2px rgba(0, 0, 0, 0.6);
    white-space: nowrap;
    text-align: center;
}
.immomatch-region-label-inner .region-count {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    background: #b8a98e;
    padding: 1px 8px;
    border-radius: 3px;
    white-space: nowrap;
}

/* Tooltip */
.immomatch-map-tooltip {
    background: #fff !important;
    color: #1f2937 !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 8px !important;
    padding: 8px 12px !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    font-size: 13px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
    line-height: 1.5 !important;
}
.immomatch-map-tooltip::before {
    border-top-color: #fff !important;
}

/* Legende */
.immomatch-map-legend {
    display: none;
    margin-top: 16px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 3px;
    padding: 16px 20px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}
.immomatch-map-legend-title {
    font-size: 14px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 12px;
}
.immomatch-map-legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.immomatch-map-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 13px;
}
.immomatch-map-legend-item:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.immomatch-map-legend-item .legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}
.immomatch-map-legend-item .legend-name {
    font-weight: 600;
    color: #374151;
}
.immomatch-map-legend-item .legend-count {
    font-weight: 500;
    color: #6b7280;
    font-size: 12px;
}
.immomatch-map-legend-item.legend-active {
    background: #b8a98e;
    border-color: #b8a98e;
}
.immomatch-map-legend-item.legend-active .legend-name {
    color: #fff;
}
.immomatch-map-legend-item.legend-active .legend-count {
    color: rgba(255, 255, 255, 0.7);
}
a.immomatch-map-legend-item {
    text-decoration: none;
}

/* Hero-Bild Overlay rechts über der Karte */
.immomatch-map-wrap.has-hero-image #immomatch-map {
    z-index: auto;
}
.immomatch-hero-overlay {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 55%;
    pointer-events: none;
    z-index: 1000;
}
.immomatch-hero-person {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: right center;
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 40%);
    mask-image: linear-gradient(to right, transparent 0%, black 40%);
}

/* Floating Buyer Bubbles */
.immomatch-buyer-bubbles {
    position: absolute;
    top: 0;
    left: 42%;
    width: 25%;
    height: 100%;
    z-index: 1001;
    pointer-events: none;
}
.immomatch-buyer-bubble {
    position: absolute;
    width: 128px;
    height: 128px;
    border-radius: 50%;
    border: 4px solid;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
    pointer-events: auto;
    transition: transform 0.2s ease;
    text-decoration: none;
}
.immomatch-buyer-bubble img {
    border-radius: 50%;
}
.immomatch-buyer-bubble:hover {
    transform: scale(1.15);
    z-index: 10;
}
.immomatch-buyer-bubble img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.immomatch-buyer-bubble.bubble-0 {
    top: 8%;
    left: 15%;
    animation: floatBubble 16s ease-in-out infinite;
}
.immomatch-buyer-bubble.bubble-1 {
    top: 38%;
    left: 55%;
    animation: floatBubble 19s ease-in-out infinite reverse;
}
.immomatch-buyer-bubble.bubble-2 {
    top: 65%;
    left: 10%;
    animation: floatBubble 21s ease-in-out infinite;
    animation-delay: -4s;
}
.immomatch-buyer-bubble.bubble-3 {
    top: 35%;
    left: 0%;
    width: 105px;
    height: 105px;
    animation: floatBubble 17s ease-in-out infinite reverse;
    animation-delay: -8s;
}
.bubble-info {
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    pointer-events: none;
    z-index: 2000;
}
.bubble-badge {
    color: #fff;
    font-size: 0.8em;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 3px;
    white-space: nowrap;
    width: fit-content;
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}
.bubble-badge.badge-region { background: #8a9bae; transition-delay: 0s; }
.bubble-badge.badge-budget { background: #7ea88e; transition-delay: 0.07s; }
.bubble-badge.badge-type   { background: #c4a67a; transition-delay: 0.14s; }
.immomatch-buyer-bubble:hover .bubble-badge {
    opacity: 1;
    transform: translateX(0);
}

@keyframes floatBubble {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(12px, -18px); }
    50% { transform: translate(-8px, -10px); }
    75% { transform: translate(15px, 12px); }
}

/* Karte anthrazit/dunkel - aufgehellt */
#immomatch-map .leaflet-tile-pane {
    filter: brightness(2.0) saturate(0.3) contrast(1.1);
}

/* Leaflet Attribution ausblenden */
.leaflet-control-attribution {
    display: none !important;
}

/* Cursor auf Polygonen */
.leaflet-interactive {
    cursor: pointer !important;
}

/* Responsive */
@media (max-width: 768px) {
    #immomatch-map {
        height: 350px !important;
        border-radius: 3px;
    }
    .immomatch-region-label-inner .region-name {
        font-size: 11px;
    }
    .immomatch-region-label-inner .region-count {
        font-size: 10px;
    }
    .immomatch-map-legend-items {
        flex-direction: column;
    }
    .immomatch-buyer-bubbles {
        display: none;
    }
}
