/* ====================================================
   MARKER TONDI (ICONE PERSONALIZZATE)
==================================================== */
.fmg-custom-marker-icon {
    background: transparent !important;
    border: none !important;
}

.fmg-custom-marker-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
}

.fmg-custom-marker-wrapper img {
    display: block;
}

/* ====================================================
   WRAPPER MAPPA NORMALE
==================================================== */
.fmg-map-wrapper {
    width: 100%;
    max-width: 100%;
    position: relative;
}

#fmg-map {
    width: 100%;
    height: 500px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* ====================================================
   FILTRI E RICERCA
==================================================== */
.fmg-filters {
    margin-bottom: 15px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.fmg-filters select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    font-size: 14px;
    cursor: pointer;
    min-width: 150px;
}

.fmg-filters select:hover {
    border-color: #999;
}

.fmg-filters select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

/* Campo ricerca marker */
#fmg-marker-search {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    min-width: 200px;
    flex: 1;
    max-width: 300px;
}

#fmg-marker-search:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

#fmg-marker-search::placeholder {
    color: #999;
}

.fmg-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.fmg-btn:hover {
    background: #f5f5f5;
    border-color: #999;
}

.fmg-btn:active {
    background: #e5e5e5;
}

/* ====================================================
   MAPPA FULLSCREEN (PAGINA DEDICATA)
==================================================== */
#fmg-fullscreen-wrapper {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
    z-index: 999999 !important;
    background: #fff !important;
}

#fmg-fullscreen-wrapper #fmg-map {
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    border-radius: 0 !important;
}

/* ====================================================
   NEUTRALIZZAZIONE TEMA PAGINA FULLSCREEN
==================================================== */
.page-id-57325 .entry-content,
.page-id-57325 .site-content,
.page-id-57325 .content-area,
.page-id-57325 .container,
.page-id-57325 .wp-block-group {
    margin: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
}

.page-id-57325 header,
.page-id-57325 footer,
.page-id-57325 .site-header,
.page-id-57325 .site-footer {
    display: none !important;
}

/* ====================================================
   POPUP PERSONALIZZATO
==================================================== */
.fmg-custom-popup .leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.fmg-custom-popup .leaflet-popup-content {
    overflow-y: auto;
    margin: 15px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.fmg-popup-content h3 {
    color: #333;
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 10px 0;
    padding: 0;
}

.fmg-popup-description {
    color: #666;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 12px;
}

.fmg-popup-description p {
    margin: 0 0 8px 0;
}

.fmg-popup-description p:last-child {
    margin-bottom: 0;
}

.fmg-popup-link {
    display: inline-block;
    padding: 8px 16px;
    background: #0073aa;
    color: #fff !important;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s ease;
}

.fmg-popup-link:hover {
    background: #005177;
    color: #fff !important;
}

/* Scrollbar personalizzata per popup */
.fmg-custom-popup .leaflet-popup-content::-webkit-scrollbar {
    width: 6px;
}

.fmg-custom-popup .leaflet-popup-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.fmg-custom-popup .leaflet-popup-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.fmg-custom-popup .leaflet-popup-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ====================================================
   TOOLTIP MARKER
==================================================== */
.fmg-marker-tooltip {
    background: rgba(0, 0, 0, 0.8) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 4px !important;
    padding: 6px 12px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3) !important;
    pointer-events: none !important;
}

.fmg-marker-tooltip::before {
    border-top-color: rgba(0, 0, 0, 0.8) !important;
}

/* Tooltip regioni */
.fmg-region-tooltip {
    background: rgba(255, 107, 0, 0.9) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 6px !important;
    padding: 8px 16px !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    box-shadow: 0 3px 10px rgba(0,0,0,0.4) !important;
    pointer-events: none !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
}

/* ====================================================
   CLUSTER STYLING PERSONALIZZATO
==================================================== */
.fmg-custom-cluster {
    background: transparent !important;
}

.fmg-custom-cluster div {
    transition: transform 0.2s ease;
}

.fmg-custom-cluster:hover div {
    transform: scale(1.1);
}

/* Fallback per cluster default (senza colore personalizzato) */
.marker-cluster-small {
    background-color: rgba(110, 204, 57, 0.6);
}
.marker-cluster-small div {
    background-color: rgba(110, 204, 57, 0.6);
}

.marker-cluster-medium {
    background-color: rgba(241, 211, 87, 0.6);
}
.marker-cluster-medium div {
    background-color: rgba(241, 211, 87, 0.6);
}

.marker-cluster-large {
    background-color: rgba(253, 156, 115, 0.6);
}
.marker-cluster-large div {
    background-color: rgba(253, 156, 115, 0.6);
}

.marker-cluster {
    background-clip: padding-box;
    border-radius: 20px;
}
.marker-cluster div {
    width: 30px;
    height: 30px;
    margin-left: 5px;
    margin-top: 5px;
    text-align: center;
    border-radius: 15px;
    font: 12px "Helvetica Neue", Arial, Helvetica, sans-serif;
}
.marker-cluster span {
    line-height: 30px;
}

/* ====================================================
   RESPONSIVE
==================================================== */
@media (max-width: 768px) {
    .fmg-filters {
        flex-direction: column;
        gap: 8px;
    }
    
    .fmg-filters select,
    .fmg-filters input,
    .fmg-btn {
        width: 100%;
        min-width: unset;
        max-width: 100%;
    }
    
    #fmg-map {
        height: 400px;
    }
    
    .fmg-custom-popup .leaflet-popup-content {
        max-height: 250px;
    }
}

@media (max-width: 480px) {
    #fmg-map {
        height: 350px;
    }
}

/* ====================================================
   CONTROLLO FULLSCREEN LEAFLET
==================================================== */
.leaflet-control-zoom-fullscreen {
    width: 30px !important;
    height: 30px !important;
    line-height: 30px !important;
    font-size: 18px !important;
}

/* ====================================================
   FIX MAPPA IN MODALITÀ FULLSCREEN
==================================================== */
.leaflet-container.leaflet-fullscreen-on {
    width: 100% !important;
    height: 100% !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 999999 !important;
}

/* ====================================================
   MARKER CON OPACITÀ RIDOTTA (FILTRO RICERCA)
==================================================== */
.leaflet-marker-icon[style*="opacity: 0.2"] {
    filter: grayscale(70%);
}

/* ====================================================
   CONTORNI REGIONI (PLACEHOLDER)
==================================================== */
.fmg-region-border {
    fill: transparent;
    stroke-width: 3px;
    stroke-opacity: 0.8;
    pointer-events: none;
}
