/* streamix-sdk.css — SDK styles (spinner, overlay wraps, fullscreen button). */

/* Spinner (preroll + loading) */
@keyframes streamixSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.streamixPrerollSpinner {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44px;
  height: 44px;
  margin-left: -22px;
  margin-top: -22px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.25);
  border-top-color: rgba(255, 255, 255, 0.95);
  animation: streamixSpin 0.9s linear infinite;
  z-index: 999;
  pointer-events: none;
}

.streamixPrerollScrim {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.55);
  z-index: 998;
  pointer-events: none;
}

/* Overlay wrapper — shared wrapper for preroll and loading spinners */
.streamixOverlayWrap {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  display: none;
  pointer-events: none;
}

/* Preroll wrapper — sits above everything */
.streamixPrerollWrap {
  z-index: 999;
}

/* Loading wrapper — sits below the fullscreen button */
.streamixLoadingWrap {
  z-index: 900;
}

/* Fullscreen button */
.streamixFsBtn {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  cursor: pointer;
  z-index: 950;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  opacity: 0.85;
  transition: opacity 0.15s;
  pointer-events: auto;
}

.streamixFsBtn:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.75);
}

.streamixFsBtn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* Plyr: override fixed-ratio wrapper to fill the SDK container.
   #playerRoot controls the outer aspect ratio (16:9 by default).
   <video> object-fit:contain handles letterboxing/centering. */
.plyr {
  width: 100% !important;
  height: 100% !important;
}

.plyr__video-wrapper,
.plyr__video-wrapper--fixed-ratio {
  width: 100% !important;
  height: 100% !important;
  padding-bottom: 0 !important;
  aspect-ratio: auto !important;
}

/* ОПЦИОНАЛЬНО: контролы плеера на нижней кромке КАДРА (а не у низа контейнера).
   Включается флагом window.STREAMIX_CONTROLS_ON_VIDEO===true (старый алиас
   STREAMIX_PLYR_CONTROLS_ON_VIDEO тоже поддерживается). Тогда адаптер движка
   вешает класс .streamixFitVideo на контент-контейнер и пишет --content-ar-num.
   По умолчанию (без флага) класса нет → поведение прежнее (контролы у низа
   контейнера). min() даёт contain-fit: для широкого видео ограничивает высота,
   для 4:3 — ширина; бокс растёт вместе с контейнером, включая fullscreen.
   Бокс-владелец контролов зависит от движка:
   - native/hlsjs/dashjs/shaka — сам <video> (нативные контролы браузера);
   - plyr — .plyr--video (свой UI);
   - videojs — .video-js (его .vjs-control-bar);
   - clappr — [data-player] (его .media-control). */
.streamixFitVideo {
  container-type: size;
  display: flex;
  align-items: center;
  justify-content: center;
}
.streamixFitVideo > video,
.streamixFitVideo .plyr.plyr--video,
.streamixFitVideo .video-js,
.streamixFitVideo [data-clappr-wrapper] [data-player] {
  --ar: var(--content-ar-num, 1.7778);
  width: min(100cqw, 100cqh * var(--ar)) !important;
  height: min(100cqh, 100cqw / var(--ar)) !important;
  max-width: 100% !important;
  max-height: 100% !important;
}
/* Страховка от движков (напр. Shaka), которые могут инлайном выставить свой
   object-fit на <video> и растянуть кадр: бокс уже подогнан под пропорцию,
   поэтому contain здесь = без искажений. */
.streamixFitVideo > video {
  object-fit: contain !important;
}
/* Clappr: его обёртка [data-clappr-wrapper] — position:absolute (вне flex-потока
   контейнера), поэтому центрируем [data-player] flex'ом ВНУТРИ обёртки.
   [data-player] делаем relative (Clappr ожидает его как контекст позиционирования). */
.streamixFitVideo [data-clappr-wrapper] {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}
.streamixFitVideo [data-clappr-wrapper] [data-player] {
  position: relative !important;
}

/* Hide native/Clappr/Video.js FS buttons (scoped to .streamixFsBtnActive on playerRoot).
   FS-переключение — только нашей кнопкой / двойным кликом по #playerRoot (нативный FS
   раскрывает только <video> без рекламного оверлея). Plyr не трогаем (он раскрывает
   #playerRoot через fullscreen.container). */
.streamixFsBtnActive video::-webkit-media-controls-fullscreen-button {
  display: none !important;
}

.streamixFsBtnActive .media-control-right-panel .media-control-icon[data-fullscreen] {
  display: none !important;
}

.streamixFsBtnActive .vjs-fullscreen-control {
  display: none !important;
}
