/* static/css/styles.css */

:root {
    --primary-color: #3498db;
    --secondary-color: #2c3e50;
    --text-color: #333;
    --bg-color: #f8f9fa;
    --card-bg: #fff;
    --border-color: #dee2e6;
    --code-bg: #f8f9fa;
    --footer-bg: #f8f9fa;
    --list-item-bg: #fff;
    --gradient-start: #eef5ff;
    --gradient-end: #f9fcff;
    --base-font-size: 16px;
    --line-spacing: 1.5;
    --transition-duration: 0.3s;
}

/* Ensure navbar is always visible and sticky */
.navbar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 9999 !important;
    width: 100% !important;
    background-color: inherit !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1) !important;
}

/* Ensure navbar background is solid */
.navbar.bg-light {
    background-color: #f8f9fa !important;
}

.navbar.bg-dark {
    background-color: #212529 !important;
}

/* Add top margin to body to account for fixed navbar */
body {
    padding-top: 56px !important;
    color: var(--text-color);
    background-color: var(--bg-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: var(--base-font-size);
    line-height: var(--line-spacing);
    transition: all var(--transition-duration) ease;
}

footer {
    margin-top: auto;
    background-color: var(--footer-bg);
    color: var(--text-color);
}

.card {
    background-color: var(--card-bg);
    border-color: var(--border-color);
}

pre {
    border-radius: 5px;
    padding: 1rem;
    margin: 1rem 0;
    background-color: var(--code-bg);
    position: relative;
    overflow: hidden;
}

.sticky-top { z-index: 1025; }

/* Sidebar independent scroll with shadows */
.sidebar-card {
    overflow: hidden;
}

.sidebar-scroll {
    max-height: calc(100vh - 8rem);
    overflow-y: auto;
    position: relative;
}

.sidebar-scroll.is-scrolling::before,
.sidebar-scroll.has-more::after {
    content: '';
    position: sticky;
    left: 0;
    right: 0;
    height: 12px;
    display: block;
    z-index: 1;
}

.sidebar-scroll.is-scrolling::before {
    top: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.08), rgba(0,0,0,0));
}

.sidebar-scroll.has-more::after {
    bottom: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.08), rgba(0,0,0,0));
}

