/* Basic Reset & Body Styling */
body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden; /* Prevent body scroll to manage scrolling within frames */
    display: flex;
    flex-direction: column;
    height: 100vh;
    background-color: #f0f2f5; /* Light background for body */
}
/* In css/main.css */
#logout-button {
    margin-right: 20px; /* Spacing from edge */
}
/* You can remove margin-right from #maximize-button if you want the logout button to provide the spacing */
#header {
    height: 60px;
    background-color: white;
    position: sticky;
    top: 0;
    width: 100%;
    z-index: 1000; /* Ensure header is on top */
    display: flex;
    justify-content: flex-end; /* Align maximize button to the right */
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05); /* Subtle shadow */
    transition: height 0.3s ease, box-shadow 0.3s ease; /* Smooth collapse/expand */
    box-sizing: border-box;
}

#header.collapsed {
    height: 0;
    overflow: hidden; /* Hide content when collapsed */
    box-shadow: none;
}

/* General Button Styling */
.app-button {
    background-color: #007bff; /* Primary blue */
    color: white;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 0.9em;
    border-radius: 5px; /* Rounded corners */
    transition: background-color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
    font-weight: 600;
    letter-spacing: 0.5px;
    white-space: nowrap; /* Prevent text wrapping */
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-button:hover {
    background-color: #0056b3; /* Darker blue on hover */
    transform: translateY(-1px); /* Slight lift effect */
    box-shadow: 0 4px 8px rgba(0,0,0,0.2); /* More prominent shadow on hover */
}

.app-button:active {
    transform: translateY(0); /* Press effect */
    background-color: #004080; /* Even darker on click */
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

#maximize-button {
    margin-right: 20px; /* Spacing from edge */
}

/* The main content area and sidebars are wrapped in this flex container */
#container {
    display: flex;
    flex: 1; /* Allows container to take remaining height */
    overflow: hidden; /* Prevents main container scrollbar */
    height: 100vh;
}

/* Sidebar Base Styles */
.sidebar {
    background-color: white;
    transition: width 0.3s ease, padding 0.3s ease; /* Smooth transitions for desktop width */
    overflow-y: auto; /* Enable scrolling for sidebar content */
    flex-shrink: 0; /* Prevent shrinking when content needs more space */
    box-shadow: 2px 0 5px rgba(0,0,0,0.05); /* Subtle shadow */
    box-sizing: border-box;
    padding: 15px; /* Default internal padding for open state */
}

/* Desktop specific sidebar width */
.sidebar {
    width: 280px; /* Default open width on desktop - MADE WIDER */
}

.sidebar.collapsed {
    width: 0px; /* Collapsed width on desktop */
    padding: 0; /* Remove padding when collapsed */
    overflow: hidden; /* Hide content when collapsed */
    box-shadow: none;
}

#left-sidebar {
    border-right: 1px solid #eee;
}

#right-sidebar {
    border-left: 1px solid #eee;
}

#main-content {
    flex-grow: 1; /* Main content takes remaining space */
    background-color: white;
    overflow-y: auto; /* Enable scrolling for main content */
    padding: 20px;
    box-sizing: border-box;
}

/* Styling for the ALWAYS-VISIBLE toggle buttons */
.toggle-sidebar-button {
    position: fixed; /* Fixed to the viewport, never disappears */
    top: 70px; /* Adjust this to be just below the header */
    z-index: 101; /* Ensure it's above sidebars and other content */
    background-color: #6c757d; /* Muted gray for these buttons */
    color: white;
    padding: 8px 12px; /* Compact padding for icons */
    font-size: 1em;
    border-radius: 5px; /* Rounded corners for a sleek look */
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: background-color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
    display: flex; /* Use flex for centering icon */
    align-items: center;
    justify-content: center;
}

.toggle-sidebar-button:hover {
    background-color: #5a6268; /* Darker gray on hover */
    transform: translateY(-1px) scale(1.05); /* Slight lift and scale on hover */
}

.toggle-sidebar-button:active {
    transform: translateY(0) scale(0.98); /* Press effect */
    background-color: #004080; /* Even darker on click */
}

#toggle-left {
    left: 0; /* Fixed to the very left edge of the viewport */
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

#toggle-right {
    right: 0; /* Fixed to the very right edge of the viewport */
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

/* --- Responsive Design for Mobile (max-width: 768px) --- */
@media (max-width: 768px) {
    #container {
        flex-direction: column; /* Stack sidebars and main content vertically */
    }

    .sidebar {
        width: 100%; /* Sidebars take full width on mobile */
        min-height: 50px; /* Minimum height for collapsed state (button visible) */
        max-height: 50px; /* Default collapsed height for mobile */
        overflow: hidden;
        padding: 10px 15px; /* Keep some padding for text on mobile collapsed */
        border-bottom: 1px solid #eee; /* Separator for stacked elements */
        transition: max-height 0.3s ease, padding 0.3s ease; /* Transition height on mobile */
        box-shadow: none; /* Remove side shadows when stacked */
        border-left: none;
        border-right: none;
    }

    .sidebar.expanded-mobile { /* New class for expanded mobile sidebar */
        max-height: 300px; /* Expanded height on mobile */
        padding-bottom: 15px; /* Ensure bottom padding on expand */
    }

    /* Adjust button position for mobile (still fixed, but maybe lower or different visual) */
    .toggle-sidebar-button {
        top: 70px; /* Keep them at the top of the screen below the header */
        padding: 8px 10px; /* Slightly smaller padding */
        font-size: 0.9em;
    }

    #toggle-left {
        left: 0; /* Stays fixed left */
        right: auto; /* Important to override desktop right if any */
    }

    #toggle-right {
        right: 0; /* Stays fixed right */
        left: auto; /* Important to override desktop left if any */
    }

    #main-content {
        height: 100vh; /* Allow main content to grow vertically */
        flex-grow: 1;
        width: 100%;
        padding: 15px;
    }
}

/* Fullscreen styles (remain the same) */
body.fullscreen {
    overflow: hidden;
}

body.fullscreen #header,
body.fullscreen .sidebar,
body.fullscreen .toggle-sidebar-button { /* Hide header, sidebars, and toggle buttons in fullscreen */
    display: none;
}

body.fullscreen #main-content {
    width: 100vw;
    height: 100vh;
    padding: 0;
}