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

:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #151b2b;
    --bg-tertiary: #1a2235;
    --text-primary: #e4e9f2;
    --text-secondary: #a8b3cf;
    --accent-primary: #4a9eff;
    --accent-secondary: #6b73ff;
    --success: #00d4aa;
    --warning: #ffb84d;
    --danger: #ff6b6b;
    --flowing: #00d4aa;
    --queuing: #ffb84d;
    --blocked: #ff6b6b;
    --bottleneck: #ff4757;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

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

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 30px 20px;
    background: var(--bg-secondary);
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

main {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* Pipeline Section */
.pipeline-section {
    background: var(--bg-secondary);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.canvas-container {
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--bg-tertiary);
    border-radius: 10px;
    padding: 20px;
    border: 2px solid rgba(74, 158, 255, 0.2);
}

#pipelineCanvas {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

/* Dashboard Section */
.dashboard-section {
    background: var(--bg-secondary);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

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

.dashboard-card {
    background: var(--bg-tertiary);
    border-radius: 10px;
    padding: 20px;
    border: 1px solid rgba(74, 158, 255, 0.1);
}

.dashboard-card h3 {
    margin-bottom: 15px;
    color: var(--accent-primary);
    font-size: 1.1rem;
}

.throughput-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--success);
    margin-bottom: 10px;
}

#throughputGraph {
    width: 100%;
    height: 150px;
    background: var(--bg-primary);
    border-radius: 8px;
}

.bottleneck-indicator {
    text-align: center;
    padding: 20px;
    background: rgba(255, 71, 87, 0.1);
    border-radius: 10px;
    border: 2px solid var(--bottleneck);
    margin-bottom: 15px;
}

.bottleneck-station {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--bottleneck);
    margin-bottom: 10px;
}

.bottleneck-capacity,
.bottleneck-queue {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin: 5px 0;
}

.system-throughput {
    text-align: center;
    font-size: 1.3rem;
    color: var(--accent-primary);
    font-weight: bold;
}

.wip-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.wip-item {
    background: var(--bg-primary);
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 0.9rem;
    border-left: 3px solid var(--accent-primary);
}

.total-wip {
    text-align: center;
    font-size: 1.2rem;
    color: var(--warning);
    font-weight: bold;
}

/* Controls Section */
.controls-section {
    background: var(--bg-secondary);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.control-group {
    background: var(--bg-tertiary);
    border-radius: 10px;
    padding: 20px;
    border: 1px solid rgba(74, 158, 255, 0.1);
}

.control-group h3 {
    margin-bottom: 15px;
    color: var(--accent-primary);
    font-size: 1.1rem;
}

.capacity-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.capacity-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.capacity-control label {
    min-width: 80px;
    font-size: 0.9rem;
}

.capacity-control input[type="range"] {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-primary);
    outline: none;
    -webkit-appearance: none;
}

.capacity-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
}

.capacity-control input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
    border: none;
}

.capacity-value {
    min-width: 40px;
    text-align: right;
    font-weight: bold;
    color: var(--accent-primary);
}

.system-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.control-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-item label {
    min-width: 120px;
    font-size: 0.9rem;
}

.slider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-primary);
    outline: none;
    -webkit-appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
}

.slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
    border: none;
}

.control-item span {
    min-width: 50px;
    text-align: right;
    font-weight: bold;
    color: var(--accent-primary);
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(74, 158, 255, 0.4);
}

.btn-secondary {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--accent-primary);
}

.btn-secondary:hover {
    background: rgba(74, 158, 255, 0.1);
}

.focusing-steps {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 2px solid transparent;
    text-align: left;
}

.btn-step:hover {
    border-color: var(--accent-primary);
    background: rgba(74, 158, 255, 0.1);
}

.btn-step.active {
    border-color: var(--success);
    background: rgba(0, 212, 170, 0.1);
}

.step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--accent-primary);
    color: white;
    border-radius: 50%;
    font-weight: bold;
    font-size: 0.9rem;
}

.step-description {
    margin-top: 15px;
    padding: 15px;
    background: var(--bg-primary);
    border-radius: 8px;
    border-left: 4px solid var(--accent-primary);
    font-size: 0.9rem;
    line-height: 1.5;
    min-height: 80px;
}

.preset-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.btn-preset {
    padding: 12px 15px;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 2px solid transparent;
}

.btn-preset:hover {
    border-color: var(--accent-primary);
    background: rgba(74, 158, 255, 0.1);
}

/* Legend Section */
.legend-section {
    background: var(--bg-secondary);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
}

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

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

.legend-flowing {
    background: var(--flowing);
}

.legend-queuing {
    background: var(--queuing);
}

.legend-blocked {
    background: var(--blocked);
}

.legend-bottleneck {
    background: var(--bottleneck);
}

/* Footer */
footer {
    text-align: center;
    margin-top: 30px;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .dashboard-grid,
    .controls-grid {
        grid-template-columns: 1fr;
    }

    .preset-buttons {
        grid-template-columns: 1fr;
    }

    .control-item {
        flex-wrap: wrap;
    }

    .control-item label {
        min-width: 100%;
        margin-bottom: 5px;
    }
}

/* Animations */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.pulsing {
    animation: pulse 1s ease-in-out infinite;
}
