/* =====================================================
   Video Section — Full-width Player + Toggle Sidebar
   Sidebar toggles via button on the right center of video
   ===================================================== */

/* ── Section wrapper ──────────────────────────────── */
.video-section {
  padding: 10px 0 0px;
  background: transparent;
  position: relative;
}

.video-section .narrowWrap {
  margin: 0 auto;
  padding: 0 10px;
}

/* ── Main wrapper: player + sidebar ──────────────── */
.video-wrapper {
  display: flex;
  flex-direction: row;
  width: 100%;
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.10);
}

/* ── Player area — takes all available space ─────── */
.video-player-area {
  flex: 1;
  min-width: 0;
  position: relative;
}

.video-player-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

@supports not (aspect-ratio: 16 / 9) {
  .video-player-wrapper {
    height: 0;
    padding-bottom: 56.25%;
  }
}

.video-player-wrapper video {
  display: block;
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  object-fit: contain;
  background: #000;
}

/* ── Toggle button — right center of video ──────── */
.video-toggle-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 2px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.25s ease, transform 0.25s ease, background 0.2s ease;
  opacity: 0;
  pointer-events: none;
}

/* Show on hover over the video wrapper */
.video-wrapper:hover .video-toggle-btn {
  opacity: 0.6;
  pointer-events: auto;
}

.video-toggle-btn:hover {
  background: rgba(0, 0, 0, 0.6);
  opacity: 1 !important;
  transform: translateY(-50%) scale(1.1);
}

/* ── Toggle arrow SVG ─────────────────────────── */
.toggle-arrow {
  display: block;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Rotate arrow when sidebar is open */
.video-toggle-btn.is-open .toggle-arrow {
  transform: rotate(180deg);
}

/* Hide when sidebar is open */
.video-toggle-btn.is-open {
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ── Sidebar playlist — hidden by default ─────── */
.video-playlist {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  width: 320px;
  max-width: 40vw;
  background: rgba(20, 20, 25, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10;
  display: flex;
  flex-direction: column;
}

/* Visible state — toggled via JS */
.video-playlist.is-open {
  transform: translateX(0);
}

/* ── Playlist header ────────────────────────────── */
.playlist-header {
  padding: 14px 16px;
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.2);
}

.playlist-header i {
  font-size: 1rem;
}

/* ── Playlist items container ──────────────────── */
.playlist-items {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

/* ── Playlist item ────────────────────────────── */
.playlist-item {
  display: flex;
  align-items: stretch;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.2s ease;
  border-left: 3px solid transparent;
  position: relative;
  background-size: cover;
  background-position: center;
}

.playlist-item:hover {
  background: rgba(255, 255, 255, 0.1);
  border-left-color: rgba(255, 255, 255, 0.3);
}

.playlist-item--active {
  background: rgba(255, 255, 255, 0.15);
  border-left-color: #4CAF50;
}

.playlist-item[style*="background-image"]::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.playlist-item__body {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.playlist-item__title {
  font-family: 'Gibson', 'noto-serif', georgia, 'Times New Roman', serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 2px 0;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.playlist-item__subtitle {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.6);
  margin: 0;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Scrollbar styling for sidebar ──────────────── */
.video-playlist::-webkit-scrollbar {
  width: 4px;
}

.video-playlist::-webkit-scrollbar-track {
  background: transparent;
}

.video-playlist::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
}

/* ── Responsive: Tablet ──────────────────────────── */
@media (max-width: 900px) {
  .video-playlist {
    width: 280px;
    max-width: 50vw;
  }
}

/* ── Responsive: Mobile ──────────────────────────── */
@media (max-width: 600px) {
  .video-section {
    padding: 10px 0 20px;
  }

  .video-toggle-btn {
    right: 8px;
    width: 38px;
    height: 38px;
    font-size: 1rem;
  }

  .video-playlist {
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 50%;
    position: absolute;
    bottom: 0;
    top: auto;
    right: 0;
    transform: translateY(100%);
    border-radius: 10px 10px 0 0;
  }

  .video-playlist.is-open {
    transform: translateY(0);
  }

  .playlist-items {
    max-height: 200px;
  }
}