:root {
    --primary-color: #4a90e2;
    --secondary-color: #f5a623;
    --background-color: #f4f7f9;
    --text-color: #333;
    --code-background: #2d2d2d;
    --card-background: #ffffff;
    --header-height: 60px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    margin: 0;
    padding: 0;
    transition: background-color 0.3s ease;
}

/* Dynamic Header */
.dynamic-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: var(--primary-color);
    color: white;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    height: 60px; /* Set a fixed height */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s ease;
}

.header-content {
    display: flex;
    align-items: center;
}

.header-content h1 {
    font-size: 1.5rem;
    margin: 0;
    margin-right: 10px;
    display: flex;
    align-items: center;
}

.tagline {
    font-size: 0.9rem;
    margin: 0;
    opacity: 0.8;
}

.header-controls {
    display: flex;
    align-items: center;
}

.header-controls button {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    margin-left: 10px;
    transition: transform 0.3s ease;
}

.header-controls button:hover {
    transform: scale(1.1);
}

/* Main Container */
.main-container {
    display: flex;
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height));
    padding-top: 70px;
}

/* Interactive Table of Contents */
.interactive-toc {
    width: 250px;
    background-color: var(--card-background);
    padding: 1rem;
    position: sticky;
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s ease;
}

.interactive-toc ul {
    list-style-type: none;
    padding: 0;
}

.interactive-toc li {
    margin-bottom: 0.5rem;
}

.interactive-toc a {
    color: var(--text-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.interactive-toc a:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.interactive-toc a i {
    margin-right: 0.5rem;
}

/* Card-based Layout */
main {
    flex-grow: 1;
    padding: 2rem;
}

.card {
    background-color: var(--card-background);
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
    overflow: hidden;
    transition: box-shadow 0.3s ease, transform 0.3s ease, background-color 0.3s ease;
}

.card:hover {
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-5px);
}

.card h2 {
    margin: 0;
    padding: 1rem;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.card .content {
    padding: 1rem;
}

/* Progress Tracker */
.progress-bar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    height: 4px;
    background-color: var(--secondary-color);
    z-index: 1000;
    transition: width 0.3s ease;
}

/* Theme Customizer */
.theme-customizer {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: var(--card-background);
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: background-color 0.3s ease;
}

.color-picker {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

.color-picker label {
    margin-right: 0.5rem;
}

#apply-theme {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#apply-theme:hover {
    background-color: var(--secondary-color);
}

/* Search Overlay */
.search-overlay {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: 100%;
    height: 0;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    overflow: hidden;
    transition: height 0.3s ease;
}

.search-overlay.active {
    height: calc(100% - var(--header-height));
}

#search-input {
    width: 80%;
    max-width: 600px;
    margin: 2rem auto;
    display: block;
    padding: 1rem;
    font-size: 1.2rem;
    border: none;
    border-radius: 4px;
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

#search-results {
    width: 80%;
    max-width: 600px;
    margin: 0 auto;
    color: white;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
    }

    .interactive-toc {
        width: 100%;
        height: auto;
        position: static;
    }

    .card h2 {
        font-size: 1.2rem;
    }
}

/* Dark Mode */
body.dark-mode {
    --background-color: #1e1e1e;
    --text-color: #f0f0f0;
    --card-background: #2d2d2d;
}

body.dark-mode .dynamic-header {
    background-color: #333;
}

body.dark-mode .interactive-toc a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.card {
    animation: fadeIn 0.5s ease-out;
}

/* Code Blocks */
pre {
    background-color: var(--code-background);
    border-radius: 4px;
    padding: 1rem;
    overflow-x: auto;
    position: relative;
    color: #f0f0f0; /* Light text color for better contrast */
}

pre::before {
    content: attr(data-language);
    position: absolute;
    top: 0;
    right: 0;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    background-color: rgba(255, 255, 255, 0.1);
    color: #f0f0f0;
    border-bottom-left-radius: 4px;
}

code {
    font-family: 'Fira Code', 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Add styles for inline code */
:not(pre) > code {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    color: var(--text-color);
}