/* Neon Colors for Data */
.color-green { color: #4ade80; text-shadow: 0 0 5px rgba(74, 222, 128, 0.3); }
.color-cyan { color: #22d3ee; text-shadow: 0 0 5px rgba(34, 211, 238, 0.3); }
.color-purple { color: #c084fc; text-shadow: 0 0 5px rgba(192, 132, 252, 0.3); }

:root {
    --bg-base: #0a0a0a;
    --bg-panel: #171717;
    --bg-card: #262626;
    --bg-card-hover: #333333;
    --text-main: #f5f5f5;
    --text-muted: #a3a3a3;
    --title_accent: #c084fc;
    --accent: #ec4899;
    --accent-hover: #f472b6;
    --border: #404040;
    --radius-md: 8px;
    --radius-lg: 12px;
}


body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-base);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    display: flex;
    height: 100vh;
    box-sizing: border-box;
    overflow: hidden;
}

/* Layout */
#app-container {
    display: flex;
    width: 100%;
    height: 100%;
    padding: 16px;
    gap: 16px;
}

#sidebar {
    width: 200px;
    min-width: 200px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--bg-panel);
    padding: 20px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    height: calc(100% - 40px);
}

/* Sidebar Header & Dropdown */
.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#note-filter {
    background: var(--bg-base);
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 4px 8px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}

#note-filter:focus {
    border-color: var(--accent);
}

/* Style the dropdown options for darker OS themes */
#note-filter option {
    background: var(--bg-panel);
    color: var(--text-main);
}

#main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: calc(100% - 32px);
    overflow-y: auto;
    padding-right: 8px; /* For scrollbar */
}

/* Typography & Inputs */
h2 { margin: 0; font-size: 1.25rem; font-weight: 600; }
h3 { margin: 0 0 4px 0; font-size: 1rem; font-weight: 600; }
p { margin: 0; line-height: 1.5; color: var(--text-muted); }

input[type="text"] {
    width: 100%;
    padding: 12px;
    background: var(--bg-base);
    border: 1px solid var(--border);
    color: var(--text-main);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    box-sizing: border-box;
    transition: border-color 0.2s;
}
input[type="text"]:focus {
    outline: none;
    border-color: var(--accent);
}

/* Scale List */
#scale-list {
    overflow-y: auto;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 4px;
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.scale-card {
    background: var(--bg-card);
    padding: 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}
.scale-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border);
    transform: translateY(-1px);
}
.scale-card.active {
    border-color: var(--accent);
    background: rgba(236, 72, 153, 0.1);
}
.scale-card p { font-size: 0.85rem; margin-bottom: 8px; }

.badge {
    display: inline-flex;
    align-items: center;
    background: var(--bg-base);
    border: 1px solid var(--border);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    color: var(--accent-hover);
    font-weight: 500;
}

/* Header Info Area */
.panel {
    background: var(--bg-panel);
    padding: 10px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}
.header-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}
/* Header Panel Layout */
.header-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-text {
    text-align: left;
}

.header-links {
    display: flex;
    gap: 12px;
    align-items: center;
    font-size: 1.1rem;
}

.header-links a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.header-links a:hover {
    color: var(--accent-hover);
}

.header-links .separator {
    color: var(--border);
}

/* Modal Overlay Styles */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    backdrop-filter: blur(4px);
    transition: opacity 0.3s, visibility 0.3s;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    padding: 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    transform: translateY(-20px);
    transition: transform 0.3s;
}

.modal-overlay.show .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s;
}

.close-btn:hover {
    color: var(--accent);
}

.modal-body p, .modal-body li {
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 8px;
}

.modal-body a {
    color: #22d3ee; /* Cyan color matching your data viz */
    text-decoration: none;
}


#active-title { color: var(--accent); font-size: 1.5rem; }
#page-title { color: var(--title_accent); font-size: 2.5rem; text-align: center;}
#sub-title { color: var(--title_accent); text-align: center;}
#page-desc { color: var(--text-muted); text-align: center;}

/* Strudel Player */
.player-container {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

strudel-repl {
    height: 300px; /* Fixed height for the REPL */
    width: 100px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    overflow: hidden;
    background: var(--bg-base);
}

/* Player Layout */
.player-content {
    display: flex;
    gap: 16px;
    align-items: stretch;
}

#player-wrapper {
    flex-shrink: 0;
}

/* Interval Matrix */
.interval-matrix-container {
    flex-grow: 1;
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow-y: auto;
    height: 300px; /* Match Strudel REPL height */
}

#interval-matrix {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.85rem;
}

#interval-matrix th, 
#interval-matrix td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}

#interval-matrix th {
    background: var(--bg-card);
    position: sticky; /* Keeps header at top while scrolling */
    top: 0;
    color: var(--title_accent);
    font-weight: 600;
    z-index: 1;
}

#interval-matrix tr:hover {
    background: var(--bg-card-hover);
}

/* Visualizer */
.visualizer-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 320px;
}
.vis-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Spectral Analysis Panel */
/* Canvas & Spectral Layout */
.canvas-layout {
    display: flex;
    gap: 16px;
    flex-grow: 1;
    align-items: stretch;
    min-height: 280px;
}

#spectral-panel {
    display: flex;
    flex-direction: column; /* Stack vertically instead of horizontally */
    justify-content: flex-start;
    align-items: flex-start;
    width: 220px;
    flex-shrink: 0;
    align-self: stretch;
    background: #0f111a;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    gap: 24px;
    opacity: 0.3; 
    transition: opacity 0.3s;
    box-sizing: border-box;
    min-height: max-content;
}

#spectral-panel.active {
    opacity: 1;
}

.spectral-left h3 {
    font-family: 'Orbitron', sans-serif;
    letter-spacing: 1px;
    margin-bottom: 8px;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
}

.spectral-left p {
    font-size: 0.8rem;
    font-family: monospace;
    line-height: 1.4;
}

.spectral-right {
    display: flex;
    flex-direction: column; /* Stack data rows cleanly */
    gap: 12px;
    font-family: monospace;
    font-size: 0.95rem;
    color: var(--text-muted);
    width: 100%;
}

.spectral-right span {
    font-weight: bold;
}

canvas {
    flex-grow: 1;
    min-width: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-base);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    display: block;
}

/* Custom Checkbox */
.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    user-select: none;
}
.toggle-label input[type="checkbox"] {
    accent-color: var(--accent);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Responsive Design for Mobile */
@media (max-width: 800px) {
    #app-container { flex-direction: column; overflow-y: auto; display: block; }
    #sidebar { width: 100%; height: 400px; min-width: auto; margin-bottom: 16px; }
    #main-content { overflow-y: visible; height: auto; }
    #spectral-panel { width: 100%; flex-direction: row; box-sizing: border-box; }
    body { height: auto; overflow: auto; }
    .visualizer-container { height: 300px; }
    .player-content { flex-direction: column; }
    .canvas-layout { flex-direction: column; }
    .header-panel { flex-direction: column; gap: 16px; align-items: flex-start; }
}
