/* ============================================================
   VR 360 PANORAMA — MILITARY EMERGENCY TACTICAL UI
   Theme: Dark Olive / Charcoal / Red Alert
   Fonts: Rajdhani (headings), Barlow Condensed (UI), Share Tech Mono (status)
   ============================================================ */

:root {
    --bg-dark:        #0b1329;
    --bg-panel:       rgba(15, 23, 42, 0.94);
    --bg-panel-hover: rgba(30, 41, 59, 0.96);
    --navy-dark:      #0f172a;
    --navy-mid:       #1e293b;
    --blue-accent:    #0284c7;
    --blue-bright:    #38bdf8;
    --blue-dim:       rgba(2, 132, 199, 0.35);
    --blue-glow:      rgba(56, 189, 248, 0.25);
    --status-online:  #38bdf8;
    --text-primary:   #f8fafc;
    --text-muted:     #94a3b8;
    --text-bright:    #ffffff;
    --border-blue:    rgba(56, 189, 248, 0.35);
    --grid-line:      rgba(56, 189, 248, 0.08);
    --font-heading:   'Rajdhani', 'Barlow Condensed', Arial, sans-serif;
    --font-ui:        'Barlow Condensed', 'Rajdhani', Arial, sans-serif;
    --font-mono:      'Share Tech Mono', 'Courier New', monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-ui);
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-dark);
}

/* LOADING SCREEN */
#loader-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 28px,
            var(--grid-line) 28px,
            var(--grid-line) 29px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 28px,
            var(--grid-line) 28px,
            var(--grid-line) 29px
        ),
        radial-gradient(ellipse at center, #1e293b 0%, #0b1329 70%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: var(--text-primary);
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

#loader-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.spinner {
    width: 52px;
    height: 52px;
    border: 3px solid rgba(2, 132, 199, 0.2);
    border-top: 3px solid var(--blue-bright);
    border-right: 3px solid var(--blue-bright);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 24px;
    box-shadow: 0 0 18px rgba(56, 189, 248, 0.4), inset 0 0 12px rgba(56, 189, 248, 0.1);
}

@keyframes spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--text-primary);
    text-shadow: 0 0 12px rgba(56, 189, 248, 0.5);
    animation: tac-blink 1.8s ease-in-out infinite;
}

@keyframes tac-blink {
    0%, 80%, 100% { opacity: 1; }
    90% { opacity: 0.4; }
}

/* TOP SCENE HEADER BADGE */
#scene-header {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    background: var(--bg-panel);
    border: 1px solid var(--border-blue);
    border-left: 4px solid var(--blue-accent);
    border-radius: 6px;
    padding: 10px 24px 10px 20px;
    color: var(--text-primary);
    text-align: left;
    pointer-events: none;
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.6),
        inset 0 0 30px rgba(2, 132, 199, 0.08);
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
    min-width: 280px;
}

#scene-header::before {
    content: '';
    position: absolute;
    top: -1px; left: -1px;
    width: 12px; height: 12px;
    border-top: 2px solid var(--blue-bright);
    border-left: 2px solid var(--blue-bright);
}

#scene-header::after {
    content: '';
    position: absolute;
    bottom: -1px; right: -1px;
    width: 12px; height: 12px;
    border-bottom: 2px solid var(--blue-bright);
    border-right: 2px solid var(--blue-bright);
}

#scene-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-bright);
    margin-bottom: 3px;
}

#scene-desc {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* FLOATING SCENE MENU */
#ui-container {
    position: absolute;
    bottom: 25px;
    left: 25px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.menu-toggle-btn {
    background: var(--navy-mid);
    border: 1px solid var(--border-blue);
    border-left: 3px solid var(--blue-accent);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 11px 18px;
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(8px);
    transition: all 0.15s ease;
    position: relative;
    text-decoration: none;
}

.menu-toggle-btn::before {
    content: '';
    position: absolute;
    top: -1px; left: -1px;
    width: 8px; height: 8px;
    border-top: 2px solid var(--blue-bright);
    border-left: 2px solid var(--blue-bright);
}

