/*
 * Widget "Hotels Map" (includes/elementor/widgets/hotels-map.php).
 * Los valores --fhm-* los sobrescriben los controles de estilo del widget.
 */
.fahana-hotels-map {
    --fhm-height: 520px;
    --fhm-list-width: 25%;
    --fhm-gap: 20px;
    --fhm-item-color: #33251A;
    --fhm-item-bg: transparent;
    --fhm-item-border: #E1DACB;
    --fhm-item-active-color: #FFFFFF;
    --fhm-item-active-bg: #AC613E;
    --fhm-item-active-border: #AC613E;
    --fhm-scrollbar: #AC613E;
    --fhm-item-spacing: 6px;
    --fhm-marker: #AC613E;
    --fhm-marker-active: #33251A;
    --fhm-marker-stroke: #FFFFFF;
    --fhm-marker-size: 9px;
    --fhm-cluster: #33251A;
    --fhm-cluster-text: #FFFFFF;
    --fhm-cta-bg: #AC613E;
    --fhm-cta-color: #FFFFFF;
    --fhm-action: #AC613E;

    display: flex;
    gap: var(--fhm-gap);
    width: 100%;
    height: var(--fhm-height);
}

.fahana-hotels-map--list-right {
    flex-direction: row-reverse;
}

.fahana-hotels-map-canvas {
    position: relative;
    z-index: 0;
    isolation: isolate; /* Encierra los z-index de Google Maps para que no tapen la cabecera. */
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
    overflow: hidden;
}

/* Listado de destinos */
.fahana-hotels-map-list {
    box-sizing: border-box; /* El padding del control no debe desbordar la altura del mapa. */
    display: flex;
    flex-direction: column;
    flex: 0 0 var(--fhm-list-width);
    min-width: 0;
    height: 100%;
}

.fahana-hotels-map-list-title {
    margin: 0 0 12px;
}

.fahana-hotels-map-items {
    position: relative; /* Referencia de offsetTop para el scroll del JS. */
    flex: 1 1 auto;
    margin: 0;
    padding: 0;
    list-style: none;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--fhm-scrollbar) transparent;
}

/* Hueco para la barra solo cuando hay scroll (clase puesta por el JS). */
.fahana-hotels-map-items.is-scrollable {
    padding-right: 8px;
}

.fahana-hotels-map-items::-webkit-scrollbar {
    width: 6px;
}

.fahana-hotels-map-items::-webkit-scrollbar-thumb {
    background: var(--fhm-scrollbar);
    border-radius: 6px;
}

.fahana-hotels-map-items li {
    margin: 0 0 var(--fhm-item-spacing);
    padding: 0;
}

.fahana-hotels-map-items li:last-child {
    margin-bottom: 0;
}

/* Reset de botón: el tema/Elementor aplican estilos globales a <button>. */
.fahana-hotels-map .fahana-hotels-map-item {
    display: block;
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--fhm-item-border);
    border-radius: 4px;
    background: var(--fhm-item-bg);
    color: var(--fhm-item-color);
    font: inherit;
    text-align: left;
    text-transform: none;
    letter-spacing: normal;
    line-height: 1.3;
    white-space: normal;
    cursor: pointer;
    transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}

.fahana-hotels-map .fahana-hotels-map-item:hover,
.fahana-hotels-map .fahana-hotels-map-item:focus-visible,
.fahana-hotels-map .fahana-hotels-map-item.is-active {
    border-color: var(--fhm-item-active-border);
    background: var(--fhm-item-active-bg);
    color: var(--fhm-item-active-color);
}

.fahana-hotels-map .fahana-hotels-map-item:focus-visible {
    outline: 2px solid var(--fhm-item-active-border);
    outline-offset: 2px;
}

/* Marcadores (contenido HTML de los AdvancedMarkerElement) */
.fahana-hotels-map-marker {
    display: block;
    box-sizing: border-box;
    width: calc(var(--fhm-marker-size) * 2);
    height: calc(var(--fhm-marker-size) * 2);
    border: 2px solid var(--fhm-marker-stroke);
    border-radius: 50%;
    background: var(--fhm-marker);
    box-shadow: 0 1px 4px rgba(51, 37, 26, .3);
    cursor: pointer;
    /* Google ancla el contenido por abajo-centro: centrar el círculo en el punto. */
    transform: translateY(50%);
    transition: transform .15s ease, background-color .15s ease;
}

.fahana-hotels-map-marker.is-active {
    background: var(--fhm-marker-active);
    transform: translateY(50%) scale(1.35);
}

