:root {
    --primary-color: #4a90e2;
    --secondary-color: #2c3e50;
    --accent-color: #e74c3c;
    --background-color: #f5f7fa;
    --panel-bg: #ffffff;
    --border-color: #ddd;
    --highlight-color: #f1c40f;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background-color);
    color: var(--secondary-color);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 20px;
}

header h1 {
    color: var(--primary-color);
}

main {
    display: flex;
    gap: 20px;
    flex: 1;
    min-height: 0; /* Important for scrolling */
}

.info-section {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

.info-card {
    flex: 1;
    background: #0b1220;
    border: 1px solid #334155;
    border-radius: 12px;
    color: #e2e8f0;
    padding: 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.25);
}

.info-card h3 {
    color: #0ea5e9;
    margin-bottom: 10px;
}

.info-card ol {
    padding-left: 18px;
    line-height: 1.7;
}

.control-panel {
    flex: 0 0 350px;
    background: #0f172a;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.25);
    overflow-y: auto;
    color: #e2e8f0;
}

.visualization-panel {
    flex: 1;
    background: var(--panel-bg);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: relative;
    display: flex;
    flex-direction: column;
}

#cy {
    width: 100%;
    height: 100%;
    flex: 1;
}

section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

h2 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: var(--primary-color);
}

h3 {
    font-size: 1rem;
    margin-bottom: 10px;
}

.input-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #cbd5e1;
}

input[type="text"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #334155;
    border-radius: 4px;
    background: #0b1220;
    color: #e2e8f0;
}

button {
    cursor: pointer;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    background-color: #1e293b;
    color: #e2e8f0;
    font-weight: 500;
    transition: background 0.3s;
}

button:hover {
    background-color: #0ea5e9;
}

button:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

.primary-btn {
    background-color: var(--primary-color);
    width: 100%;
    margin-top: 10px;
}

.primary-btn:hover {
    background-color: #357abd;
}

.controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
}

.controls button {
    flex: 1;
}

#speed-select {
    background: #0b1220;
    border: 1px solid #334155;
    color: #e2e8f0;
    padding: 6px 8px;
    border-radius: 4px;
}

.speed-select {
    display: flex;
    align-items: center;
    gap: 8px;
}

#simulation-status {
    background: #0b1220;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #334155;
    color: #e2e8f0;
}

#result-message {
    margin-top: 10px;
    font-weight: bold;
    text-align: center;
    min-height: 1.5em;
}

.accepted {
    color: #10b981;
}

.rejected {
    color: #ef4444;
}

.transition-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

.transition-row label {
    margin: 0;
    min-width: 60px;
}

.transition-row input {
    flex: 1;
}

.legend {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.9);
    padding: 10px;
    border-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    display: flex;
    gap: 15px;
}

.fit-btn {
    position: absolute;
    bottom: 20px;
    left: 20px;
    z-index: 10;
}

.progress-block {
    margin-top: 8px;
}

#input-progress {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.symbol-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    background: #111827;
    border: 1px solid #334155;
    color: #e2e8f0;
    border-radius: 6px;
    min-width: 24px;
    transition: transform var(--animation-duration, 0.6s), box-shadow var(--animation-duration, 0.6s), background var(--animation-duration, 0.6s);
}

.symbol-pill.consumed {
    transform: scale(1.05);
    background: #0ea5e9;
    box-shadow: 0 0 12px rgba(14,165,233,0.6);
}

#path-container {
    margin-top: 16px;
}

#path-taken {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 6px;
}

.state-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: #111827;
    border: 1px solid #334155;
    border-radius: 999px;
    color: #e2e8f0;
    transition: box-shadow var(--animation-duration, 0.6s), transform var(--animation-duration, 0.6s), background var(--animation-duration, 0.6s);
}

.state-pill.current {
    background: #0ea5e9;
    box-shadow: 0 0 12px rgba(14,165,233,0.6);
    transform: scale(1.05);
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.dot.start {
    background-color: #9eea00; /* Light green usually for start */
    border: 2px solid #666;
}

.dot.current {
    background-color: var(--highlight-color);
}

.dot.accept {
    border: 3px double #e74c3c;
    background-color: transparent;
}
