/* css/style.css */

/* --- General Resets & Typography --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: 'Roboto', sans-serif;
    line-height: 1.7;
    color: #333;
    background-color: #f4f7f6; /* Light overall page background */
    font-size: 16px;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Montserrat', sans-serif;
    margin-bottom: 0.75em;
    line-height: 1.3;
    font-weight: 600;
    color: #2c3e50;
}

.container { /* General purpose container for content sections */
    width: 90%;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

/* --- Header (#mainHeader) --- */
#mainHeader {
    background-color: #2c3e50; /* Dark blue/charcoal */
    color: #ecf0f1;
    padding: 10px 0; /* Vertical padding for the header bar */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    transition: margin-left 0.3s ease-in-out; /* For sidebar interaction */
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
}

#mainHeader .header-container { /* Inner container for header content */
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 95%; /* Take most of the width */
    max-width: 1280px; /* Max width for very large screens */
    margin: 0 auto; /* Center it */
    padding: 0 15px; /* Padding inside the header bar */
}

#mainHeader .header-left {
    display: flex;
    align-items: center;
}

#mainHeader #branding h1 {
    margin: 0;
    font-size: 1.3em; /* Slightly smaller for better fit */
    font-weight: 700;
    white-space: nowrap; /* Prevent branding from wrapping */
}

#mainHeader #branding h1 a {
    color: #ecf0f1;
    text-decoration: none;
}

.open-nav-btn { /* Hamburger button */
    font-size: 1.7em; /* Hamburger icon size */
    background: none;
    border: none;
    color: #ecf0f1;
    cursor: pointer;
    padding: 5px; /* Clickable area */
    margin-right: 10px; /* Space between button and branding */
    display: block; /* Display by default (mobile-first) */
}

/* Top Navigation Bar Styles */
#mainHeader nav.top-nav {
    display: none; /* CRITICAL: HIDDEN BY DEFAULT FOR MOBILE */
}

#mainHeader nav.top-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    /* display: flex; - will be applied in media query for larger screens */
}

#mainHeader nav.top-nav ul li {
    /* No display property here by default */
}

#mainHeader nav.top-nav ul li a {
    color: #ecf0f1;
    padding: 15px 10px; /* Padding when visible on desktop */
    display: block;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: background-color 0.2s ease;
}

#mainHeader nav.top-nav ul li.active a,
#mainHeader nav.top-nav ul li a:hover {
    background-color: #34495e;
    border-radius: 3px;
}


/* --- Sidebar (#mySidebar) --- */
.sidebar {
    height: 100%;
    width: 0; /* Hidden by default */
    position: fixed;
    z-index: 1001;
    top: 0;
    left: 0;
    background-color: #2c3e50; /* Match header or slightly different */
    overflow-y: auto; /* Allow scrolling in sidebar if content is long */
    overflow-x: hidden;
    transition: width 0.3s ease-in-out;
    padding-top: 60px; /* Space for the close button if header is fixed */
    box-shadow: 3px 0 6px rgba(0,0,0,0.2);
}

.sidebar .closebtn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 2em;
    line-height: 1;
    background: none;
    border: none;
    color: #bdc3c7;
    cursor: pointer;
}
.sidebar .closebtn:hover {
    color: #fff;
}

.sidebar .sidebar-inner-content {
    padding: 15px;
}

.sidebar h3 {
    color: #ecf0f1;
    font-size: 1.1em;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #4a637b;
}

.sidebar ul {
    list-style: none;
    padding-left: 0; /* Remove default ul padding */
}

.sidebar ul li a {
    padding: 10px 15px;
    text-decoration: none;
    font-size: 0.95em;
    color: #bdc3c7;
    display: block;
    transition: background-color 0.2s ease, color 0.2s ease;
    border-radius: 3px;
    margin-bottom: 3px;
}

.sidebar ul li a:hover,
.sidebar ul li a.active-sidebar-link {
    background-color: #34495e; /* Slightly lighter for hover/active in sidebar */
    color: #ffffff;
}

