/* Chapter 8 Specific Styles */
.integration-header {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #ec4899 100%);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    margin: 2rem 0;
    position: relative;
    overflow: hidden;
    color: white;
}

.integration-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: repeating-linear-gradient(
        45deg,
        rgba(255,255,255,0.1) 0px,
        rgba(255,255,255,0.1) 2px,
        transparent 2px,
        transparent 15px
    );
    animation: integrationShine 4s linear infinite;
}

@keyframes integrationShine {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.integration-header h2 {
    font-size: 2.5em;
    margin-bottom: 10px;
    position: relative;
    z-index: 1;
    color: white !important;
}

.integration-header p {
    font-size: 1.2em;
    position: relative;
    z-index: 1;
    opacity: 0.9;
    color: white !important;
}

.puzzle-icon {
    font-size: 2em;
    margin-bottom: 15px;
    animation: puzzleFloat 3s ease-in-out infinite;
}

@keyframes puzzleFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(5deg); }
}

.decision-tree-demo {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 2px solid #0ea5e9;
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem 0;
    position: relative;
}

.decision-tree-demo::before {
    content: "Algorithm Selection Decision Tree";
    position: absolute;
    top: -12px;
    left: 20px;
    background: #0ea5e9;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
}

.decision-tree {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 2rem 0;
}

.decision-node {
    background: white;
    border: 2px solid #0ea5e9;
    border-radius: 12px;
    padding: 1rem;
    margin: 0.5rem;
    text-align: center;
    min-width: 200px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.decision-node:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(14, 165, 233, 0.3);
}

.decision-node.active {
    background: #0ea5e9;
    color: white;
}

.decision-branches {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    margin: 1rem 0;
}

.algorithm-recommendation {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

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

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

.algorithm-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border: 2px solid #e2e8f0;
    transition: all 0.3s ease;
    position: relative;
}

.algorithm-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.algorithm-card.best-choice {
    border-color: #10b981;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(5, 150, 105, 0.1));
}

.algorithm-card.best-choice::before {
    content: "⭐";
    position: absolute;
    top: -10px;
    right: 15px;
    background: #10b981;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.algorithm-card h4 {
    color: #2c3e50 !important;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.performance-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin: 15px 0;
}

.perf-metric {
    text-align: center;
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.perf-value {
    font-size: 1.1rem;
    font-weight: bold;
    color: #4f46e5;
}

.perf-value.excellent {
    color: #10b981;
}

.perf-value.good {
    color: #0ea5e9;
}

.perf-value.fair {
    color: #f59e0b;
}

.perf-value.poor {
    color: #ef4444;
}

.perf-label {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 5px;
}

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

.case-studies {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.case-study {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: all 0.3s ease;
}

.case-study:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.case-study.selected {
    border: 2px solid #a855f7;
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.1), rgba(147, 51, 234, 0.1));
}

.case-study h5 {
    color: #2c3e50 !important;
    margin-bottom: 1rem;
}

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

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

.implementation-step {
    background: white;
    border-radius: 8px;
    padding: 1.25rem;
    border-left: 4px solid #4f46e5;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: relative;
}

.step-number {
    position: absolute;
    top: -10px;
    left: -10px;
    background: #4f46e5;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
}

.final-checklist {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 2px solid #10b981;
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem 0;
}

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

.checklist-item {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    border: 1px solid #10b981;
    cursor: pointer;
    transition: all 0.3s ease;
}

.checklist-item:hover {
    background: #f0fdf4;
}

.checklist-item.checked {
    background: #10b981;
    color: white;
}

.checklist-item.checked::before {
    content: "✓ ";
    font-weight: bold;
}

@media (max-width: 768px) {
    .comparison-matrix {
        grid-template-columns: 1fr;
    }
    
    .performance-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .decision-branches {
        flex-direction: column;
        gap: 1rem;
    }
    
    .implementation-steps {
        grid-template-columns: 1fr;
    }
    
    .integration-header h2 {
        font-size: 2rem;
    }
}