.menu-toggle-btn:hover {
    background: #334155;
    border-left-color: var(--blue-bright);
    color: var(--text-bright);
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.6),
        0 0 12px var(--blue-glow);
    transform: translateX(2px);
}

#scene-menu-drawer {
    margin-top: 8px;
    background: var(--bg-panel);
    border: 1px solid var(--border-blue);
    border-left: 3px solid var(--blue-accent);
    border-radius: 6px;
    padding: 10px;
    width: 272px;
    max-height: 320px;
    overflow-y: auto;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7), 0 0 20px var(--blue-glow);
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

#scene-menu-drawer::-webkit-scrollbar { width: 4px; }
#scene-menu-drawer::-webkit-scrollbar-track { background: var(--navy-dark); }
#scene-menu-drawer::-webkit-scrollbar-thumb { background: var(--blue-accent); border-radius: 2px; }

#scene-menu-drawer.collapsed {
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    display: none;
}

.scene-btn {
    background: transparent;
    border: none;
    border-left: 3px solid rgba(56, 189, 248, 0.2);
    color: var(--text-primary);
    padding: 9px 12px;
    border-radius: 4px;
    text-align: left;
    font-family: var(--font-ui);
    font-size: 0.92rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.scene-btn:hover {
    background: rgba(56, 189, 248, 0.12);
    border-left-color: var(--blue-accent);
    color: var(--text-bright);
    padding-left: 16px;
}

.scene-btn.active {
    background: rgba(2, 132, 199, 0.25);
    border-left: 3px solid var(--blue-bright);
    color: var(--blue-bright);
    font-weight: 700;
}

/* OFFLINE STATUS BADGE */
#offline-badge {
    position: absolute;
    bottom: 25px;
    right: 25px;
    z-index: 100;
    background: rgba(15, 23, 42, 0.88);
    border: 1px solid var(--border-blue);
    border-radius: 6px;
    color: var(--blue-bright);
    padding: 6px 14px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(6px);
    text-transform: uppercase;
}

.dot-online {
    width: 7px;
    height: 7px;
    background-color: var(--blue-bright);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--blue-bright), 0 0 16px rgba(56, 189, 248, 0.4);
    animation: status-pulse 2s ease-in-out infinite;
}

@keyframes status-pulse {
    0%, 100% { box-shadow: 0 0 8px var(--green-status); opacity: 1; }
    50% { box-shadow: 0 0 16px var(--green-status), 0 0 30px rgba(0, 255, 65, 0.5); opacity: 0.8; }
}

/* HIDE DEFAULT A-FRAME VR BUTTON */
.a-enter-vr, .a-enter-vr-button, .a-enter-ar, .a-enter-ar-button {
    display: none !important;
}

/* ============================================================
   LANDSLIDE EFFECT OVERLAYS
   ============================================================ */

body::after {
    content: '';
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 200;
    opacity: 0;
    transition: opacity 0.8s ease;
}

body.ls-level-1::after {
    background: radial-gradient(ellipse at center, transparent 42%, rgba(180, 60, 0, 0.32) 100%);
    opacity: 1;
    animation: ls-vignette-pulse-1 3.5s ease-in-out infinite;
}

body.ls-level-2::after {
    background: radial-gradient(ellipse at center, transparent 33%, rgba(200, 0, 0, 0.42) 100%);
    opacity: 1;
    animation: ls-vignette-pulse-2 2s ease-in-out infinite;
}

body.ls-level-3::after {
    background:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 3px,
            rgba(180, 0, 0, 0.04) 3px,
            rgba(180, 0, 0, 0.04) 4px
        ),
        radial-gradient(ellipse at center, transparent 22%, rgba(180, 0, 0, 0.58) 100%);
    opacity: 1;
    animation: ls-vignette-pulse-3 0.9s ease-in-out infinite;
}

