/* Marzipano 360 Viewer specific styles */
#pano {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    overflow: hidden;
    /* Prevent the mobile browser from consuming touch events (scroll,
       pinch-zoom) that Marzipano needs for panorama drag / pinch navigation. */
    touch-action: none;
}

/* Base Hotspot Container */
.hotspot {
    position: absolute;
    cursor: pointer;
    transform: translate(-50%, -50%);
    transition: transform 0.2s ease;
    z-index: 50;
    user-select: none;
}

.hotspot:hover {
    transform: translate(-50%, -50%) scale(1.15);
}

/* Navigation Hotspot */
.hotspot-nav {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, rgba(245, 197, 24, 0.25), rgba(232, 146, 10, 0.45));
    border: 2px solid var(--color-honey);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #ffffff;
    font-size: 15px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
    box-shadow: 0 0 15px rgba(245, 197, 24, 0.45), inset 0 0 8px rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(4px);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.hotspot-nav:hover {
    background: linear-gradient(135deg, var(--color-honey), var(--color-amber));
    color: #ffffff;
    box-shadow: 0 0 25px rgba(245, 197, 24, 0.85), inset 0 0 4px rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%) scale(1.15) rotate(5deg);
}

.hotspot-nav::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--color-honey);
    opacity: 0;
    animation: hotspot-pulse-honey 1.8s infinite ease-out;
}

/* Info Hotspot */
.hotspot-info {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, rgba(74, 122, 74, 0.25), rgba(46, 74, 46, 0.45));
    border: 2px solid var(--color-forest-light);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #ffffff;
    font-size: 14px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
    box-shadow: 0 0 12px rgba(74, 122, 74, 0.45), inset 0 0 6px rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(4px);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.hotspot-info:hover {
    background: linear-gradient(135deg, var(--color-forest-light), var(--color-forest));
    color: #ffffff;
    box-shadow: 0 0 20px rgba(74, 122, 74, 0.85), inset 0 0 4px rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%) scale(1.15) rotate(-5deg);
}

.hotspot-info::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--color-forest-light);
    opacity: 0;
    animation: hotspot-pulse-forest 1.8s infinite ease-out;
}

@keyframes hotspot-pulse-honey {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1.6);
        opacity: 0;
    }
}

@keyframes hotspot-pulse-forest {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1.6);
        opacity: 0;
    }
}

