/* Cuco Assistant widget — self-contained, used on the React landing and the
   static case pages. All classes are prefixed .cuco-w- and colors are hardcoded
   so it never depends on the host page's CSS variables. */

#cuco-widget,
#cuco-widget * {
  box-sizing: border-box;
}

#cuco-widget {
  --cw-coral: #ff6f61;
  --cw-yellow: #ffc300;
  --cw-ink: #0d1626;
  --cw-ink-2: #18233a;
  --cw-line: rgba(255, 255, 255, 0.09);
  --cw-text: #eaf1fb;
  --cw-muted: #8a97ad;
  position: fixed;
  z-index: 2147483000;
  bottom: 0;
  right: 0;
  font-family: "Space Grotesk", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---- Launcher (FAB) ---- */
.cuco-w-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border: none;
  border-radius: 50%;
  background: var(--cw-coral);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  display: grid;
  place-items: center;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  animation: cuco-w-pop 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.cuco-w-fab:hover {
  transform: scale(1.06);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.34);
}
.cuco-w-fab svg {
  width: 28px;
  height: 28px;
}
#cuco-widget[data-state="docked"] .cuco-w-fab,
#cuco-widget[data-state="expanded"] .cuco-w-fab {
  display: none;
}

/* ---- Panel ---- */
.cuco-w-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 390px;
  height: min(640px, calc(100vh - 48px));
  display: none;
  flex-direction: column;
  overflow: hidden;
  background: var(--cw-ink);
  color: var(--cw-text);
  border: 1px solid var(--cw-line);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  animation: cuco-w-in 0.26s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
#cuco-widget[data-state="docked"] .cuco-w-panel,
#cuco-widget[data-state="expanded"] .cuco-w-panel {
  display: flex;
}
#cuco-widget[data-state="expanded"] .cuco-w-panel {
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 0;
}
/* expanded centers its content in a comfortable column */
#cuco-widget[data-state="expanded"] .cuco-w-scroll,
#cuco-widget[data-state="expanded"] .cuco-w-foot {
  align-items: center;
}
#cuco-widget[data-state="expanded"] .cuco-w-thread,
#cuco-widget[data-state="expanded"] .cuco-w-inputwrap {
  width: 100%;
  max-width: 720px;
}

/* ---- Header ---- */
.cuco-w-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--cw-line);
  flex: none;
}
.cuco-w-id {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.cuco-w-logo {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  flex: none;
}
.cuco-w-id-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.cuco-w-name {
  font-weight: 700;
  font-size: 15px;
}
.cuco-w-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--cw-muted);
  letter-spacing: 0.02em;
}
.cuco-w-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #36d399;
  box-shadow: 0 0 0 0 rgba(54, 211, 153, 0.6);
  animation: cuco-w-pulse 2s infinite;
}
.cuco-w-actions {
  display: flex;
  gap: 4px;
  flex: none;
}
.cuco-w-iconbtn {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--cw-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s ease, color 0.15s ease;
}
.cuco-w-iconbtn:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--cw-text);
}
.cuco-w-iconbtn svg {
  width: 18px;
  height: 18px;
}

/* ---- Thread ---- */
.cuco-w-scroll {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 16px;
}
.cuco-w-thread {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.cuco-w-msg {
  max-width: 86%;
  display: flex;
  flex-direction: column;
  animation: cuco-w-bubble 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.cuco-w-msg.assistant {
  align-self: flex-start;
}
.cuco-w-msg.user {
  align-self: flex-end;
  align-items: flex-end;
}
.cuco-w-tag {
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--cw-yellow);
  margin: 0 0 4px 4px;
  font-weight: 700;
}
.cuco-w-bubble {
  margin: 0;
  padding: 12px 15px;
  line-height: 1.5;
  font-size: 14.5px;
  border-radius: 15px;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.cuco-w-msg.assistant .cuco-w-bubble {
  background: var(--cw-ink-2);
  border: 1px solid var(--cw-line);
  border-top-left-radius: 5px;
}
.cuco-w-msg.user .cuco-w-bubble {
  background: var(--cw-coral);
  color: #fff;
  border-top-right-radius: 5px;
}
.cuco-w-bubble strong {
  font-weight: 700;
  color: #fff;
}
.cuco-w-bubble a {
  color: var(--cw-yellow);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-word;
}
.cuco-w-msg.user .cuco-w-bubble a {
  color: #fff;
}

/* ---- Typing ---- */
.cuco-w-typing {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}
.cuco-w-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cw-muted);
  animation: cuco-w-typing 1.2s infinite ease-in-out;
}
.cuco-w-typing span:nth-child(2) {
  animation-delay: 0.15s;
}
.cuco-w-typing span:nth-child(3) {
  animation-delay: 0.3s;
}

/* ---- Footer ---- */
.cuco-w-foot {
  flex: none;
  padding: 12px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cuco-w-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.cuco-w-chip {
  border: 1px solid var(--cw-line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--cw-text);
  border-radius: 100px;
  padding: 7px 13px;
  font-size: 12.5px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.cuco-w-chip:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--cw-coral);
}
.cuco-w-inputwrap {
  width: 100%;
}
.cuco-w-consent {
  margin: 7px 2px 0;
  font-size: 10.5px;
  line-height: 1.35;
  color: var(--cw-muted);
  opacity: 0.75;
  text-align: center;
}
.cuco-w-inputbar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--cw-line);
  border-radius: 14px;
  padding: 7px 7px 7px 14px;
  transition: border-color 0.15s ease;
}
.cuco-w-inputbar:focus-within {
  border-color: var(--cw-coral);
}
.cuco-w-input {
  flex: 1;
  resize: none;
  border: none;
  outline: none;
  background: transparent;
  color: var(--cw-text);
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.4;
  max-height: 120px;
  padding: 7px 0;
}
.cuco-w-input::placeholder {
  color: var(--cw-muted);
}
.cuco-w-send {
  flex: none;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 11px;
  background: var(--cw-coral);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.cuco-w-send:disabled {
  opacity: 0.4;
  cursor: default;
}
.cuco-w-send:not(:disabled):hover {
  transform: scale(1.06);
}

/* ---- Small screens: docked panel goes near-fullscreen ---- */
@media (max-width: 460px) {
  .cuco-w-panel {
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 0;
  }
}

@keyframes cuco-w-pop {
  from { opacity: 0; transform: scale(0.6); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes cuco-w-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}
@keyframes cuco-w-bubble {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes cuco-w-pulse {
  0% { box-shadow: 0 0 0 0 rgba(54, 211, 153, 0.5); }
  70% { box-shadow: 0 0 0 7px rgba(54, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(54, 211, 153, 0); }
}
@keyframes cuco-w-typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}
