/* Universal box-sizing and reset */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Base HTML and Body styles */
html, body {
    height: 100%;
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #e0e0e0; /* Light gray text for the dark theme */
    background-color: #1a1a1a; /* Very dark background */
    overflow: hidden; /* Prevent scrolling, as the UI will manage its own space */
}

/* Main application container */
#app-container {
    display: flex;
    flex-direction: column;
    height: 100vh; /* Full viewport height */
    width: 100vw; /* Full viewport width */
}

/* Header (Top Bar) */
header {
    background-color: #2a2a2a; /* Slightly lighter dark gray */
    padding: 10px 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); /* Subtle shadow for depth */
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0; /* Prevent header from shrinking */
    z-index: 10; /* Ensure header is above other content */
}

header h1 {
    font-size: 1.5em;
    color: #00bfff; /* Roblox-like blue for branding */
    margin: 0;
    text-shadow: 0 0 5px rgba(0, 191, 255, 0.5); /* Subtle glow effect */
}

header nav {
    display: flex;
    gap: 20px; /* Space between nav links */
}

header nav a {
    color: #e0e0e0;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

header nav a:hover {
    color: #00bfff;
}

/* Main content area (holds panels and game view) */
main {
    display: flex;
    flex: 1; /* Takes up all available vertical space */
    overflow: hidden; /* Hide overflow from its children */
}

/* Side Panels (for editor UI like scene hierarchy, properties) */
.panel {
    background-color: #2a2a2a;
    width: 250px; /* Fixed width for side panels */
    flex-shrink: 0; /* Prevent panels from shrinking */
    padding: 15px;
    overflow-y: auto; /* Enable scrolling for panel content */
    border-right: 1px solid #3a3a3a; /* Separator line */
    border-left: 1px solid #3a3a3a; /* Separator line */
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.1); /* Inner shadow for depth */
    z-index: 5; /* Below header, above canvas */
}

aside#left-panel {
    border-right: none; /* No right border on the left-most panel */
}

aside#right-panel {
    border-left: none; /* No left border on the right-most panel */
}

.panel h2 {
    font-size: 1.2em;
    color: #00bfff;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(0, 191, 255, 0.3); /* Subtle separator */
    padding-bottom: 8px;
}

/* Game Canvas Container */
#game-canvas-container {
    flex: 1; /* Takes up all available horizontal space */
    position: relative; /* For positioning the UI overlay */
    background-color: #121212; /* Very dark background for the 3D scene */
    overflow: hidden; /* Ensure canvas doesn't overflow */
}

#webblox-canvas {
    display: block; /* Remove extra space below inline elements */
    width: 100%;
    height: 100%;
}

/* UI Overlay (Player HUD, Editor Tools, Chat, etc.) */
#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Allow clicks to pass through to the canvas by default */
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Push elements to top/bottom */
    padding: 10px;
    z-index: 15; /* Ensure it's above the canvas */
}

/* Footer (Bottom Bar) */
footer {
    background-color: #2a2a2a;
    padding: 8px 20px;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.2); /* Subtle shadow for depth */
    flex-shrink: 0; /* Prevent footer from shrinking */
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center; /* Center the text */
    z-index: 10;
}

footer p {
    font-size: 0.9em;
    color: #cccccc;
    margin: 0;
}

/* Responsive Design for smaller screens */
@media (max-width: 768px) {
    main {
        flex-direction: column; /* Stack panels and game view vertically */
    }

    .panel {
        width: 100%; /* Panels take full width */
        max-height: 200px; /* Limit panel height to save screen space */
        border-right: none;
        border-left: none;
        border-bottom: 1px solid #3a3a3a; /* Add bottom border as separator */
    }

    aside#left-panel, aside#right-panel {
        order: -1; /* Place panels above the game view */
    }

    footer {
        min-height: 60px; /* Taller footer on smaller screens */
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.2em;
    }

    header, footer {
        padding: 8px 15px;
    }

    .panel {
        padding: 10px;
    }

    .panel h2 {
        font-size: 1em;
        margin-bottom: 10px;
    }
}