/* Copyright Ayers Electronics Inc. All rights reserved. */
/* The shared browse sidebar: preview, tab bar and one list surface. The list ends at the mini
   player's measured top edge while the bar shows; normal-flow page padding cannot reserve that
   space for this absolutely positioned column. Under 900 wide the column is not drawn. */

#ondemand,
#musicHome,
#serversPage,
#settingsPage,
#collectionPage {
  position: relative;
}
.side-column {
  display: none;
}

@media (min-width: 900px) {
  #ondemand,
  #musicHome,
  #serversPage,
  #settingsPage,
  #collectionPage {
    --side-gap: calc(12 * var(--od-tv-px));
  }
  /* The column stands on the page margin; its preview reaches --preview-reach past it, so the frame is the
     guide's own box (css/layout/on-demand.css). */
  .side-column {
    position: absolute;
    top: 0;
    right: var(--page-margin);
    bottom: var(--side-gap);
    z-index: 3;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    width: calc(var(--od-pan-w) - var(--preview-reach) - 7px);
  }
  body.mini-player-over-music #ondemand > .side-column,
  body.mini-player-over-music #musicHome > .side-column,
  body.mini-player-over-music #serversPage > .side-column,
  body.mini-player-over-music #settingsPage > .side-column,
  body.mini-player-over-music #collectionPage > .side-column {
    bottom: var(--mini-player-height, 0px);
  }
  .side-column.hidden {
    display: none;
  }
  /* The main area beside the column keeps one width: the column's own and a gap. A library's grid
     keeps its own room (css/layout/on-demand.css). */
  #ondemand:not(.grid-open) #odScroll,
  #ondemand #odDetail,
  #collectionScroll,
  #musicRows {
    margin-right: calc(var(--od-pan-w) - var(--preview-reach) - 7px + var(--side-gap));
  }

  /* The preview's room: the frame and its 8px insets, seated here on every page the column stands on. */
  .side-preview-slot {
    position: relative;
    flex: none;
    height: calc(var(--preview-w) * 9 / 16 + 16px);
    pointer-events: none;
  }
  .side-panel {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    padding: 0;
    border: 1px solid var(--border-soft);
    border-top: 0;
    border-radius: 0 0 var(--radius) var(--radius);
    background: var(--panel);
  }
  .side-preview-slot > * {
    pointer-events: auto;
  }
  .side-column #odPreviewWrap {
    position: absolute;
    top: 0;
    right: calc(-1 * var(--preview-reach));
    margin-right: 0;
  }
  /* The profile's Show Preview setting off: the frame and its room go. */
  #guide.preview-off .side-preview-slot,
  #guide.preview-off.mode-ondemand #odPan {
    display: none;
  }
  /* The list area's head: the choices stand in one row of equal segments, each word whole. */
  .side-choices {
    display: flex;
    flex-wrap: nowrap;
    flex: none;
    margin: 0;
    background: var(--panel);
    border-color: var(--border-soft);
    border-radius: var(--radius) var(--radius) 0 0;
  }
  .side-choices .seg-btn[data-edge="first"],
  .side-choices .seg-ind[data-edge="first"] {
    border-radius: calc(var(--radius) - 1px) 0 0;
  }
  .side-choices .seg-btn[data-edge="last"],
  .side-choices .seg-ind[data-edge="last"] {
    border-radius: 0 calc(var(--radius) - 1px) 0 0;
  }
  .side-choices .seg-btn[data-edge="only"],
  .side-choices .seg-ind[data-edge="only"] {
    border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;
  }
  .side-choices .seg-btn {
    flex: 1 1 0;
    min-width: 0;
    min-height: calc(30 * var(--od-tv-px));
    padding: 0 2px;
    font-size: var(--type-label);
    letter-spacing: 0;
    white-space: nowrap;
  }
  .side-face {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    padding: calc(6 * var(--od-tv-px));
  }
  .side-face-slot,
  .side-column .smart-mix-face {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
  }
  .side-face-slot > *,
  .side-column .smart-mix-face > * {
    flex-shrink: 0;
  }
  .side-face-slot > .side-list,
  .side-column .smart-mix-picks {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
  }
  .side-column .side-list.is-empty {
    display: flex;
    flex-direction: column;
  }
  .side-column .side-empty {
    flex: 1 0 auto;
  }
  .side-face[data-face="tools"] > .side-face-slot {
    min-height: min-content;
  }
  .side-choices.hidden + .side-panel {
    border-top: 1px solid var(--border-soft);
  }
  /* A page's own tools stand alone on the page's ground, 12 under the frame (the wrap's 8px inset included). */
  .side-column.tools-only .side-panel {
    margin-top: calc(12 * var(--od-tv-px) - 8px);
    border: 0;
    background: none;
  }
  .side-column.tools-only .side-face {
    padding: 0;
  }
  /* Carried onto the collection page, the column holds its list area alone: the preview stays in On
     Demand's band under the page. */
  #collectionPage .side-preview-slot {
    display: none;
  }
  #collectionPage {
    flex: 1 1 auto;
    min-height: 0;
  }
}

