/**
 * Visum Image Mapper — Frontend CSS
 * Stili per tutti gli stili popup: tooltip, panel, lightbox, expand
 * + mobile responsive
 */

/* ── Wrapper mappa ────────────────────────────────────────────────────────── */

.vim-map-wrap {
    position: relative;
    display: block;
    width: 100%;
    font-family: inherit;
}

.vim-image-container {
    position: relative;
    display: inline-block;
    width: 100%;
    overflow: hidden;
    line-height: 0;
}

.vim-base-image {
    display: block;
    width: 100%;
    height: auto;
    pointer-events: none;
    user-select: none;
}

/* ── Marker ───────────────────────────────────────────────────────────────── */

.vim-marker {
    position: absolute;
    width:  var(--vim-marker-size, 36px);
    height: var(--vim-marker-size, 36px);
    transform: translate(-50%, -50%);
    background: var(--vim-marker-bg, #6d28d9);
    color:      var(--vim-marker-color, #ffffff);
    border: 2px solid rgba(255,255,255,.6);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 10;
    transition: transform .2s ease, box-shadow .2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

.vim-marker:hover,
.vim-marker.vim-marker-active {
    transform: translate(-50%, -50%) scale(1.15);
    box-shadow: 0 4px 20px rgba(0,0,0,.35);
    z-index: 20;
}

.vim-marker-inner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: calc(var(--vim-marker-size, 36px) * 0.38);
    font-weight: 700;
}

/* Pulse animation per marker dot */
.vim-marker-style-dot .vim-marker-pulse {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid var(--vim-marker-bg, #6d28d9);
    animation: vim-pulse 2s ease-in-out infinite;
    opacity: 0;
}

@keyframes vim-pulse {
    0%   { transform: scale(1);    opacity: .7; }
    100% { transform: scale(1.6);  opacity: 0;  }
}

/* Pin style */
.vim-marker-style-pin {
    border-radius: 50% 50% 50% 0;
    transform: translate(-50%, -100%) rotate(-45deg);
}

.vim-marker-style-pin:hover,
.vim-marker-style-pin.vim-marker-active {
    transform: translate(-50%, -100%) rotate(-45deg) scale(1.15);
}

.vim-marker-style-pin .vim-marker-inner {
    transform: rotate(45deg);
}

.vim-marker-style-pin .vim-marker-inner svg {
    display: none;
}

/* ── Animazioni entrata ───────────────────────────────────────────────────── */

.vim-anim-fade   { animation: vim-fade-in .25s ease forwards; }
.vim-anim-slide  { animation: vim-slide-up .28s ease forwards; }
.vim-anim-scale  { animation: vim-scale-in .25s cubic-bezier(.34,1.56,.64,1) forwards; }
.vim-anim-flip   { animation: vim-flip-in .3s ease forwards; }

@keyframes vim-fade-in    { from { opacity:0; } to { opacity:1; } }
@keyframes vim-slide-up   { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }
@keyframes vim-scale-in   { from { opacity:0; transform:scale(.85); } to { opacity:1; transform:scale(1); } }
@keyframes vim-flip-in    { from { opacity:0; transform:rotateX(-20deg) scale(.9); } to { opacity:1; transform:rotateX(0) scale(1); } }

/* ── Tooltip ──────────────────────────────────────────────────────────────── */

.vim-tooltips-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 30;
}

.vim-tooltip {
    position: absolute;
    pointer-events: all;
    min-width: 200px;
    max-width: 280px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,.18);
    padding: 0;
    overflow: hidden;
    z-index: 40;
    border: 1px solid rgba(0,0,0,.08);
}

.vim-tooltip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #fff;
    border-bottom: none;
}

.vim-tooltip-img img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}

.vim-tooltip-title {
    font-size: 14px;
    font-weight: 700;
    color: #111;
    padding: 12px 14px 4px;
    line-height: 1.3;
}

.vim-tooltip-desc {
    font-size: 13px;
    color: #555;
    padding: 0 14px 10px;
    line-height: 1.5;
}

.vim-tooltip-link {
    display: block;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 600;
    color: var(--vim-marker-bg, #6d28d9);
    text-decoration: none;
    border-top: 1px solid rgba(0,0,0,.06);
    transition: background .15s;
}

.vim-tooltip-link:hover { background: rgba(0,0,0,.04); }

/* ── Pannello laterale ────────────────────────────────────────────────────── */

.vim-map-wrap { display: flex; }
.vim-image-container { flex: 1; min-width: 0; }

.vim-panel {
    width: 0;
    overflow: hidden;
    transition: width .35s cubic-bezier(.77,0,.18,1);
    background: #fff;
    box-shadow: inset 2px 0 12px rgba(0,0,0,.06);
    position: relative;
    flex-shrink: 0;
}

.vim-panel-open { width: 300px; }

.vim-map-wrap.vim-panel-left  .vim-panel { order: -1; box-shadow: inset -2px 0 12px rgba(0,0,0,.06); }
.vim-map-wrap.vim-panel-bottom { flex-direction: column; }
.vim-map-wrap.vim-panel-bottom .vim-panel { width: 100%; height: 0; }
.vim-map-wrap.vim-panel-bottom .vim-panel.vim-panel-open { width: 100%; height: auto; min-height: 200px; }

.vim-panel-close {
    position: absolute;
    top: 12px; right: 12px;
    background: rgba(0,0,0,.08);
    border: none;
    border-radius: 50%;
    width: 28px; height: 28px;
    cursor: pointer;
    font-size: 14px;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s;
    z-index: 2;
}

.vim-panel-close:hover { background: rgba(0,0,0,.15); }

.vim-panel-inner { padding: 20px; }

.vim-panel-slide { animation: vim-fade-in .2s ease; }

.vim-panel-img img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 14px;
    display: block;
}

