/* ═══════════════════════════════════════════════════════
   mixer.css  —  Channel-strip mixer UI
   ═══════════════════════════════════════════════════════ */

/* ── Wrapper ────────────────────────────────────────── */

.mixer-subcontainer {
    display: flex;
    justify-content: center;
    width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 12px 8px;
}

#mixer {
    display: inline-flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 2px;
    background: #f0f4f9;
    border-radius: 10px;
    padding: 12px 8px 8px;
    border: 1px solid #d0daea;
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.12);
}

/* ── Channel strip ──────────────────────────────────── */

.mix-ch {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 76px;
    padding: 8px 6px 6px;
    gap: 8px;
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid #e2e8f2;
    transition: border-color 0.15s;
}

.mix-ch + .mix-ch {
    border-left: 1px solid #e2e8f2;
}

/* ── Header (color swatch + name) ───────────────────── */

.mix-ch__header {
    display: flex;
    align-items: center;
    gap: 5px;
    width: 100%;
    min-width: 0;
}

.mix-ch__color-wrap {
    flex: 0 0 auto;
}

.mix-ch__color-swatch {
    width: 13px;
    height: 13px;
    padding: 0;
    border: 1.5px solid rgba(0,0,0,0.15);
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
    outline: none;
    transition: transform 0.1s, border-color 0.15s;
}

.mix-ch__color-swatch:hover {
    transform: scale(1.25);
    border-color: rgba(0,0,0,0.35);
}

.mix-ch__name {
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 10px;
    font-weight: 600;
    color: #4a5675;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

/* ── Fader + VU meter (Ableton-style: VU strip beside fader) ── */

.mix-ch__fader-meter {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    gap: 4px;
    flex-wrap: wrap;
}

/* VU strip — grows from bottom inside overflow:hidden */
.mix-ch__vu-col {
    position: relative;
    width: 8px;
    height: 100px;
    background: #dde3ef;
    border-radius: 3px;
    overflow: hidden;
    flex-shrink: 0;
}

/* Level fill — anchored to bottom, height set by JS */
.mix-ch__vu-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 0%;
    background: linear-gradient(
        to top,
        #22c55e  0%   55%,
        #84cc16  55%  65%,
        #eab308  65%  80%,
        #f97316  80%  92%,
        #ef4444  92% 100%
    );
    border-radius: 2px;
}

/* Peak hold line */
.mix-ch__vu-peak {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: #e8eaf0;
    border-radius: 1px;
    opacity: 0;
    bottom: 0%;
    pointer-events: none;
    transition: opacity 0.12s;
}

/* Fader column */
.mix-ch__fader-col {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100px;
    flex-shrink: 0;
}

.mix-ch__fader {
    writing-mode: vertical-lr;
    direction: rtl;
    -webkit-appearance: none;
    appearance: none;
    width: 6px;
    height: 100px;
    background: #d8e0ec;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
    border: none;
}

.mix-ch__fader::-webkit-slider-runnable-track {
    background: #d8e0ec;
    border-radius: 3px;
    width: 6px;
}

.mix-ch__fader::-moz-range-track {
    background: #d8e0ec;
    border-radius: 3px;
    width: 6px;
}

.mix-ch__fader::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 7px;
    background: #5a7a9a;
    border-radius: 2px;
    border: none;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(15,23,42,0.3), inset 0 1px 0 rgba(255,255,255,0.35);
}

.mix-ch__fader::-webkit-slider-thumb:hover {
    background: #3a6080;
}

.mix-ch__fader::-moz-range-thumb {
    width: 22px;
    height: 7px;
    background: #5a7a9a;
    border-radius: 2px;
    border: none;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(15,23,42,0.3);
}

.mix-ch__db-label {
    width: 100%;
    font-size: 9px;
    font-variant-numeric: tabular-nums;
    color: #6b7a90;
    letter-spacing: 0.02em;
    text-align: center;
}

/* ── Mute / Solo / Vis buttons ──────────────────────── */

