/* ==========================================================================
   MADRID MAP COMPONENT
   Extract from madrid-map-static-bw.html
   ========================================================================== */

.ph-map-wrapper {
    position: relative;
    width: 100%;
    /* Layered background: dark overlay + national map */
    background: linear-gradient(rgba(6, 22, 46, 0.85), rgba(6, 22, 46, 0.85)),
        url('../images/spain-map-national.jpg') no-repeat center center !important;
    background-size: cover !important;
    border-radius: 12px;
    overflow: hidden;
    margin: 4rem 0;
    padding: 100px 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.4);
}

@media (max-width: 1024px) {
    .ph-map-wrapper {
        padding: 60px 20px;
    }
}

@media (max-width: 768px) {
    .ph-map-wrapper {
        padding: 40px 10px;
        background-attachment: scroll;
    }
}

/* Map Instances */
#ph-madrid-map,
.ph-map-instance {
    width: 100%;
    max-width: 1000px;
    /* Focus the interactive area */
    height: 600px;
    min-height: 400px;
    background: rgba(255, 255, 255, 0.02) !important;
    position: relative;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.6);
    /* CSS Variables driven by JS */
    --ph-map-tile-filter: grayscale(100%);
    --ph-map-tile-blend: normal;
}

/* Style the tiles based on JS variables */
.ph-map-instance .leaflet-tile {
    filter: var(--ph-map-tile-filter) !important;
    mix-blend-mode: var(--ph-map-tile-blend) !important;
    pointer-events: auto !important;
}

/* Base style for all leaflet containers */
.leaflet-container {
    font-family: inherit !important;
    background: transparent !important;
}

/* Custom marker styling */
.custom-marker {
    width: 50px;
    height: 50px;
    background: #0637eb;
    /* Brand Blue */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 3px solid white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.custom-marker.marker-hover {
    background: #ef6b0d !important;
    /* Brand Orange */
    transform: scale(1.15);
    box-shadow: 0 8px 24px rgba(239, 107, 13, 0.4);
    z-index: 1000 !important;
}

.custom-marker img {
    width: 30px !important;
    height: 30px !important;
    object-fit: contain !important;
    display: block !important;
}

.leaflet-popup-content-wrapper {
    border-radius: 8px;
    padding: 0;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.leaflet-popup-content {
    margin: 0 !important;
    min-width: 260px;
}

.popup-content {
    padding: 20px 20px 25px;
}

.popup-title {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #ef6b0d95;
}

.popup-stats-row {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin: 15px 0;
    gap: 10px;
}

.stat-item {
    flex: 1;
    text-align: center;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #0637eb;
    /* Brand Blue */
    line-height: 1.2;
}

.stat-label {
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.popup-images {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #ef6b0d74;
}

.round-thumb {
    width: 45px !important;
    height: 45px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    border: 2px solid #fff !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1) !important;
}

/* Safety override for ANY image inside a leaflet marker or popup */
.leaflet-marker-icon img,
.leaflet-popup-content img {
    max-width: none !important;
}

.custom-marker img {
    max-width: 30px !important;
}


.leaflet-popup-tip {
    background: white;
}

/* Hide zoom controls */
.leaflet-control-zoom {
    display: none;
}

/* Hide attribution */
.leaflet-control-attribution {
    display: none;
}


/* Marker logo text fallback */
.custom-marker {
    font-family: 'Inter', sans-serif;
    letter-spacing: -0.5px;
    line-height: 1;
}


@media (max-width: 768px) {
    #ph-madrid-map {
        height: 450px;
    }
}