/* Side Panel Styles */
.side-panel {
    position: fixed;
    top: 0;
    right: -380px;
    width: 380px;
    height: 100vh;
    background: #000;
    border-left: 1px solid #333;
    z-index: 1000;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    font-family: "SF Mono", "Monaco", "Inconsolata", "Roboto Mono", monospace;
    box-shadow: -4px 0 20px rgba(74, 67, 67, 0.3);
}

.side-panel.visible {
    right: 0;
}

.side-panel.detached {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100vh;
    transition: none;
    border-left: none;
}

.side-panel.detached.visible {
    right: 0;
}

.side-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #333;
    background: #111;
    min-height: 48px;
}

.panel-tabs {
    display: flex;
    gap: 2px;
    height: 100%;
    flex: 1;
}

.tab-btn {
    background: transparent;
    border: none;
    color: #888;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0.04em;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
    border-radius: 2px;
    font-family: "Analo Grotesk", "Inconsolata", sans-serif;
    flex: 1;
    justify-content: center;
}

.tab-btn:hover {
    background: #222;
    color: #fff;
}

.tab-btn.active {
    background: #333;
    color: #fff;
}

.tab-btn ion-icon {
    font-size: 14px;
}

.toggle-panel-btn {
    background: none;
    border: none;
    margin-right: 7px;
    color: #888;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease;
    padding: 0;
}

.toggle-panel-btn:hover {
    color: #fff;
}

.side-panel-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Canvas Controls Styles */
.canvas-controls {
    padding: 20px;
}

.control-section {
    margin-bottom: 30px;
}

.control-section h4 {
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 15px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid #333;
    padding-bottom: 8px;
}

.control-group {
    margin-bottom: 20px;
}

.control-group label {
    display: block;
    color: #ccc;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.color-picker {
    width: 100%;
    height: 32px;
    border: 1px solid #444;
    border-radius: 4px;
    background: #111;
    cursor: pointer;
}

.color-palette {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.palette-color {
    width: 32px;
    height: 32px;
    border: 1px solid #444;
    border-radius: 4px;
    cursor: pointer;
    background: #111;
}

.pitch-color-example {
    display: grid;
    grid-template-rows: repeat(7, auto);
    grid-auto-flow: column;
    gap: 6px;
    margin-top: 10px;
    margin-left: 10px;
    margin-right: 10px;
}

.pitch-color-item {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 28px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    overflow: hidden;
    user-select: none;
}

.pitch-color-item span {
    position: relative;
    z-index: 1;
    pointer-events: none;
    font-size: 10px;
    font-weight: 600;
    color: #000;
    text-shadow: 0 0 2px rgba(255, 255, 255, 0.8);
}

.pitch-color-item input[type='color'] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: none;
    opacity: 0;
    cursor: pointer;
}

.setting-info {
    margin-top: 6px;
}

.setting-info small {
    color: #888;
    font-size: 11px;
    font-style: italic;
    line-height: 1.3;
}

.tracks-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.track-tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #111;
    border: 1px solid #333;
    padding: 8px 12px;
    margin-bottom: 12px;
    border-radius: 4px;
}

.track-tile {
    background: #111;
    border: 1px solid #333;
    padding: 8px;
    transition: all 0.15s ease;
}

.track-tile:hover {
    border-color: #444;
}

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

.track-info {
    display: flex;
    align-items: center;
    gap: 6px;
}

.track-activity-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #333;
    transition: all 0.2s ease;
    margin-left: 4px;
}