/* Hotspot Label Tooltip */
.hotspot-tooltip {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    background: rgba(46, 74, 46, 0.95);
    border: 1px solid var(--color-honey-light);
    color: var(--color-honey-light);
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(46, 74, 46, 0.25);
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.hotspot:hover .hotspot-tooltip {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

/* Public Viewer HUD Layer */
.viewer-hud {
    position: absolute;
    z-index: 100;
    pointer-events: none;
}

.viewer-hud * {
    pointer-events: auto;
}

.hud-top {
    top: 24px;
    left: 24px;
}

.hud-bottom-center {
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
}

.hud-btn {
    background: rgba(46, 74, 46, 0.92);
    border: 1.5px solid var(--color-honey);
    border-radius: 8px;
    color: #fff;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(46, 74, 46, 0.25);
    transition: all 0.2s ease;
}

.hud-btn:hover {
    background: var(--color-honey);
    border-color: var(--color-honey-dark);
    color: var(--color-forest);
    transform: translateY(-2px);
}

/* Info Overlay Side Panel */
.info-panel-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(46, 74, 46, 0.45);
    backdrop-filter: blur(2px);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    display: flex;
    justify-content: flex-end;
}

.info-panel-backdrop.show {
    opacity: 1;
    pointer-events: all;
}

.info-panel {
    background: #FFFFFF;
    width: 420px;
    height: 100%;
    box-sizing: border-box;
    padding: 40px 30px;
    border-left: 1.5px solid var(--color-border);
    box-shadow: -10px 0 30px rgba(46, 74, 46, 0.12);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.info-panel-backdrop.show .info-panel {
    transform: translateX(0);
}

.info-panel-close {
    align-self: flex-end;
    background: transparent;
    border: none;
    color: var(--color-muted);
    font-size: 24px;
    cursor: pointer;
    margin-bottom: 20px;
    transition: color 0.2s ease;
}

.info-panel-close:hover {
    color: var(--color-danger);
}

.info-panel-media {
    width: 100%;
    border-radius: 12px;
    margin-bottom: 24px;
    overflow: hidden;
    background: var(--color-cream-dark);
    border: 1px solid var(--color-border);
}

.info-panel-media img {
    width: 100%;
    display: block;
}

.info-panel-media iframe {
    width: 100%;
    aspect-ratio: 16/9;
    border: none;
    display: block;
}

.info-panel-title {
    font-family: var(--font-body);
    font-size: 24px;
    font-weight: 700;
    color: var(--color-ink);
    margin: 0 0 14px 0;
}

.info-panel-desc {
    color: var(--color-muted);
    font-size: 15px;
    line-height: 1.7;
    margin-bottom: 30px;
}

.info-panel-btn {
    display: block;
    width: 100%;
    text-align: center;
    background: var(--color-honey);
    color: var(--color-amber-dark);
    padding: 12px;
    border: none;
    border-radius: var(--radius-pill);
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.info-panel-btn:hover {
    background: var(--color-honey-dark);
    color: var(--color-amber-dark);
    transform: translateY(-1px);
}

/* Scene Tour Navigation Sidebar */
.tour-scenes-bar {
    position: absolute;
    bottom: 84px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(46, 74, 46, 0.9);
    backdrop-filter: blur(12px);
    border: 1.5px solid var(--color-border);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    gap: 12px;
    max-width: 90%;
    overflow-x: auto;
    box-shadow: 0 8px 32px rgba(46, 74, 46, 0.15);
    z-index: 100;
    /* Skip rendering off-screen bar content until the user opens it. */
    content-visibility: auto;
    contain-intrinsic-size: auto 74px;
}

.scene-item-thumb {
    width: 80px;
    height: 50px;
    border-radius: 6px;
    object-fit: cover;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    /* Promote each thumb to its own compositor layer — avoids repainting
       the whole strip on hover/active state changes. */
    will-change: transform;
}

.scene-item-thumb:hover {
    transform: scale(1.05);
    border-color: var(--color-honey-light);
}

.scene-item-thumb.active {
    border-color: var(--color-honey);
    box-shadow: 0 0 10px rgba(245, 197, 24, 0.6);
}

/* Custom CSS Classes for Editor Interface Split-Screen Layout */
.editor-layout {
    display: flex;
    height: calc(100vh - 65px);
    width: 100vw;
    overflow: hidden;
}

.editor-viewport {
    flex-grow: 1;
    position: relative;
    height: 100%;
    background: #000;
}

.editor-sidebar {
    width: 350px;
    min-width: 350px;
    background: #0d1117;
    border-left: 1px solid rgba(255,255,255,0.08);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.editor-sidebar-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.editor-tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: #8b949e;
    padding: 15px 0;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
}

.editor-tab-btn.active {
    color: #fff;
    border-bottom: 2px solid #58a6ff;
}

.editor-sidebar-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
}

/* Panel Mode Indicators */
.mode-indicator {
    position: absolute;
    top: 24px;
    right: 24px;
    background: rgba(11, 15, 25, 0.85);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 100;
}

.indicator-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--accent-purple);
}

.indicator-dot.edit {
    background-color: #f08a24;
    animation: flash 1.5s infinite;
}

