/* Chapter 5 Specific Styles */
.forest-demo {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 2px solid #22c55e;
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem 0;
    position: relative;
}

.forest-demo::before {
    content: "Random Forest Builder";
    position: absolute;
    top: -12px;
    left: 20px;
    background: #22c55e;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
}

.tree-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
    max-height: 400px;
    overflow-y: auto;
}

.tree-card {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

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

.tree-card.selected {
    border-color: #22c55e;
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
}

.tree-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: block;
}

.tree-prediction {
    font-weight: bold;
    color: #15803d;
}

.tree-confidence {
    font-size: 0.8rem;
    color: #64748b;
}

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

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

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

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

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

.bootstrap-visualization {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
    margin: 1.5rem 0;
}

.bootstrap-sample {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    text-align: center;
}

.sample-data {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.25rem;
    margin: 0.5rem 0;
}

.data-point {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
    color: white;
}

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

.importance-bars {
    margin: 1rem 0;
}

.importance-bar {
    display: flex;
    align-items: center;
    margin: 0.5rem 0;
}

.bar-label {
    width: 100px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #374151;
}

.bar-fill {
    flex: 1;
    height: 25px;
    background: linear-gradient(90deg, #22c55e, #16a34a);
    border-radius: 4px;
    position: relative;
    margin: 0 1rem;
    transition: width 0.3s ease;
}

.bar-value {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 0.8rem;
    font-weight: bold;
}

.oob-section {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-left: 4px solid #f59e0b;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 2rem 0;
}

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

.perf-metric {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.metric-title {
    font-size: 0.9rem;
    color: #64748b;
    margin-bottom: 0.5rem;
}

.metric-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: #1e40af;
}

.hyperparameter-tuner {
    background: #f8fafc;
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem 0;
}

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

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

@media (max-width: 768px) {
    .tree-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }
    
    .forest-controls {
        grid-template-columns: 1fr;
    }
    
    .bootstrap-visualization {
        grid-template-columns: 1fr;
    }
    
    .performance-comparison {
        grid-template-columns: repeat(2, 1fr);
    }
}