/* Card Styles */
.card {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: none;
}

.card-title {
    color: #333;
    font-weight: 600;
}

/* Select Options Section */
.form-select {
    border-radius: 4px;
    border: 1px solid #ddd;
    padding: 8px;
}

.form-select:disabled {
    background-color: #f8f9fa;
    cursor: not-allowed;
}

/* Selected Questions Queue */
.selected-questions-container {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 4px;
    padding: 8px;
    background-color: #f8f9fa;
}

.selected-question {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 8px;
    margin: 4px 0;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.question-text {
    flex: 1;
    margin-right: 8px;
    font-size: 0.9rem;
}

/*
=======================================================================
    NEW STYLES FOR SOLUTION RENDERING - ADDED BY CASCADE
======================================================================= 
*/

/* Main container for the rendered solution from the template */
.solution-content {
    background-color: #ffffff; /* White background for a clean look */
    border-radius: 8px;
    border: 1px solid #dee2e6;
    padding: 2rem;
    font-family: 'Georgia', 'Times New Roman', serif; /* Serif font for readability */
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
}

/* This is the container div for the formatted solution */
.solution-content {
    color: #212529;
}

/* Styling for headers (e.g., "Step 1", "Explanation") */
.solution-content h1,
.solution-content h2,
.solution-content h3,
.solution-content h4,
.solution-content h5,
.solution-content h6 {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #0056b3; /* A strong, professional blue */
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e9ecef;
}

/* Styling for paragraphs */
.solution-content p {
    line-height: 1.8;
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

/* Make bold text stand out more */
.solution-content strong,
.solution-content b {
    color: #000;
}

/* Special styling for the final answer to make it pop */
.solution-content p:last-child strong,
.solution-content p:last-child b {
    display: block;
    background-color: #d1ecf1; /* Light cyan background */
    color: #0c5460; /* Dark cyan text */
    padding: 1rem;
    border-radius: 5px;
    margin-top: 1.5rem;
    border: 1px solid #bee5eb;
    text-align: center;
    font-size: 1.2rem;
}

/* Styling for lists (ordered and unordered) */
.solution-content ul,
.solution-content ol {
    padding-left: 2rem;
    margin-bottom: 1rem;
}

.solution-content li {
    margin-bottom: 0.5rem;
    line-height: 1.8;
}

/* Styling for inline code and code blocks */
.solution-content code {
    background-color: #f1f3f5;
    padding: 0.2em 0.4em;
    margin: 0;
    font-size: 90%;
    border-radius: 3px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
}

.solution-content pre {
    background: #f1f3f5;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    padding: 1rem;
    overflow-x: auto;
}

.solution-content pre code {
    background: none;
    padding: 0;
    font-size: 100%;
}

/* Styling for blockquotes */
.solution-content blockquote {
    border-left: 5px solid #007bff;
    padding-left: 1.5rem;
    margin-left: 0;
    color: #495057;
    font-style: italic;
}

/* Ensure MathJax-rendered content has appropriate styling */
.MathJax {
    font-size: 1.1em !important;
}

.mjx-container[jax="SVG"] {
    padding: 0.5em 0;
}

.remove-question {
    padding: 0 6px;
    font-size: 14px;
    line-height: 1;
}

/* Questions List */
.exercise-section {
    border: 1px solid #eee;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.exercise-header {
    background-color: #f8f9fa;
    padding: 12px;
    margin: 0;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toggle-icon {
    font-size: 1.2rem;
    font-weight: bold;
    color: #666;
}

.exercise-content {
    padding: 0 12px;
}

.question-item {
    padding: 12px;
    border-bottom: 1px solid #eee;
}

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

.sub-questions {
    margin-left: 24px;
    margin-top: 8px;
    padding-left: 12px;
    border-left: 2px solid #eee;
}

.sub-question {
    margin: 4px 0;
    color: #555;
}

/* Question Images */
.question-image {
    margin: 12px 0;
    text-align: center;
}

.question-image img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Form Elements */
.form-check-input {
    cursor: pointer;
}

.form-check-label {
    cursor: pointer;
    padding-left: 4px;
}

/* Action Buttons */
.btn {
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: 500;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Results Section */
.result-content {
    background-color: #f8f9fa;
    padding: 16px;
    border-radius: 4px;
    margin-top: 12px;
}

/* Math Content */
.math-content {
    overflow-x: auto;
    padding: 16px;
    background-color: white;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .col-md-3,
    .col-md-9 {
        margin-bottom: 20px;
    }
    
    .selected-questions-container {
        max-height: 200px;
    }
}

/* Loading State */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: "Loading...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 16px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* LaTeX Content */
.latex-content {
    font-size: 1.1em;
    line-height: 1.6;
}

/* Highlight selected questions */
.question-checkbox:checked + label {
    color: #007bff;
    font-weight: 500;
}

/* Error Messages */
.error-message {
    color: #dc3545;
    font-size: 0.9rem;
    margin-top: 4px;
}

/* Success Messages */
.success-message {
    color: #28a745;
    font-size: 0.9rem;
    margin-top: 4px;
}

/* Add this to your math_tools.css */
select:disabled {
    background-color: #e9ecef;
    cursor: not-allowed;
}

select option {
    padding: 8px;
}

.select-container {
    position: relative;
}

.select-container::after {
    content: '▼';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

/* Solution Formatting */
.structured-solution {
    font-size: 1.1rem;
    line-height: 1.6;
}

.solution-step {
    margin: 1.5rem 0;
    padding: 1rem;
    background: #f8f9fa;
    border-left: 4px solid #007bff;
    border-radius: 0.25rem;
}

.step-content {
    color: #333;
}

/* Mathematics Formatting */
.solution-content {
    font-family: 'Latin Modern Math', serif;
}

.solution-content .MathJax {
    font-size: 1.1em !important;
}

/* Code blocks within solutions */
.solution-content pre {
    background: #f1f1f1;
    padding: 1rem;
    border-radius: 0.25rem;
    overflow-x: auto;
}

/* Highlight important parts */
.solution-content .highlight {
    background-color: #fff3cd;
    padding: 0.2em 0.4em;
    border-radius: 0.2rem;
}

/* Tables in solutions */
.solution-content table {
    width: 100%;
    margin: 1rem 0;
    border-collapse: collapse;
}

.solution-content th,
.solution-content td {
    padding: 0.75rem;
    border: 1px solid #dee2e6;
    text-align: left;
}

.solution-content th {
    background-color: #f8f9fa;
}

/* Improve spacing for mathematical expressions */
.solution-content p {
    margin: 1rem 0;
}

/* Make sure mathematical expressions don't overflow on mobile */
@media (max-width: 768px) {
    .solution-content {
        overflow-x: auto;
    }
    
    .solution-step {
        margin: 1rem 0;
        padding: 0.75rem;
    }
}

.structured-solution {
    font-size: 1.1rem;
    line-height: 1.6;
    padding: 1rem;
}

.step-title {
    color: #2c3e50;
    margin: 1.5rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #eee;
}

.step-content {
    margin: 1rem 0;
    padding: 1rem;
    background: #f8f9fa;
    border-left: 4px solid #007bff;
    border-radius: 0.25rem;
}

/* Mathematics styling */
.structured-solution .MathJax {
    font-size: 1.1em !important;
}

/* Improved spacing for mathematical expressions */
.structured-solution p {
    margin: 1rem 0;
}

/* Tables in solutions */
.structured-solution table {
    width: 100%;
    margin: 1rem 0;
    border-collapse: collapse;
}

.structured-solution th,
.structured-solution td {
    padding: 0.75rem;
    border: 1px solid #dee2e6;
    text-align: left;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .structured-solution {
        font-size: 1rem;
        padding: 0.5rem;
    }
    
    .step-content {
        padding: 0.75rem;
    }
}