/* The face's own parts: the list, a note under it, the foot's buttons, the search field, the heading
   line of an open playlist. */
.side-list > * + * {
  margin-top: calc(4 * var(--od-tv-px));
}
.side-column .track-row.list {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  margin-top: 0;
  padding: calc(6 * var(--od-tv-px)) calc(2 * var(--od-tv-px));
  border: 0;
  border-bottom: 1px solid var(--border-soft);
  border-radius: 0;
  background: transparent;
}
.side-column .track-row.list:last-child {
  border-bottom: 0;
}
.side-column .track-row.list.held {
  background: var(--elevated);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.side-column .track-row-face > * + * {
  margin-left: calc(8 * var(--od-tv-px));
}
.side-column .track-row-face {
  grid-column: 1;
  min-height: calc(36 * var(--od-tv-px));
}
.side-column .track-row-links {
  grid-column: 1;
  grid-row: 2;
  margin-left: 0;
  padding-left: calc(44 * var(--od-tv-px));
}
.side-column .track-row-play {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
}
.side-column .track-row-options,
.side-column .track-row-now {
  grid-column: 3;
  grid-row: 1 / span 2;
  align-self: center;
}
.side-column .track-row-thumb {
  width: calc(36 * var(--od-tv-px));
  height: calc(36 * var(--od-tv-px));
}
.side-column .track-row .icon-btn {
  border-color: transparent;
  background: transparent;
}
.side-column .track-row .icon-btn:hover {
  background: var(--elevated);
}
.side-note {
  margin: calc(6 * var(--od-tv-px)) auto;
  max-width: 22em;
  font-size: var(--type-label);
  color: var(--muted);
  text-align: center;
}
/* The empty state takes the room left between the face's controls and foot. Short viewports keep
   the message's intrinsic height and scroll instead of clipping its instructions. */
.side-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
  padding: calc(10 * var(--od-tv-px)) calc(8 * var(--od-tv-px));
  text-align: center;
}
.side-empty-icon {
  flex: none;
  width: calc(24 * var(--od-tv-px));
  height: calc(24 * var(--od-tv-px));
  margin-bottom: calc(6 * var(--od-tv-px));
  color: var(--muted);
  opacity: 0.8;
}
.side-empty-heading {
  margin: 0;
  font-size: var(--type-body);
  font-weight: 600;
  line-height: 1.25;
}
.side-empty-line {
  margin: 0;
  max-width: 22em;
  font-size: var(--type-label);
  line-height: 1.25;
  color: var(--muted);
}
.side-foot-buttons {
  display: flex;
  margin-top: calc(6 * var(--od-tv-px));
}
.side-foot-buttons > * + * {
  margin-left: 8px;
}
.side-foot-button {
  flex: 1 1 0;
  min-width: 0;
  min-height: calc(30 * var(--od-tv-px));
  padding: 0 8px;
  border: 1px solid var(--border-soft);
  font-size: var(--type-label);
  letter-spacing: 0;
}
.side-foot-field {
  flex: 1 1 auto;
}
.side-search {
  box-sizing: border-box;
  width: 100%;
  min-height: calc(30 * var(--od-tv-px));
  padding: 0 calc(8 * var(--od-tv-px));
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font-size: var(--type-label);
}

@media (pointer: coarse) {
  html:not([data-tv]) .side-choices .seg-btn,
  html:not([data-tv]) .side-foot-button,
  html:not([data-tv]) .side-search,
  html:not([data-tv]) .side-column .track-row-face,
  html:not([data-tv]) .side-column .track-row .icon-btn {
    min-height: var(--control-min-height, 44px);
    min-width: var(--control-min-height, 44px);
  }
}