.fahana-hotels-map-cluster {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 30px;
    height: 30px;
    border: 2px solid var(--fhm-marker-stroke);
    border-radius: 50%;
    background: var(--fhm-cluster);
    color: var(--fhm-cluster-text);
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transform: translateY(50%);
}

.fahana-hotels-map-cluster.is-medium {
    width: 38px;
    height: 38px;
}

.fahana-hotels-map-cluster.is-large {
    width: 48px;
    height: 48px;
}

/* Popup (InfoWindow de Google sin cabecera), con aspecto de ficha de Google Maps */
.fahana-hotels-map .gm-style .gm-style-iw-c {
    padding: 0;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 7px 1px rgba(0, 0, 0, .3); /* Sombra de las fichas de Google. */
}

.fahana-hotels-map .gm-style .gm-style-iw-d {
    overflow: hidden !important; /* Google fija overflow: scroll en línea. */
    padding: 0;
}

.fahana-hotels-map-popup {
    position: relative;
    width: 280px;
    max-width: 100%;
    color: #202124;
    font-size: 14px;
    line-height: 1.4;
}

/* Reset de <button> para la X de cerrar. */
.fahana-hotels-map .fahana-hotels-map-popup-close {
    position: absolute;
    z-index: 1;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .95);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
    color: #3C4043;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.fahana-hotels-map .fahana-hotels-map-popup-close:hover {
    background: #FFFFFF;
    color: #202124;
}

.fahana-hotels-map-popup-image {
    display: block;
    width: 100%;
    height: 140px;
    object-fit: cover;
}

.fahana-hotels-map-popup-body {
    padding: 12px 16px 14px;
}

.fahana-hotels-map-popup-title {
    margin: 0 0 6px;
    padding-right: 28px; /* Hueco para la X de cerrar si no hay imagen. */
    color: #202124;
    font-size: 18px;
    font-weight: 500;
    line-height: 1.3;
}

.fahana-hotels-map-popup-address {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    margin: 0;
    color: #5F6368;
    font-size: 13px;
    line-height: 1.4;
}

.fahana-hotels-map-popup-address svg {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    margin-top: 1px;
    color: var(--fhm-action);
}

/* Fila de acciones redondas (como "Cómo llegar · Guardar · Compartir"). */
.fahana-hotels-map-popup-actions {
    display: flex;
    justify-content: space-around;
    gap: 8px;
    margin: 12px -16px 0;
    padding: 12px 8px 0;
    border-top: 1px solid #E8EAED;
}

.fahana-hotels-map-popup .fahana-hotels-map-popup-action {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 0;
    color: var(--fhm-action);
    text-align: center;
    text-decoration: none;
}

.fahana-hotels-map-popup-action-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 40px;
    height: 40px;
    border: 1px solid #DADCE0;
    border-radius: 50%;
    background: #FFFFFF;
    color: var(--fhm-action);
    transition: background-color .2s ease, box-shadow .2s ease;
}

.fahana-hotels-map-popup-action.is-primary .fahana-hotels-map-popup-action-icon {
    border-color: var(--fhm-cta-bg);
    background: var(--fhm-cta-bg);
    color: var(--fhm-cta-color);
}

.fahana-hotels-map-popup-action:hover .fahana-hotels-map-popup-action-icon,
.fahana-hotels-map-popup-action:focus-visible .fahana-hotels-map-popup-action-icon {
    box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}

.fahana-hotels-map-popup-action-label {
    overflow: hidden;
    max-width: 100%;
    color: var(--fhm-action);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fahana-hotels-map-popup-action:focus-visible {
    outline: 2px solid var(--fhm-action);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Anillo de foco solo con teclado. */
.fahana-hotels-map-popup a:focus:not(:focus-visible) {
    outline: none;
    box-shadow: none;
}

/* Botones de zoom de Google: protegerlos de los estilos globales de <button>. */
.fahana-hotels-map .gm-style button.gm-control-active {
    padding: 0;
    border-radius: 0;
}

/* Aviso del editor cuando falta la clave de la API. */
.fahana-hotels-map-notice {
    padding: 12px 16px;
    border: 1px dashed #AC613E;
    color: #33251A;
}

/* Móvil / tablet: mapa arriba y listado debajo, como en la referencia. */
@media (max-width: 991px) {
    .fahana-hotels-map,
    .fahana-hotels-map--list-right {
        flex-direction: column;
        height: auto;
    }

    .fahana-hotels-map-canvas {
        flex: 0 0 auto;
        height: var(--fhm-height);
    }

    .fahana-hotels-map-list {
        order: 2;
        flex: 0 0 auto;
        height: auto;
    }

    .fahana-hotels-map-items {
        max-height: 260px;
    }
}
