/* Main Styles */
body {
    margin: 0;
    background: black;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

canvas { display: block; }

/* Loading Screen */
#loadingScreen {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: radial-gradient(circle, #001122 0%, #000000 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-title {
    color: #00ffff;
    font-family: 'Courier New', monospace;
    font-size: 2.5em;
    text-shadow: 0 0 20px #00ffff;
    margin-bottom: 30px;
    animation: pulse 2s infinite;
}

.loading-bar {
    width: 300px; height: 4px;
    background: rgba(0, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 20px;
}

.loading-progress {
    height: 100%;
    background: linear-gradient(90deg, #00ffff, #0080ff);
    width: 0%;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px #00ffff;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Mobile Joystick */
.joystick-container {
    position: fixed;
    bottom: 60px; right: 40px;
    width: 120px; height: 120px;
    background: radial-gradient(circle, rgba(0, 255, 255, 0.1) 0%, rgba(0, 100, 255, 0.05) 100%);
    border: 2px solid #00ffff;
    border-radius: 50%;
    display: none;
    z-index: 10001;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
    overflow: visible;
    pointer-events: none;
}

.joystick-container.mobile-show { display: block; }

.joystick-knob {
    position: absolute;
    width: 42px; height: 42px;
    background: radial-gradient(circle, #00ffff 0%, #0080ff 100%);
    border: 1px solid #ffffff;
    border-radius: 50%;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.8);
    pointer-events: auto;
}

/* Assistant Sidebar */
#assistantSidebar {
    position: fixed;
    left: -300px; top: 0;
    width: 300px; height: 100%;
    background: linear-gradient(135deg, rgba(0, 8, 20, 0.95), rgba(0, 29, 61, 0.9));
    border-right: 4px solid #00ffff;
    border-top: 2px solid #00ffff;
    border-bottom: 2px solid #00ffff;
    transition: left 0.3s ease;
    z-index: 10000;
    padding: 20px;
    box-sizing: border-box;
    box-shadow: 4px 0 20px rgba(0, 255, 255, 0.2);
    clip-path: polygon(0 0, calc(100% - 15px) 0, 100% 15px, 100% calc(100% - 15px), calc(100% - 15px) 100%, 0 100%);
}

#assistantSidebar.open { left: 0; }

#sidebarToggle {
    position: fixed;
    left: 0; top: 50%;
    transform: translateY(-50%);
    width: 36px; height: 60vh;
    max-height: 450px;
    min-height: 300px;
    background: rgba(0, 20, 40, 0.9);
    border-bottom: 1px dotted #00ffff;
    border-right: 1px dotted #00ffff;
    border-top: 1px dotted #00ffff;
    border-radius: 0px 41px 41px 0px;
    color: #00ffff;
    font-size: 20px;
    cursor: pointer;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: left 0.3s ease;
}

#sidebarToggle.sidebar-open {
    left: 300px;
}

#sidebarToggle:hover {
    background: rgba(0, 40, 80, 0.9);
}

.display-button {
    width: 100%;
    padding: 15px;
    margin: 10px 0;
    background: rgba(0, 255, 255, 0.1);
    border: 2px solid #00ffff;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.display-button:hover {
    background: rgba(0, 255, 255, 0.3);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.4);
}



/* Responsive Design */
@media (max-width: 768px) {
    .joystick-container {
        width: 100px; height: 100px;
        bottom: 40px; right: 20px;
        overflow: visible;
        pointer-events: none;
        z-index: 10001;
    }
    .joystick-knob {
        width: 35px; height: 35px;
        pointer-events: auto;
    }
    #sidebarToggle {
        width: 28px; height: 50vh;
    }
}

/* New media query for very small screens */
@media (max-width: 480px) {
    .joystick-container {
        width: 80px; height: 80px;
        bottom: 20px; right: 10px;
        overflow: visible;
        pointer-events: none;
        z-index: 10001;
    }
    .joystick-knob {
        width: 30px; height: 30px;
        pointer-events: auto;
    }
    #assistantSidebar {
        width: 200px; /* Smaller sidebar width */
        left: -200px; /* Adjust for new width */
    }
    #assistantSidebar.open {
        left: 0;
    }
    #sidebarToggle {
        width: 24px; /* Smaller toggle width */
        height: 40vh; /* Adjust height */
    }
    #sidebarToggle.sidebar-open {
        left: 200px; /* Adjust for new sidebar width */
    }
    .display-button {
        padding: 10px; /* Smaller padding for buttons */
        font-size: 12px; /* Smaller font size */
    }
}

