@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600&display=swap');

.mh-wrap {
    position: relative;
    width: 100%;
    max-width: 100%;
    min-width: 0; /* evita que un padre flex/grid del tema fuerce el ancho del widget según su contenido */
    box-sizing: border-box;
    font-family: 'Manrope', sans-serif;
    background: #151515;
    border-radius: 12px;
    overflow: hidden;
    user-select: none;
}
/* Reset de box-sizing acotado al widget, para que paddings/bordes no sumen
   ancho extra y rompan el cálculo de las grillas/columnas internas. */
.mh-wrap *,
.mh-wrap *::before,
.mh-wrap *::after {
    box-sizing: border-box;
}

/* ── Stage ───────────────────────────────────────────────────────────────── */
.mh-stage {
    position: relative;
    width: 100%;
    /* 16:9 = ratio real de las imágenes (1920x1080). Antes era 16/7, lo que
       obligaba a "cover" a recortar arriba/abajo. Con el ratio exacto no hay
       recorte y además los hotspots quedan alineados igual que en el editor. */
    aspect-ratio: 16 / 9;
    min-width: 0;
    overflow: hidden;
}
.mh-view {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity .65s ease;
    pointer-events: none;
}
.mh-view.active { opacity: 1; pointer-events: auto; }
.mh-view img    { width: 100%; height: 100%; object-fit: cover; display: block; }
.mh-stage::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(21,21,21,.6) 0%, transparent 50%);
    pointer-events: none;
    z-index: 5;
}

/* ── Badge ───────────────────────────────────────────────────────────────── */
.mh-badge {
    position: absolute;
    top: 12px; right: 14px;
    background: rgba(21,21,21,.75);
    color: #fff;
    font-family: 'Manrope', sans-serif;
    font-size: 11px; font-weight: 500;
    padding: 5px 12px;
    border-radius: 20px;
    z-index: 20;
    pointer-events: none;
    letter-spacing: .04em;
    text-transform: uppercase;
    border: 1px solid rgba(255,255,255,.12);
}

/* ── Hotspots ────────────────────────────────────────────────────────────── */
.mh-hs {
    position: absolute;
    width: 50px; height: 50px;
    background: #fff;
    border: 2px solid rgba(255,255,255,.25);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 15;
    transform: translate(-50%, -50%);
    transition: transform .15s, background .15s;
    box-shadow: 0 2px 14px rgba(0,0,0,.5);
    animation: mh-pulse 2.8s infinite;
}
.mh-hs:hover { background: #e8e8e8; transform: translate(-50%,-50%) scale(1.1); animation: none; }
.mh-hs svg { width: 22px; height: 22px; fill: none; stroke: #151515; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mh-hs img.hs-icon { width: 26px; height: 26px; object-fit: contain; display: block; }

@keyframes mh-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(255,255,255,.55); }
    65%  { box-shadow: 0 0 0 12px rgba(255,255,255,0); }
    100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); }
}

.mh-hs-label {
    position: absolute;
    bottom: 56px; left: 50%;
    transform: translateX(-50%);
    background: #151515;
    color: #fff;
    font-family: 'Manrope', sans-serif;
    font-size: 11px; font-weight: 500;
    padding: 5px 11px;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity .15s;
    border: 1px solid rgba(255,255,255,.12);
    z-index: 1;
}
.mh-hs:hover .mh-hs-label { opacity: 1; }

