/* ==========================================================================
   Beck Hotspot Map V2 - Styles
   ========================================================================== */

/* Elementor wrapper overrides – must come first so they are not overridden.
   Both the widget element and its inner container must allow overflow so
   the popups (which still live in the DOM here before JS teleports them)
   are never clipped during a flash-of-uninitialized-content. */
.elementor-widget-beck_hotspot_map_v2,
.elementor-widget-beck_hotspot_map_v2 .elementor-widget-container {
    overflow: visible !important;
}

/* Forzar overflow:visible en todos los ancestros Elementor que contengan el mapa,
   para que el popup no quede recortado por columnas/secciones. */
.elementor-element:has(.beck-hotspot-map),
.e-con:has(.beck-hotspot-map),
.elementor-column:has(.beck-hotspot-map) {
    overflow: visible !important;
}

/* Map wrapper – overflow:visible so children (popups) are never clipped
   here. The canvas below is the only element that clips. */
.beck-hotspot-map {
    position: relative;
    display: block;
    width: 100%;
    box-sizing: border-box;
    line-height: 0;
    user-select: none;
    --beck-popup-image-direction: column;
    --beck-popup-image-width: 100%;
    --beck-popup-image-min-width: 0;
    --beck-popup-image-height: 140px;
    --beck-popup-image-render-height: var(--beck-popup-image-height);
}

.beck-hotspot-map.beck-popup-image-pos-top {
    --beck-popup-image-direction: column;
    --beck-popup-image-width: 100%;
    --beck-popup-image-min-width: 0;
    --beck-popup-image-render-height: var(--beck-popup-image-height);
}

.beck-hotspot-map.beck-popup-image-pos-bottom {
    --beck-popup-image-direction: column-reverse;
    --beck-popup-image-width: 100%;
    --beck-popup-image-min-width: 0;
    --beck-popup-image-render-height: var(--beck-popup-image-height);
}

.beck-hotspot-map.beck-popup-image-pos-left {
    --beck-popup-image-direction: row;
    --beck-popup-image-width: 42%;
    --beck-popup-image-min-width: 110px;
    --beck-popup-image-render-height: auto;
}

.beck-hotspot-map.beck-popup-image-pos-right {
    --beck-popup-image-direction: row-reverse;
    --beck-popup-image-width: 42%;
    --beck-popup-image-min-width: 110px;
    --beck-popup-image-render-height: auto;
}

.beck-hotspot-map * {
    box-sizing: border-box;
}

/* Canvas – overflow:visible para que los popups (hijos de .beck-hotspot-point)
   no queden recortados. La imagen define visualmente los bordes del mapa. */
.beck-hotspot-map__canvas {
    position: relative;
    display: block;
    width: 100%;
    overflow: visible;
}

/* Background image */
.beck-hotspot-map__image {
    display: block;
    width: 100%;
    height: 100%;
    min-height: inherit;
    object-fit: cover;
    object-position: center center;
    pointer-events: none;
}

/* Hotspot point wrapper (inside canvas) */
.beck-hotspot-point {
    position: absolute;
    transform: translate(-50%, -50%);
    z-index: 50;
    line-height: 1;
}

.beck-hotspot-point.is-open {
    z-index: 1000;
}