@keyframes flash {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Collapsible Editor Sidebar */
.editor-sidebar {
    transition: width 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), min-width 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.editor-sidebar.collapsed {
    width: 0px !important;
    min-width: 0px !important;
    border-left: none !important;
    overflow: hidden;
}

.sidebar-toggle-btn {
    position: absolute;
    top: 50%;
    right: 350px;
    transform: translateY(-50%);
    background: rgba(11, 15, 25, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-right: none;
    border-radius: 8px 0 0 8px;
    color: #fff;
    width: 24px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: -4px 0 10px rgba(0,0,0,0.2);
}

.sidebar-toggle-btn:hover {
    background: #58a6ff;
    color: #0b0f19;
}

.editor-sidebar.collapsed + .sidebar-toggle-btn {
    right: 0px;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Pano Loading Overlay
   Displayed over #pano while the first panorama texture is being fetched.
   viewer.js hides this element (display: none) once the scene is ready.
───────────────────────────────────────────────────────────────────────────── */
.pano-loading-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at center, #FFFBF0 0%, #F5EDCF 100%);
    z-index: 200;
    gap: 20px;
    /* Smooth fade-out when JS sets display:none via opacity trick */
    pointer-events: none;
}

/* Animated ring spinner */
.pano-spinner {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 3px solid rgba(245, 197, 24, 0.15);
    border-top-color: var(--color-honey);
    animation: pano-spin 0.8s linear infinite;
    box-shadow: 0 0 24px rgba(245, 197, 24, 0.25);
}

@keyframes pano-spin {
    to { transform: rotate(360deg); }
}

.pano-loading-text {
    color: var(--color-forest);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.04em;
    margin: 0;
    animation: pano-pulse 2s ease-in-out infinite;
}

@keyframes pano-pulse {
    0%, 100% { opacity: 0.5; }
    50%       { opacity: 1;   }
}

/* ═════════════════════════════════════════════════════════════════════════════
   VIRTUAL TOUR PAGE — FULL-VIEWPORT LAYOUT SYSTEM
   ─────────────────────────────────────────────────────────────────────────────
   Problem solved: the body on the VT page must be exactly one viewport tall so
   there is no outer scroll and the viewer fills all space between header/footer.

   Bottom HUD stack (desktop, measured from bottom of #pano):
     ┌─────────────────────────────────────────────────────┐  ← viewer top
     │                   panorama                          │
     │                                                     │
     ├──────── .public-hud-top ────────────────────────────│  top:24px left:24px
     │                                                     │
     │         .hud-bottom-center (zoom + toggle btns)     │  bottom: 24px
     │         height ≈ 40px → top edge ≈ 64px from bottom │
     │                                                     │
     │         .tour-scenes-bar (thumbnail strip)          │  bottom: 84px
     │         height ≈ 86px → top edge ≈ 170px from bottom│
     │         gap below scenes bar to controls: ≈ 20px    │
     └─────────────────────────────────────────────────────┘  ← bottom edge
   ═════════════════════════════════════════════════════════════════════════════ */

/* ── 1. Viewport lock ───────────────────────────────────────────────────────── */

/**
 * Lock the VT page to exactly one screen height. dvh accounts for mobile
 * browser chrome (address bar appearing / disappearing).
 * Bootstrap's min-vh-100 sets min-height which we override to a hard height.
 */
body.vt-page {
    height: 100dvh;
    max-height: 100dvh;
    min-height: unset !important;   /* Cancel Bootstrap min-vh-100 */
    overflow: hidden;               /* No outer page scroll on the VT page */
}

/* ── 2. Main viewer fill ────────────────────────────────────────────────────── */

/**
 * .vt-main is a flex child of body.vt-page.
 * flex: 1 + min-height: 0 lets it fill the remaining height between the
 * header and footer without the explicit calc() hack that broke on every
 * screen where header or footer height differed from 130px.
 */
.vt-main {
    flex: 1 1 0;
    min-height: 0;          /* Critical: allows flex child to shrink below content size */
    position: relative;
    overflow: hidden;
    background: #000;
}

/* ── 3. Footer on VT page ───────────────────────────────────────────────────── */

/**
 * Compact the footer on desktop (saves ~14px vertical space for the viewer).
 * Completely hidden on narrow mobile so the viewer gets the full screen.
 */
body.vt-page footer {
    flex-shrink: 0;
    padding-top: 5px !important;
    padding-bottom: 5px !important;
    font-size: 11px;
}

/* ── 4. HUD top title panel ─────────────────────────────────────────────────── */

/**
 * .public-hud-top is defined inline in virtualtour.jsp.
 * These rules supplement it with a max-width guard so it does not bleed
 * across the full screen on wide monitors.
 */
.public-hud-top {
    max-width: 50%;             /* Never wider than half the viewer on desktop */
}

/* ── 5. Controls HUD (.hud-bottom-center) ───────────────────────────────────── */

/**
 * The .hud-bottom-center already has bottom:24px from the rule above.
 * The old JSP inline "style=bottom:154px" has been removed, so this now applies.
 * This places buttons at 24px from the bottom — 20px below the scenes bar.
 */
#vt-controls {
    bottom: 24px;   /* Explicit to win over any inherited value */
}

/* ── 6. Scenes bar (.tour-scenes-bar) ──────────────────────────────────────── */

/**
 * Positioned at bottom:84px (from the rule earlier in this file).
 * The stack is: controls (24px) → ~40px gap → scenes bar (84px) ✓
 * No changes needed to the value — the gap was always correct.
 * The overlap was caused solely by the JSP "bottom:154px" override on controls.
 */

/* ── 7. Responsive — Tablet (max-width: 768px) ──────────────────────────────── */

@media (max-width: 768px) {

    /* Slightly smaller HUD title */
    .public-hud-top {
        top: 14px;
        left: 14px;
        padding: 10px 16px;
        max-width: calc(100% - 28px);
    }

    .public-hud-top h1 {
        font-size: 15px !important;
    }

    .public-hud-top p {
        font-size: 11px;
    }

    /* Tighter control buttons */
    .hud-btn {
        padding: 9px 13px;
        font-size: 13px;
        gap: 6px;
    }

    /* Scenes bar: sit a little lower, tighter gap */
    .tour-scenes-bar {
        bottom: 76px;
        padding: 10px;
        gap: 10px;
        max-width: 95%;
    }

    /* Thumbnails: slightly smaller */
    .scene-item-thumb {
        width: 72px;
        height: 46px;
    }
}

/* ── 8. Responsive — Mobile (max-width: 576px) ──────────────────────────────── */

@media (max-width: 576px) {

    /* ── Body / layout ── */
    body.vt-page footer {
        display: none !important;   /* Footer hidden — viewer gets full height */
    }

    /* ── HUD top title — compact one-liner ── */
    .public-hud-top {
        top: 10px;
        left: 10px;
        right: 10px;
        padding: 8px 12px;
        max-width: unset;           /* Full-width strip on very narrow screens */
        border-radius: 8px;
    }

    .public-hud-top h1 {
        font-size: 13px !important;
    }

    .public-hud-top p {
        font-size: 10px;
        margin-top: 2px !important;
    }

    /* ── Control buttons — touch-friendly minimum 44px tap target ── */
    #vt-controls {
        bottom: 16px;
        gap: 8px;
    }

    .hud-btn {
        padding: 10px 14px;     /* 44px+ tap target height */
        font-size: 12px;
        gap: 5px;
        border-radius: 6px;
    }

    /* ── Scenes bar — flush at bottom, compact thumbnails ── */
    .tour-scenes-bar {
        bottom: 68px;           /* Above mobile controls (16px + ~40px btn + 12px gap) */
        padding: 8px 10px;
        gap: 8px;
        border-radius: 10px;
        max-width: 98%;
    }

    /* Smaller thumbnails on mobile */
    .scene-item-thumb {
        width: 60px;
        height: 38px;
        border-radius: 4px;
    }

    /* Hotspot hit-area: enlarge for touch */
    .hotspot-nav,
    .hotspot-info {
        width: 48px;
        height: 48px;
    }

    /* Info panel: full-screen on mobile */
    .info-panel {
        width: 100vw;
        padding: 30px 20px;
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
    }

    .info-panel-backdrop {
        align-items: flex-end;
        justify-content: center;
    }

    .info-panel-backdrop.show .info-panel {
        transform: translateY(0);
    }

    .info-panel {
        transform: translateY(100%);
        transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
        max-height: 75vh;
        border-radius: 16px 16px 0 0;
    }
}

