/* Haberium Custom HTML5 Video Player */
.hb-player {
  position: relative;
  width: 100%;
  background: #0b0f19;
  border-radius: 12px;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  aspect-ratio: 16 / 9;
  box-shadow: 0 12px 32px -12px rgba(15, 23, 42, 0.45);
  font-family: inherit;
}

.embed-slot > .hb-player,
.nd-figure > .hb-player {
  width: 100%;
  height: 100%;
}

.article-body .hb-player {
  margin: 1.5rem 0;
}

.hb-player video {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  display: block;
  object-fit: contain;
  background: #000;
  cursor: pointer;
}

/* Floating / Sticky Mini Player */
.hb-player-placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  font-size: 13px;
  font-weight: 600;
}

.hb-player.is-floating {
  position: fixed !important;
  top: auto !important;
  left: auto !important;
  right: 20px !important;
  bottom: 20px !important;
  margin: 0 !important;
  width: 340px !important;
  height: auto !important;
  z-index: 99990 !important;
  border-radius: 12px;
  box-shadow: 0 20px 48px rgba(2, 6, 23, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.14);
  animation: hbFloatIn 0.2s ease-out;
}

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

.hb-player__float-close {
  display: none;
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 12;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 0;
  background: rgba(2, 6, 23, 0.78);
  color: #fff;
  font-size: 15px;
  line-height: 1;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.hb-player__float-close:hover {
  background: var(--color-primary, #dc2626);
}

.hb-player.is-floating .hb-player__float-close {
  display: inline-flex;
}

.hb-player.is-floating .hb-player__btn--skip,
.hb-player.is-floating .hb-player__btn--speed,
.hb-player.is-floating .hb-player__btn--share,
.hb-player.is-floating .hb-player__volume {
  display: none;
}

.hb-player__watermark {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 4;
  pointer-events: none;
  opacity: 0.72;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(6px);
  padding: 5px 10px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  max-width: 130px;
}

.hb-player__watermark img {
  display: block;
  max-height: 22px;
  width: auto;
  object-fit: contain;
}

/* Buffering Spinner */
.hb-player__spinner {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.22);
  border-top-color: var(--color-primary, #dc2626);
  z-index: 6;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  animation: hbSpin 0.8s linear infinite;
}

.hb-player.is-buffering .hb-player__spinner {
  opacity: 1;
}

@keyframes hbSpin {
  to { transform: rotate(360deg); }
}

.hb-player__center-play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  background: var(--color-primary, #dc2626);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  transition: transform 0.18s ease, opacity 0.2s ease, background-color 0.2s ease;
}

.hb-player__center-play:hover {
  transform: scale(1.08);
}

.hb-player__center-play svg {
  width: 28px;
  height: 28px;
  margin-left: 3px;
  fill: currentColor;
}

.hb-player.is-playing .hb-player__center-play,
.hb-player.is-buffering .hb-player__center-play,
.hb-player.is-ended .hb-player__center-play,
.hb-player.is-ad .hb-player__center-play {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.9);
}

/* Double-tap seek feedback */
.hb-player__seek-ripple {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 7;
  pointer-events: none;
  background: rgba(2, 6, 23, 0.72);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.hb-player__seek-ripple--left {
  left: 14%;
}

.hb-player__seek-ripple--right {
  right: 14%;
}

.hb-player__seek-ripple.is-visible {
  opacity: 1;
  transform: translateY(-50%) scale(1.06);
}

/* Toast notification (e.g. Link copied) */
.hb-player__toast {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  z-index: 14;
  background: rgba(2, 6, 23, 0.88);
  color: #fff;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.hb-player__toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* End Screen */
.hb-player__endscreen {
  position: absolute;
  inset: 0;
  z-index: 8;
  background: rgba(2, 6, 23, 0.78);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.hb-player.is-ended:not(.is-ad) .hb-player__endscreen {
  opacity: 1;
  pointer-events: auto;
}

.hb-player__end-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.hb-player__end-btn--primary {
  background: var(--color-primary, #dc2626);
  border-color: transparent;
}

.hb-player__end-btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.24);
}

.hb-player__end-btn--primary:hover {
  filter: brightness(1.08);
  background: var(--color-primary, #dc2626);
}

.hb-player__end-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Google IMA HTML5 SDK Ad Container */
.hb-player__ima-container {
  position: absolute;
  inset: 0;
  z-index: 16;
  width: 100%;
  height: 100%;
  display: none;
  background: #000;
}

.hb-player.is-ima-ad .hb-player__ima-container {
  display: block;
}

.hb-player.is-ima-ad .hb-player__center-play,
.hb-player.is-ima-ad .hb-player__controls,
.hb-player.is-ima-ad .hb-player__watermark {
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Pre-roll Ad Layer */
.hb-player__ad-layer {
  position: absolute;
  inset: 0;
  z-index: 15;
  background: #000;
  display: none;
}

.hb-player.is-ad .hb-player__ad-layer {
  display: block;
}

.hb-player__ad-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.hb-player__ad-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  background: rgba(2, 6, 23, 0.78);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.4);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.hb-player__ad-visit {
  position: absolute;
  bottom: 16px;
  left: 14px;
  z-index: 2;
  background: rgba(2, 6, 23, 0.8);
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.hb-player__ad-visit:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.hb-player__ad-skip {
  position: absolute;
  bottom: 16px;
  right: 14px;
  z-index: 2;
  background: rgba(2, 6, 23, 0.86);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.28);
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.hb-player__ad-skip:disabled {
  opacity: 0.75;
  cursor: default;
}

.hb-player__ad-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.2);
}

.hb-player__ad-progress-fill {
  height: 100%;
  width: 0%;
  background: #fbbf24;
}

/* Controls Overlay */
.hb-player__controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9;
  padding: 28px 14px 10px;
  background: linear-gradient(to top, rgba(2, 6, 23, 0.92) 0%, rgba(2, 6, 23, 0.55) 60%, transparent 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.hb-player.is-playing.is-idle:not(.is-seeking) .hb-player__controls {
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
}

.hb-player__progress-wrap {
  position: relative;
  width: 100%;
  height: 16px;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
}

.hb-player__progress-tooltip {
  position: absolute;
  bottom: 20px;
  transform: translateX(-50%);
  background: rgba(2, 6, 23, 0.92);
  color: #fff;
  padding: 3px 7px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
  white-space: nowrap;
}

.hb-player__progress-wrap:hover .hb-player__progress-tooltip,
.hb-player.is-seeking .hb-player__progress-tooltip {
  opacity: 1;
}

.hb-player__progress-track {
  position: relative;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  overflow: visible;
  transition: height 0.15s ease;
}

.hb-player__progress-wrap:hover .hb-player__progress-track,
.hb-player.is-seeking .hb-player__progress-track {
  height: 6px;
}

.hb-player__progress-buffer {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 999px;
}

.hb-player__progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: var(--color-primary, #dc2626);
  border-radius: 999px;
}

.hb-player__progress-thumb {
  position: absolute;
  right: -6px;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  transform: translateY(-50%) scale(0);
  transition: transform 0.12s ease;
}

.hb-player__progress-wrap:hover .hb-player__progress-thumb,
.hb-player.is-seeking .hb-player__progress-thumb {
  transform: translateY(-50%) scale(1);
}

.hb-player__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.hb-player__left,
.hb-player__right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hb-player__btn {
  background: transparent;
  border: 0;
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  font-size: 12px;
  font-weight: 700;
  transition: background-color 0.15s ease;
}

.hb-player__btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

.hb-player__btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hb-player__btn--speed {
  width: auto;
  padding: 0 8px;
  font-size: 12px;
  letter-spacing: 0.01em;
}

.hb-player__time {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  font-variant-numeric: tabular-nums;
  margin-left: 4px;
  white-space: nowrap;
}

.hb-player__volume {
  width: 64px;
  accent-color: var(--color-primary, #dc2626);
  cursor: pointer;
  height: 4px;
}

@media (max-width: 576px) {
  .hb-player__volume,
  .hb-player__btn--skip {
    display: none;
  }
  .hb-player__center-play {
    width: 56px;
    height: 56px;
  }
  .hb-player__watermark {
    top: 8px;
    right: 8px;
    max-width: 96px;
    padding: 3px 7px;
  }
  .hb-player__watermark img {
    max-height: 16px;
  }
  .hb-player.is-floating {
    right: 10px;
    bottom: 10px;
    width: 240px !important;
  }
}
