/* =====================================================
   Elementor Hover Box — Frontend Styles
   Author: Francesco Servillo
   ===================================================== */

/* Wrapper attorno all'intero widget immagine */
.ehb-trigger {
    position: relative;
    display: inline-block; /* si adatta all'immagine */
    width: 100%;
}

/* --------------------------------------------------
   Box principale — fuori dal flusso con position:fixed
   gestito via JS per libertà di posizionamento
   -------------------------------------------------- */
.ehb-box {
    position: fixed;          /* libero dalla gerarchia di clipping */
    z-index: 99999;
    pointer-events: none;
    white-space: normal;
    word-break: break-word;
    line-height: 1.5;
    box-sizing: border-box;

    /* Valori di default (sovrascritti dai selectors di Elementor) */
    background-color: rgba(0, 0, 0, 0.75);
    color: #ffffff;
    padding: 12px 16px;
    border-radius: 6px;
    max-width: 240px;
    font-size: 14px;

    /* Visibilità di default: nascosto */
    visibility: hidden;
    opacity: 0;
    transition: opacity 220ms ease, transform 220ms ease, visibility 0s 220ms;
}

/* Stato visibile */
.ehb-box.ehb-visible {
    visibility: visible;
    opacity: 1;
    transition: opacity 220ms ease, transform 220ms ease, visibility 0s 0s;
}

/* ---- Animazioni ---- */

/* Fade (default) — nessun transform aggiuntivo */
.ehb-anim-fade {
    /* opacity gestita sopra */
}

/* Slide Up */
.ehb-anim-slide-up {
    transform: translateY(6px);
}
.ehb-anim-slide-up.ehb-visible {
    transform: translateY(0);
}

/* Scale */
.ehb-anim-scale {
    transform: scale(0.92);
    transform-origin: center bottom;
}
.ehb-anim-scale.ehb-visible {
    transform: scale(1);
}

/* Nessuna animazione */
.ehb-anim-none {
    transition: none;
}

/* ---- Freccia / caret opzionale ---- */
.ehb-box[data-arrow]::after {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border: 6px solid transparent;
}

/* Posizioni caret (impostato da JS via data-arrow attribute) */
.ehb-box[data-arrow="bottom"]::after {
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    border-top-color: inherit; /* eredita bg-color tramite JS */
}
.ehb-box[data-arrow="top"]::after {
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    border-bottom-color: inherit;
}
.ehb-box[data-arrow="right"]::after {
    right: -12px;
    top: 50%;
    transform: translateY(-50%);
    border-left-color: inherit;
}
.ehb-box[data-arrow="left"]::after {
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    border-right-color: inherit;
}

/* Editor Elementor: mostra il box come anteprima statica */
.elementor-editor-active .ehb-box {
    position: relative !important;
    display: block !important;
    visibility: visible !important;
    opacity: 0.6 !important;
    pointer-events: none;
    margin-top: 8px;
    transition: none !important;
    z-index: auto !important;
}
