html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background-color: #1a1a2e;
    color: #ffffff;
    font-size: 14px;
}

header {
    background-color: #0f3460;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    box-sizing: border-box;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: #ffd700;
}

.logo i {
    margin-right: 0.5rem;
    color: #3776ab;
}

.mode-switcher {
    display: flex;
    gap: 0.5rem;
}

.mode-btn {
    background: #16213e;
    border: 2px solid #3776ab;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.mode-btn.active {
    background: #3776ab;
    color: white;
    box-shadow: 0 2px 8px rgba(55, 118, 171, 0.3);
}

.mode-btn:hover {
    background: #4a8bc2;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.sidebar-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar {
    position: fixed;
    top: 75px;
    bottom: 0;
    width: 320px;
    background-color: #16213e;
    padding: 1rem;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 999;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
}

.sidebar.open {
    transform: translateX(0);
}

.left-sidebar {
    left: 0;
}

.right-sidebar {
    right: 0;
    transform: translateX(100%);
}

.right-sidebar.open {
    transform: translateX(0);
}

.main-content {
    margin-top: 75px;
    height: calc(100vh - 75px);
    overflow: hidden;
}

.container {
    display: grid;
    grid-template-columns: 2fr 4px 3fr;
    height: 100%;
    gap: 0;
    padding: 0;
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
}

.left-column {
    grid-column: 1;
    overflow-y: auto;
    background-color: #16213e;
    border-radius: 8px;
    padding: 1.5rem;
    min-width: 0;
    box-sizing: border-box;
}

.concept-slider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    background-color: #0f3460;
    padding: 1rem;
    border-radius: 8px;
}

.slider-btn {
    background: #3776ab;
    border: none;
    color: white;
    padding: 0.75rem;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.slider-btn:hover {
    background: #4a8bc2;
    transform: scale(1.1);
}

#current-concept {
    flex: 1;
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
    color: #ffd700;
}

#resizer {
    grid-column: 2;
    width: 4px;
    background-color: #3776ab;
    cursor: ew-resize;
    transition: background-color 0.3s ease;
}

#resizer:hover {
    background-color: #4a8bc2;
}