/* Dot button */
.beck-hotspot-dot {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background-color: #F5C800;
    border: none;
    cursor: pointer;
    padding: 0;
    outline: none;
    z-index: 1;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.beck-hotspot-dot:hover,
.beck-hotspot-dot[aria-expanded="true"] {
    transform: scale(1.15);
    box-shadow: 0 0 0 4px rgba(245, 200, 0, 0.35);
}

.beck-hotspot-dot__label {
    position: relative;
    z-index: 1;
    font-size: 10px;
    font-weight: 700;
    color: #2B2B2B;
    line-height: 1;
    pointer-events: none;
}

/* Pulse ring */
.beck-hotspot-dot__pulse {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background-color: #F5C800;
    animation: beck-hotspot-pulse 2s ease-out infinite;
    z-index: 0;
    pointer-events: none;
}

@keyframes beck-hotspot-pulse {
    0%   { transform: scale(1);   opacity: 0.7; }
    70%  { transform: scale(2.4); opacity: 0;   }
    100% { transform: scale(2.4); opacity: 0;   }
}

/* ==========================================================================
   Popup
   --------------------------------------------------------------------------
   position:absolute relativo a .beck-hotspot-point (su containing block).
   La dirección de apertura se controla con atributos CSS en .beck-hotspot-point;
   JS sólo necesita añadir/quitar la clase is-open y resolver "auto".
   ========================================================================== */
.beck-hotspot-popup {
    position: absolute;
    z-index: 10;
    display: flex;
    flex-direction: var(--beck-popup-image-direction);
    width: 280px;
    background: #ffffff;
    border-radius: 4px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    line-height: normal;
    transition: opacity 0.2s ease, transform 0.2s ease;
    /* Dirección por defecto: abajo del punto */
    top: calc(100% + 14px);
    left: 50%;
    transform: translateX(-50%) scale(0.92);
    transform-origin: top center;
}

.beck-hotspot-popup.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) scale(1);
}

/* --- Dirección: bottom (explícita, igual que la por defecto) --- */
.beck-hotspot-point[data-direction="bottom"] .beck-hotspot-popup,
.beck-hotspot-point[data-resolved-direction="bottom"] .beck-hotspot-popup {
    top: calc(100% + 14px);
    bottom: auto;
    left: 50%;
    right: auto;
    transform: translateX(-50%) scale(0.92);
    transform-origin: top center;
}
.beck-hotspot-point[data-direction="bottom"] .beck-hotspot-popup.is-open,
.beck-hotspot-point[data-resolved-direction="bottom"] .beck-hotspot-popup.is-open {
    transform: translateX(-50%) scale(1);
}

/* --- Dirección: top --- */
.beck-hotspot-point[data-direction="top"] .beck-hotspot-popup,
.beck-hotspot-point[data-resolved-direction="top"] .beck-hotspot-popup {
    top: auto;
    bottom: calc(100% + 14px);
    left: 50%;
    right: auto;
    transform: translateX(-50%) scale(0.92);
    transform-origin: bottom center;
}
.beck-hotspot-point[data-direction="top"] .beck-hotspot-popup.is-open,
.beck-hotspot-point[data-resolved-direction="top"] .beck-hotspot-popup.is-open {
    transform: translateX(-50%) scale(1);
}

/* --- Dirección: right --- */
.beck-hotspot-point[data-direction="right"] .beck-hotspot-popup,
.beck-hotspot-point[data-resolved-direction="right"] .beck-hotspot-popup {
    top: 50%;
    bottom: auto;
    left: calc(100% + 14px);
    right: auto;
    transform: translateY(-50%) scale(0.92);
    transform-origin: left center;
}
.beck-hotspot-point[data-direction="right"] .beck-hotspot-popup.is-open,
.beck-hotspot-point[data-resolved-direction="right"] .beck-hotspot-popup.is-open {
    transform: translateY(-50%) scale(1);
}

/* --- Dirección: left --- */
.beck-hotspot-point[data-direction="left"] .beck-hotspot-popup,
.beck-hotspot-point[data-resolved-direction="left"] .beck-hotspot-popup {
    top: 50%;
    bottom: auto;
    left: auto;
    right: calc(100% + 14px);
    transform: translateY(-50%) scale(0.92);
    transform-origin: right center;
}
.beck-hotspot-point[data-direction="left"] .beck-hotspot-popup.is-open,
.beck-hotspot-point[data-resolved-direction="left"] .beck-hotspot-popup.is-open {
    transform: translateY(-50%) scale(1);
}