@keyframes ls-vignette-pulse-1 {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}
@keyframes ls-vignette-pulse-2 {
    0%, 100% { opacity: 0.65; }
    50% { opacity: 1; }
}
@keyframes ls-vignette-pulse-3 {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

body.ls-level-1 #scene-title { color: #ffaa00; }
body.ls-level-2 #scene-title { color: #ff4400; }
body.ls-level-3 #scene-title { color: var(--red-bright); text-shadow: 0 0 10px rgba(255,34,34,0.6); }

#ls-alert-badge {
    display: none;
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 300;
    background: rgba(120, 0, 0, 0.92);
    border: 1px solid var(--red-accent);
    border-left: 4px solid var(--red-bright);
    border-radius: 2px;
    color: #fff;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.88rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 8px 16px;
    pointer-events: none;
    backdrop-filter: blur(4px);
    box-shadow: 0 0 20px rgba(204, 0, 0, 0.4);
}

body.ls-level-1 #ls-alert-badge {
    display: flex;
    background: rgba(120, 50, 0, 0.9);
    border-color: #ff8800;
    border-left-color: #ffaa00;
    animation: ls-badge-blink 3s ease-in-out infinite;
}
body.ls-level-2 #ls-alert-badge {
    display: flex;
    background: rgba(140, 0, 0, 0.9);
    border-color: var(--red-accent);
    border-left-color: var(--red-bright);
    animation: ls-badge-blink 1.6s ease-in-out infinite;
}
body.ls-level-3 #ls-alert-badge {
    display: flex;
    background: rgba(120, 0, 0, 0.97);
    border-color: var(--red-bright);
    border-left-color: #ff0000;
    animation: ls-badge-blink 0.6s ease-in-out infinite;
    box-shadow: 0 0 30px rgba(255, 0, 0, 0.6);
}

@keyframes ls-badge-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.25; }
}

@keyframes ls-flash-red {
    0%, 84%, 100% { background: transparent; }
    87% { background: rgba(200, 0, 0, 0.14); }
}

body.ls-level-3 #ls-flash-overlay {
    display: block;
    animation: ls-flash-red 2s ease-in-out infinite;
}

#ls-flash-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 199;
}

/* ============================================================
   FULLSCREEN TOP-LAYER OVERLAY SUPPORT
   Ensures disaster vignette, red flash, alert badges, and UI 
   remain 100% visible when browser enters Fullscreen mode.
   ============================================================ */
:fullscreen body::after,
:-webkit-full-screen body::after,
html:fullscreen body::after,
body:fullscreen::after {
    z-index: 99999 !important;
}

:fullscreen #ls-flash-overlay,
:-webkit-full-screen #ls-flash-overlay,
html:fullscreen #ls-flash-overlay {
    z-index: 99998 !important;
}

:fullscreen #ls-alert-badge,
:-webkit-full-screen #ls-alert-badge,
html:fullscreen #ls-alert-badge {
    z-index: 99999 !important;
}

:fullscreen #scene-header,
:-webkit-full-screen #scene-header,
html:fullscreen #scene-header,
:fullscreen #ui-container,
:-webkit-full-screen #ui-container,
html:fullscreen #ui-container,
:fullscreen #offline-badge,
:-webkit-full-screen #offline-badge,
html:fullscreen #offline-badge {
    z-index: 99999 !important;
}

/* Cinematic mode: keep the photograph readable and avoid continuous alarm flashes. */
body.ls-level-1::after,
body.ls-level-2::after,
body.ls-level-3::after {
    background: radial-gradient(ellipse at center, transparent 62%, rgba(75, 39, 12, .2));
    opacity: .65;
    animation: none;
}
body.ls-level-1 #ls-alert-badge,
body.ls-level-2 #ls-alert-badge,
body.ls-level-3 #ls-alert-badge { animation: none; }
body.immersive-vr::after { display: none; }
body.ls-level-3 #ls-flash-overlay {
    display: block;
    animation: none;
    opacity: 0;
    background: radial-gradient(ellipse at center, rgba(210, 0, 0, .26) 25%, rgba(180, 0, 0, .85) 100%);
}
body.immersive-vr #ls-flash-overlay { display: none; }
#enter-vr-btn[hidden] { display: none; }
#vr-status { max-width: 240px; color: #fff; font-size: 12px; margin-top: 8px; }
@media (prefers-reduced-motion: reduce) {
    #ls-alert-badge { animation: none !important; }
}
