/* Live Brand Preview — theme dock panel */

/* Landing iframe embed: keep dock visible, sized to iframe viewport */
body.bb-premium-embed .bb-premium-theme-dock {
  right: 12px;
  bottom: 12px;
  width: min(300px, calc(100vw - 24px));
  max-height: min(70vh, 520px);
}

/* Collapsed dock: shrink hit area to header pill only (full width was blocking step buttons) */
body.bb-premium-embed .bb-premium-theme-dock.is-collapsed {
  width: max-content;
  max-width: min(300px, calc(100vw - 24px));
  pointer-events: none;
}

body.bb-premium-embed .bb-premium-theme-dock.is-collapsed .bb-premium-theme-dock__head {
  pointer-events: auto;
}

@media (max-width: 899px) {
  body.bb-premium-embed .bb-premium-theme-dock {
    right: 8px;
    bottom: 8px;
    width: min(248px, calc(100vw - 16px));
    max-height: min(52vh, 380px);
    font-size: 11.5px;
  }

  body.bb-premium-embed.is-embed-fullscreen .bb-premium-theme-dock {
    bottom: max(8px, env(safe-area-inset-bottom, 0px));
  }

  /* Minimized pill — compact on mobile embed; +10% wider than prior minimized size */
  body.bb-premium-embed .bb-premium-theme-dock.is-collapsed,
  body.bb-premium-embed.is-embed-mobile .bb-premium-theme-dock.is-collapsed {
    width: max-content;
    max-width: min(calc(248px * 0.935), calc((100vw - 16px) * 0.935));
    transform: scale(0.6545);
    transform-origin: 100% 100%;
  }

  /* Expanded panel — 20% wider on mobile embed */
  body.bb-premium-embed.is-embed-mobile .bb-premium-theme-dock:not(.is-collapsed) {
    width: min(calc(248px * 1.2), calc(100vw - 16px));
  }
}

body.bb-premium-embed.bb-premium-modal-example-page .bb-theme-shell {
  padding-bottom: 56px;
}

/* Landing iframe: stay collapsed on load — no breathe pulse until expanded */
body.bb-premium-embed .bb-premium-theme-dock.is-collapsed {
  animation: none;
}

body.bb-premium-embed .bb-premium-theme-dock.is-collapsed .bb-premium-theme-dock__brand-icon,
body.bb-premium-embed .bb-premium-theme-dock.is-collapsed .bb-premium-theme-dock__brand-icon::after {
  animation: none;
}

/* Expanded Live Brand Preview panel — above embed play/pause + step controls */
body.bb-premium-embed .bb-premium-theme-dock:not(.is-collapsed) {
  z-index: 2147483647;
}

body.bb-premium-embed:has(.bb-premium-theme-dock:not(.is-collapsed)) .bb-premium-demo-controls,
body.bb-premium-embed:has(.bb-premium-theme-dock:not(.is-collapsed)) .bb-premium-demo-controls--top {
  z-index: 2147483600;
}

.bb-premium-theme-dock {
  --tfs-accent: #635bff;
  --tfs-accent-soft: rgba(99, 91, 255, 0.55);
  --tfs-surface: rgba(12, 14, 22, 0.82);
  --tfs-surface-elevated: rgba(255, 255, 255, 0.06);
  --tfs-border: rgba(255, 255, 255, 0.1);
  --tfs-border-strong: rgba(255, 255, 255, 0.16);
  --tfs-text: rgba(255, 255, 255, 0.94);
  --tfs-text-muted: rgba(255, 255, 255, 0.55);
  --tfs-radius: 20px;
  --tfs-radius-sm: 12px;

  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2147483000;
  width: min(320px, calc(100vw - 40px));
  max-height: min(80vh, 580px);
  display: flex;
  flex-direction: column;
  border-radius: var(--tfs-radius);
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.08) 0%, transparent 42%),
    var(--tfs-surface);
  border: 1px solid var(--tfs-border);
  box-shadow:
    0 0 0 1px rgba(99, 91, 255, 0.12),
    0 24px 64px rgba(0, 0, 0, 0.45),
    0 0 48px rgba(99, 91, 255, 0.14);
  color: var(--tfs-text);
  font: 500 12.5px/1.45 Roboto, system-ui, -apple-system, sans-serif;
  backdrop-filter: blur(24px) saturate(1.35);
  -webkit-backdrop-filter: blur(24px) saturate(1.35);
  pointer-events: auto;
  isolation: isolate;
  overflow: hidden;
  transform-origin: 100% 100%;
}

@keyframes bb-tfs-dock-breathe-collapsed {
  0%, 100% {
    transform: scale(1);
    box-shadow:
      0 0 0 1px rgba(99, 91, 255, 0.16),
      0 22px 58px rgba(0, 0, 0, 0.44),
      0 0 40px rgba(99, 91, 255, 0.2);
  }
  50% {
    transform: scale(1.0425);
    box-shadow:
      0 0 0 1px rgba(99, 91, 255, 0.33),
      0 27px 69px rgba(99, 91, 255, 0.29),
      0 0 56px rgba(99, 91, 255, 0.39);
  }
}