/* Controls Panel */
#controls {
    position: absolute;
    top: 10px;
    left: 10px;
    color: white;
    font-family: Arial, sans-serif;
    z-index: 100;
}

.panel {
    background: rgba(0, 0, 0, 0.8);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #444;
}

.panel h3 {
    margin: 0 0 10px 0;
    font-size: 14px;
}

.row {
    margin: 8px 0;
}

label {
    display: inline-block;
    width: 60px;
    font-size: 12px;
}

input {
    width: 45px;
    margin: 0 2px;
    padding: 4px;
    background: #222;
    color: white;
    border: 1px solid #555;
    border-radius: 3px;
}

button {
    width: 100%;
    margin: 8px 0 0 0;
    padding: 8px;
    background: #0066cc;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

button:hover {
    background: #0088ff;
}

/* Camera Controls */
#cameraControls {
    position: absolute;
    top: 10px;
    right: 230px;
    background: rgba(0, 0, 0, 0.8);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #444;
    color: white;
    font-family: Arial, sans-serif;
    display: none;
}

#cameraControls h3 {
    margin: 0 0 10px 0;
    font-size: 14px;
}

#cameraControls .row {
    margin: 8px 0;
}

#cameraControls label {
    display: inline-block;
    width: 30px;
    font-size: 12px;
}

#cameraControls input[type="range"] {
    width: 100px;
    margin: 0 5px;
}

#cameraControls input[type="number"] {
    width: 50px;
    margin: 0 2px;
    padding: 2px;
    background: #222;
    color: white;
    border: 1px solid #555;
}

/* Navigation Buttons */
#goUpButton {
    position: fixed;
    bottom: 200px;
    right: 40px;
    width: 80px;
    height: 40px;
    background: #00ffff;
    color: black;
    border: none;
    border-radius: 5px;
    font-weight: bold;
    display: none;
    z-index: 1000;
}

#backButton {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 80px;
    height: 40px;
    background: #ff0000;
    color: white;
    border: none;
    border-radius: 5px;
    font-weight: bold;
    display: none;
    z-index: 1000;
}

/* Loading Screen Enhancements */
.sci-fi-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(90deg, rgba(0, 255, 255, 0.1) 1px, transparent 1px),
        linear-gradient(0deg, rgba(0, 255, 255, 0.1) 1px, transparent 1px),
        linear-gradient(45deg, transparent 40%, rgba(0, 255, 255, 0.05) 50%, transparent 60%);
    background-size: 50px 50px, 50px 50px, 100px 100px;
    animation: gridMove 15s linear infinite;
}

.house-floor {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 30%;
    background:
        linear-gradient(90deg, rgba(0, 255, 255, 0.15) 2px, transparent 2px),
        linear-gradient(0deg, rgba(0, 255, 255, 0.15) 2px, transparent 2px);
    background-size: 40px 40px;
    border-top: 2px solid rgba(0, 255, 255, 0.3);
    opacity: 0.6;
}

@keyframes gridMove {
    0% {
        transform: translate(0, 0);
    }
    100% {
        transform: translate(100px, 100px);
    }
}

.loading-text {
    color: #00aaff;
    font-family: 'Courier New', monospace;
    font-size: 1em;
    margin-bottom: 10px;
}

.loading-percentage {
    color: #00ffff;
    font-family: 'Courier New', monospace;
    font-size: 1.5em;
    text-shadow: 0 0 10px #00ffff;
    font-weight: bold;
}

/* Sidebar Enhancements */
.sidebar-title {
    color: #00ffff;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 20px;
    text-align: center;
    text-shadow: 0 0 10px #00ffff;
}

.assistant-chatbox {
    position: absolute;
    background: linear-gradient(135deg, rgba(0, 100, 200, 0.95), rgba(0, 200, 255, 0.9));
    border: 2px solid #00ffff;
    border-radius: 15px;
    padding: 10px 15px;
    color: white;
    font-family: Arial, sans-serif;
    font-size: 14px;
    max-width: 200px;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.4);
    display: none;
    z-index: 10002;
    transform: translateX(-50%);
}

.assistant-chatbox::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid #00ffff;
}

/* Utility Classes */
.controls-hide {
    display: none;
}

/* Hidden Elements */
.security-iframe, .position-iframe {
    display: none !important;
    visibility: hidden !important;
}

.security-iframe.camera-active,
.position-iframe.position-active {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Pointer Events Control */
.position-iframe, .security-iframe {
    pointer-events: none !important;
}

.position-iframe.position-active,
.security-iframe.camera-active {
    pointer-events: auto !important;
}

