/* styles.css */
:root {
    --bg-primary: #0a0c10;
    --bg-surface: #12161f;
    --bg-surface-raised: #181e2b;
    --bg-surface-hover: #222a3c;
    --border-color: #262f3f;
    --text-main: #e2e8f0;
    --text-muted: #64748b;
    --accent: #00f2fe;
    --accent-active: #4facfe;
    --status-active: #00e676;
    --status-idle: #ff9100;
    --status-error: #ff5252;

    --color-delta: #8b5cf6;
    --color-theta: #3b82f6;
    --color-alpha: #06b6d4;
    --color-beta: #10b981;
    --color-gamma: #f59e0b;
    --color-omega: #ef4444;

    --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-main);
    font-family: var(--font-sans);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.app-container {
    width: 100%;
    max-width: 1080px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
    overflow: hidden;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--bg-surface-raised);
    border-bottom: 1px solid var(--border-color);
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-symbol {
    font-size: 2.2rem;
    color: var(--accent);
    line-height: 1;
}

.brand h1 {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.badge {
    font-size: 0.65rem;
    padding: 2px 6px;
    background: rgba(0, 242, 254, 0.1);
    color: var(--accent);
    border-radius: 4px;
    border: 1px solid rgba(0, 242, 254, 0.3);
    font-family: var(--font-mono);
}

.badge-sub {
    background: rgba(100, 116, 139, 0.1);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.system-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--status-idle);
    box-shadow: 0 0 8px var(--status-idle);
}

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

.main-panel {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.card {
    background: var(--bg-surface-raised);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 18px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.card h2 {
    font-size: 0.95rem;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: -6px;
    margin-bottom: 14px;
}

.band-selector-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.select-styled {
    background: var(--bg-surface);
    color: var(--accent);
    border: 1px solid var(--border-color);
    padding: 6px 10px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    cursor: pointer;
}

.select-styled:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.btn {
    padding: 10px 16px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: var(--font-mono);
    border-radius: 6px;
    cursor: pointer;
    border: none;
    transition: all 0.15s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-active));
    color: #000;
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 0 15px rgba(0, 242, 254, 0.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background: #232b3b;
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-accent {
    background: #1e3a8a;
    color: #93c5fd;
    border: 1px solid #3b82f6;
}

.btn-warning {
    background: #451a1a;
    color: #fca5a5;
    border: 1px solid #ef4444;
}

.btn-toggle.active {
    background: #065f46;
    color: #6ee7b7;
    border: 1px solid #10b981;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.controls-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.adsr-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.control-group label {
    font-size: 0.8rem;
    color: var(--text-main);
    display: flex;
    justify-content: space-between;
}

.param-val {
    font-family: var(--font-mono);
    color: var(--accent);
}

input[type="range"] {
    width: 100%;
    accent-color: var(--accent);
    cursor: pointer;
}

.spectral-regions-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.region-tag {
    font-size: 0.65rem;
    font-family: var(--font-mono);
    padding: 3px 6px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.tag-delta { color: var(--color-delta); border-color: rgba(139, 92, 246, 0.4); }
.tag-theta { color: var(--color-theta); border-color: rgba(59, 130, 246, 0.4); }
.tag-alpha { color: var(--color-alpha); border-color: rgba(6, 182, 212, 0.4); }
.tag-beta  { color: var(--color-beta);  border-color: rgba(16, 185, 129, 0.4); }
.tag-gamma { color: var(--color-gamma); border-color: rgba(245, 158, 11, 0.4); }
.tag-omega { color: var(--color-omega); border-color: rgba(239, 68, 68, 0.4); }

.band-matrix-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 6px;
}

.band-pad {
    height: 60px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 4px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: background 0.1s, border-color 0.1s;
}

.band-pad:hover:not(.disabled) {
    background: var(--bg-surface-hover);
    border-color: #3b82f6;
}

.band-pad.active {
    background: #1e293b;
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.3);
}

.band-pad.disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

.band-pad-num {
    font-size: 0.6rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
}

.band-pad-freq {
    font-size: 0.65rem;
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--text-main);
    text-align: right;
}

.band-meter-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 0%;
    background: var(--accent);
    opacity: 0.5;
    pointer-events: none;
    transition: height 0.05s ease-out;
}

.band-pad.region-delta .band-meter-bar { background: var(--color-delta); }
.band-pad.region-theta .band-meter-bar { background: var(--color-theta); }
.band-pad.region-alpha .band-meter-bar { background: var(--color-alpha); }
.band-pad.region-beta  .band-meter-bar { background: var(--color-beta);  }
.band-pad.region-gamma .band-meter-bar { background: var(--color-gamma); }
.band-pad.region-omega .band-meter-bar { background: var(--color-omega); }

.telemetry-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 14px;
}

.metric-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.metric-label {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.metric-value {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
}

.console-wrapper {
    background: #07090c;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
}

.console-header {
    background: #0f131a;
    padding: 6px 12px;
    font-size: 0.7rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

.console-output {
    height: 110px;
    overflow-y: auto;
    padding: 8px 12px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    line-height: 1.5;
}

.log-entry {
    margin-bottom: 3px;
}

.log-info { color: #38bdf8; }
.log-success { color: var(--status-active); }
.log-warning { color: var(--status-idle); }
.log-error { color: var(--status-error); }

@media (max-width: 800px) {
    .band-matrix-grid {
        grid-template-columns: repeat(6, 1fr);
    }
    .adsr-grid, .telemetry-grid, .controls-grid {
        grid-template-columns: 1fr 1fr;
    }
}