/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --light-color: #ecf0f1;
    --dark-color: #2c3e50;
    --sidebar-width: 250px;
    --header-height: 60px;
    --text-color: #333;
    --text-light: #7f8c8d;
    --border-radius: 4px;
    --box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    --sidebar-bg: #2c3e50;
    --sidebar-text: #ecf0f1;
    --sidebar-hover: #34495e;
    --sidebar-active: #3498db;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: #f5f7fa;
    display: flex;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 15px 2rem calc(var(--sidebar-width) + 30px);
    transition: padding 0.3s ease;
    position: relative;
    z-index: 1;
}

/* Header Styles */
header {
    background-color: var(--primary-color);
    color: white;
    padding: 0;
    box-shadow: var(--box-shadow);
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    z-index: 1000;
    height: var(--header-height);
    display: flex;
    align-items: center;
}
main.container {
    margin: 40px auto 0;
    width: 95%;
    max-width: 1400px; /* Increased by ~30% from the standard 1200px */
}
header>h1 {
    text-align: center !important;
    width: 100%;
    margin: 0 auto !important;
    margin-left: -20% !important;
}

/* Mobile styles */
@media (max-width: 768px) {
    header>h1 {
        margin-left: 5% !important;
        text-align: center !important;
    }
}
.content-header {
    width: 100%;
    padding: 1rem 0;
    margin: 0;
    background-color: var(--primary-color);
    color: white;
}

header .container {
    padding-left: 15px;
}

header h1 {
    font-size: 1.5rem;
    margin: 0;
    text-align: left;
}

/* Sidebar Styles */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 1001;
    transition: transform 0.3s ease;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.sidebar-header h2 {
    color: white;
    margin: 0;
    font-size: 1.2rem;
}

