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

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

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

h1 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 2.5rem;
    font-weight: 700;
}

.subtitle {
    color: #7f8c8d;
    font-size: 1.2rem;
    font-weight: 300;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn-primary { background: #3498db; color: white; }
.btn-success { background: #27ae60; color: white; }
.btn-warning { background: #f39c12; color: white; }
.btn-info { background: #17a2b8; color: white; }
.btn-danger { background: #e74c3c; color: white; }
.btn-secondary { background: #6c757d; color: white; }

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.color-box {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 2px solid #ddd;
}

.color-box.webhook { background: #3498db; }
.color-box.decision { background: #f39c12; }
.color-box.processing { background: #9b59b6; }
.color-box.ai { background: #e74c3c; }
.color-box.output { background: #27ae60; }
.color-box.note { background: #95a5a6; }

#flowchart-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    margin-bottom: 30px;
    overflow-x: auto;
}

#flowchart {
    width: 100%;
    height: 800px;
    border-radius: 8px;
}

.description {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.description h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 2rem;
    border-bottom: 3px solid #3498db;
    padding-bottom: 10px;
}

.description h3 {
    color: #34495e;
    margin: 25px 0 15px 0;
    font-size: 1.4rem;
}

.description h4 {
    color: #2c3e50;
    margin: 15px 0 10px 0;
    font-size: 1.2rem;
}

.section {
    margin-bottom: 30px;
}

.section ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

.section li {
    margin-bottom: 8px;
}

.treatment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.treatment-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 20px;
    border-radius: 12px;
    border-left: 5px solid;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.short-audio {
    border-left-color: #17a2b8;
}

.long-audio {
    border-left-color: #e74c3c;
}

.treatment-card h4 {
    margin-bottom: 10px;
}

.treatment-card ul {
    margin-left: 0;
    list-style: none;
}

.treatment-card li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 8px;
}

.treatment-card li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: #3498db;
    font-weight: bold;
}

.tech-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.tech-item {
    background: linear-gradient(135deg, #ecf0f1 0%, #bdc3c7 100%);
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #3498db;
    font-weight: 500;
}

.node-label {
    font-size: 12px;
    font-weight: 600;
    text-anchor: middle;
    fill: #2c3e50;
}

.node-description {
    font-size: 10px;
    text-anchor: middle;
    fill: #7f8c8d;
}

.highlighted {
    stroke: #f39c12 !important;
    stroke-width: 3px !important;
}

.dimmed {
    opacity: 0.3;
}

.active-path {
    stroke: #27ae60 !important;
    stroke-width: 3px !important;
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .controls {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .legend {
        flex-direction: column;
        align-items: center;
    }
    
    .treatment-grid,
    .tech-grid {
        grid-template-columns: 1fr;
    }
    
    #flowchart {
        height: 1000px;
    }
}

@media (max-width: 480px) {
    .description {
        padding: 20px 15px;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
}

/* Dagre-D3 specific styles */
.node rect {
    stroke: #333;
    stroke-width: 2px;
    cursor: pointer;
}

.node.webhook rect {
    fill: #3498db;
}

.node.decision rect {
    fill: #f39c12;
}

.node.processing rect {
    fill: #9b59b6;
}

.node.ai rect {
    fill: #e74c3c;
}

.node.output rect {
    fill: #27ae60;
}

.node.note rect {
    fill: #95a5a6;
}

.edgePath path {
    stroke: #333;
    stroke-width: 2px;
    fill: none;
}

.node.active rect {
    stroke: #f39c12;
    stroke-width: 3px;
}