/* ML Fundamentals Chapter 1 Specific Styles */
/* File location: static/css/tutorials/ml_fundamentals/chapter1.css */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Universal text color override for all ML Fundamentals content */
body,
body *,
main,
main *,
.azbn-section,
.azbn-section *,
.azbn-container,
.azbn-container *,
.content-section,
.content-section *,
.interactive-demo,
.interactive-demo *,
.quiz-question,
.quiz-question *,
.azbn-hero,
.azbn-hero *,
h1, h2, h3, h4, h5, h6,
p, label, span, div, li, ul, ol, strong, em {
    color: #333 !important;
}

/* Ensure proper background for content areas */
.azbn-section,
.azbn-container,
.content-section {
    background: white !important;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* Main content styling */
main {
    padding-top: 100px;
}

.azbn-section {
    padding: 2rem 0;
}

.azbn-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    background: white !important;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    margin-top: 20px;
    margin-bottom: 20px;
}

/* Navigation buttons */
.navigation-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 2rem 0;
    flex-wrap: wrap;
    gap: 1rem;
}

/* Chapter title styling */
h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: #2c3e50 !important;
    font-weight: 700;
    text-align: center;
}

/* Chapter subtitle */
.azbn-container > p[style*="font-size: 1.1rem"] {
    font-size: 1.1rem;
    color: #666 !important;
    margin-bottom: 2rem;
    text-align: center;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* Section navigation styling */
.section-nav {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 10px;
    padding: 1rem;
    margin: 1.5rem 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    text-align: center;
}

.section-nav button {
    background: white;
    border: 2px solid #667eea;
    color: #667eea !important;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    font-weight: 500;
    transition: all 0.3s ease;
    margin: 0.25rem;
    cursor: pointer;
    font-family: inherit;
}

.section-nav button:hover {
    background: #667eea;
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.section-nav button.active {
    background: #667eea;
    color: white !important;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Content sections */
.content-section {
    display: none;
    padding: 2rem 0;
    animation: fadeIn 0.3s ease-in;
}

.content-section.active {
    display: block;
}

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

.content-section h2 {
    color: #2c3e50 !important;
    margin: 2rem 0 1.5rem;
    font-size: 1.8rem;
    font-weight: 600;
}

.content-section h3 {
    color: #34495e !important;
    margin: 1.5rem 0 1rem;
    font-size: 1.4rem;
    font-weight: 600;
}

.content-section h4 {
    color: #34495e !important;
    margin: 1rem 0 0.5rem;
    font-size: 1.2rem;
    font-weight: 600;
}

/* Card styles */
.azbn-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1rem 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    position: relative;
}

.azbn-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border-color: #667eea;
}

.azbn-card h3,
.azbn-card h4 {
    color: #2c3e50 !important;
    font-size: 1.3rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.azbn-card p {
    color: #555 !important;
    line-height: 1.6;
    margin-bottom: 1rem;
}

/* Interactive demo styling */
.interactive-demo {
    background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
    border: 2px solid #bbdefb;
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem 0;
    color: #333 !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    position: relative;
}

.interactive-demo::before {
    content: "Interactive Demo";
    position: absolute;
    top: -12px;
    left: 20px;
    background: #2196f3;
    color: white !important;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
}

.interactive-demo h3,
.interactive-demo h4 {
    color: #1976d2 !important;
    margin-bottom: 1rem;
}

.interactive-demo input,
.interactive-demo button {
    margin: 0.5rem;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: inherit;
}

.interactive-demo button {
    background: #2196f3;
    color: white !important;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

.interactive-demo button:hover {
    background: #1976d2;
}

.interactive-demo label {
    font-weight: 500;
    display: block;
    margin-bottom: 0.25rem;
}

/* Visualization styling */
.visualization {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
    text-align: center;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
}

.visualization canvas {
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    max-width: 100%;
    height: auto;
}

/* Quiz question styling */
.quiz-question {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 50%);
    border: 2px solid #ffc107;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 2rem 0;
    color: #333 !important;
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.2);
}

.quiz-question h4 {
    color: #e65100 !important;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.quiz-question input[type="radio"] {
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

.quiz-question label {
    display: block;
    padding: 0.5rem 0;
    cursor: pointer;
    color: #333 !important;
}

.quiz-question button {
    background: #ffc107;
    color: #333 !important;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    margin-top: 1rem;
    transition: background-color 0.3s ease;
}

.quiz-question button:hover {
    background: #ffb300;
}

/* Code block styling */
.code-block {
    background: #1e1e1e;
    color: #f8f8f2 !important;
    padding: 20px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    overflow-x: auto;
    margin: 15px 0;
    position: relative;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    border: 1px solid #333;
}

.code-block pre,
.code-block code {
    color: #f8f8f2 !important;
    margin: 0;
    background: transparent;
}

.code-block::before {
    content: "Python Code";
    position: absolute;
    top: -10px;
    right: 10px;
    background: #667eea;
    color: white !important;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7em;
}

/* Grid layout */
.azbn-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}

/* Lists styling */
ul, ol {
    margin: 1rem 0;
    padding-left: 2rem;
}

li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

/* Strong text styling */
strong {
    font-weight: 600;
    color: #2c3e50 !important;
}

/* Button styling */
.azbn-btn {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white !important;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.azbn-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    filter: brightness(1.1);
    color: white !important;
}

.azbn-btn.azbn-secondary {
    background: white;
    color: #667eea !important;
    border: 2px solid #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.azbn-btn.azbn-secondary:hover {
    background: #667eea;
    color: white !important;
}

/* Result divs styling */
#prediction-result,
#preprocessing-demo,
#evaluation-demo,
#installation-test,
#library-demo,
#q1-result,
#q2-result,
#q3-result,
#quiz-score,
#rl-result {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
    color: #333 !important;
}

/* Grid world styling for RL demo */
#grid-world {
    display: inline-block;
    border: 2px solid #333;
    margin: 1rem 0;
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .azbn-container {
        padding: 1rem;
        margin: 10px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .section-nav {
        padding: 0.75rem;
    }
    
    .section-nav button {
        padding: 0.5rem 1rem;
        margin: 0.15rem;
        font-size: 0.9rem;
    }
    
    .azbn-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .azbn-card,
    .interactive-demo,
    .quiz-question {
        padding: 1rem;
    }
    
    .navigation-buttons {
        flex-direction: column;
        text-align: center;
    }
    
    .code-block {
        font-size: 0.8em;
        padding: 15px;
    }
    
    .visualization {
        padding: 0.75rem;
    }
}

@media (max-width: 480px) {
    main {
        padding-top: 80px;
    }
    
    .azbn-container {
        padding: 0.75rem;
        margin: 5px;
    }
    
    h1 {
        font-size: 1.75rem;
    }
    
    .content-section h2 {
        font-size: 1.5rem;
    }
    
    .content-section h3 {
        font-size: 1.2rem;
    }
    
    .section-nav button {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .interactive-demo::before {
        font-size: 0.7rem;
        padding: 2px 8px;
    }
}