/* NewsIt Universal Video Player (Mrowser-Style Custom Player) */

.nh-player-root {
  position: relative;
  width: 100%;
  height: 100%;
  background: #000;
  border-radius: 0;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  font-family:var(--nh-script-font,NewsItScripts),-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Standalone desktop card mode */
.uvp-landscape-mode .nh-player-root {
  aspect-ratio: 16 / 9;
  height: auto;
}

[data-layout="vertical"].nh-player-root,
.nh-player-root[data-layout="vertical"],
.uvp-reels-mode .nh-player-root {
  width: 100% !important;
  height: 100% !important;
  aspect-ratio: auto !important;
}

.nh-player-root:fullscreen {
  width: 100vw !important;
  height: 100vh !important;
  border-radius: 0;
  aspect-ratio: auto;
}

.nh-player-root:-webkit-full-screen {
  width: 100vw !important;
  height: 100vh !important;
  border-radius: 0;
  aspect-ratio: auto;
}

/* ── Video Element ── */
.nh-player-video {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: #000;
  pointer-events: auto;
}

[data-layout="vertical"] .nh-player-video,
.nh-player-root[data-layout="vertical"] .nh-player-video,
.uvp-reels-mode .nh-player-video {
  object-fit: cover;
}

/* ── Fallback Frame / Iframe ── */
.nh-uvp-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #000;
  border-radius: 0;
  overflow: hidden;
}

.uvp-landscape-mode .nh-uvp-frame {
  aspect-ratio: 16 / 9;
  height: auto;
}

.nh-uvp-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ── Stream Sniffer Toast Banner (Mrowser-Style) ── */
.nh-player-toast {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  background: rgba(18, 22, 30, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 11.5px;
  font-weight: 500;
  color: #f1f3f7;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
  white-space: nowrap;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nh-player-toast .nh-toast-spinner {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: #ffca28;
  border-radius: 50%;
  animation: nh-spin 0.8s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}

@keyframes nh-spin {
  to { transform: rotate(360deg); }
}

.nh-player-toast.is-hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(-10px);
  pointer-events: none;
}

/* ── Top Header Controls (Subtitle Delay / CC Capsule) - Hidden as per user request ── */
.nh-player-top,
.nh-sub-sync-box {
  display: none !important;
}

.nh-sub-btn {
  background: transparent;
  border: 0;
  color: #fff;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.nh-sub-btn.is-active {
  background: #ffca28;
  color: #000;
}

.nh-sub-sep {
  width: 1px;
  height: 16px;
  background: rgba(255, 255, 255, 0.22);
}

.nh-sub-step-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 0;
  color: #fff;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  line-height: 1;
  transition: background 0.15s;
}

.nh-sub-step-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

.nh-sub-value {
  font-size: 11.5px;
  font-family:var(--nh-script-font,NewsItScripts),SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: #e2e8f0;
  min-width: 44px;
  text-align: center;
}

/* ── Center Controls (Play/Pause, Rewind 15, Forward 15) ── */
.nh-player-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  z-index: 22;
  pointer-events: auto;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.nh-center-btn {
  background: rgba(18, 22, 30, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  transition: transform 0.15s ease, background 0.15s ease;
}

.nh-center-btn:hover {
  transform: scale(1.08);
  background: rgba(30, 36, 48, 0.9);
}

.nh-center-btn:active {
  transform: scale(0.95);
}

.nh-center-skip {
  width: 46px;
  height: 46px;
}

.nh-center-play {
  width: 64px;
  height: 64px;
  background: rgba(255, 202, 40, 0.9);
  color: #000;
  border-color: rgba(255, 202, 40, 0.5);
}

.nh-center-play:hover {
  background: #ffca28;
}

/* ── Bottom Controls Bar ── */
.nh-player-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 14px 12px 14px;
  background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.55) 40%, rgba(0, 0, 0, 0.88) 100%);
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 22;
  pointer-events: auto;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

/* Scrubber / Progress Bar */
.nh-progress-container {
  position: relative;
  width: 100%;
  height: 14px;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.nh-progress-track {
  position: relative;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
  overflow: visible;
  transition: height 0.15s ease;
}

.nh-progress-container:hover .nh-progress-track {
  height: 6px;
}

.nh-progress-buffer {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 0%;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 2px;
}

.nh-progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 0%;
  background: #ffca28;
  border-radius: 2px;
}

.nh-progress-thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 12px;
  height: 12px;
  margin-top: -6px;
  margin-left: -6px;
  border-radius: 50%;
  background: #ffca28;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.nh-progress-container:hover .nh-progress-thumb,
.nh-progress-container.is-dragging .nh-progress-thumb {
  opacity: 1;
  transform: scale(1.2);
}

