/* Remodelers Guide CSS - Active Navigation */

/* Reset and root variables */
* {margin: 0; padding: 0; box-sizing: border-box;}

:root {
    --primary-color: #2c5f2d;
    --secondary-color: #f7941d;
    --accent-color: #1a3a1a;
    --text-primary: #333333;
    --text-secondary: #666666;
    --background-light: #f9f9f9;
    --background-white: #ffffff;
    --border-color: #dddddd;
    --header-bg: #1a3a1a;
    --footer-bg: #2c5f2d;
    --sidebar-bg: #f5f5f5;
    --sidebar-hover: #e8f5e9;
    --active-bg: #d4edda;
    --active-color: #155724;
    --sidebar-width: 280px;
    --header-height: 70px;
}

/* Typography */
body {
    font-family: 'Segoe UI', Tahoma, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--background-white);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 1.5rem;
    color: var(--accent-color);
}
h1 {font-size: 2.5rem;} h2 {font-size: 2rem;} h3 {font-size: 1.75rem;}
h4 {font-size: 1.5rem;} h5 {font-size: 1.25rem;} h6 {font-size: 1.1rem;}

p {margin-bottom: 1rem;}
a {color: var(--primary-color); text-decoration: none; transition: color 0.3s;}
a:hover {color: var(--secondary-color);}

/* Header */
header {
    background: var(--header-bg);
    color: #fff;
    padding: 1rem 2rem;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-height);
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.site-title {font-size: 1.8rem; font-weight: 700; color: #fff; margin: 0;}
.site-title a {color: #fff; text-decoration: none;}
.site-title a:hover {color: var(--secondary-color);}

/* Sidebar Navigation */
.sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    background: var(--sidebar-bg);
    overflow-y: auto;
    padding: 1rem 0;
    z-index: 900;
    box-shadow: 2px 0 5px rgba(0,0,0,0.05);
}

/* Navigation spacing - tight and uniform */
.sidebar nav ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
}
.sidebar nav > ul > li {
    margin-bottom: 0.5rem;
}
.sidebar nav li {
    margin: 0;
    padding: 0;
}
.sidebar nav a {
    padding: 0.4rem 1rem;
    display: block;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}
.sidebar nav > ul > li > a {
    font-weight: 600;
    color: var(--accent-color);
}
.sidebar nav a:hover {
    background: var(--sidebar-hover);
    border-left-color: var(--secondary-color);
    padding-left: calc(1.5rem + 5px);
}

/* Active link highlighting */
.sidebar nav a.active {
    background: var(--active-bg);
    color: var(--active-color);
    font-weight: 700;
    border-left-color: var(--primary-color);
}

/* Submenu - hidden by default, tight spacing */
.sidebar nav .submenu {
    list-style: none;
    padding-left: 0;
    margin: 0.2rem 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}
.sidebar nav .submenu li {
    margin: 0;
}
.sidebar nav .submenu a {
    padding: 0.3rem 1rem 0.3rem 2rem;
    font-size: 0.95rem;
    font-weight: 400;
    color: var(--text-secondary);
    border-left: 3px solid transparent;
}
.sidebar nav .submenu a:hover {
    color: var(--primary-color);
    background: var(--sidebar-hover);
    border-left-color: var(--primary-color);
}
.sidebar nav .submenu a.active {
    background: var(--active-bg);
    color: var(--active-color);
    font-weight: 600;
    border-left-color: var(--primary-color);
}

/* Show submenu when hovering parent, or force open when parent nav-item is active */
.sidebar nav .nav-item:hover .submenu,
.sidebar nav .nav-item.active-section .submenu {
    max-height: 500px;
}
.nav-item.active-section .submenu {
    display: block !important;
    max-height: none !important;
}

/* Ensure proper hierarchical list indentation in article content */
article ul {
    margin-left: 0;
    padding-left: 2em;
}
article ul ul {
    margin-left: 0;
    padding-left: 2em;
}
article li {
    margin-bottom: 0.5em;
}
article > ul {
    padding-left: 1.5em;
}

/* Mobile nav toggle */
.mobile-nav-toggle {
    display: none;
    position: fixed;
    top: calc(var(--header-height) - 45px);
    right: 1.5rem;
    background: var(--secondary-color);
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    z-index: 1001;
}

/* Main content */
.main-wrapper {display: flex; flex: 1; margin-top: var(--header-height);}
main {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 3rem 2rem;
    min-height: calc(100vh - var(--header-height));
}
article {
    max-width: 900px;
    background: var(--background-white);
    padding: 2rem;
    margin-bottom: 2rem;
}

/* Lists */
ul, ol {margin-left: 1.5rem; margin-bottom: 1.5rem;}
li {margin-bottom: 0.5rem; line-height: 1.7;}

/* Tables */
table {width: 100%; border-collapse: collapse; margin-bottom: 2rem; background: #fff;}
table thead {background: var(--primary-color); color: #fff;}
table th, table td {padding: 1rem; text-align: left; border: 1px solid var(--border-color);}
table tbody tr:nth-child(even) {background: var(--background-light);}
table tbody tr:hover {background: #e8f5e9;}

/* Images */
img {max-width: 100%; height: auto; display: block; margin: 1.5rem 0;}
figure {margin: 1.5rem 0;}
figcaption {font-size: 0.9rem; color: var(--text-secondary); font-style: italic; margin-top: 0.5rem;}

/* Footer */
footer {
    background: var(--footer-bg);
    color: #fff;
    padding: 2rem;
    margin-left: var(--sidebar-width);
    text-align: center;
}
footer a {color: #fff;}
footer a:hover {color: var(--secondary-color);}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {transform: translateX(-100%); transition: transform 0.3s;}
    .sidebar.active {transform: translateX(0);}
    .mobile-nav-toggle {display: block;}
    main, footer {margin-left: 0;}
    h1 {font-size: 2rem;} h2 {font-size: 1.75rem;} h3 {font-size: 1.5rem;}
}

@media print {
    header, .sidebar, footer {display: none;}
    main {margin-left: 0;}
}
