/* ============================================
   SIDEBAR & LAYOUT STYLES
   
   Theme is loaded separately via base.html:
   <link rel="stylesheet" href="{% static 'ambient-theme.css' %}">
   ============================================ */

:root {
    /* Sidebar dimensions */
    --icon-width: 40px;
    --link-container-margin: 10px;
    --sidebar-collapsed-width: calc(var(--icon-width) + (var(--link-container-margin) * 2));
    --sidebar-expanded-width: 190px;
}

.sidebar-link-container {
    width: var(--icon-width);
    height: 40px;
    transition: width 0.3s cubic-bezier(0.4,0,0.2,1);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    /* Changed padding to margin */
    margin-top: 5px;
    margin-bottom: 5px;
    margin-left: var(--link-container-margin);
    margin-right: var(--link-container-margin);
    flex-shrink: 0;
    /*background: #D1DFEF;*/
    border-radius: 4px;
    /* No debug border */
    box-sizing: border-box; /* Ensure padding is included in width */
}

/* General body container (vertical layout) */
.general-body {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background: #ffffff; /* Pure white background */
}

/* Top bar styles - glassmorphism effect */
.top-bar {
    width: 100%;
    height: 56px; /* Fixed height for top bar */
    flex-shrink: 0; /* Don't allow top bar to shrink */
    z-index: 100;
    background-color: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px); /* Safari support */
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

/* Navbar inside top bar */
.top-bar .navbar {
    height: 100%;
    padding-top: 0;
    padding-bottom: 0;
}

/* Navbar title */
.navbar-title {
    color: white;
    font-size: 1.25rem;
    font-weight: 500;
}

/* Main container that holds sidebar and general-body in horizontal layout */
.main-container {
    display: flex;
    height: 100vh; /* Full viewport height */
    width: 100vw;
    background: #ffffff; /* Pure white background */
}

/* Sidebar styles */
.sidebar {
    width: var(--sidebar-collapsed-width);
    height: 100vh; /* Full viewport height */
    background-color: #f8f9fa; /* Cool gray, barely tinted */
    color: #fff;
    padding-left: 0;
    padding-right: 0;
    transition: width 0.3s cubic-bezier(0.4,0,0.2,1);
    overflow-x: hidden;
    flex-shrink: 0; /* Don't allow sidebar to shrink */
    z-index: 10;
    border-right: 1px solid rgba(0, 0, 0, 0.08); /* Subtle divider */
}
.sidebar:hover {
    width: var(--sidebar-expanded-width);
}
.sidebar-label {
    display: none;
    margin-left: 2px;
    /*background: #D1DFEF;*/
    padding: 2px 6px;
    color: #000;
    font-size: 0.93em;
    font-weight: 600; /* Semibold text */
    white-space: nowrap;
}
.sidebar-link-container img {
    width: var(--icon-width);
    height: var(--icon-width);
    object-fit: contain;
    flex-shrink: 0;
    padding: 5px;
}

/* Enhanced debugging - moved to main .sidebar-link-container definition */

/* Reset Bootstrap's default padding/margin */
.sidebar ul.nav {
    padding: 0;
    margin: 0;
}

.sidebar li.nav-item {
    padding: 0;
    margin: 0;
}

.nav-link {
    padding: 0; /* Reset any padding */
    margin: 0; /* Reset any margin */
    box-sizing: border-box;
}

.nav-item {
    box-sizing: border-box;
}

.sidebar:hover .sidebar-link-container {
    width: calc(var(--sidebar-expanded-width) - var(--link-container-margin) * 2);
}
.sidebar:hover .sidebar-link-container .sidebar-label {
    display: block;
}
.nav-link {
    display: flex;
    align-items: center;
    color: #000 !important;
}
.sidebar-sticky {
    position: relative;
    top: 0;
    height: calc(100vh - 56px);
    padding-top: 5px; 
}

/* Body content area */
.body-content {
    flex-grow: 1;
    overflow-y: auto; /* Enable scrolling if content is too long */
    background: #ffffff; /* Pure white background */
}

/* Container fluid inside body content */
.body-content .container-fluid {
    padding: 0.5rem;
}

/* Footer styles - glassmorphism effect */
footer.footer {
    flex-shrink: 0; /* Don't allow footer to shrink */
    background-color: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px); /* Safari support */
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

/* No margin adjustment needed with this layout when sidebar expands */

/* Sidebar divider */
.sidebar-divider {
    display: flex;
    justify-content: center;
    padding: 8px 0;
}

.sidebar-divider .divider {
    width: 75%;
    height: 1px;
    background-color: rgba(0, 0, 0, 0.1);
}

/* Mobile sidebar toggle button */
.sidebar-toggle-btn {
    display: none;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    margin-right: 15px;
}

.sidebar-toggle-btn img {
    height: 20px;
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.sidebar-overlay.active {
    display: block;
}

/* Mobile responsive styles */
@media (max-width: 768px) {
    .sidebar-toggle-btn {
        display: block;
    }
    
    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        height: 100vh;
        width: var(--sidebar-expanded-width);
        transition: left 0.3s ease-in-out;
        z-index: 1000;
    }
    
    .sidebar.mobile-open {
        left: 0;
    }
    
    /* Always show labels on mobile when sidebar is open */
    .sidebar.mobile-open .sidebar-link-container {
        width: calc(var(--sidebar-expanded-width) - var(--link-container-margin) * 2);
    }
    
    .sidebar.mobile-open .sidebar-label {
        display: block;
    }
    
    /* Disable hover expansion on mobile */
    .sidebar:hover {
        width: var(--sidebar-expanded-width);
    }
    
    .sidebar:hover .sidebar-link-container {
        width: calc(var(--sidebar-expanded-width) - var(--link-container-margin) * 2);
    }
}
