/*
 * Transport row on computers, from 1100 px (redesign 2026-11, as in the
 * approved mockup "Main"). src/ui/transportBar.js moves the transport strip
 * into .sw-transport-row, the first row of the workspace, across the arrange
 * and the right panel:
 *   + Track ▾ · undo / redo · tools · transport · loop · metronome ▾ ·
 *   BAR / TIME / BPM / SIG · Grid ▾ + Snap · View ▾ · full screen · Mixer ·
 *   Inspector / Room panel · settings
 * Below 1100 px nothing here applies and the strip is back in the room.
 */

.sw-transport-row,
.sw-tracks-head {
  display: none;
}

@media (min-width: 1100px) {
  /* ---------- Workspace: the row on top, arrange and panel below ---------- */
  html body .workspace.sw-transport-docked {
    grid-template-rows: auto minmax(0, 1fr) !important;
    row-gap: 0.6rem !important;
  }

  html body .workspace.sw-transport-docked > .sw-transport-row {
    display: block;
    grid-column: 1 / -1;
    grid-row: 1;
    min-width: 0;
  }

  html body .workspace.sw-transport-docked > .inspector-side,
  html body .workspace.sw-transport-docked > .room,
  html body .workspace.sw-transport-docked > .room-side {
    grid-row: 2 !important;
  }

  html body .workspace.sw-transport-docked > .room,
  html body .workspace.sw-transport-docked > .room-side {
    min-height: 0 !important;
  }

  html body .workspace.sw-transport-docked {
    --inspector-top-space: 0px !important;
  }

  /* ---------- The strip: one flex row ---------- */
  html body .workspace .sw-transport-row > .transport-strip {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 0.4rem !important;
    box-sizing: border-box !important;
    width: 100% !important;
    height: 3.5rem !important;
    min-height: 3.5rem !important;
    margin: 0 !important;
    padding: 0 0.6rem !important;
    border: 1px solid #2c2a24 !important;
    border-radius: 0.9rem !important;
    background: #12110e !important;
    grid-template-columns: none !important;
    grid-template-areas: none !important;
    grid-template-rows: none !important;
    overflow: visible !important;
  }

  html body .sw-transport-row > .transport-strip .transport-primary-row,
  html body .sw-transport-row > .transport-strip .transport-primary-row .transport,
  html body .sw-transport-row > .transport-strip .transport-secondary-row {
    display: contents !important;
  }

  html body .sw-transport-row > .transport-strip .mobile-edit-drawer,
  html body .sw-transport-row > .transport-strip .mobile-settings-drawer,
  html body .sw-transport-row > .transport-strip #positionDisplay {
    display: none !important;
  }

  html body .sw-transport-row > .transport-strip > *,
  html body .sw-transport-row > .transport-strip .transport > *,
  html body .sw-transport-row > .transport-strip .readout {
    flex: 0 0 auto !important;
    grid-area: auto !important;
    position: relative !important;
    inset: auto !important;
    margin: 0 !important;
    transform: none !important;
  }

  /* The centre group sits in the middle of what is left. */
  html body .sw-transport-row > .transport-strip .transport-core {
    margin-left: auto !important;
  }

  html body .sw-transport-row > .transport-strip .sw-tp-display {
    margin-right: auto !important;
  }

  /* ---------- Shared look of the small groups ---------- */
  html body .sw-transport-row .sw-tp-group,
  html body .sw-transport-row > .transport-strip .edit-tools {
    display: flex !important;
    align-items: stretch !important;
    height: 2.25rem !important;
    padding: 0 !important;
    border: 1px solid #3a372f !important;
    border-radius: 0.6rem !important;
    background: #1b1a16 !important;
    overflow: hidden !important;
  }

  html body .sw-transport-row .sw-tp-group > button,
  html body .sw-transport-row > .transport-strip .edit-tools .icon-edit {
    box-sizing: border-box !important;
    display: inline-grid !important;
    place-items: center !important;
    flex: 0 0 2.1rem !important;
    width: 2.1rem !important;
    min-width: 0 !important;
    height: 100% !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-right: 1px solid #2c2a24 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: #d9d3c6 !important;
  }

  html body .sw-transport-row .sw-tp-group > button:last-child,
  html body .sw-transport-row > .transport-strip .edit-tools .icon-edit:last-of-type {
    border-right: 0 !important;
  }

  html body .sw-transport-row .sw-tp-group > button:hover:not(:disabled),
  html body .sw-transport-row > .transport-strip .edit-tools .icon-edit:hover:not(:disabled) {
    background: #2a2822 !important;
    color: #fff8e8 !important;
  }

  html body .sw-transport-row .sw-tp-group > button:disabled {
    color: #6f6a60 !important;
  }

  html body .sw-transport-row .sw-tp-group svg,
  html body .sw-transport-row .sw-tp-mixer svg,
  html body .sw-transport-row .sw-tp-settings svg {
    width: 1rem;
    height: 1rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  html body .sw-transport-row .sw-tp-panels > button[aria-pressed="true"] {
    background: #2a2316 !important;
    color: #e8bf6a !important;
  }

  /* ---------- + Track ▾ ---------- */
  html body .sw-transport-row .add-track-menu {
    position: relative !important;
  }

  html body .sw-transport-row #addAudioBtn {
    box-sizing: border-box !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.3rem !important;
    width: auto !important;
    height: 2.25rem !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 0.65rem !important;
    border: 1px solid #3a372f !important;
    border-radius: 0.6rem !important;
    background: #1b1a16 !important;
    color: #f4efe4 !important;
    font-size: 0 !important;
    font-weight: 650 !important;
    white-space: nowrap !important;
  }

  html body .sw-transport-row #addAudioBtn::before {
    content: "+ Track";
    font-size: 0.8rem;
  }

  html body .sw-transport-row #addAudioBtn::after {
    content: "";
    width: 0.4rem;
    height: 0.4rem;
    margin: -0.2rem 0 0 0.15rem;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg);
    opacity: 0.75;
  }

  html body .sw-transport-row #addAudioBtn:hover {
    border-color: #6b5426 !important;
  }

  html body .sw-transport-row .add-track-popover {
    top: calc(100% + 0.4rem) !important;
    bottom: auto !important;
    left: 0 !important;
    right: auto !important;
    z-index: 90 !important;
  }

  /* ---------- Display: BAR · TIME · BPM · SIG ---------- */
  html body .sw-transport-row .sw-tp-display {
    display: flex !important;
    align-items: stretch !important;
    height: 2.75rem !important;
    border: 1px solid #2c2a24 !important;
    border-radius: 0.7rem !important;
    background: #050504 !important;
    overflow: hidden !important;
  }

  html body .sw-transport-row .sw-tp-cell,
  html body .sw-transport-row .sw-tp-display .essential-bpm-control {
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    gap: 0.12rem !important;
    width: auto !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0.2rem 0.65rem !important;
    border: 0 !important;
    border-left: 1px solid #24221c !important;
    border-radius: 0 !important;
    background: transparent !important;
    text-align: left !important;
  }

  html body .sw-transport-row .sw-tp-cell:first-child {
    border-left: 0 !important;
  }

  html body .sw-transport-row .sw-tp-cell > span,
  html body .sw-transport-row .sw-tp-display .essential-bpm-control > span {
    color: #8f897c !important;
    font-size: 0.58rem !important;
    font-weight: 650 !important;
    letter-spacing: 0.1em !important;
    line-height: 1 !important;
    text-transform: uppercase !important;
  }

  html body .sw-transport-row .sw-tp-cell > output,
  html body .sw-transport-row .sw-tp-display #bpmInput {
    color: #f4efe4 !important;
    font: 600 1.05rem/1.15 "JetBrains Mono", "SF Mono", ui-monospace, monospace !important;
    font-variant-numeric: tabular-nums !important;
    letter-spacing: 0 !important;
    white-space: nowrap !important;
  }

  html body .sw-transport-row .sw-tp-bar > output {
    min-width: 4.4em;
    color: #e8bf6a !important;
  }

  html body .sw-transport-row .sw-tp-time > output {
    min-width: 5.4em;
  }

  html body .sw-transport-row .sw-tp-display .essential-bpm-control {
    width: 4.1rem !important;
  }

  html body .sw-transport-row .sw-tp-display #bpmInput {
    height: 1.3rem !important;
  }

  html body .sw-transport-row .sw-tp-sig {
    cursor: pointer;
  }

  html body .sw-transport-row .sw-tp-sig:hover {
    background: #12110e !important;
  }

  /* ---------- Right: Grid + Snap, View, full screen, Mixer, panels, settings ---------- */
  html body .sw-transport-row > .transport-strip .readout {
    display: flex !important;
    align-items: center !important;
    gap: 0.4rem !important;
  }

  html body .sw-transport-row .sw-tp-mixer {
    box-sizing: border-box !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.4rem !important;
    height: 2.25rem !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 0.75rem !important;
    border: 1px solid #3a372f !important;
    border-radius: 0.6rem !important;
    background: #1b1a16 !important;
    color: #f4efe4 !important;
    font-size: 0.8rem !important;
    font-weight: 650 !important;
  }

  html body .sw-transport-row .sw-tp-mixer[aria-pressed="true"] {
    border-color: #8a6f37 !important;
    background: #2a2316 !important;
    color: #e8bf6a !important;
  }

  html body .sw-transport-row .sw-tp-settings {
    box-sizing: border-box !important;
    display: inline-grid !important;
    place-items: center !important;
    width: 2.25rem !important;
    min-width: 2.25rem !important;
    height: 2.25rem !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 1px solid #3a372f !important;
    border-radius: 0.6rem !important;
    background: #1b1a16 !important;
    color: #d9d3c6 !important;
  }

  html body .sw-transport-row .sw-tp-settings[aria-pressed="true"] {
    border-color: #8a6f37 !important;
    color: #e8bf6a !important;
  }

  /* The footer keeps the status line only: Mixer and the settings gear are
     in this row now (the settings panel itself still opens from the footer). */
  html body .workspace.sw-transport-docked .room-footer #mixerBtn,
  html body .workspace.sw-transport-docked #globalSettingsMenu > summary {
    display: none !important;
  }

  /* ---------- Track list head: "N TRACKS · Close all" ---------- */
  html body .workspace.sw-transport-docked .track-toolbar > .sw-tracks-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    min-width: 0;
    padding: 0 0.6rem;
  }

  html body .sw-tracks-head .sw-tracks-count {
    color: #a7a197;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.09em;
  }

  html body .sw-tracks-head .sw-tracks-fold {
    height: 1.5rem;
    padding: 0 0.4rem;
    border: 0;
    border-radius: 0.4rem;
    background: transparent;
    color: #d9d3c6;
    font: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
  }

  html body .sw-tracks-head .sw-tracks-fold:hover:not(:disabled) {
    background: #23221d;
    color: #fff8e8;
  }
}

