/* Define global CSS variables */
:root {
    --panel-bg-color: #000000;
    --viewer-bg-color: #242323;
    /* Common background color */
}

/* Reset default margin and padding for all elements */
* {
    margin: 0;
    box-sizing: border-box;
    line-height: 1.15;
}

/* Main grid layout */
body {
    display: grid;
    grid-template-rows: auto 1fr 25px;
    /* Ensure info panel is last */
    grid-template-columns: 70px 1fr;
    /* Sidebar width fixed, main content flexible */
    grid-template-areas:
        "sidebar main"
        "sidebar main"
        "info info";
    /* Info panel spans full width */
    height: 100vh;
    /* Full viewport height */
    font-family: 'Poppins', sans-serif;
}

/* Sidebar (Navigation Panel) */
nav {
    grid-area: sidebar;
    background-color: var(--panel-bg-color);
    color: white;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

/* Style each navigation item */
.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    text-decoration: none;
    color: white;
}

/* Style the icons */
.nav-item img {
    width: 40px;
    height: 40px;
    filter: invert(0%);
}

/* Style the text below icons */
.nav-item span {
    font-size: 12px;
    margin-top: 5px;
}

/* Dark Mode Toggle Button */
#dark-mode-toggle {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Dark Mode Icon */
#dark-mode-toggle img {
    width: 40px;
    height: 40px;
}

/* Main container (Holds left panel, viewer, and right panel) */
.main-container {
    grid-area: main;
    display: grid;
    grid-template-columns: 300px auto 120px;
    /* Left Panel (300px), Viewer (Auto), Right Panel (120px) */
    grid-template-areas: "left-panel viewer right-panel";
    gap: 0px;
    padding: 0px;
    /* height: 100vh; Ensure full height */
}

/* Viewer (3D Canvas Area) */
.viewer {
    grid-area: viewer;
    background-color: var(--viewer-bg-color);
    position: relative;
    /* Needed for absolute positioning */
    width: 100%;
    /* Ensure viewer fills its grid space */
    /* height: 100vh; Take full height */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    /* Prevents any content overflow */
}

/* Make the canvas fill the viewer completely */
#viewcanvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Style for Drawer Button */
#drawerButton {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* SVG Icon Styling */
#drawerButton img {
    width: 24px;
    /* Adjust size */
    height: 24px;
    transition: transform 0.3s ease-in-out;
    filter: invert(46%) sepia(90%) saturate(598%) hue-rotate(146deg) brightness(96%) contrast(99%);
}

/* Ensure Smooth Rotation Animation */
#drawerButton img {
    transition: transform 0.3s ease-in-out;
}

/* Position Drawer Button at the Top Center */
#drawerDiv {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    /* Space between button and bottom drawer */
}

/* Ensure Bottom Drawer is in a Single Row */
#bottomDrawer {
    display: none;
    justify-content: center;
    /* Centers icons */
    align-items: center;
    gap: 14px;
    /* Space between icons */
    flex-wrap: nowrap;
    /* Prevents icons from wrapping to the next line */
    overflow-x: auto;
    /* Allows scrolling if icons exceed width */
    padding: 0px;
}

/* Style for Buttons Inside Bottom Drawer */
#bottomDrawer button {
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Icon Styling for Bottom Drawer */
#bottomDrawer button img {
    width: 25px;
    /* Adjust icon size */
    height: 25px;
    transition: transform 0.3s ease-in-out;
}

/* Hover Effect for Bottom Drawer Icons */
#bottomDrawer button:hover img {
    transform: scale(1.1);
}

#ID_BUTTON_toggleModelTree,
#ID_BUTTON_toggleUnitDiv,
#ID_BUTTON_hideMeasurements,
#ID_BUTTON_clearScene,
#ID_BUTTON_autoAlignModel,
#ID_BUTTON_alignModel,
#ID_BUTTON_zoomFit,
#ID_BUTTON_toggleViewCubeDiv{
    filter: invert(46%) sepia(90%) saturate(598%) hue-rotate(146deg) brightness(96%) contrast(99%);
}


/* Button Icons Styling */
.measurement-control-img {
    /* width: 24px;
    height: 24px;
    filter: invert(50%) brightness(120%); */

    height: 30px;
    width: 30px;
    border-radius: 50%;
    background: #41c9b000;
    border: none;
}

/* Info Panel - Positioned at the bottom */
.info-panel {
    font-size: 12px;
    grid-area: info;
    background-color: var(--panel-bg-color);
    color: white;
    text-align: center;
    padding: 1px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 25px;
    width: 100vw;
    position: fixed;
    bottom: 0;
    left: 0;
    border-top: 1px solid #4a4a4a;
}

/* Units Section */
.units {
    display: flex;
    gap: 20px;
    /* Space between Scanner Unit & Viewing Unit */
}

/* Make Scanner Unit and Viewing Unit inline */
.unit-item {
    display: flex;
    align-items: center;
    gap: 10px;
    /* Space between label and dropdown */
}

/* Dropdown Styling */
.unit-item select {
    padding: 0px 8px;
    background-color: #000000;
    color: white;
}

/* Ensure Model Name is Right-Aligned */
#modelNameDiv {
    text-align: right;
    flex-grow: 1;
    /* Ensures it takes remaining space */
}


/* Responsive Design for Smaller Screens */
@media (max-width: 768px) {
    body {
        grid-template-rows: auto auto 50px;
        /* Adjust layout for small screens */
        grid-template-columns: 1fr;
        grid-template-areas:
            "sidebar"
            "main"
            "info";
    }

    /* Stack panels vertically */
    .main-container {
        grid-template-columns: 1fr;
        grid-template-areas:
            "viewer"
            "left-panel"
            "right-panel";
    }
}

#jsTreeContainer {
    overflow: auto; /* Enables both horizontal and vertical scrolling */
    max-height: 500px; /* Adjust height as needed */
    max-width: 100%; /* Adjust width as needed */
    white-space: nowrap; /* Prevents text from wrapping, ensuring horizontal scroll */
}