.vim-panel-title {
    font-size: 18px;
    font-weight: 700;
    color: #111;
    margin: 0 0 8px;
    line-height: 1.3;
}

.vim-panel-desc {
    font-size: 14px;
    color: #555;
    line-height: 1.6;
    margin-bottom: 14px;
}

.vim-panel-link {
    display: inline-block;
    padding: 8px 18px;
    background: var(--vim-marker-bg, #6d28d9);
    color: var(--vim-marker-color, #fff) !important;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: opacity .2s;
}

.vim-panel-link:hover { opacity: .85; }

/* ── Lightbox ─────────────────────────────────────────────────────────────── */

.vim-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99990;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.vim-lightbox.vim-lb-open { display: flex; }

.vim-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.8);
    backdrop-filter: blur(4px);
}

.vim-lightbox-box {
    position: relative;
    background: #fff;
    border-radius: 16px;
    max-width: 640px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 1;
    box-shadow: 0 24px 64px rgba(0,0,0,.4);
}

.vim-lightbox-close {
    position: absolute;
    top: 14px; right: 14px;
    background: rgba(0,0,0,.1);
    border: none;
    border-radius: 50%;
    width: 32px; height: 32px;
    cursor: pointer;
    font-size: 16px;
    display: flex; align-items: center; justify-content: center;
    z-index: 2;
    transition: background .15s;
}

.vim-lightbox-close:hover { background: rgba(0,0,0,.2); }

.vim-lightbox-img img {
    width: 100%;
    height: 260px;
    object-fit: cover;
    display: block;
    border-radius: 16px 16px 0 0;
}

.vim-lightbox-content { padding: 24px; }

.vim-lightbox-title {
    font-size: 22px;
    font-weight: 700;
    color: #111;
    margin: 0 0 12px;
}

.vim-lightbox-desc {
    font-size: 15px;
    color: #555;
    line-height: 1.7;
    margin-bottom: 20px;
}

.vim-lightbox-link {
    display: inline-block;
    padding: 10px 24px;
    background: var(--vim-marker-bg, #6d28d9);
    color: var(--vim-marker-color, #fff) !important;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: opacity .2s;
}

.vim-lightbox-link:hover { opacity: .85; }

/* ── Expand inline ────────────────────────────────────────────────────────── */

.vim-expand-popup {
    position: absolute;
    z-index: 30;
    min-width: 220px;
    max-width: 300px;
    pointer-events: all;
}

.vim-expand-inner {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,.2);
    overflow: hidden;
    border: 1px solid rgba(0,0,0,.08);
    position: relative;
}

.vim-expand-close {
    position: absolute;
    top: 8px; right: 8px;
    background: rgba(0,0,0,.08);
    border: none;
    border-radius: 50%;
    width: 24px; height: 24px;
    cursor: pointer;
    font-size: 12px;
    display: flex; align-items: center; justify-content: center;
}

.vim-expand-content { padding: 14px; }

/* ── Mobile: lista verticale ──────────────────────────────────────────────── */

.vim-mobile-list { display: none; }

@media (max-width: 768px) {
    /* Nascondi marker su mobile */
    .vim-marker { display: none; }
    .vim-tooltips-layer,
    .vim-panel,
    .vim-lightbox { display: none !important; }

    /* Layout mappa: solo immagine */
    .vim-map-wrap {
        flex-direction: column;
        display: block;
    }

    /* Lista mobile visibile */
    .vim-mobile-list {
        display: flex;
        flex-direction: column;
        gap: 12px;
        margin-top: 16px;
    }

    .vim-mobile-item {
        display: flex;
        gap: 14px;
        align-items: flex-start;
        background: #f9fafb;
        border: 1px solid #e5e7eb;
        border-radius: 10px;
        padding: 14px;
    }

    .vim-mobile-num {
        width: 28px;
        height: 28px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 12px;
        font-weight: 700;
        flex-shrink: 0;
    }

    .vim-mobile-content { flex: 1; min-width: 0; }

    .vim-mobile-img {
        width: 100%;
        height: 120px;
        object-fit: cover;
        border-radius: 6px;
        margin-bottom: 8px;
        display: block;
    }

    .vim-mobile-title {
        display: block;
        font-size: 15px;
        font-weight: 700;
        color: #111;
        margin-bottom: 4px;
    }

    .vim-mobile-desc {
        font-size: 13px;
        color: #555;
        line-height: 1.5;
        margin-bottom: 8px;
    }

    .vim-mobile-link {
        font-size: 12px;
        font-weight: 600;
        color: var(--vim-marker-bg, #6d28d9);
        text-decoration: none;
    }
}