/* Controls Row */
.nh-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.nh-controls-left,
.nh-controls-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nh-ctrl-btn {
  background: transparent;
  border: 0;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.nh-ctrl-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.nh-ctrl-btn:active {
  transform: scale(0.92);
}

.nh-time-text {
  font-size: 12px;
  font-family:var(--nh-script-font,NewsItScripts),SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: #e2e8f0;
  white-space: nowrap;
}

/* Volume hover slider */
.nh-volume-wrapper {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nh-volume-slider {
  width: 0;
  opacity: 0;
  transition: width 0.2s ease, opacity 0.2s ease;
  accent-color: #ffca28;
  cursor: pointer;
}

.nh-volume-wrapper:hover .nh-volume-slider {
  width: 60px;
  opacity: 1;
}

/* Speed Button */
.nh-speed-btn {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.12);
  border: 0;
  color: #fff;
  cursor: pointer;
  min-width: 30px;
  text-align: center;
  transition: background 0.15s;
}

.nh-speed-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ── Controls Auto-Hide ── */
.nh-player-root.is-playing.is-inactive .nh-player-top,
.nh-player-root.is-playing.is-inactive .nh-player-center,
.nh-player-root.is-playing.is-inactive .nh-player-bottom {
  opacity: 0;
  pointer-events: none;
}

/* ── Subtitle Cues Rendering ── */
.nh-player-subtitles {
  position: absolute;
  bottom: 60px;
  left: 20px;
  right: 20px;
  text-align: center;
  pointer-events: none;
  z-index: 20;
  transition: bottom 0.25s ease;
}

.nh-player-root.is-playing.is-inactive .nh-player-subtitles {
  bottom: 24px;
}

.nh-sub-cue-line {
  display: inline-block;
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
  margin: 2px 0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}

/* ── Error & Loading States ── */
.nh-uvp-error {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 160px;
  color: #fff;
  background: #000;
  font-size: 13px;
  padding: 20px;
  text-align: center;
}

/* ── Pre-roll Video Overlay (Reference Frame 4) ── */
.nh-preroll-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #000;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: opacity 0.22s ease;
}

.nh-preroll-overlay.is-dismissed {
  opacity: 0;
  pointer-events: none;
}

.nh-preroll-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

.nh-preroll-top {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 45;
}

.nh-ad-learn-more {
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: background 0.2s;
}

.nh-ad-learn-more:active {
  background: rgba(255, 255, 255, 0.25);
}

.nh-ad-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 45;
}

.nh-ad-center-btn {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
}

.nh-ad-center-btn:active {
  transform: scale(0.92);
  background: rgba(0, 0, 0, 0.85);
}

.nh-preroll-bottom {
  position: absolute;
  bottom: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 45;
  pointer-events: none;
}

.nh-ad-timer {
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.5px;
  pointer-events: auto;
}

.nh-ad-skip-btn {
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  border: 1.5px solid rgba(255, 255, 255, 0.7);
  border-radius: 4px;
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  pointer-events: auto;
  min-width: 42px;
  text-align: center;
  transition: all 0.2s ease;
}

.nh-ad-skip-btn:disabled {
  opacity: 0.9;
  cursor: default;
  border-color: rgba(255, 255, 255, 0.45);
}

.nh-ad-countdown-box {
  display: inline-block;
  min-width: 14px;
}

.nh-ad-skip-btn.is-ready {
  background: #ff1744;
  border-color: #ff1744;
  color: #fff;
  box-shadow: 0 2px 10px rgba(255, 23, 68, 0.5);
}

/* ── Legacy fallback pre-roll ── */
.nh-preroll {
  position: absolute;
  inset: 0;
  z-index: 35;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nh-preroll-media {
  position: absolute;
  inset: 0;
  cursor: pointer;
}

.nh-preroll-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.nh-preroll-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: #ffca28;
  color: #000;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 4px;
  letter-spacing: .4px;
}

.nh-preroll-skip {
  position: absolute;
  bottom: 16px;
  right: 14px;
  background: rgba(0, 0, 0, .78);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .45);
  padding: 8px 14px;
  font-size: 13px;
  border-radius: 4px;
  cursor: pointer;
}

.nh-preroll-skip:disabled {
  opacity: .75;
  cursor: default;
}

.nh-preroll-skip:not(:disabled):active {
  background: rgba(255, 255, 255, .2);
}

/* Keep an unavailable source readable instead of leaving an empty black stage. */
.nh-player-failed .nh-player-toast {
  top: 50%; transform: translate(-50%, -50%); max-width: 86%;
  white-space: normal; text-align: center; padding: 20px;
  font-size: 15px; line-height: 1.5; border-radius: 12px;
}
.nh-player-failed .nh-player-center { display: none; }

/* ── Clean In-Feed Video Preview Mode (Zero Controls) ── */
.nh-player-root.nh-preview-mode .nh-player-center,
.nh-player-root.nh-preview-mode .nh-player-bottom,
.nh-player-root.nh-preview-mode .nh-player-toast,
.nh-player-root.nh-preview-mode .nh-player-subtitles,
.nh-player-root.nh-preview-mode .nh-center-btn,
.nh-player-root.nh-preview-mode .nh-ctrl-btn,
.nh-player-root.nh-preview-mode .nh-progress-container,
.nh-player-root.nh-preview-mode button,
.nh-player-root.has-ad-active .nh-player-center,
.nh-player-root.has-ad-active .nh-player-bottom,
.nh-player-root.has-ad-active .nh-player-toast,
.nh-player-root.has-ad-active .nh-player-subtitles,
.nh-player-root.has-ad-active .nh-center-btn,
.nh-player-root.has-ad-active .nh-ctrl-btn,
.nh-player-root.has-ad-active .nh-progress-container,
.nh-player-root.has-ad-active button {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}