/* Modern hero */
.hero-section {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    border: 1px solid var(--border-color);
}
.hero-visual { border-radius: 8px; background: var(--card-bg); }
.code-window { border: 1px solid #3c3c3c; border-radius: 8px; overflow: hidden; }
.code-window-header { background: #2d2d30; padding: 8px 12px; display: flex; gap: 6px; }
.code-window-header span { width: 10px; height: 10px; border-radius: 50%; background: #bbb; }
.code-window pre { border: 0; border-radius: 0; margin: 0; position: relative; }
.code-window pre::after {
    display: none;
}

/* Language header for code-window */
.code-window pre::before {
    content: attr(data-language, "code");
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background-color: #2d2d30;
    color: #d4d4d4;
    padding: 6px 12px;
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #3c3c3c;
}

/* Banner code formatting - ensure proper left alignment and indentation */
.hero-visual .code-window pre {
    text-align: left;
    padding: 2.5rem 1rem 1rem 1rem;
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 14px;
    line-height: 1.5;
    background-color: #1e1e1e !important;
    color: #d4d4d4 !important;
    margin: 0;
    border: 0;
    border-radius: 0;
    overflow-x: auto;
    overflow-y: auto;
    height: 230px;
}

.hero-visual .code-window code {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    background-color: transparent;
    color: inherit;
    padding: 0;
    border: 0;
    border-radius: 0;
}

/* Banner code always uses dark theme regardless of user preference */
.hero-visual .code-window pre[data-theme="dark"] {
    background-color: #1e1e1e !important;
    color: #d4d4d4 !important;
}

.hero-visual .code-window pre[data-theme="dark"] code {
    background-color: transparent !important;
    color: #d4d4d4 !important;
}

/* Code blocks - always dark theme like VS Code */
pre {
    background-color: #1e1e1e !important;
    color: #d4d4d4;  /* No !important - let hljs override for syntax colors */
    border: 1px solid #3c3c3c;
    border-radius: 6px;
    margin: 1.5rem 0;
    position: relative;
}

/* Let highlight.js handle all syntax highlighting - no custom overrides */

pre code {
    display: block;
    overflow-x: auto;
    padding: 1em;
    background-color: transparent !important;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
}

/* Code block header - always dark */
pre::before {
    content: attr(data-language, "code");
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background-color: #2d2d30;
    color: #d4d4d4;
    padding: 8px 16px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #3c3c3c;
    border-radius: 6px 6px 0 0;
}

/* Copy button - always dark */
pre::after {
    content: "Copy";
    position: absolute;
    top: 8px;
    right: 16px;
    background-color: transparent;
    border: 1px solid #3c3c3c;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    color: #d4d4d4;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

pre:hover::after {
    background-color: #007acc;
    color: white;
    border-color: #007acc;
}

/* Exclude copy button from banner code */
pre.no-copy-button::after {
    display: none;
}

pre.no-copy-button:hover::after {
    display: none;
}

/* Style inline code elements (code tags not inside pre blocks) */
:not(pre) > code {
    background-color: #e9ebec;
    color: #000000;
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-size: inherit;
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* Dark theme support for inline code */
.dark-theme :not(pre) > code {
    background-color: #2d2d30;
    color: #ffffff;
}













/* Course cards */
.course-card { transition: transform .15s ease, box-shadow .15s ease; }
.course-card:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(0,0,0,.08); }
.course-placeholder { height: 180px; background: #eef2f6; border-bottom: 1px solid var(--border-color); }

/* Feature cards */
.feature-card { border: 1px solid var(--border-color); border-radius: 8px; background: var(--card-bg); }

/* Back to top */
.back-to-top { position: fixed; right: 16px; bottom: 16px; border-radius: 50%; width: 44px; height: 44px; display: grid; place-items: center; box-shadow: 0 6px 16px rgba(0,0,0,.15); }

/* Scroll progress */
#scrollProgress { position: fixed; top: 56px; left: 0; height: 5px; background: var(--primary-color); width: 0; z-index: 2000; }



/* Result badge */
.result-badge { width: 110px; height: 110px; border-radius: 50%; display: grid; place-items: center; background: #eaf4ff; border: 1px solid var(--border-color); }
.result-badge span { font-size: 28px; font-weight: 700; color: #1e88e5; }

/* Code block enhancements - always dark theme */
.code-block-wrapper {
    margin: 1.5rem 0;
    border-radius: 0.375rem;
    overflow: hidden;
    border: 1px solid #3c3c3c;
    background-color: #1e1e1e;
}

.code-block-wrapper pre {
    margin: 0;
    border-radius: 0;
    border: none;
    background-color: #1e1e1e;
    padding: 1rem;
}

.code-block-wrapper code {
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    display: block;
    background: transparent !important;
}

/* Ensure highlight.js colors are applied */
.code-block-wrapper code.hljs {
    background: transparent !important;
    padding: 0;
}

/* Prevent highlighting on output blocks */
.output-block code.nohighlight {
    color: #e2e8f0;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background-color: #2d2d30;
    border-bottom: 1px solid #3c3c3c;
}

.code-language {
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.85rem;
    color: #d4d4d4;
}

.copy-button {
    background-color: transparent;
    border: 1px solid #3c3c3c;
    border-radius: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
    color: #d4d4d4;
    min-width: 85px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.copy-button:hover {
    background-color: #007acc;
    color: white;
    border-color: #007acc;
}

.code-container {
    display: flex;
    position: relative;
    overflow: hidden;
}

.line-numbers {
    display: flex;
    flex-direction: column;
    padding: 1rem 0.5rem;
    min-width: 2.5rem;
    text-align: right;
    background-color: var(--code-bg);
    color: #888;
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.9rem;
    user-select: none;
    border-right: 1px solid var(--border-color);
}

.line-numbers span {
    line-height: 1.5;
}

.code-container pre {
    margin: 0;
    border-radius: 0;
    flex-grow: 1;
    border: none;
    background-color: var(--card-bg);
}

.code-container code {
    padding: 0;
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* Styles for regular code blocks (fallback) */
pre[data-language] {
    padding-top: 2.5rem;
}

pre[data-language]::before {
    content: attr(data-language);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 0.5rem 1rem;
    background-color: var(--code-bg);
    border-bottom: 1px solid var(--border-color);
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.85rem;
    color: var(--text-color);
}

/* Try Yourself button */
.try-yourself-btn {
    background-color: transparent;
    border: 1px solid #3c3c3c;
    border-radius: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    color: #d4d4d4;
    margin-right: 0.5rem;
}

.try-yourself-btn:hover {
    background-color: #28a745;
    color: white;
    border-color: #28a745;
}

.code-actions {
    display: flex;
    align-items: center;
}

/* Collapsible output section */
.output-collapsible {
    margin: 0.5rem 0 1.5rem 0;
}

.output-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: #f1f3f4;
    border: 1px solid #dadce0;
    border-radius: 0.375rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    color: #5f6368;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 120px;
    justify-content: center;
}

.output-toggle-btn:hover {
    background-color: #e8eaed;
    border-color: #c6c9cc;
}

.output-toggle-btn .toggle-icon {
    transition: transform 0.2s ease;
    font-size: 0.75rem;
}

.output-collapsible.expanded .toggle-icon {
    transform: rotate(90deg);
}

.output-collapsible.expanded .output-toggle-btn span {
    display: none;
}

.output-collapsible.expanded .output-toggle-btn::after {
    content: 'Hide Output';
}

.output-content {
    display: none;
    margin-top: 0.5rem;
}

.output-collapsible.expanded .output-content {
    display: block;
}

.output-block {
    margin: 0;
    /* border: none !important; */
    background-color: #00000000 !important;
    padding: 0.5rem 0;
    padding-top: 0.5rem !important;
    box-shadow: none !important;
}

/* Hide the "CODE" pseudo-element header and line numbers on output blocks */
.output-block::before,
.output-block::after {
    display: none !important;
}

/* Remove line numbers from output blocks */
.output-block .line-number,
.output-block .line-numbers {
    display: none !important;
}

.output-block code {
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    display: block;
    color: #e0e0e0;
    background: transparent !important;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.9rem;
    line-height: 1.6;
    padding-left: 0 !important;
}

/* Mermaid diagram styling */
.mermaid-wrapper {
    margin: 1.5rem 0;
    border-radius: 0.375rem;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    background-color: #f7fafc;
}

.mermaid-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background-color: #edf2f7;
    border-bottom: 1px solid #e2e8f0;
}

.mermaid-label {
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.85rem;
    color: #4a5568;
}

.mermaid {
    padding: 1.5rem;
    display: flex;
    justify-content: center;
    background-color: #ffffff;
}

/* Dark theme styles for output and mermaid */
.dark-theme .output-toggle-btn {
    background-color: #2d3748;
    border-color: #4a5568;
    color: #a0aec0;
}

.dark-theme .output-toggle-btn:hover {
    background-color: #3d4a5c;
    border-color: #5a6b7c;
}

.dark-theme .output-block {
    background-color: transparent;
    /* border: none; */
}

.dark-theme .output-block code {
    color: #e0e0e0;
}

.dark-theme .mermaid-wrapper {
    border-color: #4a5568;
    background-color: #2d3748;
}

.dark-theme .mermaid-header {
    background-color: #1a202c;
    border-color: #4a5568;
}

.dark-theme .mermaid-label {
    color: #a0aec0;
}

.dark-theme .mermaid {
    background-color: #2d3748;
}

/* Error block styling */
.error-block-wrapper {
    margin: 0.5rem 0 1.5rem 0;
    border-radius: 0.375rem;
    overflow: hidden;
    border: 1px solid #e5a3a3;
    background-color: #fef2f2;
}

.error-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: #fde8e8;
    color: #991b1b;
    border-bottom: 1px solid #e5a3a3;
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.85rem;
    font-weight: 600;
}

.error-header i {
    font-size: 0.9rem;
    color: #b91c1c;
}

.error-block {
    margin: 0;
    background-color: #fef2f2 !important;
    padding: 0.75rem 1rem;
    border: none !important;
}

.error-block::before,
.error-block::after {
    display: none !important;
}

.error-block code {
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    display: block;
    color: #991b1b;
    background: transparent !important;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Dark theme adjustments for error blocks */
.dark-theme .error-block-wrapper {
    border-color: #7f1d1d;
    background-color: #1e1e1e;
}

.dark-theme .error-header {
    background-color: #2d2d30;
    color: #fca5a5;
    border-bottom-color: #7f1d1d;
}

.dark-theme .error-header i {
    color: #f87171;
}

.dark-theme .error-block {
    background-color: #1e1e1e !important;
}

.dark-theme .error-block code {
    color: #fca5a5;
}

/* List styling */
.list-group-item {
    background-color: var(--list-item-bg);
    color: var(--text-color);
    border-color: var(--border-color);
}

/* Active heading highlight for in-page anchors in sidebar (optional) */
.sidebar-topic-list a.active-heading {
    background-color: rgba(52, 152, 219, 0.08);
    border-left: 3px solid var(--primary-color);
}

/* Animation for progress tracking */
.progress-bar {
    transition: width 0.5s ease-in-out;
}

.topic-content {
    color: var(--text-color);
    font-size: var(--base-font-size);
    line-height: var(--line-spacing);
}

/* Topic content reveal animation */
.topic-content > * {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .4s ease, transform .4s ease;
}

.topic-content > *.reveal-in {
    opacity: 1;
    transform: translateY(0);
}

/* Mini ToC styling */
.mini-toc ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
}
.mini-toc li { margin-bottom: .25rem; }
.mini-toc a {
    text-decoration: none;
    color: inherit;
    font-size: .95rem;
}
.mini-toc a:hover { color: var(--primary-color); }

/* Focus mode: hide sidebar on large screens, expand content */
.focus-mode .col-md-3 { display: none; }
.focus-mode .col-md-9 { width: 100%; flex: 0 0 100%; max-width: 100%; }

/* Markdown content styling */
.topic-content h1,
.topic-content h2,
.topic-content h3,
.topic-content h4,
.topic-content h5,
.topic-content h6 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    font-weight: 500;
}

.topic-content h2 {
    font-size: 1.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.topic-content h3 {
    font-size: 1.5rem;
}

.topic-content p {
    margin-bottom: 1rem;
}

.topic-content ul, 
.topic-content ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

.topic-content img {
    max-width: 100%;
    height: auto;
    margin: 1rem 0;
    border-radius: 0.25rem;
}

.topic-content table {
    width: 100%;
    margin-bottom: 1rem;
    border-collapse: collapse;
}

.topic-content table th,
.topic-content table td {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
}

.topic-content table th {
    background-color: var(--bg-color);
}

.topic-content blockquote {
    padding: 0.5rem 1rem;
    margin: 1rem 0;
    border-left: 4px solid var(--primary-color);
    background-color: var(--bg-color);
}

/* Basic code block styling */
pre {
    position: relative;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    margin: 1.5rem 0;
    padding: 1rem;
    overflow: auto;
}

pre code {
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    display: block;
}

/* Code header with language */
pre::before {
    content: "code";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background-color: #e9ecef;
    padding: 0.5rem 1rem;
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.85rem;
    font-weight: bold;
    text-transform: uppercase;
    border-bottom: 1px solid #dee2e6;
}

/* Disable pseudo-elements for code blocks inside wrapper */
.code-block-wrapper pre::before,
.code-block-wrapper pre::after {
    display: none;
}

/* Code block wrapper styling - dark theme for syntax highlighting */
.code-block-wrapper {
    margin: 1.5rem 0;
    border: 1px solid #3c3c3c;
    border-radius: 0.375rem;
    overflow: hidden;
    background: #1e1e1e;
}

.code-block-wrapper pre {
    margin: 0;
    border: none;
    border-radius: 0;
    background: #1e1e1e;
}

.code-block-wrapper pre::before,
.code-block-wrapper pre::after {
    display: none;
}

/* Code header styling - dark theme */
.code-header {
    background: #2d2d30;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #3c3c3c;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.code-language {
    font-size: 0.85rem;
    font-weight: bold;
    text-transform: uppercase;
    color: #d4d4d4;
    letter-spacing: 0.5px;
}

.code-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Try Yourself button styling */
.try-yourself-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 0.375rem 0.75rem;
    border-radius: 0.25rem;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.try-yourself-btn:hover {
    background: #218838;
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.try-yourself-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.try-yourself-btn i {
    font-size: 0.9em;
}

/* Copy button styling for code blocks in wrapper */
.code-block-wrapper .copy-button {
    background: #6c757d;
    color: white;
    border: none;
    padding: 0.375rem 0.75rem;
    border-radius: 0.25rem;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-width: 85px;
}

.code-block-wrapper .copy-button:hover {
    background: #5a6268;
}

.code-block-wrapper .copy-button:active {
    background: #4a5258;
}

.code-block-wrapper .copy-button i {
    font-size: 0.9em;
}

/* Set language name from class */
pre.language-python::before {
    content: "python";
}
pre.language-javascript::before, pre.language-js::before {
    content: "javascript";
}
pre.language-html::before {
    content: "html";
}
pre.language-css::before {
    content: "css";
}
pre.language-bash::before, pre.language-shell::before {
    content: "bash";
}
pre.language-c::before {
    content: "c";
}
pre.language-cpp::before {
    content: "c++";
}
pre.language-java::before {
    content: "java";
}

/* Copy button */
pre::after {
    content: "Copy";
    position: absolute;
    top: 0.25rem;
    right: 1rem;
    background-color: transparent;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
}

/* Exclude copy button from banner code */
pre.no-copy-button::after {
    display: none;
}

pre:hover::after {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
}

/* Exclude hover effect from banner code */
pre.no-copy-button:hover::after {
    display: none;
}

/* Dark theme adjustments */
body.dark-theme pre {
    background-color: #282c34;
    border-color: #444;
}

body.dark-theme pre::before {
    background-color: #2c2c2c;
    border-color: #444;
    color: #f8f9fa;
}

body.dark-theme pre::after {
    border-color: #444;
    color: #f8f9fa;
}

/* Exclude copy button from banner code in dark theme */
body.dark-theme pre.no-copy-button::after {
    display: none;
}

body.dark-theme pre:hover::after {
    background-color: #5dade2;
    color: white;
    border-color: #5dade2;
}

/* Exclude hover effect from banner code in dark theme */
body.dark-theme pre.no-copy-button:hover::after {
    display: none;
}

/* Add to static/css/styles.css */

/* Line numbers for code blocks */
.code-container {
    display: flex;
    position: relative;
    overflow: hidden;
    margin: 1.5rem 0;
    border-radius: 0.375rem;
    border: 1px solid var(--border-color);
}

.line-numbers {
    display: flex;
    flex-direction: column;
    padding: 1rem 0;
    min-width: 2.5rem;
    text-align: right;
    background-color: #2d2d30;
    color: #858585;
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.9rem;
    user-select: none;
    border-right: 1px solid #3c3c3c;
}

.line-number {
    padding: 0 0.5rem;
    line-height: 1.5;
}

.code-container pre {
    margin: 0;
    border-radius: 0;
    flex-grow: 1;
    border: none;
    padding-top: 1rem !important;
}

/* Dark theme adjustments */
body.dark-theme .line-numbers {
    background-color: #2c2c2c;
    color: #888;
    border-color: var(--border-color);
}

/* Course card styling */
.course-image-container {
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 1rem;
}

.course-image {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
}

.card .card-body {
    display: flex;
    flex-direction: column;
}

.card .card-title {
    margin-bottom: 1rem;
    align-self: anchor-center;
}

.card .card-text {
    flex-grow: 1;
    margin-bottom: 1rem;
    align-self: anchor-center;
}

.card .btn {
    margin: 0 auto;
}

/* Add this to static/css/styles.css */
.subtopic-list {
    margin-left: 20px;
    border-left: 2px solid var(--border-color);
}

.topic-parent {
    font-weight: 500;
}

.topic-child {
    padding-left: 15px;
    position: relative;
}

.topic-child:before {
    content: "└";
    position: absolute;
    left: 0;
    color: var(--border-color);
}

/* Tree view styles */
.topic-tree .subtopic-list {
    margin-left: 20px;
    border-left: 2px solid var(--border-color);
    padding-left: 15px;
}

.topic-tree .subtopic-item {
    position: relative;
    padding: 5px 0;
}

.topic-tree .subtopic-item:before {
    content: "└─";
    position: absolute;
    left: -15px;
    color: var(--border-color);
}

/* Indentation for sidebar */
.sidebar-topic-list .topic-parent {
    font-weight: 500;
}

.sidebar-topic-list .topic-child {
    padding-left: 20px;
    position: relative;
}

.sidebar-topic-list .topic-child:before {
    content: "└";
    position: absolute;
    left: 8px;
    color: var(--border-color);
}

pre[data-copied]::after {
    content: "Copied!";
    background-color: #28a745;
    color: white;
    border-color: #28a745;
}

/* Enhanced styling for copy button when clicked */
.copy-button.copied {
    background-color: #28a745;
    color: white;
    border-color: #28a745;
}


/* Modern XP and Level display in navbar */
.xp-display-modern {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-radius: 25px;
    border: 1px solid rgba(102, 126, 234, 0.2);
    transition: all 0.3s ease;
}

.xp-display-modern:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.2) 100%);
    border-color: rgba(102, 126, 234, 0.4);
    transform: translateY(-1px);
}

.xp-level-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.xp-level-badge .level-number {
    color: white;
    font-weight: 700;
    font-size: 14px;
}

.xp-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.xp-amount {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    line-height: 1;
}

.xp-progress-bar {
    width: 60px;
    height: 6px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 2px;
}

.xp-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #48bb78 0%, #38a169 100%);
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* Dark theme support for XP display */
body.dark-theme .xp-display-modern {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.2) 100%);
    border-color: rgba(102, 126, 234, 0.3);
}

body.dark-theme .xp-amount {
    color: #e5e7eb;
}

body.dark-theme .xp-progress-bar {
    background: rgba(255, 255, 255, 0.1);
}

/* Legacy support - keep old classes but redirect */
.xp-container {
    display: none; /* Hide old version */
}

.level-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    font-weight: bold;
    margin-right: 8px;
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Header profile picture */
.header-profile-pic {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(102, 126, 234, 0.3);
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
}

.header-profile-placeholder {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: 600;
}

/* Profile picture upload section */
.profile-picture-upload {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.profile-picture-upload input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

.profile-picture-overlay {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    text-align: center;
    padding: 6px 12px;
    font-size: 11px;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.3s ease;
    white-space: nowrap;
}

.profile-picture-upload:hover .profile-picture-overlay {
    opacity: 1;
}

.profile-avatar-large {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.profile-avatar-large:hover {
    transform: scale(1.05);
}

.profile-avatar-placeholder-large {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 3.5rem;
    font-weight: 600;
    border: 4px solid white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.profile-avatar-placeholder-large:hover {
    transform: scale(1.05);
}

/* Profile Picture Modal */
.profile-picture-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    animation: fadeIn 0.3s ease;
}

.profile-picture-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-picture-modal-content {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
    animation: zoomIn 0.3s ease;
}

.profile-picture-modal-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
}

.profile-picture-modal-close:hover,
.profile-picture-modal-close:focus {
    color: #bbb;
}

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

@keyframes zoomIn {
    from { transform: scale(0.7); }
    to { transform: scale(1); }
}

/* Accessibility Features */
.high-contrast {
    --text-color: #000;
    --bg-color: #fff;
    --card-bg: #fff;
    --border-color: #000;
    --code-bg: #f0f0f0;
}

.high-contrast .card {
    border: 2px solid #000;
}

.high-contrast .btn {
    border: 2px solid #000;
}

.dyslexic-font {
    font-family: 'OpenDyslexic', 'Comic Sans MS', 'Arial', sans-serif;
    letter-spacing: 0.1em;
    word-spacing: 0.2em;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus indicators for accessibility */
*:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Skip to content link for screen readers */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-color);
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 1000;
}

.skip-link:focus {
    top: 6px;
}
/* Interactive Features - Enhanced Topic Page */

/* Scroll progress indicator */
#scrollProgress {
    position: fixed;
    top: 56px;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), #2ecc71);
    width: 0%;
    z-index: 9998;
    transition: width 0.1s ease;
}

