/* Room watch playlist: watch summary, shared modal content and YouTube preview. */
.room-watch-playlist-summary[hidden],
.room-watch-playlist-add-form[hidden],
.room-watch-playlist-empty[hidden] {
  display: none !important;
}

.room-watch-playlist-summary {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.room-watch-playlist-next {
  min-width: 0;
}

.room-watch-playlist-next > span {
  display: block;
  margin-bottom: 3px;
  color: var(--hf-color-muted);
  font-size: 9px;
  font-weight: 700;
  line-height: 1.2;
}

.room-watch-playlist-next > strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--hf-color-text-strong);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-watch-playlist-open {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 10px;
  color: var(--hf-color-primary-hover);
  background: rgba(var(--hf-color-primary-rgb), 0.08);
  border: 1px solid rgba(var(--hf-color-primary-rgb), 0.16);
  border-radius: 9px;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.room-watch-playlist-open:hover,
.room-watch-playlist-open:focus {
  background: rgba(var(--hf-color-primary-rgb), 0.14);
  border-color: rgba(var(--hf-color-primary-rgb), 0.26);
  outline: none;
}

.room-watch-playlist-open > strong {
  min-width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  color: #fff;
  background: var(--hf-color-primary);
  border-radius: 999px;
  box-sizing: border-box;
  font-size: 8px;
}

.room-watch-playlist-open > i {
  font-size: 11px;
}

/* The playlist uses the shared Handsfriend modal layer on both PC and mobile.
 * This file owns only the content geometry inside that common dialog. */
.room-watch-playlist-dialog {
  --hf-modal-dialog-width: 500px;
}

.room-watch-playlist-header {
  padding-right: 0;
}

.room-watch-playlist-title-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}

.room-watch-playlist-title-row h2 {
  margin: 0;
  color: var(--hf-color-text-strong);
  font-size: 18px;
  font-weight: 850;
  line-height: 1.3;
}

.room-watch-playlist-capacity {
  min-width: 42px;
  margin-top: 2px;
  padding: 4px 6px;
  color: var(--hf-color-muted);
  background: var(--hf-color-surface-soft);
  border: 1px solid var(--hf-color-line);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}

.room-watch-playlist-auto-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 16px;
  padding: 12px 0 14px;
  border-bottom: 1px solid var(--hf-color-line);
}

.room-watch-playlist-auto-row > div {
  min-width: 0;
}

.room-watch-playlist-auto-row strong,
.room-watch-playlist-auto-row small {
  display: block;
}

.room-watch-playlist-auto-row strong {
  color: var(--hf-color-text-strong);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.3;
}

.room-watch-playlist-auto-row small {
  margin-top: 4px;
  color: var(--hf-color-muted);
  font-size: 10px;
  line-height: 1.4;
}

/* Same visual language as the account/community switches: pill, knob, ON/OFF. */
.room-watch-playlist-switch {
  min-width: 58px;
  height: 30px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 3px 7px 3px 4px;
  color: var(--hf-color-muted);
  background: var(--hf-switch-off-bg);
  border: 1px solid var(--hf-switch-off-border);
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
}

.room-watch-playlist-switch-knob {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  background: var(--hf-switch-knob-bg);
  border-radius: 50%;
  box-shadow: var(--hf-switch-knob-shadow);
}

.room-watch-playlist-switch.is-enabled {
  flex-direction: row-reverse;
  padding: 3px 4px 3px 7px;
  color: var(--hf-button-primary-text);
  background: var(--hf-switch-on-bg);
  border-color: var(--hf-switch-on-bg);
}

.room-watch-playlist-switch:disabled {
  opacity: 0.62;
  cursor: default;
}

@media (hover: hover) and (pointer: fine) {
  .room-watch-playlist-switch:not(:disabled):hover {
    background: var(--hf-color-line-strong);
    border-color: var(--hf-color-muted-light);
  }

  .room-watch-playlist-switch.is-enabled:not(:disabled):hover {
    background: var(--hf-switch-on-hover-bg);
    border-color: var(--hf-switch-on-hover-bg);
  }
}

.room-watch-playlist-body {
  max-height: min(330px, 44vh);
  margin-top: 8px;
  padding-top: 0;
  padding-bottom: 0;
}