/* The row never gets wider than the window: it gets tighter step by step. */
@media (min-width: 1100px) {
  html body .workspace .sw-transport-row > .transport-strip {
    gap: 0.3rem !important;
    padding: 0 0.45rem !important;
  }

  html body .sw-transport-row > .transport-strip .transport-core .icon-button {
    width: 2.3rem !important;
    min-width: 2.3rem !important;
    height: 2.3rem !important;
    min-height: 2.3rem !important;
  }

  html body .sw-transport-row > .transport-strip .transport-core #playBtn {
    width: 3.2rem !important;
    min-width: 3.2rem !important;
  }

  html body .sw-transport-row .sw-tp-cell,
  html body .sw-transport-row .sw-tp-display .essential-bpm-control {
    padding: 0.2rem 0.5rem !important;
  }
}

@media (min-width: 1100px) and (max-width: 1499px) {
  /* Mixer keeps its icon and tooltip. */
  html body .sw-transport-row .sw-tp-mixer > span {
    display: none !important;
  }

  html body .sw-transport-row .sw-tp-mixer {
    width: 2.25rem !important;
    padding: 0 !important;
    justify-content: center !important;
  }

  html body .sw-transport-row .sw-tp-group > button,
  html body .sw-transport-row > .transport-strip .edit-tools .icon-edit {
    flex-basis: 1.85rem !important;
    width: 1.85rem !important;
  }
}