/* Keyboard shortcuts hint */
.keyboard-hint {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
}

.keyboard-hint-toggle {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    transition: all 0.3s;
}

.keyboard-hint-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.keyboard-hint-content {
    position: absolute;
    bottom: 50px;
    left: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    min-width: 220px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s;
}

.keyboard-hint-content.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.keyboard-hint-content strong {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.keyboard-hint-content ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.keyboard-hint-content li {
    padding: 0.25rem 0;
    font-size: 0.85rem;
    color: var(--text-color);
}

.keyboard-hint-content kbd {
    background: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 2px 6px;
    font-size: 0.75rem;
    font-family: inherit;
    box-shadow: 0 1px 0 rgba(0,0,0,0.2);
}

/* Flash highlight animation */
.flash-highlight {
    animation: flashHighlight 1s ease;
}

@keyframes flashHighlight {
    0%, 100% { background-color: transparent; }
    50% { background-color: rgba(52, 152, 219, 0.3); }
}

/* Section progress indicator */
.section-progress {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    gap: 0.75rem;
}

.section-progress-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-color);
}

.section-progress-bar {
    flex: 1;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
}

.section-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #2ecc71);
    border-radius: 3px;
    transition: width 0.5s ease;
    width: 0%;
}

.section-progress-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-color);
    min-width: 40px;
    text-align: right;
}

