/* VR360 Tour — viewer Marzipano + menu + side-panel + hotspots
   Portage 1:1 du module PrestaShop vlvirtualtour (Veloland). */

.vr360-shell,
.vr360-shell * {
    box-sizing: border-box;
}

.vr360-shell {
    position: relative;
    width: 100%;
    margin: 0 auto;
    background: #111;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    height: var(--vr360-height, 600px);
}

.vr360-shell .vr360-menu-toggle,
.vr360-shell .vr360-fullscreen-toggle,
.vr360-shell .vr360-close {
    font-family: inherit;
    line-height: 1;
    min-width: 0;
    min-height: 0;
    margin: 0;
    text-transform: none;
    letter-spacing: normal;
}
.vr360-shell .vr360-menu-toggle svg,
.vr360-shell .vr360-fullscreen-toggle svg,
.vr360-shell .vr360-close svg {
    display: block;
}
.vr360-viewer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: #111;
}

/* ===== Placeholder lazy-load (preview.webp + bouton Démarrer) ===== */
.vr360-placeholder {
    position: absolute;
    inset: 0;
    z-index: 5;
    cursor: pointer;
    overflow: hidden;
    background: #111;
}
.vr360-placeholder__media {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}
.vr360-placeholder:hover .vr360-placeholder__media {
    transform: scale(1.02);
}
.vr360-shell .vr360-start {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 26px;
    border: 0;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.78);
    color: #fff;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    transition: background 0.15s, transform 0.15s;
    z-index: 6;
}
.vr360-shell .vr360-start:hover,
.vr360-shell .vr360-start:focus-visible {
    background: #2563eb;
    transform: translate(-50%, -50%) scale(1.04);
    outline: none;
}
.vr360-shell .vr360-start[disabled] {
    opacity: 0.7;
    cursor: wait;
}
.vr360-shell.is-loading .vr360-start span::after {
    content: '…';
}
.vr360-shell.is-loaded .vr360-placeholder {
    display: none;
}
@media (max-width: 480px) {
    .vr360-shell .vr360-start {
        padding: 11px 18px;
        font-size: 13px;
        gap: 8px;
    }
    .vr360-shell .vr360-start svg { width: 16px; height: 16px; }
}

/* Cache les contrôles tant que Marzipano n'est pas booté. */
.vr360-shell:not(.is-loaded) .vr360-menu-toggle,
.vr360-shell:not(.is-loaded) .vr360-fullscreen-toggle,
.vr360-shell:not(.is-loaded) .vr360-menu,
.vr360-shell:not(.is-loaded) .vr360-side-panel,
.vr360-shell:not(.is-loaded) .vr360-legend {
    display: none !important;
}

/* ===== Menu / Fullscreen toggles ===== */
.vr360-shell .vr360-menu-toggle,
.vr360-shell .vr360-fullscreen-toggle {
    position: absolute;
    top: 12px;
    z-index: 10;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    flex-shrink: 0;
}
.vr360-menu-toggle { left: 12px; }
.vr360-fullscreen-toggle { right: 12px; }
.vr360-shell:has(.vr360-side-panel.is-open) .vr360-fullscreen-toggle {
    visibility: hidden;
}
.vr360-menu-toggle:hover,
.vr360-menu-toggle:focus-visible,
.vr360-fullscreen-toggle:hover,
.vr360-fullscreen-toggle:focus-visible {
    background: rgba(0, 0, 0, 0.85);
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.vr360-shell.is-fullscreen {
    width: 100vw;
    height: 100vh;
    max-width: none;
    max-height: none;
    border-radius: 0;
}

/* ===== Menu scènes (drawer gauche) ===== */
.vr360-menu {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px;
    max-width: 80%;
    background: rgba(20, 20, 20, 0.95);
    color: #fff;
    padding: 60px 16px 16px;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 8;
}
.vr360-menu--open .vr360-menu {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5);
}
.vr360-menu__title {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #aaa;
    margin: 0 0 12px;
}
.vr360-menu-list { list-style: none; margin: 0; padding: 0; }
.vr360-menu-list li { margin: 0 0 8px; }

.vr360-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 6px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s, border-color 0.15s;
}
.vr360-menu-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.3);
}
.vr360-menu-item.is-active {
    background: rgba(255, 255, 255, 0.14);
    border-color: #fff;
}
.vr360-menu-item img {
    width: 64px;
    height: 36px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}
.vr360-menu-item__label {
    font-size: 0.9rem;
    line-height: 1.2;
}

