/* ── Subtitle Panel ─────────────────────────────────────────── */
.audio-wrapper,
.subtitle-wrapper { position: relative; }

.sub-btn.active { color: var(--primary); }

.subtitle-panel {
  position: absolute;
  bottom: calc(100% + 10px);
  right: 0;
  background: rgba(10,10,20,0.97);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 6px;
  min-width: 165px;
  flex-direction: column;
  gap: 2px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
  z-index: 20;
  animation: slideUp 0.2s ease;
}

.subtitle-item {
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 9px 14px;
  text-align: left;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  white-space: nowrap;
  width: 100%;
}

.subtitle-item:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }
.subtitle-item.active { color: var(--primary); background: rgba(229,9,20,0.12); font-weight: 600; }

/* ── Player Modal ─────────────────────────────────────────── */
.player-modal {
  position: fixed; inset: 0;
  background: #000;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.player-container { display: flex; flex-direction: column; height: 100%; position: relative; }

/* ── Player Header ─────────────────────────────────────────── */
.player-header {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: 20px 24px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.8) 0%, transparent 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
  transition: opacity 0.3s ease;
}

.player-header h2 {
  font-size: 18px; font-weight: 700; color: white;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
  max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── Video Area ────────────────────────────────────────────── */
.video-player-wrapper { flex: 1; position: relative; background: #000; overflow: hidden; }
.video-player { width: 100%; height: 100%; object-fit: contain; display: block; }
/* The media engine creates its <video> inside its own root in this container */
.video-container, .video-container .media-engine-root { position: absolute; inset: 0; }
.video-container video { width: 100% !important; height: 100% !important; object-fit: contain; display: block; }
.video-container video::cue { font-size: 70%; line-height: 1.3; color: #fff; background: rgba(0, 0, 0, 0.55); }

/* ── Player Controls ───────────────────────────────────────── */
.player-controls {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 0 24px 20px;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 100%);
  z-index: 10;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.player-controls.hidden, .player-header.hidden, .player-info.hidden {
  opacity: 0; pointer-events: none;
}

/* Progress bar */
.progress-bar-container { margin-bottom: 14px; padding: 8px 0; cursor: pointer; }
.progress-bar { height: 4px; background: rgba(255,255,255,0.2); border-radius: 2px; position: relative; transition: height 0.15s ease; }
.progress-bar-container:hover .progress-bar { height: 6px; }
.progress-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--primary); border-radius: 2px; width: 0%; }
.progress-handle { position: absolute; top: 50%; transform: translate(-50%, -50%) scale(0); width: 14px; height: 14px; background: white; border-radius: 50%; transition: transform 0.15s ease; }
.progress-bar-container:hover .progress-handle { transform: translate(-50%, -50%) scale(1); }

/* Controls bottom */
.controls-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.controls-left, .controls-right { display: flex; align-items: center; gap: 4px; }

.control-btn {
  background: none; border: none; color: white; padding: 8px; border-radius: 6px;
  cursor: pointer; transition: all 0.15s ease; display: flex; align-items: center;
  justify-content: center; opacity: 0.85; font-family: inherit;
}
.control-btn:hover { background: rgba(255,255,255,0.15); opacity: 1; }
.control-btn.active { color: var(--primary); opacity: 1; }

.volume-slider { display: flex; align-items: center; overflow: hidden; width: 0; transition: width 0.25s ease, opacity 0.25s ease; opacity: 0; }
.volume-slider.show { width: 80px; opacity: 1; }
#volume-control { width: 80px; accent-color: var(--primary); cursor: pointer; height: 4px; }

.time { font-size: 12.5px; color: rgba(255,255,255,0.85); font-variant-numeric: tabular-nums; font-weight: 500; padding: 0 4px; }
.time-separator { font-size: 12px; color: rgba(255,255,255,0.4); }

.quality-select {
  background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px; color: white; font-size: 12px; font-weight: 600;
  padding: 6px 10px; cursor: pointer; outline: none; font-family: inherit;
}
.quality-select option { background: #1a1a2e; color: white; }

/* Player info row */
.player-info { padding: 0 24px 16px; display: flex; gap: 12px; align-items: center; }
#player-description { font-size: 13px; color: rgba(255,255,255,0.6); flex: 1; }

.meta-btn {
  background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.8); padding: 8px 14px; border-radius: 100px;
  cursor: pointer; font-size: 12.5px; font-weight: 500; font-family: inherit;
  display: flex; align-items: center; gap: 6px; transition: all 0.15s ease;
}
.meta-btn:hover { background: rgba(255,255,255,0.2); color: white; }
.meta-btn.active { background: rgba(229,9,20,0.3); border-color: var(--primary); color: white; }

/* Buffering indicator */
.player-buffering {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 12px; pointer-events: none;
}
.player-buffering .spinner { width: 48px; height: 48px; border-color: rgba(255,255,255,0.2); border-top-color: var(--primary); }
