/* ShopCast storefront widget styles.
   Everything is namespaced under .shopcast-* and uses maximum z-index
   restraint: above content, below Shopify's own modals (which use ~2^31). */

.shopcast-root {
  --shopcast-primary: #1a1a1a;
  --shopcast-accent: #e63946;
  --shopcast-radius: 14px;
  position: fixed;
  z-index: 999990;
  pointer-events: none;
}

/* ---- mini player ---- */

.shopcast-mini {
  position: fixed;
  /* ~20% of viewport height, 9:16 aspect */
  height: 20vh;
  min-height: 130px;
  max-height: 240px;
  aspect-ratio: 9 / 16;
  border-radius: var(--shopcast-radius);
  overflow: hidden;
  background: #000;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  z-index: 999990;
}

.shopcast-mini:hover,
.shopcast-mini:focus-visible {
  transform: scale(1.04);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.45);
  outline: 2px solid var(--shopcast-accent);
  outline-offset: 2px;
}

.shopcast-root[data-position="right-center"] .shopcast-mini {
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
}
.shopcast-root[data-position="right-center"] .shopcast-mini:hover,
.shopcast-root[data-position="right-center"] .shopcast-mini:focus-visible {
  transform: translateY(-50%) scale(1.04);
}
.shopcast-root[data-position="right-bottom"] .shopcast-mini {
  right: 16px;
  bottom: 16px;
}
.shopcast-root[data-position="left-center"] .shopcast-mini {
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
}
.shopcast-root[data-position="left-center"] .shopcast-mini:hover,
.shopcast-root[data-position="left-center"] .shopcast-mini:focus-visible {
  transform: translateY(-50%) scale(1.04);
}
.shopcast-root[data-position="left-bottom"] .shopcast-mini {
  left: 16px;
  bottom: 16px;
}

.shopcast-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #000;
}

.shopcast-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  background: var(--shopcast-accent);
  color: #fff;
  font: 700 10px/1 -apple-system, system-ui, sans-serif;
  letter-spacing: 0.08em;
  padding: 4px 7px;
  border-radius: 5px;
  animation: shopcast-pulse 1.8s infinite;
}

@keyframes shopcast-pulse {
  50% {
    opacity: 0.6;
  }
}

.shopcast-badge--test {
  top: auto;
  bottom: 8px;
  background: #b58900;
  animation: none;
}

@media (prefers-reduced-motion: reduce) {
  .shopcast-badge {
    animation: none;
  }
  .shopcast-mini {
    transition: none;
  }
}

.shopcast-mini-close {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}

.shopcast-mini:hover .shopcast-mini-close,
.shopcast-mini:focus-within .shopcast-mini-close {
  opacity: 1;
}

.shopcast-mini--error {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--shopcast-primary);
}

.shopcast-fallback {
  color: #fff;
  font: 600 12px/1.4 -apple-system, system-ui, sans-serif;
  text-align: center;
  padding: 12px;
}

/* ---- expanded view ---- */

.shopcast-lock {
  overflow: hidden;
}

.shopcast-x {
  /* Height of the chat band at the bottom of the expanded player.
     CTAs and the featured-product card sit just above it. */
  --shopcast-chat-h: 15dvh;
  position: fixed;
  inset: 0;
  z-index: 999995;
  background: rgba(10, 10, 12, 0.92);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.shopcast-x-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(100vw, calc(100dvh * 9 / 16));
  height: 100dvh;
  max-height: 100dvh;
  background: #000;
}

@media (min-width: 760px) {
  .shopcast-x-stage {
    height: 92dvh;
    border-radius: 18px;
    overflow: hidden;
  }
}

.shopcast-x-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: linear-gradient(rgba(0, 0, 0, 0.65), transparent);
}