.right-column {
    grid-column: 3;
    display: flex;
    flex-direction: column;
    background-color: #16213e;
    border-radius: 8px;
    padding: 1rem;
    overflow-y: auto;
    height: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.python-interface {
    flex: 1;
    display: none;
    flex-direction: column;
}

.python-interface.active {
    display: flex;
}

/* Notebook Interface */
.notebook-controls {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.control-btn {
    background: #3776ab;
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.control-btn:hover {
    background: #4a8bc2;
    transform: translateY(-1px);
}

.colab-btn {
    background: #f9ab00;
    color: #333;
}

.colab-btn:hover {
    background: #ffc107;
}

#notebook-container {
    flex: 1 1 0;
    overflow-y: auto;
    border: 1px solid #3776ab;
    border-radius: 8px;
    background-color: #1a1a2e;
    max-height: calc(100vh - 250px);
    min-height: 400px;
    width: 100%;
    box-sizing: border-box;
}

.notebook-cell {
    border-bottom: 1px solid rgba(55, 118, 171, 0.3);
    padding: 1.5rem;
    position: relative;
    transition: all 0.3s ease;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.notebook-cell:hover {
    background-color: rgba(55, 118, 171, 0.05);
}

.notebook-cell:last-child {
    border-bottom: none;
}

.cell-controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.notebook-cell:hover .cell-controls {
    opacity: 1;
}

.cell-btn {
    background: #16213e;
    border: 1px solid #3776ab;
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.cell-btn:hover {
    background: #3776ab;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(55, 118, 171, 0.3);
}

.cell-header {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
    gap: 1rem;
}

.cell-label {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.85rem;
    color: #3776ab;
    font-weight: bold;
    min-width: 80px;
}

.cell-input {
    margin-bottom: 1rem;
}

.cell-editor {
    width: 100%;
    background: #16213e;
    border: 1px solid #3776ab;
    border-radius: 6px;
    color: white;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    padding: 1rem;
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
    transition: all 0.3s ease;
    outline: none;
}

.cell-editor:focus {
    border-color: #4a8bc2;
    box-shadow: 0 0 0 2px rgba(74, 139, 194, 0.2);
}

.cell-editor::placeholder {
    color: #888;
    font-style: italic;
}

.cell-output-container {
    margin-top: 1rem;
}

.cell-output-label {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.85rem;
    color: #3776ab;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.cell-output {
    background-color: #0f3460;
    border: 1px solid #3776ab;
    border-radius: 6px;
    padding: 1rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    white-space: pre-wrap;
    font-size: 0.9rem;
    line-height: 1.4;
    max-height: 400px;
    overflow-y: auto;
    transition: all 0.3s ease;
    word-wrap: break-word;
    overflow-wrap: break-word;
    width: 100%;
    box-sizing: border-box;
}

.cell-output.error {
    background-color: #4a0e0e;
    border-color: #ff6b6b;
    color: #ff9999;
}

.cell-output:empty {
    display: none;
}

/* Terminal Interface */
.terminal-controls {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

#terminal-container {
    flex: 1;
    background-color: #0a0a0a;
    border: 1px solid #3776ab;
    border-radius: 8px;
    padding: 1rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    overflow-y: auto;
}

#terminal-output {
    flex: 1;
    white-space: pre-wrap;
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 1rem;
}

.terminal-input {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.prompt {
    color: #3776ab;
    font-weight: bold;
    font-size: 0.9rem;
    margin-top: 0.3rem;
}

#terminal-editor {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    font-family: inherit;
    font-size: 0.9rem;
    resize: none;
    min-height: 1.4em;
    outline: none;
}

/* Package Sidebar */
.package-search {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

#package-search {
    flex: 1;
    background: #1a1a2e;
    border: 1px solid #3776ab;
    color: white;
    padding: 0.5rem;
    border-radius: 4px;
}

.package-category {
    margin-bottom: 1.5rem;
}

.package-category h3 {
    color: #ffd700;
    border-bottom: 1px solid #3776ab;
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
}

.package-category ul {
    list-style: none;
    padding: 0;
}

.package-category li {
    padding: 0.25rem 0;
    color: #ccc;
    font-size: 0.9rem;
}

/* Topic List */
#topic-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

#topic-list li {
    margin-bottom: 0.5rem;
}

#topic-list button {
    background: none;
    border: 1px solid #3776ab;
    color: white;
    padding: 0.75rem 1rem;
    width: 100%;
    text-align: left;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#topic-list button:hover,
#topic-list button.active {
    background: #3776ab;
    color: white;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(26, 26, 46, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #16213e;
    border-top: 4px solid #3776ab;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Sub-concept buttons */
#sub-concept-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-bottom: 0.75rem;
    padding: 0.5rem;
    background: rgba(22, 33, 62, 0.3);
    border-radius: 6px;
    border: 1px solid rgba(55, 118, 171, 0.2);
}

.sub-concept-btn {
    background: #16213e;
    border: 1px solid #3776ab;
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    max-width: 200px;
}

.sub-concept-btn:hover,
.sub-concept-btn.active {
    background: #3776ab;
    color: white;
}

/* CodeMirror customization */
.CodeMirror {
    background: #1a1a2e !important;
    color: white !important;
    border: 1px solid #3776ab;
    border-radius: 4px;
    font-size: 0.9rem;
    height: auto;
    min-height: 100px;
}

.CodeMirror-gutters {
    background: #16213e !important;
    border-right: 1px solid #3776ab !important;
}

.CodeMirror-linenumber {
    color: #888 !important;
}

/* Enhanced Responsive Design */
@media (max-width: 768px) {
    .container {
        display: flex;
        flex-direction: column;
        grid-template-columns: none;
        gap: 0.5rem;
        padding: 0.5rem;
        height: calc(100vh - 75px);
        overflow: hidden;
    }

    .left-column {
        grid-column: unset;
        flex: 0 0 auto;
        height: auto;
        max-height: 40vh;
        min-height: 200px;
        overflow-y: auto;
        margin-bottom: 0.5rem;
    }

    .right-column {
        grid-column: unset;
        flex: 1 1 auto;
        height: auto;
        min-height: 300px;
        overflow-y: auto;
    }

    #resizer {
        display: none;
        grid-column: unset;
    }

    .mode-switcher {
        order: -1;
    }

    .sidebar {
        width: 100%;
        max-width: 100vw;
    }

    .notebook-controls,
    .terminal-controls {
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    .control-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }

    #notebook-container {
        max-height: none;
        min-height: 200px;
        height: auto;
    }

    #terminal-container {
        height: auto;
        min-height: 200px;
    }
}