.room-watch-playlist-list {
  min-height: 0;
}

.room-watch-playlist-item {
  min-width: 0;
  display: grid;
  grid-template-columns: 26px 64px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 9px 2px;
  border-bottom: 1px solid rgba(91, 115, 129, 0.1);
  box-sizing: border-box;
}

.room-watch-playlist-item:last-child {
  border-bottom: 0;
}

.room-watch-playlist-item.is-current {
  margin: 0 -5px;
  padding-right: 7px;
  padding-left: 7px;
  background: rgba(var(--hf-color-primary-rgb), 0.06);
  border-radius: 10px;
}

.room-watch-playlist-item.is-dragging {
  position: relative;
  z-index: 2;
  background: var(--hf-color-surface-soft);
  box-shadow: inset 0 0 0 1px rgba(var(--hf-color-primary-rgb), 0.28);
}

.room-watch-playlist-drag-ghost {
  position: fixed;
  z-index: calc(var(--hf-z-modal, 30000) + 20);
  margin: 0;
  pointer-events: none;
  opacity: 0.72;
  background: var(--hf-color-surface);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(6, 18, 38, 0.18);
  transform: translate3d(0, 0, 0);
  will-change: left, top;
}

.room-watch-playlist-handle,
.room-watch-playlist-order {
  width: 26px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--hf-color-muted-light);
  background: transparent;
  border: 0;
  font-size: 11px;
  font-weight: 800;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.room-watch-playlist-handle {
  cursor: grab;
}

.room-watch-playlist-handle:active {
  cursor: grabbing;
}

.room-watch-playlist-thumb {
  width: 64px;
  aspect-ratio: 16 / 9;
  display: block;
  object-fit: cover;
  background: var(--hf-color-surface-soft);
  border-radius: 8px;
}

.room-watch-playlist-copy {
  min-width: 0;
}