@keyframes bb-tfs-dock-icon-breathe-collapsed {
  0%, 100% {
    transform: scale(1);
    box-shadow:
      0 8px 20px rgba(99, 91, 255, 0.28),
      inset 0 1px 0 rgba(255, 255, 255, 0.18);
  }
  50% {
    transform: scale(1.07);
    box-shadow:
      0 10px 24px rgba(99, 91, 255, 0.42),
      0 0 18px rgba(99, 91, 255, 0.32),
      inset 0 1px 0 rgba(255, 255, 255, 0.23);
  }
}

body.bb-premium-demo-motion-paused .bb-premium-theme-dock,
body.bb-premium-demo-motion-paused .bb-premium-theme-dock.is-collapsed .bb-premium-theme-dock__brand-icon,
body.bb-premium-demo-motion-paused .bb-premium-theme-dock__brand-icon::after {
  animation-play-state: paused !important;
}

.bb-premium-theme-dock::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.22) 0%,
    rgba(99, 91, 255, 0.35) 40%,
    rgba(99, 91, 255, 0.2) 70%,
    rgba(255, 255, 255, 0.06) 100%
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.bb-premium-theme-dock a,
.bb-premium-theme-dock button,
.bb-premium-theme-dock input,
.bb-premium-theme-dock textarea,
.bb-premium-theme-dock select,
.bb-premium-theme-dock label {
  pointer-events: auto;
}

.bb-premium-theme-dock.is-collapsed {
  max-height: none;
  will-change: transform, box-shadow;
  animation: bb-tfs-dock-breathe-collapsed 3.7s ease-in-out infinite;
}

.bb-premium-theme-dock.is-collapsed .bb-premium-theme-dock__body {
  display: none;
}

.bb-premium-theme-dock.is-collapsed .bb-premium-theme-dock__toggle-icon {
  transform: rotate(-90deg);
}

.bb-premium-theme-dock.is-collapsed .bb-premium-theme-dock__brand-icon {
  transform-origin: center center;
  will-change: transform, box-shadow;
  animation: bb-tfs-dock-icon-breathe-collapsed 3.7s ease-in-out infinite;
}

.bb-premium-theme-dock.is-collapsed .bb-premium-theme-dock__brand-icon::after {
  animation-duration: 3.4s;
}

/* ---- Header ---- */

.bb-premium-theme-dock__head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--tfs-border);
  flex-shrink: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, transparent 100%);
}

.bb-premium-theme-dock__brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  flex: 1 1 auto;
}

.bb-premium-theme-dock__brand-icon {
  position: relative;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  overflow: hidden;
  background: #0c1020;
  box-shadow:
    0 8px 20px rgba(99, 91, 255, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

@keyframes bb-tfs-brand-icon-shine {
  0% {
    background-position: 220% center;
  }
  100% {
    background-position: -120% center;
  }
}

/* Frosted glass base over mood video */
.bb-premium-theme-dock__brand-icon::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(
    148deg,
    rgba(255, 255, 255, 0.32) 0%,
    rgba(255, 255, 255, 0.08) 42%,
    rgba(255, 255, 255, 0.02) 58%,
    rgba(255, 255, 255, 0.14) 100%
  );
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.42),
    inset 0 -1px 0 rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(2px) saturate(1.2);
  -webkit-backdrop-filter: blur(2px) saturate(1.2);
}

/* Shimmer sweep across the chip */
.bb-premium-theme-dock__brand-icon::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(
    108deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0) 36%,
    rgba(255, 255, 255, 0.55) 50%,
    rgba(255, 255, 255, 0) 64%,
    rgba(255, 255, 255, 0) 100%
  );
  background-size: 240% 100%;
  background-repeat: no-repeat;
  background-position: 220% center;
  mix-blend-mode: overlay;
  animation: bb-tfs-brand-icon-shine 2.6s ease-in-out infinite;
}

.bb-premium-theme-dock__brand-icon-video {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.bb-premium-theme-dock__brand-icon img {
  position: relative;
  z-index: 3;
  width: 22px;
  height: 22px;
  display: block;
  filter: brightness(0) invert(1) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}

.bb-premium-theme-dock__brand-copy {
  min-width: 0;
}

.bb-premium-theme-dock__title {
  margin: 0;
  font: 600 13px/1.2 Roboto, system-ui, sans-serif;
  letter-spacing: -0.01em;
  color: rgba(255, 255, 255, 0.92);
}

.bb-premium-theme-dock__toggle {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--tfs-border-strong);
  border-radius: 10px;
  background: var(--tfs-surface-elevated);
  color: rgba(255, 255, 255, 0.88);
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease;
}

.bb-premium-theme-dock__toggle:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.28);
}

.bb-premium-theme-dock__toggle:focus-visible {
  outline: 2px solid var(--tfs-accent);
  outline-offset: 2px;
}

.bb-premium-theme-dock__toggle-icon {
  width: 18px;
  height: 18px;
  display: block;
  transition: transform 0.28s cubic-bezier(0.34, 1.2, 0.64, 1);
}

