/* Chapter 6 Specific Styles */
.boosting-demo {
    background: linear-gradient(135deg, #fff7ed 0%, #fed7aa 100%);
    border: 2px solid #ea580c;
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem 0;
    position: relative;
}

.boosting-demo::before {
    content: "Sequential Learning Demo";
    position: absolute;
    top: -12px;
    left: 20px;
    background: #ea580c;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
}

.sequential-flow {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 2rem 0;
}

.boosting-round {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    display: grid;
    grid-template-columns: 80px 1fr 120px;
    gap: 1rem;
    align-items: center;
    transition: all 0.3s ease;
}

.boosting-round:hover {
    transform: translateX(10px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.round-number {
    background: linear-gradient(135deg, #ea580c, #dc2626);
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
}

.round-details {
    flex: 1;
}

.round-title {
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: #1f2937;
}

.round-description {
    color: #64748b;
    font-size: 0.9rem;
}

.round-metrics {
    text-align: right;
}

.metric-label {
    font-size: 0.8rem;
    color: #64748b;
}

.metric-value {
    font-size: 1.2rem;
    font-weight: bold;
    color: #ea580c;
}

.residual-visualization {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 0.5rem;
    margin: 1rem 0;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
}

.residual-bar {
    background: #ef4444;
    border-radius: 4px 4px 0 0;
    display: flex;
    align-items: end;
    justify-content: center;
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    transition: all 0.3s ease;
    cursor: pointer;
    min-height: 20px;
}

.residual-bar:hover {
    opacity: 0.8;
    transform: scale(1.1);
}

.residual-bar.small {
    background: #22c55e;
}

.loss-chart {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    margin: 2rem 0;
}

.loss-progression {
    height: 200px;
    background: linear-gradient(to bottom, transparent 0%, #f1f5f9 100%);
    border-radius: 8px;
    position: relative;
    margin: 1rem 0;
    border: 2px solid #e2e8f0;
}

.loss-curve {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: end;
    padding: 10px;
}

.loss-point {
    flex: 1;
    background: #ea580c;
    margin: 0 1px;
    border-radius: 2px 2px 0 0;
    transition: all 0.3s ease;
}

.loss-point:hover {
    background: #dc2626;
}

.learning-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.learning-control {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.learning-control label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #374151;
}

.learning-control input[type="range"] {
    width: 100%;
    margin: 0.5rem 0;
}

.control-value {
    display: inline-block;
    background: #ea580c;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: bold;
    margin-left: 0.5rem;
}

.weak-learner-demo {
    background: linear-gradient(135deg, #f3e8ff 0%, #e9d5ff 100%);
    border: 2px solid #a855f7;
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem 0;
}

.learner-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.weak-learner {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
}

.weak-learner:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.weak-learner.selected {
    border-color: #a855f7;
    background: linear-gradient(135deg, #f3e8ff, #e9d5ff);
}

.learner-accuracy {
    font-size: 1.5rem;
    font-weight: bold;
    color: #7c3aed;
    margin: 0.5rem 0;
}

.gradient-explanation {
    background: #f8fafc;
    border-left: 4px solid #3b82f6;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 2rem 0;
}

.math-formula {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    font-family: 'Times New Roman', serif;
    font-size: 1.1rem;
    margin: 1rem 0;
    border: 2px solid #e2e8f0;
}

.comparison-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin: 2rem 0;
}

.comparison-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.rf-card {
    border-left: 4px solid #22c55e;
}

.gb-card {
    border-left: 4px solid #ea580c;
}

@media (max-width: 768px) {
    .boosting-round {
        grid-template-columns: 60px 1fr;
        gap: 0.5rem;
    }
    
    .round-metrics {
        grid-column: 1 / -1;
        text-align: left;
        margin-top: 1rem;
    }
    
    .learning-controls {
        grid-template-columns: 1fr;
    }
    
    .comparison-grid {
        grid-template-columns: 1fr;
    }
}