/* TubiusPlayer v1 - custom control layer over a native <video> + hls.js.
   Theme via CSS variables on .tp; operators override them in their style.css. */
.tp {
  --tp-accent: #e7374a;
  --tp-bg: #000;
  --tp-fg: #fff;
  --tp-panel: rgba(0, 0, 0, 0.55);
  --tp-hover: rgba(255, 255, 255, 0.18);
  --tp-track: rgba(255, 255, 255, 0.3);

  position: relative;
  /* Fill the host container: height:100% takes the parent's height when it has
     one (e.g. the default .player has aspect-ratio 16/9), and aspect-ratio is the
     fallback shape when the parent height is auto - so {video_player} fits any
     layout it is dropped into. */
  width: 100%;
  height: 100%;
  aspect-ratio: 16 / 9;
  background: var(--tp-bg);
  overflow: hidden;
  user-select: none;
  line-height: 0;
  font-family: inherit;
}
.tp:fullscreen,
.tp:-webkit-full-screen {
  width: 100%;
  height: 100%;
}
.tp-video {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--tp-bg);
  object-fit: contain; /* letterbox any aspect into the container, no distortion */
}
.tp:fullscreen .tp-video,
.tp:-webkit-full-screen .tp-video {
  height: 100%;
  object-fit: contain;
}

/* Big center play overlay (before start / when paused). */
.tp-big {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 3;
}
.tp-big svg {
  width: 72px;
  height: 72px;
  fill: var(--tp-fg);
  opacity: 0.92;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
  transition: transform 0.12s ease;
}
.tp-big:hover svg {
  transform: scale(1.08);
}
.tp.tp-playing .tp-big {
  display: none;
}

/* Buffering spinner. */
.tp-spin {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  border: 3px solid var(--tp-track);
  border-top-color: var(--tp-fg);
  border-radius: 50%;
  animation: tp-rot 0.8s linear infinite;
  z-index: 2;
  display: none;
}
.tp.tp-buffering .tp-spin {
  display: block;
}
@keyframes tp-rot {
  to {
    transform: rotate(360deg);
  }
}

/* Control bar. */
.tp-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 6px 10px 8px;
  background: linear-gradient(to top, var(--tp-panel), transparent);
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 4;
  opacity: 1;
  transition: opacity 0.25s ease;
  line-height: 1;
}
.tp.tp-hide .tp-bar {
  opacity: 0;
  pointer-events: none;
}

/* Seek bar. */
.tp-seek {
  position: relative;
  height: 14px;
  display: flex;
  align-items: center;
  cursor: pointer;
}
.tp-seek-track {
  position: relative;
  width: 100%;
  height: 4px;
  background: var(--tp-track);
  border-radius: 3px;
  overflow: hidden;
}
.tp-seek:hover .tp-seek-track {
  height: 6px;
}
.tp-buf {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: rgba(255, 255, 255, 0.35);
  width: 0;
}
.tp-played {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: var(--tp-accent);
  width: 0;
}

/* Scrub-preview tooltip. */
.tp-tip {
  position: absolute;
  bottom: 22px;
  transform: translateX(-50%);
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  pointer-events: none;
  z-index: 5;
}
.tp-seek:hover .tp-tip {
  display: flex;
}
.tp-tip-img {
  background-repeat: no-repeat;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 4px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  background-color: var(--tp-bg);
}
.tp-tip-time {
  font-size: 11px;
  color: var(--tp-fg);
  background: rgba(0, 0, 0, 0.7);
  padding: 1px 6px;
  border-radius: 3px;
  line-height: 1.4;
}

/* Buttons row. */
.tp-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--tp-fg);
}
.tp-btn {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  color: var(--tp-fg);
}
.tp-btn svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}
.tp-btn:hover {
  opacity: 0.8;
}
.tp-time {
  font-size: 12px;
  color: var(--tp-fg);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.tp-spacer {
  flex: 1;
}

/* Volume. */
.tp-vol {
  display: flex;
  align-items: center;
  gap: 4px;
}
.tp-vol-slider {
  width: 0;
  opacity: 0;
  transition: width 0.18s ease, opacity 0.18s ease;
  height: 4px;
  accent-color: var(--tp-accent);
  cursor: pointer;
}
.tp-vol:hover .tp-vol-slider,
.tp-vol-slider:focus {
  width: 64px;
  opacity: 1;
}
.tp-touch .tp-vol-slider {
  display: none;
}

/* Quality menu. */
.tp-quality {
  position: relative;
}
.tp-quality-btn {
  font-size: 12px;
  color: var(--tp-fg);
  background: none;
  border: 0;
  cursor: pointer;
  padding: 2px 4px;
}
.tp-quality-btn:hover {
  opacity: 0.8;
}
.tp-quality-menu {
  position: absolute;
  right: 0;
  bottom: 26px;
  background: rgba(0, 0, 0, 0.9);
  border-radius: 6px;
  padding: 4px 0;
  min-width: 84px;
  display: none;
  flex-direction: column;
}
.tp-quality.tp-open .tp-quality-menu {
  display: flex;
}
.tp-quality-menu button {
  background: none;
  border: 0;
  color: var(--tp-fg);
  font-size: 12px;
  text-align: left;
  padding: 6px 12px;
  cursor: pointer;
  white-space: nowrap;
}
.tp-quality-menu button:hover {
  background: var(--tp-hover);
}
.tp-quality-menu button.tp-active {
  color: var(--tp-accent);
}
.tp-hidden {
  display: none !important;
}

/* Embed (third-party iframe) player: poster + centered play button until click. */
.tp-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
  cursor: pointer;
}
.tp-embed-poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.tp-embed-play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 4.5rem;
  height: 4.5rem;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}
.tp-embed-play:hover {
  background: rgba(0, 0, 0, 0.75);
}
.tp-embed-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
}

/* VAST ad overlay - covers the player area (.tp or .tp-embed, both relative)
   while an ad plays. */
.tv-ad {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: #000;
  display: flex;
}
.tv-ad-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.tv-ad-skip {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 31;
  padding: 6px 12px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 4px;
  font: 13px sans-serif;
  cursor: pointer;
}

/* Start-screen / pause overlay ads: an operator HTML banner covering the player
   area, above the controls (5) but below a VAST video overlay (30). */
.tp-ad-ovl {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(0, 0, 0, 0.82);
}
.tp-ad-ovl[hidden] {
  display: none;
}
/* The gutter lives on the box, not as layer padding: an adaptive size is a
   percentage of the player, and padding on the layer would resolve those
   percentages against a smaller content box (80% would render as 77%). */
.tp-ad-inner {
  max-width: calc(100% - 32px);
  max-height: calc(100% - 32px);
  overflow: auto;
  text-align: center;
}
.tp-ad-inner img {
  max-width: 100%;
  height: auto;
}
/* Player-drawn Play button under the start-screen banner. */
.tp-ad-play {
  padding: 9px 22px;
  background: var(--tp-accent, #f59e0b);
  color: #000;
  border: none;
  border-radius: 6px;
  font: 600 15px sans-serif;
  cursor: pointer;
}
.tp-ad-play:hover {
  filter: brightness(1.08);
}
/* Small close/resume affordance on the pause banner. */
.tp-ad-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  font: 18px sans-serif;
  line-height: 1;
  cursor: pointer;
}
.tp-ad-close:hover {
  background: rgba(0, 0, 0, 0.85);
}