/* Navigation Styles */
.menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.menu li {
    margin: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.menu a {
    color: var(--sidebar-text);
    text-decoration: none;
    padding: 0.8rem 1.5rem;
    display: flex;
    align-items: center;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.menu a i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

.menu a:hover {
    background-color: var(--sidebar-hover);
    padding-left: 1.8rem;
}

.menu a.active {
    background-color: var(--sidebar-active);
    color: white;
    border-left: 4px solid white;
}

/* Submenu Styles */
.submenu {
    max-height: 0;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.1);
    transition: max-height 0.3s ease;
}

.submenu a {
    padding-left: 2.5rem;
    font-size: 0.85rem;
}

.menu-item.has-submenu > a::after {
    content: '\f078';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    margin-left: auto;
    font-size: 0.7rem;
    transition: transform 0.3s;
}

.menu-item.has-submenu.open > a::after {
    transform: rotate(180deg);
}

.menu-item.has-submenu.open > .submenu {
    max-height: 500px; /* Adjust based on content */
}

/* Menu Toggle Button */
.menu-toggle {
    display: none;
    cursor: pointer;
    font-size: 1.5rem;
    color: white;
    padding: 0.5rem;
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 1002;
    background: var(--sidebar-active);
    border-radius: 4px;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
}

/* Main Content */
main {
    flex: 1;
    padding: 0;
    min-height: 100vh;
    margin-top: var(--header-height);
}

.welcome {
    background-color: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    text-align: center;
}

.welcome h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.welcome p {
    margin-bottom: 1rem;
    color: var(--text-light);
}

/* Content Page Styles */
.content-section {
    background: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 2rem;
}

.topic-card {
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border-left: 4px solid var(--secondary-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.topic-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.topic-card h3 {
    color: var(--primary-color);
    margin-top: 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
}

.comparison-table {
    overflow-x: auto;
    margin: 1.5rem 0;
}

.comparison-table table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.comparison-table th,
.comparison-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.comparison-table th {
    background-color: #f5f7fa;
    font-weight: 600;
    color: var(--primary-color);
}

.comparison-table tr:hover {
    background-color: #f9f9f9;
}

.key-points {
    background-color: #f8f9fa;
    border-left: 4px solid var(--secondary-color);
    padding: 1rem 1.5rem 1rem 2rem;
    margin: 1.5rem 0;
    border-radius: 0 4px 4px 0;
}

.key-points li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.key-points li:last-child {
    margin-bottom: 0;
}

/* ClassLoader Section Styles */
.classloader-hierarchy {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin: 2rem 0;
}

.classloader-item {
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.classloader-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}

.classloader-item.bootstrap::before {
    background-color: #e74c3c; /* Red for Bootstrap */
}

.classloader-item.extension::before {
    background-color: #3498db; /* Blue for Extension */
}

.classloader-item.application::before {
    background-color: #2ecc71; /* Green for Application */
}

.classloader-item h4 {
    margin-top: 0;
    color: var(--primary-color);
    padding-bottom: 0.5rem;
    border-bottom: 1px dashed #eee;
}

.classloader-item ul {
    padding-left: 1.5rem;
    margin: 1rem 0;
}

.classloader-item li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.classloader-item .code-block {
    margin: 1rem 0 0;
    border-left: 3px solid #eee;
}

/* Responsive Design */
@media (min-width: 768px) {
    .classloader-hierarchy {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .classloader-item {
        flex: 1 1 calc(33.333% - 2rem);
        min-width: 300px;
    }
}

.content-section h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--light-color);
}

.content-section h3 {
    color: var(--secondary-color);
    margin: 1.5rem 0 1rem;
}

.content-section p {
    margin-bottom: 1rem;
    line-height: 1.7;
}

/* Table Styles */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    margin: 1.5rem 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-radius: 4px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.9em;
    min-width: 600px;
}

.data-table th,
.data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.data-table th {
    background-color: #f5f5f5;
    font-weight: 600;
    color: #333;
    text-transform: uppercase;
    font-size: 0.8em;
    letter-spacing: 0.5px;
}

.data-table tr:hover {
    background-color: #f9f9f9;
}

.data-table code {
    background-color: #f0f0f0;
    padding: 2px 5px;
    border-radius: 3px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    color: #d63384;
}

/* Code Block Styles */
.code-block {
    background-color: #f8fafc;
    border-radius: 6px;
    padding: 1.5rem 1rem 1rem;
    margin: 1.5rem 0;
    overflow-x: auto;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    position: relative;
    border-left: 4px solid var(--secondary-color);
    font-family: 'Fira Code', 'Consolas', 'Monaco', 'Andale Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
}

.code-block pre {
    margin: 0;
    padding: 0;
    background: transparent;
    white-space: pre;
    overflow-x: auto;
}

.code-block code {
    display: block;
    padding: 0.5rem 0;
    color: #2d3748;
    font-family: inherit;
    font-size: 0.9em;
    line-height: 1.6;
}

/* Syntax Highlighting */
.code-block .keyword {
    color: #7c3aed; /* Purple */
    font-weight: 600;
}

.code-block .type {
    color: #2563eb; /* Blue */
    font-weight: 500;
}

.code-block .string {
    color: #dc2626; /* Red */
}

.code-block .comment {
    color: #64748b; /* Slate 500 */
    font-style: italic;
}

.code-block .number {
    color: #d97706; /* Amber 700 */
    font-weight: 500;
}

/* Line numbers */
.code-block.line-numbers {
    counter-reset: line;
}

.code-block.line-numbers .line::before {
    counter-increment: line;
    content: counter(line);
    display: inline-block;
    width: 2em;
    margin-right: 1em;
    color: #94a3b8; /* Slate 400 */
    text-align: right;
    user-select: none;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .code-block {
        background-color: #1e293b; /* Slate 800 */
        color: #e2e8f0; /* Slate 200 */
    }
    
    .code-block code {
        color: #e2e8f0; /* Slate 200 */
    }
    
    .code-block .keyword {
        color: #a78bfa; /* Violet 400 */
    }
    
    .code-block .type {
        color: #60a5fa; /* Blue 400 */
    }
    
    .code-block .string {
        color: #f87171; /* Red 400 */
    }
    
    .code-block .comment {
        color: #94a3b8; /* Slate 400 */
    }
    
    .code-block .number {
        color: #fbbf24; /* Amber 400 */
    }
}

.code-block.line-numbers {
    counter-reset: line;
}

.code-block.line-numbers code {
    position: relative;
    padding-left: 3.8em;
}

.code-block.line-numbers .line-number {
    position: absolute;
    left: 0;
    width: 3em;
    text-align: right;
    padding-right: 1em;
    color: #7f8c8d;
    user-select: none;
    counter-increment: line;
}

.code-block.line-numbers .line-number::before {
    content: counter(line);
}

.copy-button {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: #e0e6ed;
    border: none;
    border-radius: 3px;
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.copy-button:hover {
    opacity: 1;
    background: #d1d8e0;
}

.copy-button.copied {
    background: #2ecc71;
    color: white;
}

.copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.25rem 0.5rem;
    background-color: rgba(255, 255, 255, 0.8);
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 0.8em;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease;
    color: #c678dd;
}

.code-block .type {
    color: #e5c07b;
}

.code-block .string {
    color: #98c379;
}

.code-block .comment {
    color: #5c6370;
    font-style: italic;
}

/* Footer */
footer {
    background-color: var(--dark-color);
    color: white;
    text-align: center;
    padding: 1.5rem 0;
    margin-top: 2rem;
}

/* Responsive Design */
@media (max-width: 992px) {
    :root {
        --sidebar-width: 220px;
    }
    
    .container {
        padding-left: 15px;
    }
    
    header {
        left: 0;
    }
    
    .sidebar {
        transform: translateX(-100%);
        z-index: 1001;
    }
    
    .sidebar.active {
        transform: translateX(0);
        box-shadow: 2px 0 15px rgba(0, 0, 0, 0.2);
    }
    
    .menu-toggle {
        display: flex;
    }
    
    .overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1000;
    }
    
    .overlay.active {
        display: block;
    }
    
    .menu a {
        padding: 0.7rem 1.2rem;
    }
    
    .submenu a {
        padding-left: 2.2rem;
    }
}

@media (max-width: 576px) {
    :root {
        --header-height: 50px;
    }
    
    header h1 {
        font-size: 1.2rem;
    }
    
    .sidebar {
        width: 80%;
    }
}

/* Footer Design Credit */
.design-credit {
    display: inline-block;
    margin-left: 10px;
    padding-left: 10px;
    border-left: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 0.9em;
    color: #bdc3c7;
    font-style: italic;
}

.design-credit:hover {
    color: var(--secondary-color);
    transition: color 0.3s ease;
}

/* Utility Classes */
.highlight {
    background-color: #fff3cd;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
}

.note {
    background-color: #e7f4ff;
    border-left: 4px solid var(--secondary-color);
    padding: 1rem;
    margin: 1.5rem 0;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}