.section-progress.complete .section-progress-fill {
    animation: progressComplete 0.5s ease;
}

@keyframes progressComplete {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Hoverable inline code */
.hoverable-code {
    cursor: help;
    position: relative;
    transition: all 0.2s;
}

.hoverable-code:hover {
    background-color: rgba(52, 152, 219, 0.2);
    border-radius: 3px;
}

/* Highlight related code blocks */
.code-block-wrapper.highlight-related {
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.5);
    transform: scale(1.01);
    transition: all 0.3s ease;
}

/* Back to top button enhancements */
.back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    transition: all 0.3s;
}

.back-to-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

/* Dark theme adjustments for interactive features */
.dark-theme .keyboard-hint-content {
    background: #2d3748;
    border-color: #4a5568;
}

.dark-theme .keyboard-hint-content kbd {
    background: #4a5568;
    border-color: #718096;
    color: #e2e8f0;
}

.dark-theme .section-progress {
    background: #1a202c;
    border-color: #4a5568;
}

.dark-theme .section-progress-bar {
    background: #4a5568;
}

/* Smooth reveal animation for content */
.topic-content h2,
.topic-content h3 {
    scroll-margin-top: 80px;
}

/* Reading time animation */
#reading-meta {
    transition: all 0.3s ease;
}

/* Tooltip for hoverable elements */
[title] {
    position: relative;
}