.track-activity-indicator.active {
    background: #51cf66;
    box-shadow: 0 0 6px rgba(81, 207, 102, 0.6);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

.track-number {
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    font-family: "Inconsolata", monospace;
}

.track-controls {
    display: flex;
    gap: 4px;
}

.mute-btn,
.solo-btn {
    background: transparent;
    border: 1px solid #444;
    color: #888;
    width: 20px;
    height: 20px;
    cursor: pointer;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    border-radius: 2px;
}

.mute-btn:hover,
.solo-btn:hover {
    background: #222;
    border-color: #555;
    color: #fff;
}

.mute-btn.active {
    background: #ff6b6b;
    border-color: #ff6b6b;
    color: #fff;
}

.solo-btn.active {
    background: #51cf66;
    border-color: #51cf66;
    color: #fff;
}

.mute-btn ion-icon,
.solo-btn ion-icon {
    font-size: 10px;
}

.track-assignments {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.assignment-row {
    display: flex;
    gap: 8px;
}

.assignment-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
}

.assignment-group label {
    color: #888;
    font-size: 9px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.assignment-group label ion-icon {
    font-size: 9px;
    opacity: 0.8;
}

/* Luminode Configuration Styles */
.luminode-config {
    margin-top: 8px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
}

.config-header {
    display: flex;
    align-items: center;
    margin-bottom: 0;
    cursor: pointer;
    padding: 4px 0;
    border-radius: 0;
    transition: background-color 0.2s ease;
    height: 24px;
}

.config-header label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    color: rgba(255, 255, 255, 0.7);
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
}

.config-icon {
    width: 10px;
    height: 10px;
    opacity: 0.8;
}

.config-controls {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
    padding-bottom: 8px;
}

.config-control-row {
    display: flex;
    gap: 8px;
}

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

.config-control-spacer {
    flex: 1;
}

.config-control label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 9px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.config-slider {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.config-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: #51cf66;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.config-slider::-webkit-slider-thumb:hover {
    background: #69db7c;
    transform: scale(1.1);
}

.config-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: #51cf66;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.config-slider::-moz-range-thumb:hover {
    background: #69db7c;
    transform: scale(1.1);
}

.slider-value {
    color: #51cf66;
    font-size: 10px;
    font-weight: 600;
    min-width: 30px;
    text-align: right;
    font-family: "Inconsolata", monospace;
}

.config-number {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    color: white;
    font-size: 11px;
    padding: 6px 8px;
    font-family: "Inconsolata", monospace;
    outline: none;
    transition: all 0.2s ease;
}

.config-number:focus {
    border-color: #51cf66;
    background: rgba(255, 255, 255, 0.08);
}

.config-number:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

.luminode-icon {
    width: 10px;
    height: 10px;
    opacity: 0.8;
    color: currentColor;
}

.luminode-blade-with-edit {
    display: flex !important;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.luminode-blade-with-edit .tp-btnv {
    flex: 1;
    min-width: 0;
}

.midi-blade-with-dice {
    display: flex !important;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.midi-blade-with-dice .tp-lstv {
    flex: 1;
    min-width: 0;
}

.luminode-edit-icon {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.45);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease, opacity 0.15s ease;
}

.luminode-edit-icon:hover:not(:disabled) {
    color: #51cf66;
}

.luminode-edit-icon:disabled,
.luminode-edit-icon[hidden] {
    opacity: 0.25;
    cursor: default;
    pointer-events: none;
}

.luminode-edit-icon ion-icon {
    font-size: 16px;
    pointer-events: none;
}

.luminode-generator-icon {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.45);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease, opacity 0.15s ease;
}

.luminode-generator-icon:hover {
    color: #51cf66;
}

.luminode-generator-icon.is-active {
    color: #51cf66;
}

.luminode-generator-icon ion-icon {
    font-size: 16px;
    pointer-events: none;
}

.midi-device-select,
.luminode-select {
    background: #222;
    border: 1px solid #444;
    color: #fff;
    padding: 4px 6px;
    font-size: 10px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border-radius: 2px;
}

.midi-device-select:hover,
.luminode-select:hover {
    background: #333;
    border-color: #555;
}

.midi-device-select:focus,
.luminode-select:focus {
    outline: none;
    border-color: #51cf66;
    background: #333;
}

.midi-device-select option,
.luminode-select option {
    background: #111;
    color: #ffffff;
    padding: 6px;
}

/* Grid Controls */
.grid-controls {
    margin-top: 8px;
}

.grid-controls-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.grid-control-row {
    display: flex;
    gap: 8px;
}

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

.grid-control label {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
    font-weight: 500;
}

/* Noise Controls */
.noise-controls {
    margin-top: 8px;
}

.noise-controls-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.noise-control-row {
    display: flex;
    gap: 8px;
}

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

.noise-control label {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
    font-weight: 500;
}

/* Modulation Controls */
.modulation-controls {
    padding: 20px;
}