/* ===== Side-panel (info hotspot) ===== */
.vr360-side-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 360px;
    max-width: 90%;
    background: #fff;
    color: #222;
    padding: 24px;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    z-index: 9;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.2);
}
.vr360-side-panel.is-open {
    transform: translateX(0);
}
.vr360-close {
    position: absolute;
    top: 12px;
    right: 12px;
    height: 36px;
    padding: 0 14px 0 12px;
    border: 0;
    background: #111;
    color: #fff;
    border-radius: 18px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    transition: background 0.15s, transform 0.1s;
    z-index: 2;
}
.vr360-close:hover,
.vr360-close:focus-visible {
    background: #2563eb;
    outline: none;
    transform: translateY(-1px);
}
.vr360-panel__title {
    font-size: 1.25rem;
    margin: 56px 0 12px 0;
    color: #111;
}
.vr360-panel__body {
    font-size: 0.95rem;
    line-height: 1.5;
    color: #444;
}
.vr360-panel__body img { max-width: 100%; border-radius: 6px; }

/* Boutons "Voir" — lien externe optionnel */
.vr360-panel__links {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}
.vr360-panel__link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #2563eb;
    color: #fff !important;
    text-decoration: none !important;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background 0.15s, transform 0.1s;
}
.vr360-panel__link-btn::after {
    content: '→';
    margin-left: 8px;
    transition: transform 0.15s;
}
.vr360-panel__link-btn:hover,
.vr360-panel__link-btn:focus-visible {
    background: #1d4ed8;
    transform: translateX(2px);
    outline: none;
}

/* ===== Légende ===== */
.vr360-legend {
    position: absolute;
    top: 68px;
    right: 12px;
    z-index: 9;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.2;
    backdrop-filter: blur(6px);
    pointer-events: none;
    max-width: 200px;
}
.vr360-legend__item { display: flex; align-items: center; gap: 8px; }
.vr360-legend__dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #fff;
    flex-shrink: 0;
    box-sizing: content-box;
}
.vr360-legend__dot--info { background: #fff; }
.vr360-legend__dot--direction { background: #2563eb; }
.vr360-legend__dot--link { background: #ff9100; }
@media (max-width: 480px) { .vr360-legend { display: none; } }

/* ===== Hotspots (chip = dot + label) ===== */
.vr360-hotspot {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.78);
    color: #fff;
    border: 2px solid #fff;
    border-radius: 999px;
    padding: 6px 16px 6px 6px;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    transition: transform 0.15s, box-shadow 0.15s;
}
.vr360-hotspot:hover,
.vr360-hotspot:focus-visible {
    transform: scale(1.06);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    outline: none;
}
.vr360-hotspot__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    color: #000;
    flex-shrink: 0;
}
.vr360-hotspot__icon svg { width: 10px; height: 10px; }
.vr360-hotspot--direction .vr360-hotspot__icon {
    background: #2563eb;
    color: #fff;
    box-shadow: 0 0 0 2px #fff;
}
.vr360-hotspot--link .vr360-hotspot__icon {
    background: #ff9100;
    color: #fff;
    box-shadow: 0 0 0 2px #fff;
}
.vr360-hotspot__label { line-height: 1; margin-left: 8px; }

@media (max-width: 768px) {
    .vr360-menu { width: 220px; padding-top: 56px; }
    .vr360-side-panel { width: 100%; }
    .vr360-hotspot {
        font-size: 11px;
        padding: 4px 10px 4px 8px;
    }
}

/* sr-only */
.vr360-shell .sr-only {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===== Spinner overlay (chargement Marzipano + tiles équirectangulaires) ===== */
.vr360-spinner {
    position: absolute;
    inset: 0;
    z-index: 40;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: rgba(15, 18, 25, 0.78);
    color: #fff;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    transition: opacity 260ms ease-out;
    pointer-events: none;
}
.vr360-spinner.is-fading-out {
    opacity: 0;
}
.vr360-spinner__circle {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.22);
    border-top-color: #fff;
    border-radius: 50%;
    animation: vr360-spin 0.85s linear infinite;
}
.vr360-spinner__text {
    font-size: 14px;
    font-weight: 500;
    opacity: 0.95;
    text-align: center;
    padding: 0 20px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}
@keyframes vr360-spin {
    to { transform: rotate(360deg); }
}
@media (max-width: 480px) {
    .vr360-spinner__circle { width: 40px; height: 40px; border-width: 3px; }
    .vr360-spinner__text { font-size: 13px; }
}