.room-watch-playlist-copy > strong {
  display: block;
  overflow: hidden;
  color: var(--hf-color-text-strong);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-watch-playlist-meta {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.room-watch-playlist-meta small {
  min-width: 0;
  overflow: hidden;
  color: var(--hf-color-muted);
  font-size: 9px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-watch-playlist-current {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 5px;
  color: var(--hf-color-primary-hover);
  background: rgba(var(--hf-color-primary-rgb), 0.1);
  border-radius: 999px;
  font-size: 8px;
  font-weight: 800;
  line-height: 1.2;
}

.room-watch-playlist-actions {
  display: flex;
  align-items: center;
  gap: 3px;
}

.room-watch-playlist-icon-button {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--hf-color-muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
  font-size: 10px;
}

.room-watch-playlist-icon-button:hover,
.room-watch-playlist-icon-button:focus {
  color: var(--hf-color-primary-hover);
  background: rgba(var(--hf-color-primary-rgb), 0.08);
  outline: none;
}

.room-watch-playlist-icon-button.is-danger:hover,
.room-watch-playlist-icon-button.is-danger:focus {
  color: var(--hf-color-danger, #d95858);
  background: rgba(217, 88, 88, 0.08);
}

.room-watch-playlist-icon-button:disabled {
  opacity: 0.35;
  cursor: default;
}

.room-watch-playlist-icon-button:disabled:hover,
.room-watch-playlist-icon-button:disabled:focus {
  color: var(--hf-color-muted);
  background: transparent;
}

.room-watch-playlist-empty {
  min-height: 130px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 18px;
  color: var(--hf-color-muted);
  text-align: center;
}

.room-watch-playlist-empty .fa {
  margin-bottom: 3px;
  font-size: 18px;
  opacity: 0.45;
}

.room-watch-playlist-empty strong {
  color: var(--hf-color-text-strong);
  font-size: 11px;
}

.room-watch-playlist-empty span {
  font-size: 9px;
  line-height: 1.45;
}

.room-watch-playlist-footer {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--hf-color-line);
}

.room-watch-playlist-participant-notice {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  color: var(--hf-color-muted);
  font-size: 10px;
  line-height: 1.4;
}

.room-watch-playlist-participant-notice[hidden] {
  display: none !important;
}

.room-watch-playlist-participant-notice .fa {
  flex: 0 0 auto;
  color: var(--hf-color-muted-light);
  font-size: 11px;
}

.room-watch-playlist-status {
  min-height: 0;
  color: var(--hf-color-muted);
  font-size: 9px;
  line-height: 1.35;
}

.room-watch-playlist-status:not(:empty) {
  margin-bottom: 7px;
}

.room-watch-playlist-status.is-error {
  color: var(--hf-color-danger, #d95858);
}

.room-watch-playlist-add-form > div {
  display: flex;
  align-items: stretch;
  gap: 7px;
}

.room-watch-playlist-add-form input {
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 0 11px;
  color: var(--hf-color-text-strong);
  background: var(--hf-color-surface);
  border: 1px solid rgba(91, 115, 129, 0.2);
  border-radius: 9px;
  font-size: 11px;
  outline: none;
  box-sizing: border-box;
}

.room-watch-playlist-add-form input:focus {
  border-color: rgba(var(--hf-color-primary-rgb), 0.58);
  box-shadow: 0 0 0 3px rgba(var(--hf-color-primary-rgb), 0.08);
}

.room-watch-playlist-add-form button {
  min-width: 62px;
  height: 38px;
  flex: 0 0 auto;
  padding: 0 12px;
  color: #fff;
  background: var(--hf-color-primary);
  border: 1px solid var(--hf-color-primary);
  border-radius: 9px;
  font-size: 10px;
  font-weight: 800;
}

.room-watch-playlist-add-form button:hover,
.room-watch-playlist-add-form button:focus {
  background: var(--hf-color-primary-hover);
  border-color: var(--hf-color-primary-hover);
  outline: none;
}

.room-watch-playlist-add-form button:disabled,
.room-watch-playlist-add-form input:disabled {
  opacity: 0.58;
  cursor: default;
}

/* YouTube metadata is attached after the normal chat message has rendered.
 * Only one owner action is exposed: add the shared video to the playlist. */
.room-youtube-preview {
  width: min(300px, 100%);
  margin: 5px 0px;
  overflow: hidden;
  background: var(--hf-color-surface);
  border: 1px solid rgba(91, 115, 129, 0.14);
  border-radius: 11px;
  box-shadow: 0 2px 7px rgba(20, 39, 51, 0.06);
}

.room-youtube-preview-main {
  min-width: 0;
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  align-items: stretch;
}

.room-youtube-preview-thumb {
  width: 86px;
  object-fit: cover;
  background: var(--hf-color-surface-soft);
}

.room-youtube-preview-copy {
  min-width: 0;
  padding: 7px 8px;
}

.room-youtube-preview-copy strong,
.room-youtube-preview-copy span {
  display: block;
}

.room-youtube-preview-copy strong {
  display: -webkit-box;
  overflow: hidden;
  color: var(--hf-color-text-strong);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.room-youtube-preview-copy span {
  margin-top: 3px;
  color: var(--hf-color-muted);
  font-size: 8px;
}

.room-youtube-preview.is-loading .room-youtube-preview-copy strong {
  color: var(--hf-color-muted);
  font-weight: 700;
}

.room-youtube-preview-actions {
  display: flex;
  justify-content: flex-end;
  padding: 6px 7px;
  border-top: 1px solid rgba(91, 115, 129, 0.1);
}

.room-youtube-preview-actions button {
  min-height: 28px;
  padding: 0 10px;
  color: var(--hf-color-primary-hover);
  background: var(--hf-color-surface);
  border: 1px solid rgba(var(--hf-color-primary-rgb), 0.22);
  border-radius: 7px;
  font-size: 8px;
  font-weight: 800;
  white-space: nowrap;
}

.room-youtube-preview-actions button:hover,
.room-youtube-preview-actions button:focus {
  background: rgba(var(--hf-color-primary-rgb), 0.07);
  border-color: rgba(var(--hf-color-primary-rgb), 0.32);
  outline: none;
}

.room-youtube-preview-actions button:disabled {
  opacity: 0.58;
  cursor: default;
}

@media (min-width: 901px) {
  body.room-chat-page .room-watch-playlist-summary {
    width: 100%;
    min-width: 0;
    margin-top: 5px;
    margin-left: -1px;
    padding: 8px 9px;

    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;

    background: rgba(255, 255, 255, 0.58);
    border: 1px solid rgba(91, 115, 129, 0.14);
    border-radius: 10px;

    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    box-shadow: none;
    appearance: none;
  }

  body.room-chat-page .room-watch-playlist-open {
    min-height: 0;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  body.room-chat-page .room-watch-playlist-open:hover,
  body.room-chat-page .room-watch-playlist-open:focus {
    background: transparent;
    border-color: transparent;
    outline: none;
  }

  body.room-chat-page .room-watch-playlist-summary:hover {
    background: rgba(var(--hf-color-primary-rgb), 0.04);
    border-color: rgba(var(--hf-color-primary-rgb), 0.2);
  }

  body.room-chat-page .room-watch-playlist-summary:focus-visible {
    outline: 2px solid rgba(var(--hf-color-primary-rgb), 0.22);
    outline-offset: 1px;
  }

  body.room-chat-page #room_watch_panel.is-setup .room-watch-playlist-summary,
  body.room-chat-page
    #room_watch_panel.is-minimized
    .room-watch-playlist-summary {
    display: none !important;
  }
}

@media (max-width: 900px) {
  body.room-chat-page .room-watch-playlist-summary {
    display: block;
    grid-column: 2;

    width: auto;
    min-width: 0;
    margin: 0;
    padding: 0;

    color: inherit;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;

    font: inherit;
    text-align: inherit;
    appearance: none;
    -webkit-appearance: none;
  }

  body.room-chat-page .room-watch-playlist-next {
    display: none;
  }

  body.room-chat-page .room-watch-playlist-open {
    min-height: 30px;
    padding: 0 8px;
  }

  body.room-chat-page
    #room_watch_panel.is-mobile-minimized
    .room-watch-playlist-summary {
    display: none !important;
  }

  body.room-chat-page .room-watch-playlist-next {
    display: none;
  }

  body.room-chat-page .room-watch-playlist-open {
    min-height: 30px;
    padding: 0 8px;
  }

  body.room-chat-page
    #room_watch_panel.is-mobile-minimized
    .room-watch-playlist-summary {
    display: none !important;
  }
}

@media (max-width: 768px) {
  .room-watch-playlist-dialog {
    --hf-modal-dialog-width: 440px;
  }

  .room-watch-playlist-header {
    padding-right: 0;
  }

  .room-watch-playlist-title-row h2 {
    font-size: 16px;
  }

  .room-watch-playlist-auto-row {
    margin-top: 13px;
    padding-bottom: 12px;
  }

  .room-watch-playlist-auto-row small {
    max-width: 220px;
    font-size: 9px;
  }

  .room-watch-playlist-body {
    max-height: min(320px, 42vh);
  }

  .room-watch-playlist-item {
    grid-template-columns: 26px 58px minmax(0, 1fr) auto;
    gap: 7px;
    padding-top: 9px;
    padding-bottom: 9px;
  }

  .room-watch-playlist-thumb {
    width: 58px;
  }

  .room-watch-playlist-copy > strong {
    font-size: 10px;
  }

  .room-watch-playlist-add-form input,
  .room-watch-playlist-add-form button {
    height: 36px;
  }

  .room-youtube-preview {
    width: min(286px, 100%);
  }

  .room-watch-playlist-capacity {
    margin-top: 1px;
  }
}

html[data-hf-theme="dark"] body.room-chat-page .room-watch-playlist-summary {
  background: rgba(255, 255, 255, 0.045);
  border-color: rgba(170, 188, 198, 0.14);
}

html[data-hf-theme="dark"] .room-watch-playlist-item {
  border-color: rgba(170, 188, 198, 0.12);
}

html[data-hf-theme="dark"] .room-watch-playlist-item.is-current {
  background: rgba(var(--hf-color-primary-rgb), 0.09);
}

html[data-hf-theme="dark"] .room-watch-playlist-item.is-dragging {
  background: rgba(var(--hf-color-primary-rgb), 0.12);
}

html[data-hf-theme="dark"] .room-youtube-preview-actions {
  border-color: rgba(170, 188, 198, 0.14);
}

html[data-hf-theme="dark"] .room-youtube-preview-actions button {
  background: rgba(10, 17, 23, 0.62);
}