/* ── Selector de vistas ──────────────────────────────────────────────────── */
.mh-angles {
    /* Grid en vez de flex: con flex+min-width, si el widget queda en un
       contenedor angosto el navegador puede agrandar TODO el ancho del
       widget en vez de bajar los botones de línea (overflow del padre).
       Con grid + minmax el ancho del track está acotado por el propio
       contenedor, así que siempre wrappea hacia abajo, nunca desborda. */
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 8px;
    padding: 12px 16px;
    background: #151515;
    border-top: 1px solid rgba(255,255,255,.08);
    min-width: 0;
}
.mh-ang-btn {
    width: 100%;
    min-width: 0;
    padding: 9px 8px;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 8px;
    color: rgba(255,255,255,.45);
    font-family: 'Manrope', sans-serif;
    font-size: 12px; font-weight: 500;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
    letter-spacing: .01em;
    text-align: center;
    overflow-wrap: break-word;
    word-break: break-word;
}
.mh-ang-btn:hover  { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.2); }
.mh-ang-btn.active { background: #fff; border-color: #fff; color: #151515; }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.mh-modal-bg {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.85);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.mh-modal-bg.open { display: flex; }

.mh-modal {
    background: #151515;
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 14px;
    width: 100%;
    max-width: 500px;
    overflow: hidden;
    position: relative;
    animation: mh-modal-in .2s ease;
}
@keyframes mh-modal-in {
    from { opacity: 0; transform: scale(.96) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.mh-modal-media {
    width: 100%;
    aspect-ratio: 16/9;
    overflow: hidden;
    background: #000;
}
.mh-modal-media img   { width: 100%; height: 100%; object-fit: cover; display: block; }
.mh-modal-media video { width: 100%; height: 100%; object-fit: cover; object-position: center bottom; display: block; }

.mh-modal-body { padding: 20px 22px 24px; }

.mh-modal-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.12);
    color: rgba(255,255,255,.5);
    font-family: 'Manrope', sans-serif;
    font-size: 11px; font-weight: 500;
    padding: 3px 10px;
    border-radius: 20px;
    margin-bottom: 12px;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.mh-modal-title {
    font-family: 'Manrope', sans-serif;
    font-size: 18px; font-weight: 600;
    color: #fff;
    margin-bottom: 10px;
    line-height: 1.3;
}
.mh-modal-desc {
    font-family: 'Manrope', sans-serif;
    font-size: 13px;
    color: rgba(255,255,255,.5);
    line-height: 1.7;
}
.mh-modal-close-x {
    position: absolute;
    top: 12px; right: 12px;
    width: 32px; height: 32px;
    background: rgba(21,21,21,.72);
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    z-index: 10;
}
.mh-modal-close-x:hover { background: #151515; }
.mh-modal-close-x svg { width: 14px; height: 14px; fill: none; stroke: #fff; stroke-width: 2.5; stroke-linecap: round; }

/* ── Navegación tipo tour 360° (flechas curvas) ─────────────────────────── */
.mh-tour-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 56px; height: 56px;
    cursor: pointer;
    z-index: 16;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .18s ease;
}
.mh-tour-nav-prev { left: 18px; }
.mh-tour-nav-next { right: 18px; }
.mh-tour-nav:hover { transform: translateY(-50%) scale(1.1); }

.mh-tour-nav-circle {
    fill: rgba(21,21,21,.45);
    stroke: rgba(255,255,255,.3);
    stroke-width: 1.5;
    transition: fill .18s, stroke .18s;
}
.mh-tour-nav:hover .mh-tour-nav-circle {
    fill: rgba(21,21,21,.75);
    stroke: rgba(255,255,255,.55);
}
.mh-tour-nav-arc {
    fill: none;
    stroke: rgba(255,255,255,.85);
    stroke-width: 2.5;
    stroke-linecap: round;
}
.mh-tour-nav-tip { fill: rgba(255,255,255,.85); }

.mh-tour-nav-tooltip {
    position: absolute;
    bottom: 66px;
    left: 50%;
    transform: translateX(-50%);
    background: #151515;
    color: #fff;
    font-family: 'Manrope', sans-serif;
    font-size: 11px; font-weight: 500;
    padding: 5px 11px;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity .15s;
    border: 1px solid rgba(255,255,255,.12);
}
.mh-tour-nav:hover .mh-tour-nav-tooltip { opacity: 1; }

@media (max-width: 640px) {
    .mh-tour-nav { width: 44px; height: 44px; }
    .mh-tour-nav svg { width: 44px; height: 44px; }
    .mh-tour-nav-prev { left: 10px; }
    .mh-tour-nav-next { right: 10px; }

    .mh-angles {
        grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
        gap: 6px;
        padding: 10px 12px;
    }
    .mh-ang-btn {
        font-size: 11px;
        padding: 8px 6px;
    }
}

@media (max-width: 380px) {
    /* Por debajo de esto, forzamos 2 columnas fijas: más prolijo que dejar
       que auto-fit decida con celdas muy angostas. */
    .mh-angles {
        grid-template-columns: repeat(2, 1fr);
    }
}