.modulation-controls .control-section + .control-section {
    margin-top: 20px;
    padding-top: 12px;
    border-top: 1px solid #222;
}

.modulation-controls #modulators-pane-container,
.modulation-controls #audio-tracks-pane-container {
    margin-top: 12px;
}

.glow-audio-player-row {
    display: flex;
    align-items: center;
    padding-left: 4px;
    padding-right: 4px;
}

.glow-audio-player-row .tp-lblv_l {
    flex: 0 0 auto;
    width: var(--tp-label-width, 84px);
    color: var(--lbl-fg, #aaa);
    font-size: 11px;
}

.glow-audio-player-row .tp-lblv_v {
    flex: 1;
    min-width: 0;
}

/* External Systems (MIDI generators + tablet) */
.external-systems-controls {
    padding: 20px;
}

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

.modulator-header h4 {
    color: #fff;
    font-size: 14px;
    font-weight: 400;
    margin: 0;
    text-transform: none;
    letter-spacing: 0.04em;
    font-family: "Analo Grotesk", "Inconsolata", sans-serif;
}

.add-modulator-btn {
    background: #333;
    border: 1px solid #555;
    color: #fff;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: all 0.15s ease;
    border-radius: 3px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: "Analo Grotesk", "Inconsolata", sans-serif;
}

.add-modulator-btn:hover:not(:disabled) {
    background: #444;
    border-color: #666;
}

.add-modulator-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.add-modulator-btn ion-icon {
    font-size: 12px;
}

.no-modulators {
    color: #888;
    font-size: 12px;
    text-align: center;
    padding: 20px;
    font-style: italic;
}

.modulators-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modulator-item {
    background: #111;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 12px;
    transition: border-color 0.15s ease;
}

.modulator-item:hover {
    border-color: #444;
}

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

.modulator-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.modulator-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #51cf66;
}

.toggle-label {
    color: #ccc;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.remove-modulator-btn {
    background: transparent;
    border: 1px solid #444;
    color: #888;
    width: 20px;
    height: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    border-radius: 2px;
    padding: 0;
}

.remove-modulator-btn:hover {
    background: #ff6b6b;
    border-color: #ff6b6b;
    color: #fff;
}

.remove-modulator-btn ion-icon {
    font-size: 12px;
}

.modulator-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modulator-row {
    display: flex;
    gap: 12px;
}

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

.modulator-control-group label {
    color: #ccc;
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modulator-control-group select {
    background: #222;
    border: 1px solid #444;
    color: #fff;
    padding: 6px 8px;
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
    border-radius: 3px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.modulator-control-group select:hover {
    background: #333;
    border-color: #555;
}

.modulator-control-group select:focus {
    outline: none;
    border-color: #51cf66;
    background: #333;
}

.waveform-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.waveform-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    color: #51cf66;
}

.waveform-svg {
    width: 100%;
    height: 100%;
}

.modulator-luminode-display {
    display: flex;
    align-items: center;
    min-height: 32px;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.luminode-name {
    color: #51cf66;
    font-size: 11px;
    font-weight: 500;
    font-family: "Inconsolata", monospace;
    text-transform: lowercase;
}

.axis-label {
    color: rgba(255, 255, 255, 0.6);
    font-size: 9px;
    font-weight: 600;
    margin-right: 4px;
    font-family: "Inconsolata", monospace;
}

.waveform-preview-row {
    margin-top: 4px;
    margin-bottom: 8px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding-left: 0;
}

.waveform-preview-container {
    padding: 4px 8px;
    background: var(--tp-container-background-color);
    border-radius: 3px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-right: 4px;
    width: 40px;
    height: 20px;
    flex-shrink: 0;
}

.waveform-preview-container .waveform-svg {
    color: var(--tp-input-foreground-color);
    width: 100%;
    height: 100%;
    display: block;
}

/* Analo Grotesk on track / folder titles (Tweakpane) */
.side-panel .tp-tabv_t,
.side-panel .tp-tbiv,
.side-panel .tp-fldv_t {
    font-family: "Analo Grotesk", "Inconsolata", sans-serif;
    font-weight: 400;
    letter-spacing: 0.04em;
    text-transform: none;
}
