/* 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;
  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;
  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 {
  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-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;
  bottom: 34dvh;
  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;
  max-height: 32dvh;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.78) 38%);
}

.shopcast-chat-list {
  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 13px/1.4 -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: 999px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  padding: 9px 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: 999px;
  background: var(--shopcast-accent, #e63946);
  color: #fff;
  font: 600 13px/1 -apple-system, system-ui, sans-serif;
  padding: 0 16px;
  cursor: pointer;
}

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

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