body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: #f8f9fa; /* Slightly lighter background */
    color: #343a40; /* Darker gray for text */
}

.container {
    width: 85%; /* Slightly wider */
    max-width: 1200px; /* Max width for larger screens */
    margin: 20px auto; /* Add some margin around the container */
    overflow: visible; /* Allow sticky positioning of children relative to viewport */
    padding: 20px 30px; /* More padding inside */
    background-color: #fff;
    padding-bottom: 30px;
    min-height: calc(100vh - 160px); /* Adjust for new margins/footer */
    border-radius: 8px; /* Rounded corners for the main container */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05); /* Subtle shadow for the container */
}

nav {
    background: #333;
    color: #fff;
    padding: 10px 0;
    border-bottom: #0779e4 3px solid;
}

nav ul {
    padding: 0;
    list-style: none;
    text-align: center;
}

nav ul li {
    display: inline;
    margin-right: 20px;
}

nav a {
    color: #fff;
    text-decoration: none;
    font-size: 18px;
}

nav a:hover {
    color: #0779e4;
}

footer {
    background: #333;
    color: #fff;
    text-align: center;
    padding: 20px;
    margin-top: 20px;
}

h1, h2, h3, h4 {
    color: #333;
}

h1 {
    border-bottom: 2px solid #0779e4;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.btn {
    display: inline-block;
    background: #0779e4;
    color: #fff;
    padding: 10px 20px;
    text-decoration: none;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 10px;
    transition: background-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn:hover {
    background: #0056b3;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* Theory Page Specifics */
.theory-container {
    display: flex;
    gap: 20px;
}

.theory-nav {
    flex: 1;
    background: #fdfdff; /* Slightly off-white */
    padding: 20px; /* More padding */
    border-radius: 8px; /* Consistent rounding */
    max-height: calc(100vh - 120px); /* Adjust max height */
    overflow-y: auto; /* Enable vertical scroll */
    box-shadow: 0 2px 8px rgba(0,0,0,0.05); /* Subtle shadow */
    position: sticky; /* Stick to the viewport on scroll */
    top: 20px; /* Offset from the top */
    align-self: flex-start; /* Ensure it aligns to the start of the flex container */
}

.theory-nav h2 {
    margin-top: 0;
    border-bottom: 1px solid #ddd;
    padding-bottom: 5px;
}

.theory-nav ul {
    list-style: none;
    padding-left: 0;
}

.theory-nav ul li a {
    text-decoration: none;
    color: #333;
    display: block;
    padding: 5px 0;
}

.theory-nav ul li a:hover {
    color: #0779e4;
}

.theory-nav ul ul { /* Nested lists for subsections */
    padding-left: 20px;
    font-size: 0.9em;
}

.theory-content {
    flex: 3;
}

.theory-content section {
    margin-bottom: 30px;
}

.theory-content article {
    margin-top: 15px;
    padding-left: 15px;
    border-left: 3px solid #eee;
}

.theory-content h2 {
    color: #0779e4;
}
.theory-content h3 {
    color: #555;
}

/* Enhanced styling for PQL code blocks */
.theory-content pre {
    display: block; /* Ensure it's a block element */
    background-color: #272822; /* Dark background for code blocks (Monokai-like) */
    color: #f8f8f2; /* Light text color for dark background */
    border: 1px solid #444; /* Border for the container */
    padding: 1em; /* Generous padding */
    border-radius: 6px; 
    overflow-x: auto; 
    margin: 20px 0; /* More vertical separation */
    box-shadow: 0 2px 5px rgba(0,0,0,0.1); /* Slightly more pronounced shadow */
}

/* Styling for the <code> tag specifically within <pre> */
.theory-content pre code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
    font-size: 0.95em; 
    line-height: 1.5; /* Improve readability of multi-line code */
    background-color: transparent !important; /* Ensure no overriding background */
    color: inherit !important; /* Inherit text color from <pre> */
    padding: 0 !important; /* Reset padding */
    display: block; /* Make the code element itself a block within pre if needed */
}

/* General inline code styling (if any, distinct from blocks) */
.theory-content p > code, 
.theory-content li > code,
.theory-content h3 > code { /* For code in paragraphs, list items, or headings */
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
    background-color: #eef0f2; /* Lighter background for inline code */
    color: #c7254e; /* A common color for inline code snippets */
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-size: 0.85em;
}

.section-divider {
    border: 0;
    height: 1px;
    background: #ddd;
    margin: 30px 0;
}

.quiz-link {
    display: block;
    margin-top: 15px;
    padding: 10px;
    background-color: #0779e4;
    color: white;
    text-align: center;
    text-decoration: none;
    border-radius: 5px;
}
.quiz-link:hover {
    background-color: #0056b3;
}


/* Quiz Page Specifics */
.quiz-question {
    background: #fff;
    padding: 20px; /* More padding */
    margin-bottom: 20px; /* More margin */
    border: 1px solid #e9ecef; /* Lighter border */
    border-radius: 8px; /* Consistent rounding */
    box-shadow: 0 2px 8px rgba(0,0,0,0.05); /* Subtle shadow */
}

.quiz-question.correct {
    border-left: 5px solid #28a745; /* Green for correct */
}

.quiz-question.incorrect {
    border-left: 5px solid #dc3545; /* Red for incorrect */
}

.quiz-option {
    margin-bottom: 8px;
}

.quiz-option label {
    margin-left: 5px;
}

.explanation {
    margin-top: 10px;
    padding: 10px;
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 4px;
    font-size: 0.9em;
}

.explanation p {
    margin: 5px 0;
}


/* Practical Exercises Page Specifics */

/* Tab navigation for databases */
.db-tabs {
    margin-bottom: 20px;
    border-bottom: 2px solid #0779e4;
    padding-bottom: 10px;
}

.db-tab-button {
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    padding: 10px 15px;
    cursor: pointer;
    margin-right: 5px;
    border-radius: 5px 5px 0 0;
    font-size: 1em;
    transition: background-color 0.3s ease;
}

.db-tab-button:hover {
    background-color: #e0e0e0;
}

.db-tab-button.active {
    background-color: #0779e4;
    color: white;
    border-bottom-color: #0779e4; /* Make bottom border same color as background */
}

.db-tab-content .database-section.hidden {
    display: none;
}
.db-tab-content .database-section.active {
    display: block; /* Or flex, grid, etc., depending on its original display type if needed */
}

/* Ensure dividers associated with hidden tabs are also hidden */
.database-section-divider.hidden {
    display: none;
}


.database-section {
    margin-bottom: 40px;
    padding: 20px;
    background-color: #fdfdfd;
    border: 1px solid #eaeaea;
    border-radius: 5px;
}

.database-section > h2 { /* Target only the main DB name h2 */
    border-bottom: 1px solid #ccc;
    padding-bottom: 10px;
    margin-top: 0;
}

.practical-exercise-container {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

.db-schema {
    flex: 1;
    background: #fdfdff; /* Slightly off-white */
    padding: 20px; /* More padding */
    border-radius: 8px; /* Consistent rounding */
    border: 1px solid #e9ecef; /* Lighter border */
    max-height: 600px; /* Limit height and allow scroll if needed */
    overflow-y: auto;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05); /* Subtle shadow */
}

.db-schema h3, .db-schema h4 {
    margin-top: 0;
    color: #333;
}
.db-schema h4 {
    font-size: 1.1em;
    margin-bottom: 5px;
    border-bottom: 1px dashed #ddd;
    padding-bottom: 3px;
}

.db-schema ul {
    list-style: none;
    padding-left: 0;
    font-size: 0.9em;
}
.db-schema ul li {
    margin-bottom: 3px;
}

/* Styling for schema tables */
.schema-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
    font-size: 0.9em;
}

