/* Studio section styles: content (the videos route: kind tabs, toolbar, bulk bar, pager, row hover actions) and
   playlists (views/playlists.js). Tokens come from styles.css :root. Desktop first; phone rules at the end. */

/* Section tabs (Video | Short | Collections) use the shared tab grammar from styles.css. The status filter sits
   under them: the same grammar, smaller. */
.kind-tabs .tabs { margin-bottom: 4px; }
.status-tabs .tabs { margin-bottom: 12px; }
.status-tabs .tab { padding: 8px 10px; font-size: var(--fs-sm); }

/* Search and filters above the list: the shared .filter-bar, with this section's columns. The selects do not submit
   on change (a keyboard user would re-load the list at every arrow key); Apply or Enter does. */
.content-toolbar {
  grid-template-columns: minmax(200px, 2fr) repeat(3, minmax(140px, 1fr)) auto;
  align-items: end;
  margin: 0 0 12px;
}
.content-toolbar .field { margin: 0; }
.toolbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Bulk bar: appears when rows are selected. Hidden attribute must win over the flex layout. */
.bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin: 0 0 12px;
  padding: 12px 16px;
  background: var(--primary-tint);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}
.bulk-bar[hidden] { display: none; }
/* Sticky at the bottom of the viewport: the actions stay in reach while the list is scrolled */
.bulk-bar { position: sticky; bottom: 12px; z-index: 4; box-shadow: 0 -4px 16px rgba(16, 24, 40, 0.08); }
.bulk-bar[aria-busy="true"] { opacity: 0.75; }
.bulk-count { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.bulk-count:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; border-radius: var(--radius-xs); }
.bulk-note { margin: 0; flex: 1 1 320px; color: var(--text-2); font-size: var(--fs-sm); text-wrap: pretty; }
.bulk-note:empty { display: none; }
.bulk-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.bulk-actions .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }

/* Selection checkboxes */
.cell-select { width: 44px; padding-right: 0; }
.row-check, #select-all { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); cursor: pointer; }
.data-table th.cell-select { vertical-align: middle; }

/* Scheduled: approved, waiting for its date (not live yet). Blue-tint, so it does not read as published. */
.chip-scheduled { background: var(--primary-tint); color: var(--primary); }

/* Long unbroken titles (a 80+ letter Russian word) wrap inside the row, the card and the item page */
.video-title, .row-desc, .row-text, .detail-grid > *, .banner p { min-width: 0; overflow-wrap: anywhere; }

/* Scheduled date under the status chip */
.row-sched { margin: 6px 0 0; color: var(--muted); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }

/* Hover actions: analytics appears with the row hover or focus; touch screens always show it */
.row-hover { display: inline-flex; }
.row-hover:empty { display: none; }
@media (hover: hover) and (pointer: fine) {
  .video-card .row-hover { opacity: 0; }
  .video-card:hover .row-hover,
  .video-card:focus-within .row-hover { opacity: 1; }
}

/* Pager */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; margin: 16px 0 0; }
.pager-info { color: var(--muted); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }

/* Collections (playlists): list on the left, the chosen collection on the right */
.pl-root { min-width: 0; }
.pl-layout { display: grid; grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); gap: 24px; align-items: start; }
.pl-side,
.pl-main {
  min-width: 0;
  padding: var(--card-pad);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.pl-side-head { margin-bottom: 12px; }
.pl-heading { margin: 0; font-size: var(--fs-md); font-weight: 600; }
.pl-heading:focus-visible,
.pl-title:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; border-radius: var(--radius-xs); }
.pl-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.pl-pick {
  width: 100%;
  min-height: 44px;
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  text-align: left;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.pl-pick:hover { background: var(--surface-2); }
.pl-pick[aria-current="true"] { border-color: var(--primary); background: var(--primary-tint); }
.pl-pick-title { font-weight: 600; overflow-wrap: anywhere; }
.pl-pick-meta { color: var(--muted); font-size: var(--fs-xs); }

.pl-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px 16px; margin-bottom: 16px; }
.pl-head-text { min-width: 0; }
.pl-title { margin: 0; font-size: var(--fs-xl); overflow-wrap: anywhere; }
.pl-title-ru { margin: 4px 0 0; color: var(--muted); overflow-wrap: anywhere; }
.pl-state { margin: 8px 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pl-head-actions { margin-top: 0; }

.pl-form {
  display: grid;
  gap: 4px;
  margin: 0 0 20px;
  padding: 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.pl-form .form-alert { margin: 0; color: var(--danger); font-size: var(--fs-sm); }
.pl-form .form-alert[hidden] { display: none; }
.pl-form .actions { margin-top: 8px; }

/* Items are an ordered list (the order is the playlist order): the marker stays, the row inside is flex */
.pl-items { margin: 0 0 16px; padding-left: 32px; display: grid; gap: 8px; }
.pl-items::marker { color: var(--muted); font-variant-numeric: tabular-nums; }
.pl-item {
  display: list-item;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.pl-item-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px 12px;
}
.pl-item-main { flex: 1 1 220px; min-width: 0; display: grid; gap: 4px; }
.pl-item-title { font-weight: 600; overflow-wrap: anywhere; }
.pl-item-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: var(--fs-sm); }
.pl-item-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.pl-item-actions .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.pl-add { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-top: 12px; }
.pl-add .field { flex: 1 1 280px; margin: 0; }

@media (max-width: 1023px) {
  .content-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolbar-search,
  .toolbar-actions { grid-column: 1 / -1; }
}
@media (max-width: 899px) {
  .pl-layout { grid-template-columns: minmax(0, 1fr); }
}

/* Phone: the table turns into rows (styles.css). The checkbox sits at the left of the title; the bulk bar stays at the bottom.
   Checkboxes are 24 px, the smallest target WCAG 2.2 AA accepts; the rows keep 8 px between them. */
@media (max-width: 699px) {
  .content-toolbar { grid-template-columns: minmax(0, 1fr); }
  .kind-tabs { margin-bottom: 12px; }
  .data-table tbody tr { position: relative; }
  .data-table td.cell-select {
    position: absolute;
    left: 12px;
    top: 16px;
    width: auto;
    padding: 0;
    display: block;
  }
  .data-table td.cell-main { padding-left: 40px; }
  .row-check, #select-all { width: 24px; height: 24px; }
  .row-hover { opacity: 1; }
  .bulk-bar { bottom: calc(8px + env(safe-area-inset-bottom)); }
  .bulk-actions .btn { flex: 1 1 auto; }
  .pl-title { font-size: var(--fs-lg); }
  .pl-item-actions .btn { flex: 1 1 auto; }
}
