/* Live page (Live/IndexView): 9:16 player with a product / chat panel beside it. Uses the storefront tokens from
   assets/css/Layout/storefront.css and must sit inside .hv1. Design: docs/design-system.md */

.hv1 .v1-live {
  --v1-live-h: min(80vh, 720px);
  display: grid;
  grid-template-columns: calc(var(--v1-live-h) * 9 / 16) minmax(320px, 420px);
  justify-content: center;
  gap: 24px;
  margin-top: 24px;
}

/* ---------- Player ---------- */
.hv1 .v1-live-player {
  position: relative;
  height: var(--v1-live-h);
  background: #000;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

.hv1 .v1-live-player iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  /* viewers watch only: no YouTube hover UI (title, share, watch-on-YouTube) over the stream */
  pointer-events: none;
}

/* top-left overlay: LIVE + viewers */
.hv1 .v1-live-top {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 2;
  display: flex;
  gap: 6px;
  pointer-events: none;
}

.hv1 .v1-live-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}

.hv1 .v1-live-pill--live {
  background: var(--brand-primary-hover);
}

.hv1 .v1-live-pill--live .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
  animation: v1LiveBlink 1.2s infinite;
}

.hv1 .v1-live-pill[hidden] {
  display: none;
}

/* unmute button */
.hv1 .v1-live-unmute {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 0;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  backdrop-filter: blur(4px);
  cursor: pointer;
  transition: background 0.2s;
  animation: v1LivePulse 2s infinite;
}

.hv1 .v1-live-unmute:hover {
  background: var(--brand-primary-hover);
}

.hv1 .v1-live-unmute[hidden] {
  display: none;
}

@keyframes v1LivePulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(244, 114, 182, 0.55);
  }
  50% {
    box-shadow: 0 0 0 9px rgba(244, 114, 182, 0);
  }
}

/* "lagi dibahas" product card over the video */
.hv1 .v1-live-pinned {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 64px; /* above the YouTube control bar */
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  color: var(--text-dark) !important;
  text-decoration: none;
  transition:
    opacity 0.3s,
    transform 0.3s;
}

.hv1 .v1-live-pinned.is-hide {
  opacity: 0;
  transform: translateY(8px);
}

.hv1 .v1-live-pinned[hidden] {
  display: none;
}

.hv1 .v1-live-pinned-img {
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: #f8fafc;
  object-fit: contain;
  padding: 4px;
}

.hv1 .v1-live-pinned-body {
  flex: 1;
  min-width: 0;
  line-height: 1.25;
}

.hv1 .v1-live-pinned-tag {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--brand-primary-hover);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.hv1 .v1-live-pinned-name {
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hv1 .v1-live-pinned-price {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--brand-primary-hover);
}

/* white disc with a Bootstrap Icons x, overlapping the card's top-right corner */
.hv1 .v1-live-pinned-close {
  position: absolute;
  top: -10px;
  right: -8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid #e2e8f0;
  border-radius: 50%;
  background: #fff;
  color: var(--text-muted);
  font-size: 0.65rem;
  line-height: 1;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition:
    background 0.2s,
    color 0.2s,
    border-color 0.2s;
}

.hv1 .v1-live-pinned-close:hover {
  background: var(--brand-secondary);
  border-color: var(--brand-primary);
  color: var(--brand-primary-hover);
}

/* ---------- Side panel: Produk / Chat ---------- */
.hv1 .v1-live-panel {
  display: flex;
  flex-direction: column;
  height: var(--v1-live-h);
  background: #fff;
  border: 1px solid #f1f5f9;
  border-radius: 12px;
  overflow: hidden;
}

.hv1 .v1-live-tabs {
  display: flex;
  border-bottom: 1px solid #e2e8f0;
}

/* style.css gives every <button> display:flex, padding 6px 18px, a border and radius: reset all of it here */
.hv1 .v1-live-tab {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: -1px; /* active underline sits on the tab bar's border */
  padding: 14px 10px;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: none;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-muted);
  cursor: pointer;
  transition:
    color 0.2s,
    border-color 0.2s,
    background 0.2s;
}

.hv1 .v1-live-tab:hover {
  color: var(--brand-primary-hover);
  background: var(--brand-secondary);
}

.hv1 .v1-live-tab.is-active {
  color: var(--brand-primary-hover);
  border-bottom-color: var(--brand-primary-hover);
}

.hv1 .v1-live-tab .count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: #f1f5f9;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  transition:
    background 0.2s,
    color 0.2s;
}

.hv1 .v1-live-tab.is-active .count {
  background: var(--brand-primary-hover);
  color: #fff;
}