.sidebar ul li a.collapsible-trigger .arrow {
    float: right;
    transition: transform 0.2s ease-in-out;
    font-size: 0.8em;
    line-height: inherit;
}
.sidebar ul li a.collapsible-trigger.open .arrow {
    transform: rotate(180deg);
}

.sidebar .submenu {
    padding-left: 15px; /* Indent submenus */
    /* display: none; by default in HTML, JS toggles */
}
.sidebar .submenu a {
    font-size: 0.9em;
    padding: 8px 15px 8px 25px;
    color: #95a5a6; /* Lighter for submenu items */
}
.sidebar .submenu .submenu a { /* Deeper nesting */
    padding-left: 40px;
}


/* --- Page Content Wrapper (#pageContentWrapper) --- */
#pageContentWrapper {
    padding-top: 60px; /* Height of fixed header */
    transition: margin-left 0.3s ease-in-out;
    flex-grow: 1; /* Ensure it takes up available vertical space */
}

.page-main-area.container { /* Apply container styles to this specific wrapper */
    background-color: #ffffff; /* White background for content */
    padding: 20px 25px; /* More padding for content area */
    border-radius: 5px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-top: 20px; /* Space below header */
    margin-bottom: 20px; /*Space above footer */
}

/* --- Footer --- */
#mainFooter {
    background-color: #2c3e50;
    color: #bdc3c7;
    text-align: center;
    padding: 20px 0;
    font-size: 0.9em;
}

/* --- Error Page Styling --- */
.error-page {
    text-align: center;
    padding: 50px 20px;
}
.error-page h1 {
    color: #e74c3c;
}

/* --- Jupyter Notebook Content Specifics --- */
/* Best placed inside individual assignments/Assignment_X.php <style> tags */
/* or a separate notebook.css linked only on those pages to prevent global conflicts. */
/* Example for scoping if included here: */
#notebook-container {
    font-size: 1rem;
    line-height: 1.6;
}
#notebook-container pre,
#notebook-container code {
    font-size: 0.875rem; /* 14px if base is 16px */
    white-space: pre-wrap;
    word-break: break-word;
    overflow-x: auto;
    background-color: #f7f7f7;
    border: 1px solid #e1e1e1;
    padding: 0.8em;
    border-radius: 4px;
    margin-bottom: 1em;
}
/* ... (other specific Jupyter styles, carefully scoped) ... */


/* ==========================================================================
   MEDIA QUERIES for Responsiveness
   ========================================================================== */

/* Tablets and small desktops - where top nav might start appearing */
@media screen and (min-width: 768px) {
    #mainHeader #branding h1 {
        font-size: 1.6em;
    }
    #pageContentWrapper {
        padding-top: 70px; /* If header height changes slightly */
    }
    /* If you want top-nav to appear on tablets already: */
    /*
    .open-nav-btn {
        display: none;
    }
    #mainHeader nav.top-nav {
        display: flex;
        align-items: center;
    }
    #mainHeader nav.top-nav ul {
        display: flex;
    }
    */
}

/* Desktops - Hamburger hidden, top nav shown */
@media screen and (min-width: 992px) {
    .open-nav-btn {
        display: none; /* Hide hamburger on desktop */
    }

    #mainHeader nav.top-nav {
        display: flex; /* Show the top navigation */
        align-items: center;
    }

    #mainHeader nav.top-nav ul {
        display: flex; /* Make list items arrange horizontally */
    }

    #mainHeader nav.top-nav ul li a {
        padding: 20px 12px;
        font-size: 0.95rem;
    }

    /* Optional: If you want sidebar permanently open on desktop and content to shift */
    /*
    #mySidebar {
        width: 250px;
        padding-top: 70px; // Adjust if header is fixed and has this height
    }
    #mySidebar .closebtn { display: none; }
    #pageContentWrapper, #mainHeader { margin-left: 250px; }
    */
}

/* Extra Large screens */
@media screen and (min-width: 1200px) {
    #mainHeader nav.top-nav ul li a {
        padding: 20px 15px;
        font-size: 1rem;
    }
}