:root {
    --bg-color: #1e1e2f;
    --panel-bg: #2a2a40;
    --text-color: #e0e0e0;
    --accent: #00ffcc;
    --bar-default: #4facfe;
    --bar-compare: #ffeb3b;
    --bar-swap: #ff4b4b;
    --bar-sorted: #00e676;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
}

header {
    background-color: var(--panel-bg);
    padding: 20px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.controls {
    display: flex;
    gap: 20px;
    align-items: center;
}

button, select {
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    background-color: #3f3f5a;
    color: white;
    cursor: pointer;
    font-size: 14px;
    transition: 0.2s;
}

button:hover, select:hover { background-color: #505070; }
button.primary { background-color: var(--accent); color: #000; font-weight: bold; }
button.primary:hover { background-color: #00ccaa; }

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.stats-panel {
    display: flex;
    gap: 30px;
    margin-bottom: 20px;
    font-size: 1.2rem;
    font-weight: bold;
    justify-content: center;
}

.stat-box span { color: var(--accent); }

#visualization-container {
    flex: 1;
    background-color: var(--panel-bg);
    border-radius: 10px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 20px;
    gap: 2px;
    overflow: hidden;
}

.array-bar {
    background-color: var(--bar-default);
    flex: 1; 
    margin: 0 1px; 
    border-radius: 3px 3px 0 0;
    transition: height 0.1s ease, background-color 0.1s ease;
    min-height: 1px; /* Ensures even tiny values are visible */
}


#workspaces-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    padding: 20px;
    flex: 1;
}

.algo-workspace {
    background: var(--panel-bg);
    border-radius: 8px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    height: 400px;
}

.bars-container {
    flex: 1;
    display: flex;
    align-items: flex-end;
    gap: 1px;
    margin-top: 15px;
}

.playback-controls {
    display: flex;
    gap: 10px;
    background: #1a1a2e;
    padding: 10px;
    border-radius: 8px;
}

.complexity {
    font-size: 0.85rem;
    color: #888;
    margin-top: 5px;
}
/* --- Dashboard Header Layout --- */
.dashboard-header {
    display: flex;
    gap: 30px;
    background-color: var(--panel-bg);
    padding: 20px 30px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
    align-items: stretch;
}

/* Left Column: Info */
.header-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
    border-right: 2px solid #3f3f5a;
    padding-right: 30px;
}

.header-info h1 {
    color: var(--accent);
    font-size: 1.6rem;
    margin-bottom: 5px;
}

.info-content p {
    font-size: 0.95rem;
    line-height: 1.5;
    color: #b0b0c0;
    margin-bottom: 10px;
}

.info-content strong {
    color: #ffffff;
}

/* Right Column: Controls */
.header-controls {
    flex: 2;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.header-controls h3 {
    color: var(--accent);
    font-size: 1.2rem;
}

.controls-grid {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.control-column {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

/* Form Elements Styling */
.control-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.control-group label {
    font-size: 0.85rem;
    color: #a0a0b0;
    font-weight: bold;
}

/* Make the multi-select box look cleaner */
select[multiple] {
    height: 140px;
    overflow-y: auto;
    padding: 5px;
}

select[multiple] option {
    padding: 8px;
    margin-bottom: 2px;
    border-radius: 4px;
}

select[multiple] option:checked {
    background-color: var(--accent);
    color: #000;
    font-weight: bold;
}

/* Playback Grid */
.playback-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    background: #1a1a2e;
    padding: 12px;
    border-radius: 8px;
}

.playback-controls #btn-play {
    grid-column: span 2; /* Make the play button span full width */
}
/* --- Generate Button Styling --- */
#generate-btn {
    background: linear-gradient(135deg, #00ffcc, #00b3aa);
    color: #000;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 12px 20px;
    border-radius: 6px;
    box-shadow: 0 4px 15px rgba(0, 255, 204, 0.3);
    transition: all 0.2s ease;
    margin-top: 10px;
}

#generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 255, 204, 0.5);
}

#generate-btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 10px rgba(0, 255, 204, 0.3);
}

/* --- Pseudocode Container --- */
.algo-workspace {
    height: auto; /* Allow height to expand for pseudocode */
    min-height: 500px;
}

.pseudocode-container {
    margin-top: 15px;
    padding: 15px;
    background-color: #1a1a2e;
    border-radius: 6px;
    border-left: 4px solid var(--accent);
    font-size: 0.9rem;
    color: #e0e0e0;
    overflow-x: auto;
}
.array-bar {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    font-size: 11px;
    font-weight: bold;
    color: #000;
}

.bar-value {
    margin-bottom: 4px;
    pointer-events: none;
}

.bar-index {
    position: absolute;
    bottom: -22px;
    color: #a0a0b0;
    font-size: 12px;
}

/* MathJax Highlighting Classes */
.pseudo-compare.active { background-color: var(--bar-compare); color: #000; border-radius: 3px; padding: 0 4px; }
.pseudo-swap.active { background-color: var(--bar-swap); color: #000; border-radius: 3px; padding: 0 4px; }
.pseudo-write.active { background-color: var(--bar-swap); color: #000; border-radius: 3px; padding: 0 4px; }
