/* Scout AI + Back-to-top floating dock */
.cc-float-dock {
  position: fixed;
  right: 22px;
  bottom: 28px;
  z-index: 99990;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
  gap: 12px;
  pointer-events: none;
}

.cc-float-dock > * {
  pointer-events: auto;
}

/* Move native scroll-top into the dock stack visually */
.cc-scroll-top {
  position: fixed;
  right: 22px;
  bottom: 28px;
  z-index: 99989;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 0;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(35, 22, 81, 0.18);
  color: var(--cc-white, #fff);
  font-size: 1.25rem;
  background: var(--cc-accent, #ff8360);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease, background 0.2s ease;
}

.cc-scroll-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.cc-scroll-top:hover,
.cc-scroll-top:focus-visible {
  background: var(--cc-primary, #231651);
  outline: none;
}

/* When Scout is present, lift scroll-top above it */
body.cc-has-scout .cc-scroll-top {
  bottom: 92px;
}

body.cc-has-scout .cc-float-dock {
  bottom: 28px;
}

.cc-scout {
  position: fixed;
  right: 22px;
  bottom: 28px;
  z-index: 99990;
  font-family: Nunito, system-ui, sans-serif;
}

.cc-float-dock .cc-scout {
  position: relative;
  right: auto;
  bottom: auto;
  z-index: 1;
}

.cc-scout-launcher {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: 0;
  cursor: pointer;
  min-width: 52px;
  height: 52px;
  padding: 0 1rem 0 0.85rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--cc-primary, #231651), var(--cc-deep-purple, #3f2791));
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: 0 12px 28px rgba(35, 22, 81, 0.28);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.cc-scout-launcher:hover,
.cc-scout-launcher:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 16px 32px rgba(35, 22, 81, 0.32);
  background: linear-gradient(135deg, var(--cc-accent, #ff8360), #ff6b45);
  outline: none;
}

.cc-scout.is-open .cc-scout-launcher {
  background: var(--cc-secondary, #4cb0b3);
}

.cc-scout-launcher-icon {
  font-size: 1.35rem;
  line-height: 1;
  width: 1.5rem;
  text-align: center;
}

.cc-scout-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.85rem);
  width: min(100vw - 2rem, 380px);
  height: min(68vh, 520px);
  display: none;
  flex-direction: column;
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 22px 50px rgba(35, 22, 81, 0.22);
  border: 1px solid rgba(35, 22, 81, 0.08);
  transform-origin: bottom right;
  z-index: 2;
}

.cc-scout-panel.is-visible,
.cc-scout.is-open .cc-scout-panel {
  display: flex;
  animation: cc-scout-pop 0.22s ease;
}

/* Ensure HTML hidden attribute always wins over display:flex */
.cc-scout-panel[hidden] {
  display: none !important;
}

.cc-scout-close {
  border: 0;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  position: relative;
  z-index: 5;
  flex-shrink: 0;
  pointer-events: auto;
}

@keyframes cc-scout-pop {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.cc-scout-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  background: linear-gradient(135deg, var(--cc-primary, #231651), var(--cc-deep-purple, #3f2791));
  color: #fff;
}

.cc-scout-header strong {
  display: block;
  font-size: 1rem;
}

.cc-scout-header small {
  display: block;
  opacity: 0.85;
  margin-top: 0.15rem;
  font-size: 0.75rem;
}

.cc-scout-close:hover,
.cc-scout-close:focus-visible {
  background: rgba(255, 255, 255, 0.28);
  outline: none;
}

.cc-scout-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.9rem;
  background: var(--cc-cream, #fdf9eb);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.cc-scout-row {
  display: flex;
  align-items: flex-end;
  gap: 0.45rem;
  max-width: 100%;
}

.cc-scout-row--assistant {
  align-self: stretch;
  justify-content: flex-start;
}

.cc-scout-row--user {
  align-self: stretch;
  justify-content: flex-end;
}

.cc-scout-avatar {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--cc-primary, #231651), var(--cc-deep-purple, #3f2791));
  font-size: 1rem;
  box-shadow: 0 4px 10px rgba(35, 22, 81, 0.18);
}

.cc-scout-bubble {
  max-width: 85%;
  padding: 0.65rem 0.8rem;
  border-radius: 14px;
  font-size: 0.92rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.cc-scout-bubble--assistant {
  align-self: flex-start;
  background: #fff;
  color: var(--cc-primary, #231651);
  border: 1px solid rgba(35, 22, 81, 0.08);
  border-bottom-left-radius: 4px;
}

.cc-scout-bubble--user {
  align-self: flex-end;
  background: var(--cc-secondary, #4cb0b3);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.cc-scout-typing {
  opacity: 0.75;
  font-style: italic;
}

.cc-scout-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  padding: 0.75rem;
  background: #fff;
  border-top: 1px solid rgba(35, 22, 81, 0.08);
}

.cc-scout-input {
  width: 100%;
  resize: none;
  border: 1px solid rgba(35, 22, 81, 0.15);
  border-radius: 12px;
  padding: 0.55rem 0.7rem;
  font: inherit;
  color: var(--cc-primary, #231651);
}

.cc-scout-input:focus {
  outline: 2px solid var(--cc-secondary, #4cb0b3);
  outline-offset: 1px;
}

.cc-scout-send {
  border: 0;
  border-radius: 12px;
  padding: 0.55rem 0.9rem;
  background: var(--cc-accent, #ff8360);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  align-self: end;
}

.cc-scout-send:hover,
.cc-scout-send:focus-visible {
  background: var(--cc-primary, #231651);
  outline: none;
}

.cc-scout-footnote {
  margin: 0;
  padding: 0 0.75rem 0.65rem;
  font-size: 0.7rem;
  color: var(--cc-text, #737373);
  background: #fff;
}

/* Chat open: keep scroll-top visible but slightly dimmed so stack stays clear */
body.cc-has-scout.cc-scout-open .cc-scroll-top.is-visible {
  opacity: 0.92;
}

@media (max-width: 480px) {
  .cc-float-dock,
  .cc-scroll-top {
    right: 14px;
  }

  body.cc-has-scout .cc-scroll-top {
    bottom: 86px;
  }

  .cc-scout-launcher {
    padding: 0;
    width: 52px;
  }

  .cc-scout-launcher-text {
    display: none;
  }

  .cc-scout-panel {
    width: min(100vw - 1.5rem, 380px);
    height: min(72vh, 560px);
    right: -4px;
  }
}
