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

:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-tertiary: #0f3460;
    --text-primary: #eaeaea;
    --text-secondary: #a0a0a0;
    --accent-primary: #e94560;
    --accent-secondary: #0f4c75;
    --agent-color: #00d9ff;
    --obstacle-color: #ff6b6b;
    --velocity-color: #ffd93d;
    --border-color: #3a3a5c;
    --success-color: #4ade80;
    --error-color: #f87171;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

#app-container {
    display: flex;
    width: 100%;
    height: 100%;
}

#simulation-canvas {
    flex: 1;
    background-color: var(--bg-secondary);
    display: block;
}

#control-panel {
    width: 280px;
    min-width: 280px;
    background-color: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
}

#connection-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background-color: var(--bg-tertiary);
    border-radius: 8px;
}

#status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

#status-indicator.connected {
    background-color: var(--success-color);
    box-shadow: 0 0 8px var(--success-color);
}

#status-indicator.disconnected {
    background-color: var(--error-color);
    box-shadow: 0 0 8px var(--error-color);
}

#status-indicator.connecting {
    background-color: var(--velocity-color);
    box-shadow: 0 0 8px var(--velocity-color);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

#status-text {
    font-size: 14px;
    font-weight: 500;
}

#controls {
    display: flex;
    gap: 10px;
}

.control-btn {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#btn-start {
    background-color: var(--success-color);
    color: var(--bg-primary);
}

#btn-start:hover {
    background-color: #22c55e;
    transform: translateY(-1px);
}

#btn-stop {
    background-color: var(--accent-primary);
    color: var(--text-primary);
}

#btn-stop:hover {
    background-color: #dc2626;
    transform: translateY(-1px);
}

#btn-reset {
    background-color: var(--accent-secondary);
    color: var(--text-primary);
}

#btn-reset:hover {
    background-color: #1e40af;
    transform: translateY(-1px);
}

.control-btn:active {
    transform: translateY(0);
}

.control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

#info-panel {
    background-color: var(--bg-tertiary);
    border-radius: 8px;
    padding: 16px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    color: var(--text-secondary);
    font-size: 14px;
}

.info-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--agent-color);
}

#legend {
    background-color: var(--bg-tertiary);
    border-radius: 8px;
    padding: 16px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
}

.legend-color.agent {
    background-color: var(--agent-color);
    box-shadow: 0 0 6px var(--agent-color);
}

.legend-color.obstacle {
    background-color: var(--obstacle-color);
    box-shadow: 0 0 6px var(--obstacle-color);
}

.legend-color.velocity {
    background-color: var(--velocity-color);
    box-shadow: 0 0 6px var(--velocity-color);
}

.legend-label {
    font-size: 14px;
    color: var(--text-secondary);
}

@media (max-width: 768px) {
    #app-container {
        flex-direction: column;
    }

    #control-panel {
        width: 100%;
        min-width: unset;
        height: auto;
        border-left: none;
        border-top: 1px solid var(--border-color);
        flex-direction: row;
        flex-wrap: wrap;
        padding: 12px;
        gap: 12px;
    }

    #connection-status {
        flex: 1;
        min-width: 150px;
    }

    #controls {
        flex: 1;
        min-width: 200px;
    }

    #info-panel {
        flex: 1;
        min-width: 150px;
    }

    #legend {
        flex: 1;
        min-width: 150px;
    }
}