/* Tablet responsive design */
@media (max-width: 1024px) and (min-width: 769px) {
    .container {
        padding: 0.75rem;
    }
    
    .left-column, .right-column {
        min-width: 250px;
    }
    
    .sidebar {
        width: 300px;
    }
}

/* Large screen optimization - removed for full-screen layout */

/* Copy button styles */
.copy-btn {
    background: #3776ab;
    border: none;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    margin-top: 0.5rem;
    transition: background-color 0.3s ease;
}

.copy-btn:hover {
    background: #4a8bc2;
}

.copy-btn.copied {
    background: #28a745;
}

/* Python output styling */
.python-output {
    background-color: #0f3460;
    border: 1px solid #3776ab;
    border-radius: 4px;
    padding: 0.75rem;
    margin-top: 0.5rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    white-space: pre-wrap;
    overflow-x: auto;
}

.python-error {
    background-color: #4a0e0e;
    color: #ff6b6b;
    border-color: #ff6b6b;
}

.python-success {
    border-color: #28a745;
}

/* Execution status */
.execution-status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: #888;
    font-weight: 500;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    transition: all 0.3s ease;
    min-height: 1.2rem;
}

.execution-status:not(:empty) {
    background: rgba(55, 118, 171, 0.1);
}

.execution-status.running {
    color: #ffd700;
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.execution-status.success {
    color: #28a745;
    background: rgba(40, 167, 69, 0.1);
    border: 1px solid rgba(40, 167, 69, 0.3);
}

.execution-status.error {
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.3);
}

/* Notebook enhancements */
.notebook-cell.executing {
    background-color: rgba(255, 215, 0, 0.05);
    border-left: 3px solid #ffd700;
}

.notebook-cell.success {
    border-left: 3px solid #28a745;
}

.notebook-cell.error {
    border-left: 3px solid #ff6b6b;
}

/* Markdown cells */
.notebook-cell.markdown-cell {
    background-color: rgba(55, 118, 171, 0.03);
    border-left: 3px solid #3776ab;
}

.markdown-content {
    padding: 1rem 0;
    line-height: 1.6;
}

.markdown-content h1 {
    color: #ffd700;
    font-size: 1.8rem;
    margin: 1rem 0 0.75rem 0;
    border-bottom: 2px solid #3776ab;
    padding-bottom: 0.5rem;
}

.markdown-content h2 {
    color: #4a8bc2;
    font-size: 1.5rem;
    margin: 0.75rem 0 0.5rem 0;
}

.markdown-content h3 {
    color: #6ba3d4;
    font-size: 1.2rem;
    margin: 0.5rem 0 0.4rem 0;
}

.markdown-content strong {
    color: #ffd700;
    font-weight: 600;
}

.markdown-content em {
    color: #4a8bc2;
    font-style: italic;
}

.markdown-content code {
    background-color: rgba(55, 118, 171, 0.2);
    color: #ffd700;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
}