/* Enhanced Topic Content - Modern Interactive Styling */

/* Better card styling with hover effects */
.card {
    transition: all 0.3s ease;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.card:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

/* Topic content enhanced typography */
.topic-content {
    font-size: 1.05rem;
    line-height: 1.8;
}

.topic-content h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 2.5rem 0 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 3px solid var(--primary-color);
    position: relative;
    color: var(--secondary-color);
}

.topic-content h2::before {
    content: '';
    position: absolute;
    left: 0;
    bottom: -3px;
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #2ecc71, var(--primary-color));
}

.topic-content h3 {
    font-size: 1.35rem;
    font-weight: 600;
    margin: 2rem 0 1rem;
    color: var(--secondary-color);
    padding-left: 1rem;
    border-left: 4px solid var(--primary-color);
}

.topic-content h3:hover {
    border-left-color: #2ecc71;
    transition: border-color 0.3s ease;
}

/* Enhanced paragraphs */
.topic-content p {
    margin-bottom: 1.25rem;
    color: var(--text-color);
}

/* Interactive list styling */
.topic-content ul,
.topic-content ol {
    margin: 1.25rem 0;
    padding-left: 1.5rem;
}

.topic-content li {
    margin-bottom: 0.75rem;
    padding-left: 0.5rem;
    position: relative;
    transition: all 0.2s ease;
}

