/* Custom styles for the C Programming Learning System */

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
}

.lesson-card {
    transition: transform 0.2s, box-shadow 0.2s;
    height: 100%;
}

.lesson-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.lesson-content {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.lesson-content h1, .lesson-content h2, .lesson-content h3 {
    color: #2c3e50;
    margin-top: 30px;
    margin-bottom: 20px;
}

.lesson-content h1 {
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

.lesson-content p {
    line-height: 1.8;
    margin-bottom: 20px;
}

/* Add spacing after other block elements */
.lesson-content ul, .lesson-content ol {
    margin-top: 15px;
    margin-bottom: 20px;
}

/* Ensure proper list styling - with important to override Bootstrap */
.lesson-content ul {
    list-style-type: disc !important;
    padding-left: 20px !important;
}

.lesson-content ol {
    list-style-type: decimal !important;
    padding-left: 20px !important;
}

/* More specific selector to override Bootstrap styles */
.lesson-content ul li {
    list-style-type: disc !important;
    display: list-item !important;
}

.lesson-content ol li {
    list-style-type: decimal !important;
    display: list-item !important;
}

/* Alternative approach using before pseudo-element for custom bullets */
.lesson-content ul li {
    position: relative;
    padding-left: 20px;
}

.lesson-content ul li:before {
    content: "• ";
    position: absolute;
    left: 0;
}

.lesson-content blockquote {
    margin-top: 20px;
    margin-bottom: 20px;
    padding: 15px 20px;
    border-left: 4px solid #3498db;
    background-color: #f8f9fa;
}

.lesson-content code {
    background-color: #f1f1f1;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    color: #d6336c; /* More colorful */
}

.lesson-content pre {
    background-color: #f8f9fa;
    color: #333;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    overflow-x: auto;
    margin: 15px 0;
}

/* More colorful code blocks in lesson content */
.lesson-content pre code {
    background: none;
    padding: 0;
    color: #333;
    font-family: 'Courier New', monospace;
}

/* Colorful syntax highlighting for lesson content code blocks */
.lesson-content pre {
    background-color: #2b2b2b;
    color: #f8f8f2;
    border: 1px solid #49483e;
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 15px 0;
}

.lesson-content pre code {
    background: none;
    color: #f8f8f2;
    display: block;
    overflow-x: auto;
}

/* Use highlight.js theme for lesson content code blocks */
.lesson-content pre code {
    background: #2b2b2b;
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
}

/* Override default hljs theme to use dark theme for lesson content */
.lesson-content .hljs {
    background: #2b2b2b;
    color: #f8f8f2;
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
}

.lesson-content .hljs-keyword {
    color: #f92672; /* Red for keywords */
}

.lesson-content .hljs-function {
    color: #a6e22e; /* Green for functions */
}

.lesson-content .hljs-number {
    color: #ae81ff; /* Purple for numbers */
}

.lesson-content .hljs-string {
    color: #e6db74; /* Yellow for strings */
}

.lesson-content .hljs-comment {
    color: #75715e; /* Brown for comments */
}

.lesson-content .hljs-meta {
    color: #f8f8f2; /* Default color for meta */
}

.lesson-content .hljs-title {
    color: #a6e22e; /* Green for titles/functions */
}

.lesson-content .hljs-type {
    color: #66d9ef; /* Light blue for types */
}

.lesson-content .hljs-params {
    color: #fd971f; /* Orange for parameters */
}

.lesson-content .hljs-built_in {
    color: #a6e22e; /* Green for built-in functions */
}

.lesson-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
}

.lesson-content table,
.lesson-content th,
.lesson-content td {
    border: 1px solid #ddd;
}

.lesson-content th {
    background-color: #f2f2f2;
    padding: 10px;
    text-align: left;
}

.lesson-content td {
    padding: 10px;
}

.lesson-content img, .home-content img {
    max-width: 100%;
    height: auto;
    margin: 15px 0;
    display: block;
    cursor: pointer;
    transition: transform 0.3s ease;
    object-fit: contain; /* Ensures the entire image is visible within its bounds */
    image-rendering: -webkit-optimize-contrast; /* Optimizes rendering for better performance */
    image-rendering: crisp-edges; /* Better rendering for scaled images */
}

.lesson-content img.zoomable-img {
    max-width: 100%;
    height: auto;
    margin: 15px 0;
    display: block;
    cursor: zoom-in;
    transition: transform 0.3s ease;
    object-fit: contain; /* Ensures the entire image is visible within its bounds */
}

.lesson-content img.zoomable-img.enlarged {
    cursor: zoom-out;
    max-width: 95vw;
    max-height: 90vh;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1050; /* High z-index to appear above other elements */
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.lesson-content img.zoomable-img {
    max-width: 100%;
    height: auto;
    margin: 15px 0;
    display: block;
    cursor: zoom-in;
    transition: transform 0.3s ease;
    object-fit: contain; /* Ensures the entire image is visible within its bounds */
}

.lesson-content figure {
    margin: 15px 0;
    text-align: center;
}

.lesson-content figcaption {
    font-style: italic;
    color: #666;
    margin-top: 5px;
}

.lesson-content pre code {
    background: none;
    padding: 0;
}

.exercise-section {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.exercise-content {
    background-color: #f8f9fa;
    padding: 15px;
    border-left: 4px solid #3498db;
    border-radius: 0 4px 4px 0;
}

.editor-section {
    margin-top: 20px;
}

#code-editor {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    resize: vertical;
}

#output {
    max-height: 300px;
    overflow-y: auto;
}

.output-success {
    color: #28a745;
}

.output-error {
    color: #dc3545;
}

.footer {
    margin-top: 50px;
}

.navbar-brand {
    font-weight: bold;
}

.card {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.list-group-item.active {
    background-color: #3498db;
    border-color: #3498db;
}

/* Syntax highlighting for code blocks */
.hljs {
    display: block;
    overflow-x: auto;
    padding: 0.5em;
    background: #f0f0f0;
}

/* Dark theme for code editor */
.code-editor-dark {
    background-color: #272822 !important;
    color: #f8f8f2 !important;
}

.code-editor-dark #line-numbers {
    background-color: #3e3d32 !important;
    color: #75715e !important;
}

/* Line numbers container styling */
.line-numbers {
    background-color: #eef0f3;
    color: #6c757d;
    border-right: 1px solid #dee2e6;
    font-family: monospace;
    font-size: 14px;
    line-height: 1.4;
    padding: 10px 5px;
    text-align: right;
    overflow: hidden;
    user-select: none;
    flex-shrink: 0;
    min-width: 40px;
}

/* Dark theme for line numbers */
.code-editor-dark + .line-numbers,
.code-editor-dark .line-numbers {
    background-color: #3e3d32;
    color: #75715e;
    border-right: 1px solid #49483e;
}

/* Alternative selector for dark theme */
.code-editor-dark ~ div .line-numbers,
#editor-wrapper.code-editor-dark .line-numbers {
    background-color: #3e3d32;
    color: #75715e;
    border-right: 1px solid #49483e;
}

/* Editor wrapper styling */
.editor-wrapper {
    display: flex;
    overflow: hidden;
}

.editor-wrapper textarea {
    border: none;
    outline: none;
    resize: none;
    font-family: monospace;
    font-size: 14px;
    line-height: 1.4;
    padding: 10px;
    margin: 0;
    overflow: auto;
    flex: 1;
}

/* Dark theme for output panel */
.output-dark {
    background-color: #272822 !important;
    color: #f8f8f2 !important;
    border: 1px solid #49483e !important;
}

.output-dark pre {
    color: #f8f8f2 !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .lesson-content, .exercise-section {
        padding: 15px;
    }
}