/* ============================================================================
   Youtube Playlist Viewer — self-contained styles (no Bootstrap required).
   Everything is scoped under .ypv-viewer so it won't affect the rest of the
   site or the block editor UI.
   ========================================================================== */
.ypv-viewer {
  --ypv-bg: #0b0e1a;
  --ypv-surface: #151a2e;
  --ypv-surface-2: #1d2440;
  --ypv-text: #eef1ff;
  --ypv-muted: #98a2c8;
  --ypv-accent: #e45b9b;
  --ypv-accent-2: #7c6cff;

  box-sizing: border-box;
  /* background: var(--ypv-bg); */
  color: var(--ypv-text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  padding: 1.5rem 0;
}
.ypv-viewer *,
.ypv-viewer *::before,
.ypv-viewer *::after {
  box-sizing: border-box;
}

.up-next-item.active:focus, .up-next-item.active:focus-visible {
    outline: none;
}

/* :where(.wp-site-blocks *:focus) {
    outline: none;
} */

/* ---- Layout: container / row / columns / gutter ---- */
.ypv-viewer .container {
  width: 100%;
  padding-right: 12px;
  padding-left: 12px;
  margin-right: auto;
  margin-left: auto;
}
@media (min-width: 576px)  { .ypv-viewer .container { max-width: 540px; } }
@media (min-width: 768px)  { .ypv-viewer .container { max-width: 720px; } }
@media (min-width: 992px)  { .ypv-viewer .container { max-width: 960px; } }
@media (min-width: 1200px) { .ypv-viewer .container { max-width: 1140px; } }
@media (min-width: 1400px) { .ypv-viewer .container { max-width: 1320px; } }

.ypv-viewer .row {
  display: flex;
  flex-wrap: wrap;
  margin-top: calc(-1 * var(--ypv-gutter-y, 0px));
  margin-right: calc(-0.5 * var(--ypv-gutter-x, 0px));
  margin-left: calc(-0.5 * var(--ypv-gutter-x, 0px));
}
.ypv-viewer .row > * {
  flex-shrink: 0;
  width: 100%;
  max-width: 100%;
  margin-top: var(--ypv-gutter-y, 0px);
  padding-right: calc(var(--ypv-gutter-x, 0px) * 0.5);
  padding-left: calc(var(--ypv-gutter-x, 0px) * 0.5);
}
.ypv-viewer .g-4 {
  --ypv-gutter-x: 1.5rem;
  --ypv-gutter-y: 1.5rem;
}
@media (min-width: 992px) {
  .ypv-viewer .col-lg-8 { flex: 0 0 auto; width: 66.66666667%; }
  .ypv-viewer .col-lg-4 { flex: 0 0 auto; width: 33.33333333%; }
}

/* ---- Utility helpers ---- */
.ypv-viewer .d-none { display: none !important; }
.ypv-viewer .d-flex { display: flex !important; }
.ypv-viewer .justify-content-center { justify-content: center !important; }
.ypv-viewer .align-items-center { align-items: center !important; }
.ypv-viewer .mt-3 { margin-top: 1rem !important; }
.ypv-viewer .mb-0 { margin-bottom: 0 !important; }
.ypv-viewer .flex-grow-1 { flex-grow: 1 !important; }
.ypv-viewer .small { font-size: 0.875em; }

/* ---- Alert ---- */
.ypv-viewer .alert {
  position: relative;
  padding: 1rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
  border-radius: 0.375rem;
}
.ypv-viewer .alert-danger {
  color: #842029;
  background-color: #f8d7da;
  border-color: #f5c2c7;
}

/* ---- Badge ---- */
.ypv-viewer .badge {
  display: inline-block;
  padding: 0.35em 0.65em;
  font-size: 0.75em;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  vertical-align: baseline;
}
.ypv-viewer .rounded-pill { border-radius: 50rem !important; }
.ypv-viewer .badge-soft {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  font-weight: 500;
}

/* ---- Buttons ---- */
.ypv-viewer .btn {
  display: inline-block;
  font-weight: 400;
  line-height: 1.5;
  text-align: center;
  text-decoration: none;
  vertical-align: middle;
  cursor: pointer;
  user-select: none;
  border: 1px solid transparent;
  padding: 0.375rem 0.75rem;
  font-size: 1rem;
  border-radius: 0.375rem;
  transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
}
.ypv-viewer .btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
  border-radius: 0.25rem;
}
.ypv-viewer .btn-outline-light {
  color: #f8f9fa;
  border-color: #f8f9fa;
  background: transparent;
}
.ypv-viewer .btn-outline-light:hover {
  color: #000;
  background-color: #f8f9fa;
  border-color: #f8f9fa;
}