.topic-content li:hover {
    transform: translateX(5px);
    color: var(--primary-color);
}

.topic-content ul li::marker {
    color: var(--primary-color);
    font-size: 1.2em;
}

/* Enhanced inline code */
.topic-content code:not([class*="language-"]) {
    background: linear-gradient(135deg, #f0f4ff 0%, #e8f0fe 100%);
    padding: 0.2rem 0.5rem;
    font-size: 0.9em;
    color: #303030;
    font-weight: 500;
    transition: all 0.2s ease;
}

.topic-content code:not([class*="language-"]):hover {
    background: linear-gradient(135deg, #dbeafe 0%, #c7d7fe 100%);
}

.dark-theme .topic-content code:not([class*="language-"]) {
    background: linear-gradient(135deg, #1e3a5f 0%, #1e40af 100%);
    color: #d4d4d4;
}

/* Better blockquotes */
.topic-content blockquote {
    border-left: 4px solid var(--primary-color);
    background: linear-gradient(90deg, rgba(52, 152, 219, 0.1) 0%, transparent 100%);
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    border-radius: 0 0.5rem 0.5rem 0;
    font-style: italic;
}

/* Enhanced strong/bold text */
.topic-content strong {
    color: var(--secondary-color);
    font-weight: 700;
}

/* Code block wrapper enhancements */
.code-block-wrapper {
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.code-block-wrapper:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
    transform: translateY(-2px);
}

/* Better table styling */
.topic-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.topic-content th {
    background: linear-gradient(135deg, var(--primary-color), #2980b9);
    color: white;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
}

.topic-content td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.topic-content tr:hover {
    background-color: rgba(52, 152, 219, 0.05);
}

/* Smooth reveal animation refinement */
.topic-content > * {
    opacity: 0;
    transform: translateY(15px);
    animation: revealContent 0.6s ease forwards;
}

.topic-content > *:nth-child(1) { animation-delay: 0.1s; }
.topic-content > *:nth-child(2) { animation-delay: 0.15s; }
.topic-content > *:nth-child(3) { animation-delay: 0.2s; }
.topic-content > *:nth-child(4) { animation-delay: 0.25s; }
.topic-content > *:nth-child(5) { animation-delay: 0.3s; }
.topic-content > *:nth-child(n+6) { animation-delay: 0.35s; }

@keyframes revealContent {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Interactive buttons in content */
.topic-content .btn {
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.topic-content .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Mermaid diagram enhancements */
.mermaid-wrapper {
    transition: all 0.3s ease;
}

.mermaid-wrapper:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

/* Progress indicator enhancements */
.section-progress {
    background: linear-gradient(90deg, var(--bg-color), rgba(52, 152, 219, 0.05));
}

/* Reading meta styling */
#reading-meta {
    background: rgba(52, 152, 219, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-weight: 500;
}

/* Sidebar enhancements */
.sidebar-card {
    transition: all 0.3s ease;
}

.sidebar-card:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.list-group-item {
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.list-group-item:hover {
    background-color: rgba(52, 152, 219, 0.08);
    border-left-color: var(--primary-color);
}

.list-group-item.active {
    background: linear-gradient(90deg, var(--primary-color), #2980b9);
    border-color: var(--primary-color);
}

/* Navigation buttons enhancements */
.d-flex.justify-content-between .btn {
    transition: all 0.3s ease;
}

.d-flex.justify-content-between .btn:hover {
    transform: scale(1.05);
}