.schema-table th, .schema-table td {
    border: 1px solid #ddd;
    padding: 6px;
    text-align: left;
}

.schema-table th {
    background-color: #e9ecef;
    font-weight: bold;
}

.schema-table tr:nth-child(even) {
    background-color: #f8f9fa;
}

.queries-list {
    flex: 2;
}

.practical-query {
    background: #fff;
    padding: 25px; /* More padding */
    margin-bottom: 25px; /* More margin */
    border: 1px solid #e9ecef; /* Lighter border */
    border-radius: 8px; /* Consistent rounding */
    box-shadow: 0 2px 8px rgba(0,0,0,0.05); /* Subtle shadow */
}
.practical-query h4 {
    margin-top: 0;
    color: #0779e4;
}

.practical-query textarea {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-family: monospace;
}

.feedback {
    margin-top: 15px;
    padding: 10px;
    border-radius: 4px;
}

.feedback .correct {
    color: #155724;
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    padding: 10px;
}

.feedback .incorrect {
    color: #721c24;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    padding: 10px;
}
.feedback .error {
    color: #721c24;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    padding: 10px;
}

.feedback pre {
    background-color: #f0f0f0;
    padding: 8px;
    border-radius: 3px;
    overflow-x: auto;
}
.feedback code {
    font-family: monospace;
}
.feedback details {
    margin-top: 10px;
}
.feedback summary {
    cursor: pointer;
    color: #007bff;
    font-weight: bold;
}

.query-divider {
    border: 0;
    height: 1px;
    background: #eee;
    margin: 20px 0;
}
.database-section-divider {
    border: 0;
    height: 2px;
    background: #0779e4;
    margin: 40px 0;
}

/* New styles for interactive quiz feedback */
.quiz-option label.user-correct {
    font-weight: bold;
    color: #28a745; /* Green */
    border: 1px solid #28a745;
    padding: 2px 5px;
    border-radius: 3px;
}

.quiz-option label.user-incorrect {
    font-weight: bold;
    color: #dc3545; /* Red */
    border: 1px solid #dc3545;
    padding: 2px 5px;
    border-radius: 3px;
    text-decoration: line-through;
}

.quiz-option label.correct-answer-highlight {
    background-color: #d4edda; /* Light green background */
    color: #155724; /* Darker green text */
    padding: 2px 5px;
    border-radius: 3px;
    border: 1px dashed #155724;
}

/* Ensure specificity if needed, or combine with existing .quiz-option label styles */
.quiz-option input[type="radio"]:disabled + label {
    cursor: default; /* Indicate options are no longer interactive */
}


#feedback-text.feedback-correct {
    color: #155724; /* Dark green */
    font-weight: bold;
    padding: 10px;
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 4px;
    margin-top: 15px;
}

#feedback-text.feedback-incorrect {
    color: #721c24; /* Dark red */
    font-weight: bold;
    padding: 10px;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    margin-top: 15px;
}

#feedback-text.feedback-error {
    color: #721c24; /* Dark red for errors too */
    font-weight: bold;
    padding: 10px;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    margin-top: 15px;
}

.quiz-question-container {
    background: #fff;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