.hv1 .v1-live-pane {
  flex: 1;
  min-height: 0;
  display: none;
}

.hv1 .v1-live-pane.is-active {
  display: flex;
  flex-direction: column;
}

/* product list */
.hv1 .v1-live-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.hv1 .v1-live-list::-webkit-scrollbar {
  width: 4px;
}

.hv1 .v1-live-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.hv1 .v1-live-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  transition:
    background 0.2s,
    border-color 0.2s;
}

.hv1 .v1-live-item:hover {
  background: #f8fafc;
  border-color: var(--brand-primary);
}

.hv1 .v1-live-item.is-pinned {
  background: var(--brand-secondary);
}

.hv1 .v1-live-item-no {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 1;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--brand-primary-hover);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
}

/* etalase number inline (pinned card) */
.hv1 .v1-live-no {
  display: inline-block;
  margin-right: 6px;
  padding: 0 6px;
  border-radius: 4px;
  background: var(--brand-primary-hover);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  vertical-align: 1px;
}

/* list row the host just pinned: brief highlight, no auto-scroll (would yank a scrolling viewer) */
.hv1 .v1-live-item.is-flash {
  animation: v1-live-flash 1.4s ease-out;
}

@keyframes v1-live-flash {
  from {
    background: var(--brand-primary);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hv1 .v1-live-item.is-flash {
    animation: none;
  }
}

.hv1 .v1-live-item-img {
  position: relative;
  flex: 0 0 78px;
  width: 78px;
  height: 78px;
  border-radius: 8px;
  background: #f8fafc;
  overflow: hidden;
}

.hv1 .v1-live-item-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
}

.hv1 .v1-live-item-body {
  flex: 1;
  min-width: 0;
  color: var(--text-dark) !important;
  text-decoration: none;
}

.hv1 .v1-live-item-name {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* discount badge, same red as .v1-badge-sale */
.hv1 .v1-live-item-badge {
  display: inline-block;
  margin-top: 4px;
  padding: 1px 6px;
  border-radius: 4px;
  background: #ef4444;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
}

.hv1 .v1-live-item-price {
  margin-top: 2px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--brand-primary-hover);
}

.hv1 .v1-live-item-old {
  margin-left: 4px;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
  text-decoration: line-through;
}

.hv1 .v1-live-add {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: var(--brand-primary-hover);
  color: #fff !important;
  font-size: 1.1rem;
  text-decoration: none;
  cursor: pointer;
  transition:
    background 0.2s,
    transform 0.2s;
}

.hv1 .v1-live-add:hover {
  background: var(--brand-primary);
  transform: scale(1.08);
}

.hv1 .v1-live-add--sm {
  width: 32px;
  height: 32px;
  font-size: 0.95rem;
}

.hv1 .v1-live-empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.hv1 .v1-live-foot {
  padding: 10px 14px;
  border-top: 1px solid #e2e8f0;
  text-align: center;
  font-size: 0.8rem;
}

.hv1 .v1-live-foot a {
  color: var(--brand-primary-hover) !important;
  font-weight: 600;
  text-decoration: none;
}

.hv1 .v1-live-foot a:hover {
  text-decoration: underline;
}

.hv1 .v1-live-chat {
  flex: 1;
  width: 100%;
  border: 0;
  /* the chat embed uses dark_theme=1 (light text); keep it on a dark ground so it stays readable */
  background: #0f0f0f;
  color-scheme: dark;
}

/* keyboard focus: same pink ring as the rest of the storefront */
.hv1 .v1-live-tab:focus-visible,
.hv1 .v1-live-add:focus-visible,
.hv1 .v1-live-unmute:focus-visible,
.hv1 .v1-live-pinned-close:focus-visible,
.hv1 .v1-live-item-body:focus-visible,
.hv1 .v1-live-item-img:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 0.25rem rgba(244, 114, 182, 0.25);
}

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
  .hv1 .v1-live {
    --v1-live-h: min(72vh, 640px);
    grid-template-columns: calc(var(--v1-live-h) * 9 / 16) minmax(280px, 1fr);
    gap: 16px;
  }
}

@media (max-width: 767.98px) {
  .hv1 .v1-live {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .hv1 .v1-live-player {
    width: min(100%, calc(85vh * 9 / 16));
    height: auto;
    aspect-ratio: 9 / 16;
    margin: 0 auto;
  }

  .hv1 .v1-live-panel {
    height: 480px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hv1 .v1-live-unmute,
  .hv1 .v1-live-pill--live .dot {
    animation: none;
  }

  .hv1 .v1-live-pinned,
  .hv1 .v1-live-item,
  .hv1 .v1-live-add {
    transition: none;
  }
}