.shopcast-x-title {
  color: #fff;
  font: 600 14px/1.3 -apple-system, system-ui, sans-serif;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shopcast-x-controls {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.shopcast-ctrl {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}

.shopcast-ctrl:hover,
.shopcast-ctrl:focus-visible {
  background: rgba(255, 255, 255, 0.3);
  outline: 2px solid #fff;
}

.shopcast-ctrl--active {
  background: var(--shopcast-accent, #e63946);
}

.shopcast-x-video {
  position: absolute;
  inset: 0;
}

.shopcast-x-video .shopcast-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---- CTAs ---- */

.shopcast-ctas {
  position: absolute;
  left: 0;
  right: 0;
  /* Chat hidden (default): sit near the bottom. */
  bottom: 92px;
  z-index: 2;
  display: flex;
  gap: 8px;
  padding: 0 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.shopcast-ctas::-webkit-scrollbar {
  display: none;
}

.shopcast-cta {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: rgba(255, 255, 255, 0.95);
  color: #111;
  padding: 7px 12px 7px 7px;
  cursor: pointer;
  flex-shrink: 0;
  max-width: 240px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.shopcast-x .shopcast-cta {
  border-radius: 12px;
}

.shopcast-x[data-button-style="pill"] .shopcast-cta {
  border-radius: 999px;
}

.shopcast-x[data-button-style="square"] .shopcast-cta {
  border-radius: 2px;
}

.shopcast-cta-img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
}

.shopcast-cta-label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  font: 500 11px/1.3 -apple-system, system-ui, sans-serif;
  overflow: hidden;
}

.shopcast-cta-label strong {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 170px;
}

.shopcast-cta-label span {
  color: var(--shopcast-accent, #e63946);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.shopcast-cta--added .shopcast-cta-label span {
  color: #0a7d33;
}

/* ---- chat ---- */

.shopcast-chat {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  /* Content-sized and pinned to the bottom: the input/Send row sits at the
     very bottom, messages stack up above it (capped below). */
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.82) 45%);
}

.shopcast-chat--hidden {
  display: none;
}

.shopcast-chat-list {
  /* Grows upward with new messages, capped at ~15% of the frame so the
     video stays visible; older messages scroll off the top. */
  max-height: var(--shopcast-chat-h);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
  mask-image: linear-gradient(transparent, #000 14%);
  -webkit-mask-image: linear-gradient(transparent, #000 14%);
}

.shopcast-msg {
  color: #fff;
  font: 400 15px/1.45 -apple-system, system-ui, sans-serif;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
  word-break: break-word;
}

.shopcast-msg strong {
  color: #9ec5ff;
  margin-right: 5px;
  font-weight: 600;
}

.shopcast-msg--host strong {
  color: var(--shopcast-accent, #ff7b88);
}

.shopcast-chat-form {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.shopcast-chat-input {
  flex: 1;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  padding: 11px 14px;
  font-size: 16px; /* prevents iOS zoom-on-focus */
}

.shopcast-chat-input::placeholder {
  color: rgba(255, 255, 255, 0.55);
}

.shopcast-chat-send {
  border: 0;
  border-radius: 10px;
  background: var(--shopcast-accent, #e63946);
  color: #fff;
  font: 600 14px/1 -apple-system, system-ui, sans-serif;
  padding: 0 18px;
  cursor: pointer;
}

/* ---- camera-off placeholder ---- */

.shopcast-placeholder {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.shopcast-placeholder--empty {
  background: var(--shopcast-primary, #111);
}

/* ---- featured (host showcase) product ---- */

.shopcast-feature {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  cursor: pointer;
  pointer-events: auto;
  background: rgba(255, 255, 255, 0.97);
  color: #111;
  text-align: left;
  padding: 8px 12px 8px 8px;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  font-family: -apple-system, system-ui, sans-serif;
}

/* compact card by the mini player */
.shopcast-feature--mini {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 999991;
  max-width: 250px;
  animation: shopcast-feature-in 0.25s ease;
}

/* prominent card above the chat in expanded view */
.shopcast-feature--expanded {
  position: absolute;
  left: 12px;
  right: 12px;
  /* Chat hidden (default): sit near the bottom. */
  bottom: 16px;
  z-index: 2;
  max-width: 420px;
  margin: 0 auto;
  animation: shopcast-feature-in 0.25s ease;
}

/* When chat is open, lift the CTAs/featured card above the chat band. */
.shopcast-x--chat-open .shopcast-ctas {
  bottom: calc(var(--shopcast-chat-h) + 148px);
}

.shopcast-x--chat-open .shopcast-feature--expanded {
  bottom: calc(var(--shopcast-chat-h) + 72px);
}

@keyframes shopcast-feature-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .shopcast-feature {
    animation: none;
  }
}

.shopcast-feature-img {
  width: 46px;
  height: 46px;
  border-radius: 9px;
  object-fit: cover;
  flex-shrink: 0;
}

.shopcast-feature-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.shopcast-feature-eyebrow {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--shopcast-accent, #e63946);
}

.shopcast-feature-info strong {
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shopcast-feature-price {
  font-size: 13px;
  color: #444;
}

.shopcast-feature-cta {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--shopcast-accent, #e63946);
}

/* ---- mobile sizing ---- */

@media (max-width: 759px) {
  .shopcast-mini {
    height: 18vh;
    min-height: 120px;
  }
  .shopcast-x-stage {
    width: 100vw;
    border-radius: 0;
  }
  .shopcast-feature--mini {
    max-width: 60vw;
  }
}