@media (min-width: 1100px) and (max-width: 1379px) {
  html body .sw-transport-row #addAudioBtn::before {
    content: "+";
    font-size: 1rem;
  }

  html body .sw-transport-row #addAudioBtn {
    padding: 0 0.5rem !important;
  }

  html body .sw-transport-row > .transport-strip .transport-core .icon-button {
    width: 2.15rem !important;
    min-width: 2.15rem !important;
    height: 2.15rem !important;
    min-height: 2.15rem !important;
  }

  html body .sw-transport-row > .transport-strip .transport-core #playBtn {
    width: 2.8rem !important;
    min-width: 2.8rem !important;
  }

  html body .sw-transport-row > .transport-strip #loopBtn,
  html body .sw-transport-row > .transport-strip #metroBtn {
    width: 2.15rem !important;
    min-width: 2.15rem !important;
    height: 2.15rem !important;
    min-height: 2.15rem !important;
  }

  html body .sw-transport-row > .transport-strip .metro-control,
  html body .sw-transport-row > .transport-strip .tp-caret {
    height: 2.15rem !important;
    min-height: 2.15rem !important;
  }

  html body .sw-transport-row .sw-tp-group > button,
  html body .sw-transport-row > .transport-strip .edit-tools .icon-edit {
    flex-basis: 1.7rem !important;
    width: 1.7rem !important;
  }

  html body .sw-transport-row .sw-tp-cell,
  html body .sw-transport-row .sw-tp-display .essential-bpm-control {
    padding: 0.2rem 0.4rem !important;
  }

  html body .sw-transport-row .sw-tp-cell > output,
  html body .sw-transport-row .sw-tp-display #bpmInput {
    font-size: 0.86rem !important;
  }

  html body .sw-transport-row .sw-tp-cell > span,
  html body .sw-transport-row .sw-tp-display .essential-bpm-control > span {
    font-size: 0.52rem !important;
  }

  html body .sw-transport-row .sw-tp-display .essential-bpm-control {
    width: 3.1rem !important;
  }
}

@media (min-width: 1100px) and (max-width: 1239px) {
  html body .workspace .sw-transport-row > .transport-strip {
    gap: 0.2rem !important;
    padding: 0 0.35rem !important;
  }

  html body .sw-transport-row .sw-tp-group > button,
  html body .sw-transport-row > .transport-strip .edit-tools .icon-edit {
    flex-basis: 1.55rem !important;
    width: 1.55rem !important;
  }

  html body .sw-transport-row > .transport-strip #gridSelect {
    width: 3.5rem !important;
  }

  html body .sw-transport-row > .transport-strip .tp-view-menu > summary {
    padding: 0 0.5rem !important;
  }

  html body .sw-transport-row > .transport-strip .tp-view-menu > summary > :not(.tp-view-icon) {
    display: none !important;
  }

  /* The Inspector and the Room panel keep their own tab and handle. */
  html body .sw-transport-row .sw-tp-panels {
    display: none !important;
  }
}
