/* =========================
   HCS WORLD MAP
========================= */

.hcs-map {
    --hcs-map-fill: var(--e-global-color-primary, #006930);
    --hcs-map-fill-opacity: 1;
    --hcs-map-stroke: #ffffff;
    --hcs-map-marker: var(--e-global-color-secondary, #DBBB3E);
    --hcs-map-hq: #ffffff;
    --hcs-map-marker-size: 14px;
    --hcs-map-name: var(--e-global-color-primary, #006930);
    --hcs-map-text: var(--e-global-color-text, #21211F);
    --hcs-map-item-bg: var(--e-global-color-accent, #EDEBDD);

    display: flex;
    align-items: center;
    gap: 60px;
    width: 100%;
    font-family: var(--e-global-typography-text-font-family, 'Nexa'), sans-serif;
}

.hcs-map--left  { flex-direction: row-reverse; }
.hcs-map--top   { flex-direction: column; align-items: stretch; gap: 40px; }
.hcs-map--top .hcs-map__map { order: -1; }
.hcs-map--only  { display: block; }

.hcs-map__locations,
.hcs-map__map {
    flex: 1 1 50%;
    min-width: 0;
}

.hcs-map--top .hcs-map__locations,
.hcs-map--top .hcs-map__map,
.hcs-map--only .hcs-map__map {
    flex-basis: auto;
    width: 100%;
}

/* --- Mappa --- */

.hcs-map__map {
    overflow: hidden;
    border-radius: 20px;
}

.hcs-map__canvas {
    width: 100%;
    aspect-ratio: auto;
    min-height: 200px;
    background: transparent;
    cursor: default;
}

.hcs-map__canvas.leaflet-container {
    background: transparent;
    font-family: inherit;
}

.hcs-map__canvas .leaflet-grab,
.hcs-map__canvas .leaflet-dragging .leaflet-grab {
    cursor: default;
}

.hcs-map__canvas .leaflet-tile-pane {
    display: none;
}

.hcs-map__canvas .leaflet-control-zoom a {
    color: var(--hcs-map-text);
}

/* --- Marker --- */

.hcs-map__marker {
    background: transparent;
    border: none;
    color: var(--hcs-map-marker);
}

.hcs-map__marker.is-hq {
    color: var(--hcs-map-hq);
}

.hcs-map__marker span {
    position: absolute;
    top: 50%;
    left: 50%;
    width: var(--hcs-map-marker-size);
    height: var(--hcs-map-marker-size);
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: currentColor;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
    transition: transform 0.2s ease;
}

.hcs-map__marker.is-hq span {
    width: calc(var(--hcs-map-marker-size) + 4px);
    height: calc(var(--hcs-map-marker-size) + 4px);
    border-color: var(--hcs-map-marker);
}

.hcs-map__marker:hover span,
.hcs-map__marker.is-active span {
    transform: translate(-50%, -50%) scale(1.35);
}

/* Anello pulsante sul marker attivo */
.hcs-map__marker.is-active::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: var(--hcs-map-marker-size);
    height: var(--hcs-map-marker-size);
    border-radius: 50%;
    border: 2px solid currentColor;
    transform: translate(-50%, -50%);
    animation: hcs-map-pulse 1.4s ease-out infinite;
    pointer-events: none;
}

@keyframes hcs-map-pulse {
    0%   { transform: translate(-50%, -50%) scale(1);   opacity: 0.9; }
    100% { transform: translate(-50%, -50%) scale(3.2); opacity: 0; }
}

/* --- Popup --- */

.hcs-map__popup .leaflet-popup-content-wrapper {
    border-radius: 12px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15);
    color: var(--hcs-map-text);
    font-family: inherit;
}

.hcs-map__popup .leaflet-popup-content {
    margin: 14px 18px;
    font-size: 15px;
    line-height: 1.45;
}

.hcs-map__popup .leaflet-popup-content strong {
    color: var(--hcs-map-name);
    font-weight: 700;
}

.hcs-map__popup .leaflet-popup-tip {
    box-shadow: none;
}

/* --- Lista --- */

.hcs-map__list {
    --hcs-map-cols: 2;
    list-style: none;
    display: grid;
    grid-template-columns: repeat(var(--hcs-map-cols), minmax(0, 1fr));
    gap: 12px;
    padding: 0;
    margin: 0;
}

.hcs-map__item {
    margin: 0;
    padding: 0;
}

.hcs-map .hcs-map__item-btn {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    padding: 14px 16px;
    text-align: left;
    background: var(--hcs-map-item-bg);
    border: 2px solid transparent !important;
    border-radius: 12px;
    color: var(--hcs-map-text);
    font: inherit;
    font-size: 16px;
    line-height: 1.4;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.hcs-map .hcs-map__item-btn:hover,
.hcs-map .hcs-map__item-btn:focus,
.hcs-map .hcs-map__item.is-active .hcs-map__item-btn {
    border-color: var(--hcs-map-name) !important;
    background: var(--hcs-map-item-bg);
    color: var(--hcs-map-text);
    transform: translateY(-2px);
}

.hcs-map__item-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 17px;
    color: var(--hcs-map-name);
    white-space: normal;
}

.hcs-map__pin {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
}

.hcs-map__item-desc {
    font-size: 14px;
    opacity: 0.8;
    white-space: normal;
    overflow-wrap: anywhere;
}

/* --- Responsive --- */

@media (max-width: 1024px) {
    .hcs-map { gap: 40px; }
}

@media (max-width: 768px) {
    .hcs-map,
    .hcs-map--left {
        flex-direction: column;
        align-items: stretch;
        gap: 30px;
    }

    .hcs-map__map       { order: 1; }
    .hcs-map__locations { order: 2; }

}