/* --- Dirección: custom (dirección y gap resueltos por JS según breakpoints de Elementor) --- */
/* JS lee data-custom-dirs / data-custom-gaps desde el punto y data-beck-bps desde el mapa.
   Escribe data-custom-direction (la dirección resuelta para el viewport actual) y
   --beck-popup-gap (inline) en tiempo real, incluyendo al redimensionar la ventana.
   CSS sólo necesita los 4 bloques estáticos de posicionamiento. */

.beck-hotspot-point[data-direction="custom"],
.beck-hotspot-point[data-resolved-direction="custom"] {
    --beck-popup-gap: 50px; /* fallback hasta que JS aplique el valor correcto */
}

/* custom + bottom */
.beck-hotspot-point[data-direction="custom"][data-custom-direction="bottom"] .beck-hotspot-popup,
.beck-hotspot-point[data-resolved-direction="custom"][data-custom-direction="bottom"] .beck-hotspot-popup {
    top: calc(100% + var(--beck-popup-gap, 50px));
    bottom: auto; left: 50%; right: auto;
    transform: translateX(-50%) scale(0.92);
    transform-origin: top center;
}
.beck-hotspot-point[data-direction="custom"][data-custom-direction="bottom"] .beck-hotspot-popup.is-open,
.beck-hotspot-point[data-resolved-direction="custom"][data-custom-direction="bottom"] .beck-hotspot-popup.is-open {
    transform: translateX(-50%) scale(1);
}

/* custom + top */
.beck-hotspot-point[data-direction="custom"][data-custom-direction="top"] .beck-hotspot-popup,
.beck-hotspot-point[data-resolved-direction="custom"][data-custom-direction="top"] .beck-hotspot-popup {
    top: auto;
    bottom: calc(100% + var(--beck-popup-gap, 50px));
    left: 50%; right: auto;
    transform: translateX(-50%) scale(0.92);
    transform-origin: bottom center;
}
.beck-hotspot-point[data-direction="custom"][data-custom-direction="top"] .beck-hotspot-popup.is-open,
.beck-hotspot-point[data-resolved-direction="custom"][data-custom-direction="top"] .beck-hotspot-popup.is-open {
    transform: translateX(-50%) scale(1);
}

/* custom + right */
.beck-hotspot-point[data-direction="custom"][data-custom-direction="right"] .beck-hotspot-popup,
.beck-hotspot-point[data-resolved-direction="custom"][data-custom-direction="right"] .beck-hotspot-popup {
    top: 50%; bottom: auto;
    left: calc(100% + var(--beck-popup-gap, 50px));
    right: auto;
    transform: translateY(-50%) scale(0.92);
    transform-origin: left center;
}
.beck-hotspot-point[data-direction="custom"][data-custom-direction="right"] .beck-hotspot-popup.is-open,
.beck-hotspot-point[data-resolved-direction="custom"][data-custom-direction="right"] .beck-hotspot-popup.is-open {
    transform: translateY(-50%) scale(1);
}

/* custom + left */
.beck-hotspot-point[data-direction="custom"][data-custom-direction="left"] .beck-hotspot-popup,
.beck-hotspot-point[data-resolved-direction="custom"][data-custom-direction="left"] .beck-hotspot-popup {
    top: 50%; bottom: auto; left: auto;
    right: calc(100% + var(--beck-popup-gap, 50px));
    transform: translateY(-50%) scale(0.92);
    transform-origin: right center;
}
.beck-hotspot-point[data-direction="custom"][data-custom-direction="left"] .beck-hotspot-popup.is-open,
.beck-hotspot-point[data-resolved-direction="custom"][data-custom-direction="left"] .beck-hotspot-popup.is-open {
    transform: translateY(-50%) scale(1);
}

/* Popup image container */
.beck-hotspot-popup__image {
    width: var(--beck-popup-image-width);
    min-width: var(--beck-popup-image-min-width);
    height: var(--beck-popup-image-render-height);
    flex-shrink: 0;
    overflow: hidden;
    line-height: 0;
}