/* ---- Body ---- */

.bb-premium-theme-dock__body {
  position: relative;
  z-index: 1;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 12px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(99, 91, 255, 0.42) transparent;
}

.bb-premium-theme-dock__body::-webkit-scrollbar {
  width: 7px;
}

.bb-premium-theme-dock__body::-webkit-scrollbar-track {
  background: transparent;
}

.bb-premium-theme-dock__body::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(99, 91, 255, 0.32);
  background-clip: padding-box;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.bb-premium-theme-dock__body::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 91, 255, 0.52);
  background-clip: padding-box;
}

@media (prefers-color-scheme: dark) {
  .bb-premium-theme-dock__body {
    scrollbar-color: rgba(255, 255, 255, 0.24) transparent;
  }

  .bb-premium-theme-dock__body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  }

  .bb-premium-theme-dock__body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.32);
  }
}

.bb-premium-theme-dock__field,
.bb-premium-theme-dock__fieldset {
  margin: 0;
  padding: 10px 11px;
  border: none;
  border-radius: var(--tfs-radius-sm);
  background: var(--tfs-surface-elevated);
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bb-premium-theme-dock__fieldset {
  gap: 9px;
}

.bb-premium-theme-dock__label {
  font: 600 10px/1.2 Roboto, system-ui, sans-serif;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--tfs-text-muted);
}

.bb-premium-theme-dock__fieldset > .bb-premium-theme-dock__label {
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.72);
}

.bb-premium-theme-dock__hint {
  margin: 0;
  font-size: 10px;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.4);
}

.bb-premium-theme-dock__color {
  width: 100%;
  height: 40px;
  padding: 3px;
  border: 1px solid var(--tfs-border-strong);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.32);
  cursor: pointer;
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.bb-premium-theme-dock__color:hover {
  border-color: var(--tfs-accent-soft);
  box-shadow: 0 0 0 1px rgba(99, 91, 255, 0.2);
}

.bb-premium-theme-dock__text,
.bb-premium-theme-dock__file,
.bb-premium-theme-dock__textarea {
  width: 100%;
  box-sizing: border-box;
  border-radius: 10px;
  border: 1px solid var(--tfs-border-strong);
  background: rgba(0, 0, 0, 0.28);
  color: var(--tfs-text);
  font: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.bb-premium-theme-dock__text,
.bb-premium-theme-dock__textarea {
  padding: 9px 11px;
}

.bb-premium-theme-dock__text:focus,
.bb-premium-theme-dock__textarea:focus {
  outline: none;
  border-color: rgba(99, 91, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.18);
}

.bb-premium-theme-dock__textarea {
  min-height: 72px;
  max-height: 160px;
  line-height: 1.45;
  resize: vertical;
}

.bb-premium-theme-dock__file {
  padding: 8px 10px;
  font-size: 11px;
  cursor: pointer;
}

.bb-premium-theme-dock__file::file-selector-button {
  margin-right: 10px;
  padding: 5px 10px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(145deg, var(--tfs-accent), rgba(99, 91, 255, 0.9));
  color: #fff;
  font: 600 10px/1 Roboto, system-ui, sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}

.bb-premium-theme-dock__range {
  width: 100%;
  margin: 0;
  height: 6px;
  accent-color: var(--tfs-accent);
  cursor: pointer;
}

.bb-premium-theme-dock__range-out {
  font: 600 11px/1 Roboto, system-ui, sans-serif;
  color: rgba(255, 255, 255, 0.9);
  letter-spacing: 0;
  text-transform: none;
}

.bb-premium-theme-dock__radios {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bb-premium-theme-dock__radio {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: rgba(0, 0, 0, 0.2);
  font-size: 11.5px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
}

.bb-premium-theme-dock__radio:has(input:checked) {
  background: rgba(99, 91, 255, 0.32);
  border-color: rgba(99, 91, 255, 0.62);
  color: #fff;
}

.bb-premium-theme-dock__radio input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--tfs-accent);
}

.bb-premium-theme-dock__link-btn {
  align-self: flex-start;
  padding: 0;
  border: none;
  background: none;
  color: #b8b5ff;
  font: 600 11px/1.35 Roboto, system-ui, sans-serif;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.2s ease;
}

.bb-premium-theme-dock__link-btn:hover {
  color: #dddaff;
  text-decoration: underline;
}

@media (max-width: 480px) {
  .bb-premium-theme-dock {
    right: 10px;
    bottom: 10px;
    width: calc(100vw - 20px);
    border-radius: 18px;
  }

  .bb-premium-theme-dock__title {
    font-size: 13px;
  }

  .bb-premium-theme-dock__brand-icon {
    width: 36px;
    height: 36px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bb-premium-theme-dock,
  .bb-premium-theme-dock.is-collapsed .bb-premium-theme-dock__brand-icon {
    animation: none !important;
    transform: none !important;
  }

  .bb-premium-theme-dock__brand-icon::after {
    animation: none !important;
  }
}