/* ---- 16:9 embed ratio ---- */
.ypv-viewer .ratio {
  position: relative;
  width: 100%;
}
.ypv-viewer .ratio::before {
  display: block;
  padding-top: 56.25%;
  content: "";
}
.ypv-viewer .ratio > * {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* ---- Featured player ---- */
.ypv-viewer .player-frame {
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
  background: #000;
}
.ypv-viewer .now-playing {
  background: var(--ypv-surface);
  border: 1px solid var(--ypv-surface-2);
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  margin-top: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.ypv-viewer .now-playing .flex-grow-1 { min-width: 0; flex-basis: 0; }
.ypv-viewer .now-playing .title { font-size: 16px !important;font-weight: 600; overflow-wrap: anywhere; line-height: 1.3; margin-bottom: 0.5rem; margin-top: 0px;}
.ypv-viewer .now-playing .channel { color: var(--ypv-muted); font-size: 0.9rem; }
.ypv-viewer .now-playing .np-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 0 0 auto;
}
.ypv-viewer .now-playing .channel-logo {
  flex: 0 0 auto;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  object-fit: cover;
  background: var(--ypv-surface-2);
  border: 1px solid var(--ypv-surface-2);
}
@media (max-width: 575.98px) {
  .ypv-viewer .now-playing .np-actions { flex: 0 0 100%; }
}

/* ---- Up next panel ---- */
.ypv-viewer .playlist-panel {
  background: var(--ypv-surface);
  border: 1px solid var(--ypv-surface-2);
  border-radius: 1rem;
  padding: 1rem;
  display: flex;
  flex-direction: column;
}
.ypv-viewer .playlist-panel .ypv-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 0.35rem;
}
@media (min-width: 992px) {
  .ypv-viewer .up-next-col { position: relative; }
  .ypv-viewer .playlist-panel { position: absolute; inset: 0; }
}
.ypv-viewer .ypv-list::-webkit-scrollbar { width: 8px; }
.ypv-viewer .ypv-list::-webkit-scrollbar-thumb {
  background: var(--ypv-surface-2);
  border-radius: 4px;
}
.ypv-viewer .panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}
.ypv-viewer .panel-head h2 { font-size: 1.1rem; margin: 0; color: #eef1ff; }

.ypv-viewer .up-next-item {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.6rem;
  border-radius: 0.75rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.ypv-viewer .up-next-item:hover { background: var(--ypv-surface-2); }
.ypv-viewer .up-next-item.active {
  background: var(--ypv-surface-2);
  border-color: var(--ypv-accent);
}
.ypv-viewer .up-next-item .num {
  flex: 0 0 1.6rem;
  text-align: center;
  font-weight: 600;
  color: var(--ypv-muted);
  font-variant-numeric: tabular-nums;
}
.ypv-viewer .up-next-item.active .num { color: var(--ypv-accent); }
.ypv-viewer .up-next-item .thumb { flex: 0 0 6rem; position: relative; }
.ypv-viewer .up-next-item .thumb img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 0.5rem;
  display: block;
}
.ypv-viewer .up-next-item .thumb .duration {
  position: absolute;
  right: 0.35rem;
  bottom: 0.35rem;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 0.7rem;
  padding: 0.1rem 0.35rem;
  border-radius: 0.3rem;
}
.ypv-viewer .up-next-item .body { flex: 1; min-width: 0; line-height: 1.2;}
.ypv-viewer .up-next-item .title {
  font-size: 0.9rem !important;
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 0;
  margin-bottom: 0;
}
.ypv-viewer .up-next-item .channel { font-size: 0.78rem; color: var(--ypv-muted); }
.ypv-viewer .up-next-item.active .title { color: var(--ypv-accent); }

/* ---- Pagination ---- */
.ypv-viewer .pagination {
  display: flex;
  flex-wrap: wrap;
  padding-left: 0;
  list-style: none;
  margin: 0;
}
.ypv-viewer .pagination .page-item { list-style: none; }
.ypv-viewer .pagination .page-link {
  position: relative;
  display: block;
  padding: 0.375rem 0.75rem;
  text-decoration: none;
  background: var(--ypv-surface);
  border: 1px solid var(--ypv-surface-2);
  color: var(--ypv-text);
  border-radius: 0.5rem;
  margin: 0 0.1rem;
  font-size: 0.85rem;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.ypv-viewer .pagination .page-link:hover { background: var(--ypv-surface-2); color: #fff; }
.ypv-viewer .pagination .page-item.active .page-link {
  background: var(--ypv-accent);
  border-color: var(--ypv-accent);
  color: #fff;
}
.ypv-viewer .pagination .page-item.disabled .page-link {
  background: var(--ypv-surface);
  color: #555c80;
  pointer-events: none;
}