.mix-ch__buttons {
    display: flex;
    align-items: center;
    gap: 3px;
}

.mix-ch__btn {
    width: 20px;
    height: 20px;
    padding: 0;
    border: 1px solid #c8d4e4;
    border-radius: 3px;
    background: #eef2f8;
    color: #5a6e85;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    outline: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.mix-ch__btn:hover {
    background: #dde7f4;
    color: #2a4060;
}

.mix-ch__mute.is-active {
    background: rgba(239, 68, 68, 0.25);
    border-color: #ef4444;
    color: #ef4444;
}

.mix-ch__solo.is-active {
    background: rgba(234, 179, 8, 0.25);
    border-color: #eab308;
    color: #eab308;
}

.mix-ch__vis img {
    width: 13px;
    height: 13px;
    filter: none;
    opacity: 0.65;
}

.mix-ch__vis.is-inactive img {
    opacity: 0.22;
}

/* ── Pan ────────────────────────────────────────────── */

.mix-ch__pan-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    width: 100%;
}

.mix-ch__pan {
    -webkit-appearance: none;
    appearance: none;
    width: 58px;
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(to right, #d8e0ec, #b8c8dc 50%, #d8e0ec);
    outline: none;
    cursor: pointer;
}

.mix-ch__pan::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #5a7a9a;
    cursor: pointer;
    border: none;
    box-shadow: 0 1px 3px rgba(15,23,42,0.25);
}

.mix-ch__pan::-webkit-slider-thumb:hover {
    background: #3a6080;
}

.mix-ch__pan::-moz-range-thumb {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #5a7a9a;
    cursor: pointer;
    border: none;
}

.mix-ch__pan-label {
    font-size: 9px;
    font-variant-numeric: tabular-nums;
    color: #6b7a90;
    letter-spacing: 0.02em;
    min-width: 30px;
    text-align: center;
}

/* ── Color popup override ───────────────────────────── */

.mix-ch__color-popup {
    background: #ffffff;
    border-color: #d4dce8;
}

.mix-ch__color-popup input[type="range"] {
    display: block;
    box-sizing: content-box;
    width: 15px;
    height: 175px;
    margin: 0 auto;
    border-radius: 6px;
    background: linear-gradient(to bottom, red, yellow, lime, cyan, blue, magenta, red);
    appearance: none;
    writing-mode: vertical-lr;
    -webkit-appearance: none;
}

.mix-ch__color-popup input[type="range"]::-webkit-slider-thumb {
    box-sizing: border-box;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.8);
    border-radius: 3px;
    background: currentColor;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.mix-ch__color-popup input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.8);
    border-radius: 3px;
    background: currentColor;
    cursor: pointer;
}

/* ── Legacy .popup kept for backward compat ─────────── */

.popup {
    position: absolute;
    z-index: 9999;
    display: none;
    box-sizing: border-box;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
    text-align: center;
}

/* ── Engine of the track: follows the armed one ("ARM") or its own ───────── */
.mix-ch__engine {
    width: 100%;
    height: 20px;
    padding: 0 4px;
    border: 1px solid #c8d4e4;
    border-radius: 4px;
    background: #eef2f8;
    color: #5a6e85;
    font: 700 9.5px/1 system-ui, sans-serif;
    letter-spacing: 0.04em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}
.mix-ch__engine:hover { border-color: #4a8fa8; }
.mix-ch__engine.is-own {
    background: #2a6f88;
    border-color: #2a6f88;
    color: #ffffff;
}
.mix-ch__engine.is-unusable { opacity: 0.55; text-decoration: line-through; }
@media (pointer: coarse) {
    .mix-ch__engine { height: 30px; font-size: 11px; }
}
/* The engine menu is opened on purpose: above the notes in the corner too. */
.eraser-size-popup.track-engine-menu { z-index: 10010; }
/* A drawing track's row has one more button (delete): a little wider. */
.mix-ch.mix-ch--drawing { width: 96px; }