.beck-hotspot-popup__image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Popup body */
.beck-hotspot-popup__body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

/* Header row: badge + heading block */
.beck-hotspot-popup__header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.beck-hotspot-popup__badge {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 700;
    color: #2B2B2B;
    line-height: 1.4;
    padding-top: 2px;
}

.beck-hotspot-popup__heading {
    flex: 1;
}

.beck-hotspot-popup__title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
    text-transform: uppercase;
    color: #1a1a1a;
}

.beck-hotspot-popup__subtitle {
    margin: 0;
    font-size: 14px;
    font-style: italic;
    font-weight: 400;
    line-height: 1.3;
    color: #1a1a1a;
}

/* Description */
.beck-hotspot-popup__description {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: #555555;
}

/* CTA Button */
.beck-hotspot-popup__btn {
    display: inline-block;
    align-self: flex-start;
    padding: 8px 20px;
    background: #ffffff;
    color: #2B2B2B;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid #cccccc;
    border-radius: 3px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    margin-top: 4px;
}

.beck-hotspot-popup__btn:hover {
    background-color: #F5C800;
    color: #2B2B2B;
    border-color: #F5C800;
}

/* Close button */
.beck-hotspot-popup__close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.85);
    border: none;
    border-radius: 50%;
    font-size: 12px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    color: #2B2B2B;
    z-index: 5;
    transition: background 0.15s ease;
}

.beck-hotspot-popup__close:hover {
    background: #eeeeee;
}

/* Mobile */
@media (max-width: 600px) {
    .beck-hotspot-popup {
        width: min(280px, calc(100vw - 32px));
    }
}

@media (max-width: 1024px) {
    .beck-hotspot-map.beck-popup-image-pos-tablet-top {
        --beck-popup-image-direction: column;
        --beck-popup-image-width: 100%;
        --beck-popup-image-min-width: 0;
        --beck-popup-image-render-height: var(--beck-popup-image-height);
    }

    .beck-hotspot-map.beck-popup-image-pos-tablet-bottom {
        --beck-popup-image-direction: column-reverse;
        --beck-popup-image-width: 100%;
        --beck-popup-image-min-width: 0;
        --beck-popup-image-render-height: var(--beck-popup-image-height);
    }

    .beck-hotspot-map.beck-popup-image-pos-tablet-left {
        --beck-popup-image-direction: row;
        --beck-popup-image-width: 42%;
        --beck-popup-image-min-width: 110px;
        --beck-popup-image-render-height: auto;
    }

    .beck-hotspot-map.beck-popup-image-pos-tablet-right {
        --beck-popup-image-direction: row-reverse;
        --beck-popup-image-width: 42%;
        --beck-popup-image-min-width: 110px;
        --beck-popup-image-render-height: auto;
    }
}

@media (max-width: 767px) {
    .beck-hotspot-map.beck-popup-image-pos-mobile-top {
        --beck-popup-image-direction: column;
        --beck-popup-image-width: 100%;
        --beck-popup-image-min-width: 0;
        --beck-popup-image-render-height: var(--beck-popup-image-height);
    }

    .beck-hotspot-map.beck-popup-image-pos-mobile-bottom {
        --beck-popup-image-direction: column-reverse;
        --beck-popup-image-width: 100%;
        --beck-popup-image-min-width: 0;
        --beck-popup-image-render-height: var(--beck-popup-image-height);
    }

    .beck-hotspot-map.beck-popup-image-pos-mobile-left {
        --beck-popup-image-direction: row;
        --beck-popup-image-width: 42%;
        --beck-popup-image-min-width: 110px;
        --beck-popup-image-render-height: auto;
    }

    .beck-hotspot-map.beck-popup-image-pos-mobile-right {
        --beck-popup-image-direction: row-reverse;
        --beck-popup-image-width: 42%;
        --beck-popup-image-min-width: 110px;
        --beck-popup-image-render-height: auto;
    }
}
