/**
 * webinar-hcr.css — Isolated HCR Room Stylesheet
 * All selectors scoped to .wi-hcr — no conflict with legacy webinar-modern.css.
 * Target: < 8 KB minified.
 */

/* ── Layout Variables ──────────────────────────────────────────────────── */
.wi-hcr {
  --wi-hcr-top-offset: 0px; /* Set by PHP via inline --wi-hcr-top-offset if admin bar active */
  --wi-hcr-header-h: 50px;
  --wi-hcr-sidebar-w: min(400px, 32vw);
  --wi-hcr-bg: #1a1a1a;
  --wi-hcr-sidebar-bg: #f5f5f5;
  --wi-hcr-header-bg: #1a1a1a;
  --wi-hcr-header-color: #fff;
  --wi-hcr-tab-active-bg: #fff;
  --wi-hcr-tab-bg: #e5e5e5;
  --wi-hcr-tab-border: #ddd;
  --wi-hcr-btn-radius: 4px;
  --wi-hcr-join-bg: #6bba40;
  --wi-hcr-join-color: #fff;
  /* Room Q&A "Chat: on" pill — same values as mountLiveQaAdminToggle() in webinarignition-cta-live-frontend(-a312).js */
  --wi-hcr-live-chat-on-bg: rgba(76, 175, 80, 0.5);
  --wi-hcr-live-chat-on-color: #fff;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  /* Break out of theme content-width constraint (same technique as legacy HCR shell). */
  width: 100vw;
  max-width: 100vw;
  margin-left: calc((100% - 100vw) / 2);
  margin-right: 0;
  overflow-x: hidden;
  min-height: calc(100vh - var(--wi-hcr-top-offset));
  background: var(--wi-hcr-bg);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  position: relative;
}

.wi-hcr *,
.wi-hcr *::before,
.wi-hcr *::after {
  box-sizing: inherit;
}