.markdown-content pre {
    background-color: rgba(15, 52, 96, 0.5);
    border: 1px solid #3776ab;
    border-radius: 6px;
    padding: 1rem;
    overflow-x: auto;
    margin: 0.75rem 0;
}

.markdown-content pre code {
    background: none;
    padding: 0;
    color: #ffffff;
}

.markdown-editor-container {
    padding: 1rem 0;
}

.markdown-editor {
    width: 100%;
    min-height: 100px;
    background-color: #0f3460;
    color: #ffffff;
    border: 1px solid #3776ab;
    border-radius: 6px;
    padding: 1rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    font-size: 14px;
    resize: vertical;
    line-height: 1.6;
}

.markdown-editor:focus {
    outline: none;
    border-color: #4a8bc2;
    box-shadow: 0 0 0 2px rgba(55, 118, 171, 0.2);
}

.markdown-output-container {
    padding: 0.5rem 0;
}

.markdown-rendered {
    padding: 1rem;
    background-color: rgba(55, 118, 171, 0.05);
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.markdown-rendered:hover {
    background-color: rgba(55, 118, 171, 0.1);
}

/* Add cell button enhancement */
.add-cell-container {
    display: flex;
    justify-content: center;
    padding: 1rem;
    border-top: 1px dashed rgba(55, 118, 171, 0.3);
    margin-top: 0.5rem;
}

.add-cell-btn {
    background: #16213e;
    border: 2px dashed #3776ab;
    color: #3776ab;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.add-cell-btn:hover {
    background: rgba(55, 118, 171, 0.1);
    border-color: #4a8bc2;
    color: #4a8bc2;
    transform: translateY(-1px);
}

/* Cell numbering improvements */
.cell-label {
    user-select: none;
    background: rgba(55, 118, 171, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    border: 1px solid rgba(55, 118, 171, 0.3);
}

/* Smooth animations */
.notebook-cell {
    animation: cellSlideIn 0.3s ease-out;
}

@keyframes cellSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Enhanced Topic List Styling for Level Categories */
.topic-section {
    margin-bottom: 1.5rem;
    border: 1px solid rgba(55, 118, 171, 0.2);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.topic-section:hover {
    border-color: rgba(55, 118, 171, 0.4);
    box-shadow: 0 2px 8px rgba(55, 118, 171, 0.1);
}

.topic-header {
    background: linear-gradient(135deg, #16213e 0%, #0f3460 100%);
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(55, 118, 171, 0.3);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.3s ease;
}

.topic-header:hover {
    background: linear-gradient(135deg, #1a2a4a 0%, #123f6a 100%);
}

.topic-title {
    font-size: 1.1rem;
    font-weight: bold;
    color: #ffd700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topic-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Level Badges */
.level-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid;
    transition: all 0.3s ease;
}

.level-badge.basic {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    border-color: rgba(34, 197, 94, 0.4);
}

.level-badge.intermediate {
    background: rgba(251, 146, 60, 0.15);
    color: #fb923c;
    border-color: rgba(251, 146, 60, 0.4);
}

.level-badge.advanced {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.4);
}

.time-estimate {
    font-size: 0.8rem;
    color: #888;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.expand-indicator {
    transition: transform 0.3s ease;
    color: #3776ab;
    font-size: 1rem;
}

.topic-section.expanded .expand-indicator {
    transform: rotate(90deg);
}

/* Sub-concepts container */
.sub-concepts-container {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
    background: rgba(22, 33, 62, 0.3);
}

.topic-section.expanded .sub-concepts-container {
    max-height: 2000px;
}

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

.sub-concept-item {
    border-bottom: 1px solid rgba(55, 118, 171, 0.15);
    transition: all 0.3s ease;
}

.sub-concept-item:last-child {
    border-bottom: none;
}

.sub-concept-btn {
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    color: white;
    padding: 1rem 1.25rem;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sub-concept-btn:hover {
    background: rgba(55, 118, 171, 0.1);
    color: #ffd700;
    padding-left: 1.5rem;
}

.sub-concept-btn.active {
    background: rgba(55, 118, 171, 0.2);
    color: #ffd700;
    border-left: 3px solid #3776ab;
    padding-left: 1.4rem;
}

.sub-concept-btn.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 100%;
    background: #3776ab;
}

/* Concept Content Enhancements */
.concept-content {
    line-height: 1.6;
    color: #e5e5e5;
}

.concept-content h1, .concept-content h2, .concept-content h3 {
    color: #ffd700;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    position: relative;
}

.concept-content h1 {
    border-bottom: 2px solid #3776ab;
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}

.concept-content h2 {
    border-left: 4px solid #3776ab;
    padding-left: 1rem;
}

.concept-content h3 {
    color: #4a8bc2;
}

/* Code Block Enhancements */
.code-example {
    position: relative;
    margin: 1.5rem 0;
    border-radius: 8px;
    overflow: hidden;
    background: #0f0f0f;
    border: 1px solid #3776ab;
    transition: all 0.3s ease;
}

.code-example:hover {
    border-color: #4a8bc2;
    box-shadow: 0 4px 12px rgba(55, 118, 171, 0.15);
}

.code-header {
    background: linear-gradient(90deg, #16213e 0%, #0f3460 100%);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #3776ab;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.85rem;
    color: #888;
}

.code-language {
    color: #ffd700;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.code-language::before {
    content: '🐍';
    font-size: 1rem;
}

/* Enhanced Copy Button */
.copy-btn {
    background: rgba(55, 118, 171, 0.8);
    border: 1px solid #3776ab;
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    position: relative;
    overflow: hidden;
}

.copy-btn::before {
    content: '📋';
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.copy-btn:hover {
    background: rgba(74, 139, 194, 0.9);
    border-color: #4a8bc2;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(55, 118, 171, 0.3);
}

.copy-btn.copied {
    background: rgba(40, 167, 69, 0.9);
    border-color: #28a745;
    color: white;
}

.copy-btn.copied::before {
    content: '✅';
}

.code-content {
    background: #0a0a0a;
    padding: 1.25rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #e5e5e5;
    overflow-x: auto;
    white-space: pre-wrap;
    border: none;
    margin: 0;
}

/* Explanation and Content Separation */
.explanation-section {
    background: rgba(22, 33, 62, 0.3);
    border: 1px solid rgba(55, 118, 171, 0.2);
    border-radius: 8px;
    padding: 1.25rem;
    margin: 1.5rem 0;
    position: relative;
}

.explanation-section::before {
    content: '💡';
    position: absolute;
    top: -0.75rem;
    left: 1rem;
    background: #16213e;
    padding: 0 0.5rem;
    font-size: 1.2rem;
}

.code-output-example {
    background: rgba(15, 52, 96, 0.3);
    border: 1px solid rgba(55, 118, 171, 0.4);
    border-radius: 6px;
    padding: 1rem;
    margin: 1rem 0;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    color: #a8e6cf;
    position: relative;
}

.code-output-example::before {
    content: 'Output:';
    position: absolute;
    top: -0.6rem;
    left: 1rem;
    background: #16213e;
    color: #3776ab;
    padding: 0 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Interactive Elements */
.concept-nav {
    background: rgba(15, 52, 96, 0.2);
    border-radius: 8px;
    padding: 1rem;
    margin: 2rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.nav-btn {
    background: #3776ab;
    border: none;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.nav-btn:hover {
    background: #4a8bc2;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(55, 118, 171, 0.3);
}

.nav-btn:disabled {
    background: #555;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Progress Indicators */
.progress-container {
    background: rgba(22, 33, 62, 0.5);
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
}

.progress-bar {
    background: rgba(55, 118, 171, 0.2);
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin: 0.5rem 0;
}

.progress-fill {
    background: linear-gradient(90deg, #3776ab 0%, #4a8bc2 100%);
    height: 100%;
    border-radius: 4px;
    transition: width 0.8s ease;
    box-shadow: 0 0 10px rgba(55, 118, 171, 0.3);
}

/* Mobile Responsiveness Enhancements */
@media (max-width: 768px) {
    .topic-header {
        padding: 0.75rem 1rem;
    }

    .topic-title {
        font-size: 1rem;
    }

    .topic-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .level-badge {
        padding: 0.25rem 0.6rem;
        font-size: 0.7rem;
    }

    .sub-concept-btn {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    .code-example {
        margin: 1rem 0;
    }

    .code-header {
        padding: 0.5rem 0.75rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .copy-btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
    }

    .explanation-section {
        padding: 1rem;
        margin: 1rem 0;
    }

    .concept-nav {
        flex-direction: column;
        text-align: center;
    }

    .nav-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Animation Enhancements */
@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.concept-content {
    animation: fadeInUp 0.6s ease-out;
}

.topic-section {
    animation: slideInFromLeft 0.4s ease-out;
}

/* Accessibility Improvements */
.copy-btn:focus,
.nav-btn:focus,
.sub-concept-btn:focus {
    outline: 2px solid #4a8bc2;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .level-badge.basic {
        background: #22c55e;
        color: #000;
    }

    .level-badge.intermediate {
        background: #fb923c;
        color: #000;
    }

    .level-badge.advanced {
        background: #ef4444;
        color: #fff;
    }
}

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

/* Example Buttons Container */
.example-buttons-container {
    background: rgba(15, 52, 96, 0.3);
    border: 1px solid rgba(55, 118, 171, 0.4);
    border-radius: 8px;
    margin: 0.75rem 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.example-buttons-container:hover {
    border-color: rgba(55, 118, 171, 0.6);
}

.example-buttons-header {
    background: linear-gradient(135deg, #16213e 0%, #0f3460 100%);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 1px solid rgba(55, 118, 171, 0.3);
}

.example-buttons-header:hover {
    background: linear-gradient(135deg, #1a2a4a 0%, #123f6a 100%);
}

.example-buttons-header span {
    color: #ffd700;
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toggle-examples-btn {
    background: none;
    border: none;
    color: #3776ab;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.toggle-examples-btn:hover {
    background: rgba(55, 118, 171, 0.2);
    color: #4a8bc2;
}

.example-buttons-container.expanded .toggle-examples-btn i {
    transform: rotate(180deg);
}

.example-buttons-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out, padding 0.4s ease-out;
    background: rgba(22, 33, 62, 0.2);
}

.example-buttons-container.expanded .example-buttons-content {
    max-height: 300px;
    padding: 1rem;
}

.example-category {
    margin-bottom: 1rem;
}

.example-category:last-child {
    margin-bottom: 0;
}

.category-label {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #4a8bc2;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.example-btn {
    background: rgba(55, 118, 171, 0.2);
    border: 1px solid rgba(55, 118, 171, 0.4);
    color: #e5e5e5;
    padding: 0.4rem 0.8rem;
    margin: 0.25rem 0.25rem 0.25rem 0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    display: inline-block;
    position: relative;
    overflow: hidden;
}

.example-btn:hover {
    background: rgba(55, 118, 171, 0.4);
    border-color: #4a8bc2;
    color: #ffd700;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(55, 118, 171, 0.2);
}

.example-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(55, 118, 171, 0.3);
}

.example-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.example-btn:hover::before {
    left: 100%;
}

/* Mobile responsiveness for example buttons */
@media (max-width: 768px) {
    .example-buttons-container {
        margin: 0.5rem 0;
    }

    .example-buttons-header {
        padding: 0.5rem 0.75rem;
    }

    .example-buttons-header span {
        font-size: 0.85rem;
    }

    .example-buttons-container.expanded .example-buttons-content {
        padding: 0.75rem;
    }

    .example-btn {
        padding: 0.35rem 0.6rem;
        font-size: 0.75rem;
        margin: 0.2rem 0.2rem 0.2rem 0;
    }

    .category-label {
        font-size: 0.75rem;
        margin-bottom: 0.4rem;
    }
}

/* Progress Tracking and Completion Styles */
.completion-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid;
    transition: all 0.3s ease;
}

.completion-badge.completed {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    border-color: rgba(34, 197, 94, 0.4);
}

.completion-badge:not(.completed) {
    background: rgba(156, 163, 175, 0.15);
    color: #9ca3af;
    border-color: rgba(156, 163, 175, 0.4);
}

.concept-header-info {
    background: rgba(15, 52, 96, 0.2);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(55, 118, 171, 0.3);
}

.concept-meta .level-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.subconcept-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(55, 118, 171, 0.3);
}

.subconcept-actions {
    display: flex;
    gap: 0.75rem;
}

.mark-complete-btn {
    background: rgba(55, 118, 171, 0.8);
    border: 1px solid #3776ab;
    color: white;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mark-complete-btn:hover {
    background: rgba(74, 139, 194, 0.9);
    border-color: #4a8bc2;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(55, 118, 171, 0.3);
}

.mark-complete-btn.completed {
    background: rgba(34, 197, 94, 0.8);
    border-color: #22c55e;
    color: white;
}

.mark-complete-btn.completed:hover {
    background: rgba(34, 197, 94, 0.9);
    border-color: #16a34a;
}

.concept-progress-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    max-width: 200px;
}

.progress-indicator {
    font-size: 0.85rem;
    color: #888;
    font-weight: 500;
}

/* Sidebar Progress Indicators */
.concept-progress-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.progress-fraction {
    font-size: 0.75rem;
    color: #4a8bc2;
    font-weight: 600;
    min-width: 2.5rem;
}

.mini-progress-bar {
    width: 60px;
    height: 4px;
    background: rgba(55, 118, 171, 0.2);
    border-radius: 2px;
    overflow: hidden;
}

.mini-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3776ab 0%, #4a8bc2 100%);
    border-radius: 2px;
    transition: width 0.8s ease;
}

.completion-medal {
    color: #ffd700;
    margin-left: 0.5rem;
    animation: medallion 2s ease-in-out infinite;
}

@keyframes medallion {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.topic-header.completed {
    background: linear-gradient(135deg, #1a4d3a 0%, #0f3f2a 100%);
    border-color: rgba(34, 197, 94, 0.4);
}

.sub-concept-btn.completed {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.4);
    color: #22c55e;
}

.sub-concept-btn.completed:hover {
    background: rgba(34, 197, 94, 0.2);
    color: #16a34a;
}

.sub-concept-btn.completed i {
    color: #22c55e;
}

/* Overall Progress Display */
.overall-progress {
    background: rgba(15, 52, 96, 0.3);
    border: 1px solid rgba(55, 118, 171, 0.4);
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
}

.overall-progress h4 {
    color: #ffd700;
    margin: 0 0 0.75rem 0;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.progress-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.progress-stat {
    text-align: center;
    padding: 0.75rem;
    background: rgba(22, 33, 62, 0.5);
    border-radius: 6px;
}

.progress-stat .stat-number {
    font-size: 1.5rem;
    font-weight: bold;
    color: #4a8bc2;
    display: block;
}

.progress-stat .stat-label {
    font-size: 0.8rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.progress-text {
    text-align: center;
    font-size: 0.9rem;
    color: #888;
    margin-top: 0.5rem;
}

/* Mobile responsiveness for progress elements */
@media (max-width: 768px) {
    .concept-header-info {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .concept-meta .level-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .subconcept-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .mark-complete-btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
        width: 100%;
        justify-content: center;
    }

    .concept-progress-info {
        max-width: none;
        width: 100%;
    }

    .progress-stats {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .concept-progress-indicator {
        flex-direction: column;
        gap: 0.3rem;
        align-items: flex-start;
    }

    .mini-progress-bar {
        width: 100%;
        max-width: 120px;
    }
}