/**
 * Handbook Documentation Style
 * Chapter-based navigation for engineering education
 */

.handbook-layout {
    margin: 0 !important;
    padding: 0 !important;
}

.handbook-container {
    background-color: #fff;
}

.handbook-wrapper {
    display: flex;
    min-height: calc(100vh - 200px);
    max-width: 100%;
    margin: 0;
}

/* Sidebar Navigation */
.handbook-sidebar {
    width: 280px;
    background-color: #f7f7f7;
    border-right: 1px solid #e0e0e0;
    padding: 20px 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    flex-shrink: 0;
}

.handbook-search {
    padding: 0 20px 20px 20px;
}

.handbook-search input {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background-color: #fff;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path fill="%23666" d="M11.7 10.3l3.6 3.6-1.4 1.4-3.6-3.6c-1 .8-2.3 1.3-3.7 1.3C3.5 13 1 10.5 1 7.5S3.5 2 6.6 2s5.6 2.5 5.6 5.5c0 1.4-.5 2.7-1.5 3.8zM6.6 3.5c-2.2 0-4 1.8-4 4s1.8 4 4 4 4-1.8 4-4-1.8-4-4-4z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

.handbook-search input:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.1);
}

.handbook-navigation {
    padding: 0 20px;
}

.chapters-title {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 15px 0;
}

.chapter-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.chapter-list > li {
    margin-bottom: 5px;
}

.chapter-list > li > a {
    display: block;
    padding: 8px 12px;
    color: #333;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    transition: background-color 0.2s ease;
    position: relative;
}

.chapter-list > li > a:hover {
    background-color: #e8e8e8;
    color: #0066cc;
}

.chapter-list > li.active > a,
.chapter-list > li > a.active {
    background-color: #0066cc;
    color: #fff;
}

/* Parent chapters with children */
.chapter-parent > a.has-children::before {
    content: '›';
    position: absolute;
    left: -8px;
    font-size: 18px;
    font-weight: 600;
    transition: transform 0.2s ease;
    color: #666;
}

.chapter-parent.active > a.has-children::before {
    transform: rotate(90deg);
    color: #fff;
}

/* Child chapters */
.chapter-children {
    list-style: none;
    margin: 5px 0 10px 0;
    padding: 0;
    display: none;
}

.chapter-parent.active > .chapter-children {
    display: block;
}

.chapter-children li {
    margin-bottom: 3px;
}

.chapter-children li a {
    display: block;
    padding: 6px 12px 6px 25px;
    color: #555;
    text-decoration: none;
    font-size: 13px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.chapter-children li a:hover {
    background-color: #e0e0e0;
    color: #0066cc;
}

.chapter-children li a.active {
    color: #0066cc;
    font-weight: 600;
}

/* Main Content Area */
.handbook-content {
    flex: 1;
    padding: 40px 60px;
    max-width: 900px;
    background-color: #fff;
}

.handbook-content h1 {
    font-size: 2.5rem;
    color: #1e1e1e;
    margin: 0 0 30px 0;
    font-weight: 400;
    font-family: 'Georgia', 'Times New Roman', serif;
}

.handbook-content h2 {
    font-size: 1.8rem;
    color: #1e1e1e;
    margin: 40px 0 20px 0;
    font-weight: 600;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.handbook-content h3 {
    font-size: 1.4rem;
    color: #333;
    margin: 30px 0 15px 0;
    font-weight: 600;
}

.handbook-content p {
    font-size: 16px;
    line-height: 1.8;
    color: #333;
    margin-bottom: 20px;
}

.handbook-content ul,
.handbook-content ol {
    margin: 20px 0;
    padding-left: 30px;
}

.handbook-content li {
    margin-bottom: 10px;
    line-height: 1.8;
}

.handbook-content code {
    background-color: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: #0066cc;
}

.handbook-content pre {
    background-color: #f7f7f7;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 20px;
    overflow-x: auto;
    margin: 20px 0;
}

.handbook-content pre code {
    background-color: transparent;
    padding: 0;
    color: #333;
}

.handbook-content a {
    color: #0066cc;
    text-decoration: underline;
}

.handbook-content a:hover {
    color: #003d7a;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .handbook-content {
        padding: 30px 40px;
    }
}

@media (max-width: 768px) {
    .handbook-wrapper {
        flex-direction: column;
    }
    
    .handbook-sidebar {
        width: 100%;
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }
    
    .handbook-content {
        padding: 20px;
    }
    
    .handbook-content h1 {
        font-size: 2rem;
    }
    
    .handbook-content h2 {
        font-size: 1.5rem;
    }
}

/* Sidebar Scrollbar */
.handbook-sidebar::-webkit-scrollbar {
    width: 6px;
}

.handbook-sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.handbook-sidebar::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.handbook-sidebar::-webkit-scrollbar-thumb:hover {
    background: #a0a0a0;
}

/* Navigation section styling */
.handbook-content .navigating-chapter {
    background-color: #f9f9f9;
    border-left: 4px solid #0066cc;
    padding: 20px;
    margin: 30px 0;
}

.handbook-content .chapter-links {
    list-style: none;
    padding: 0;
    margin: 15px 0;
}

.handbook-content .chapter-links li {
    margin-bottom: 12px;
}

.handbook-content .chapter-links li a {
    text-decoration: none;
    font-weight: 600;
}

/* Print styles */
@media print {
    .handbook-sidebar {
        display: none;
    }
    
    .handbook-content {
        max-width: 100%;
        padding: 0;
    }
}