/* ── Header ──────────────────────────────────────────────────────────── */
.wi-hcr__header {
  background: var(--wi-hcr-header-bg);
  color: var(--wi-hcr-header-color);
  height: var(--wi-hcr-header-h);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  padding: 0 12px;
  position: sticky;
  top: var(--wi-hcr-top-offset);
  z-index: 100;
}
.wi-hcr__header-inner {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 12px;
}
.wi-hcr__title { font-size: 15px; font-weight: 600; flex: 1 1 0; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wi-hcr__host  { font-size: 13px; opacity: .75; white-space: nowrap; }

/* ── Admin Bar ───────────────────────────────────────────────────────── */
.wi-hcr__admin-bar { flex: 0 0 auto; }
.wi-hcr__admin-bar-inner { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.wi-hcr__admin-chat-toggle,
.wi-hcr__admin-cta-toggle,
.wi-hcr__admin-cta-reload {
  border: none; cursor: pointer; border-radius: var(--wi-hcr-btn-radius); padding: 4px 10px; font-size: 12px; font-weight: 600; line-height: 1.4;
}
.wi-hcr__admin-cta-ctrl { display: flex; align-items: center; gap: 4px; font-size: 12px; color: #fff; }
.wi-hcr__admin-cta-reload { background: rgba(255,255,255,0.15); color: #fff; }

/* ── Body: stage + sidebar (always video above, sidebar below) ──────── */
.wi-hcr__body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  min-height: 0;
}

.wi-hcr__stage {
  width: 100%;
  flex: 0 0 auto;
  min-width: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

/* 100ms: let stage consume space between header and sidebar (no tall black band) */
.wi-hcr__body:has(.wi-hcr__video--100ms) .wi-hcr__stage {
  flex: 1 1 auto;
  min-height: 0;
}

/* ── Video containers ───────────────────────────────────────────────── */
.wi-hcr__video {
  position: relative;
  background: #000;
  overflow: hidden;
  box-sizing: border-box;
}

/* YouTube: aspect from oEmbed (--wi-hcr-ar-*); pixel size refined by JS */
.wi-hcr__video--youtube {
  width: 100%;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  aspect-ratio: var(--wi-hcr-ar-w, 16) / var(--wi-hcr-ar-h, 9);
  max-height: calc(100dvh - var(--wi-hcr-header-h) - var(--wi-hcr-top-offset) - 8px);
}

/* 100ms: definite column height (mobile dvh + safe-area) + flex column (modern #vidBox parity) */
.wi-hcr__video--100ms {
  width: 100%;
  max-width: 100%;
  aspect-ratio: unset;
  min-width: 0;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: clamp(220px, calc(100dvh - var(--wi-hcr-header-h) - var(--wi-hcr-top-offset) - env(safe-area-inset-bottom, 0px) - 8px), 100dvh);
  height: clamp(220px, calc(100dvh - var(--wi-hcr-header-h) - var(--wi-hcr-top-offset) - env(safe-area-inset-bottom, 0px) - 8px), 100dvh);
  max-height: calc(100dvh - var(--wi-hcr-header-h) - var(--wi-hcr-top-offset) - env(safe-area-inset-bottom, 0px));
}

/* Isolated HCR dequeues webinar-modern.css — mirror #vidBox.wi-100ms-vidbox flex-fill here. */
.wi-hcr #vidBox.wi-hcr-100ms-vidbox.wi-hcr__hms-container {
  overflow: hidden;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  height: 100%;
  background: #000;
}

.wi-hcr__video--100ms .wi-hcr__hms-room {
  min-height: 100%;
}

.wi-hcr #vidBox.wi-hcr-100ms-vidbox #wi-hcr-hms-root {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
}

.wi-hcr #vidBox.wi-hcr-100ms-vidbox #wi-hcr-hms-root > iframe,
.wi-hcr #vidBox.wi-hcr-100ms-vidbox iframe {
  display: block;
  flex: 1 1 auto;
  width: 100% !important;
  max-width: 100%;
  height: 100% !important;
  min-height: 100%;
  border: 0;
}

/* Shared skeleton */
.wi-hcr__yt-skeleton,
.wi-hcr__hms-skeleton {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: #111;
  z-index: 2;
}
.wi-hcr__yt-skeleton-spinner,
.wi-hcr__hms-skeleton-spinner {
  width: 40px; height: 40px;
  border: 3px solid rgba(255,255,255,0.15);
  border-top-color: #fff;
  border-radius: 50%;
  animation: wi-hcr-spin 0.8s linear infinite;
}
@keyframes wi-hcr-spin { to { transform: rotate(360deg); } }

/* YT player slot fills container */
.wi-hcr__yt-container,
.wi-hcr__hms-container {
  width: 100%; height: 100%; position: relative;
}
.wi-hcr__yt-player-slot {
  position: absolute; inset: 0; z-index: 1;
}
.wi-hcr__yt-mute-layer {
  position: absolute; inset: 0; z-index: 6;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
/* Same ink as registration / live Q&A Submit (#chatQuestion): CTA vars + chevrons (see webinar-modern.css TY #wi_ctaVideo). */
.wi-hcr__yt-audio-btn {
  pointer-events: auto;
  width: auto !important;
  max-width: 92%;
  min-height: 44px;
  height: auto;
  padding: 0.75rem 1.25rem !important;
  box-sizing: border-box;
  cursor: pointer;
  font-weight: 600;
  font-size: inherit;
  line-height: 1.25;
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
  --wi-fse-p: var(--wi-cta-bg, var(--wi-fse-cta-fill, var(--wi-fse-accent, #32373c)));
  --wi-fse-c: var(--wi-cta-color, var(--wi-fse-cta-text, #ffffff));
  background-color: var(--wi-fse-p) !important;
  background-image: url(../../inc/lp/images/arrows2.png) !important;
  background-repeat: no-repeat !important;
  background-position: right center !important;
  background-size: auto 100% !important;
  color: var(--wi-fse-c) !important;
  -webkit-text-fill-color: var(--wi-fse-c) !important;
  text-shadow: none !important;
  border: none !important;
  border-radius: 0.33em;
  box-shadow: none !important;
}
.wi-hcr__yt-audio-btn:hover,
.wi-hcr__yt-audio-btn:focus {
  background-color: color-mix(in srgb, var(--wi-fse-p) 86%, #000) !important;
  color: var(--wi-fse-c) !important;
  -webkit-text-fill-color: var(--wi-fse-c) !important;
  outline: none;
}
@supports not (background-color: color-mix(in srgb, red, blue)) {
  .wi-hcr__yt-audio-btn:hover,
  .wi-hcr__yt-audio-btn:focus {
    filter: brightness(0.92);
  }
}

/* ── 100ms Preflight ────────────────────────────────────────────────── */
.wi-hcr__hms-preflight,
.wi-hcr__hms-room,
.wi-hcr__hms-error {
  position: absolute; inset: 0; z-index: 3;
  display: flex; align-items: center; justify-content: center;
  background: #111;
}
.wi-hcr__preflight {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 20px; max-width: 480px; width: 100%; color: #fff;
}
.wi-hcr__preflight-preview {
  width: 100%; aspect-ratio: 4/3; background: #000; border-radius: 8px; overflow: hidden; position: relative;
}
.wi-hcr__preflight-video { width: 100%; height: 100%; object-fit: cover; }
.wi-hcr__preflight-no-cam {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 48px;
}
.wi-hcr__preflight-controls { display: flex; gap: 12px; }
.wi-hcr__preflight-toggle-cam,
.wi-hcr__preflight-toggle-mic {
  padding: 10px 16px; border: none; border-radius: 50%; background: rgba(255,255,255,0.15);
  color: #fff; cursor: pointer; font-size: 18px; transition: background 0.2s;
}
.wi-hcr__preflight-toggle--off { background: rgba(244,67,54,0.5); }
.wi-hcr__preflight-join {
  width: 100%; padding: 14px; border: none; border-radius: var(--wi-hcr-btn-radius);
  background: var(--wi-hcr-join-bg); color: var(--wi-hcr-join-color);
  font-size: 16px; font-weight: 700; cursor: pointer; transition: opacity 0.2s;
}
.wi-hcr__preflight-join:hover { opacity: .85; }
.wi-hcr__preflight-hint { font-size: 12px; color: rgba(255,255,255,.6); text-align: center; margin: 0; }

.wi-hcr__hms-error { flex-direction: column; gap: 12px; }
.wi-hcr__hms-error-msg { color: #f44; text-align: center; padding: 0 20px; }
.wi-hcr__hms-retry { padding: 10px 24px; background: var(--wi-hcr-join-bg); color: var(--wi-hcr-join-color); border: none; border-radius: var(--wi-hcr-btn-radius); cursor: pointer; font-weight: 600; }

/* ── Overlay CTA ─────────────────────────────────────────────────────── */
.wi-hcr__overlay-cta-host {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0; pointer-events: none; z-index: 5;
}
.wi-hcr__overlay-cta {
  position: absolute; top: 20px; left: 50%; transform: translateX(-50%);
  max-width: 90%; pointer-events: auto;
}
.wi-hcr__overlay-eye {
  position: absolute; top: -14px; left: 50%; transform: translateX(-50%);
  font-size: 22px; cursor: pointer; z-index: 6;
}
.wi-hcr__overlay-body {
  background: #fff; border-radius: 8px; padding: 16px; box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  position: relative;
}
.wi-hcr__overlay-hide {
  position: absolute; top: 6px; right: 10px; cursor: pointer; font-size: 14px; color: #888; line-height: 1;
}
.wi-hcr__overlay-copy { margin-bottom: 10px; }
.wi-hcr__overlay-btn { display: block; width: 100%; text-align: center; padding: 10px; border-radius: var(--wi-hcr-btn-radius); }

/* ── Sidebar / Tabs ──────────────────────────────────────────────────── */
.wi-hcr__sidebar {
  background: var(--wi-hcr-sidebar-bg);
  border-top: 1px solid var(--wi-hcr-tab-border);
  border-left: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  width: 100%;
  flex: 0 0 auto;
  min-height: 0;
  max-height: none;
}
/* Hidden until JS adds CTA tabs (for rooms with Q&A disabled) */
.wi-hcr__sidebar--empty { display: none !important; }
.wi-hcr__sidebar--qa-hidden .wi-hcr__tab-item--qa { display: none; }

.wi-hcr__tabs { flex: 0 0 auto; border-bottom: 1px solid var(--wi-hcr-tab-border); }
.wi-hcr__tab-list { display: flex; list-style: none; margin: 0; padding: 0; overflow-x: auto; }
.wi-hcr__tab-item { flex: 0 0 auto; }
.wi-hcr__tab-item--hidden { display: none; }
.wi-hcr__tab-btn {
  border: none; background: var(--wi-hcr-tab-bg); padding: 10px 14px;
  font-size: 13px; cursor: pointer; white-space: nowrap; border-bottom: 2px solid transparent; transition: background 0.15s;
}
.wi-hcr__tab-btn--active {
  background: var(--wi-hcr-tab-active-bg); border-bottom-color: #333; font-weight: 600;
}
.wi-hcr__tab-btn:hover { background: #e0e0e0; }

.wi-hcr__panes { flex: 1 1 0; overflow-y: auto; }
.wi-hcr__pane { display: none; padding: 12px; }
.wi-hcr__pane--active { display: block; }
.wi-hcr__pane--hidden { display: none !important; }

.wi-hcr__sidebar-cta-btn { display: block; width: 100%; text-align: center; padding: 10px; margin-top: 8px; border-radius: var(--wi-hcr-btn-radius); }

/* ── HCR-Context: Admin-Bar overrides for legacy #cta-controls-bar ─── */
/* Hide the legacy toggle-arrow + gear-icon — not needed in the HCR header. */
.wi-hcr .toggle-icon-container { display: none !important; }

/* Keep the container as an inline-flex child of .wi-hcr__header-inner. */
.wi-hcr #cta-toggle-parent-container {
  display: inline-flex !important;
  align-items: center !important;
  overflow: visible !important;
  max-width: 60%;
}

/* Force the controls bar to stay visible and horizontal — no expand/collapse. */
.wi-hcr #cta-controls-bar,
.wi-hcr #cta-controls-bar.bar-closed {
  display: inline-flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 4px !important;
  padding: 0 !important;
  background: transparent !important;
  height: auto !important;
  max-height: none !important;
  min-height: 0 !important;
  opacity: 1 !important;
  overflow: visible !important;
}

/* Sticky-hide override: needed because .hide() (inline display:none) loses
   to other stylesheet rules that use display:flex !important on overlay CTA layers. */
.wi-cta-user-hidden,
.wi-cta-user-hidden[id^="overlayCta"],
.wi-cta-user-hidden[id^="orderBTN"],
.wi-cta-user-hidden[id^="wi-cta-"],
.wi-high-capacity-gb-shortcode-shell .wi-cta-user-hidden,
.wi-high-capacity-gb-shortcode-shell [id^="overlayCta"].wi-cta-user-hidden,
.wi-high-capacity-gb-shortcode-shell [id^="overlayCta"] .timedUnderArea.wi-cta-user-hidden {
    display: none !important;
}
