/* ── Cliplanner Bot Widget ────────────────────────────────────────────────── */
:root {
  --cb-primary:   #0891B2;
  --cb-primary-d: #0e7490;
  --cb-bg:        #f0f4f8;
  --cb-white:     #ffffff;
  --cb-gray:      #e5e7eb;
  --cb-text:      #1f2937;
  --cb-muted:     #6b7280;
  --cb-radius:    16px;
  --cb-shadow:    0 8px 32px rgba(0,0,0,.18);
  --cb-z:         9999;
}

/* ── Botón flotante ── */
.cb-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: var(--cb-z);
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--cb-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(8,145,178,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s, background .2s;
}
.cb-fab:hover  { background: var(--cb-primary-d); transform: scale(1.08); }
.cb-fab:active { transform: scale(.95); }
.cb-fab svg    { width: 26px; height: 26px; fill: currentColor; }

/* Badge de notificación */
.cb-fab-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 9px;
  padding: 1px 5px;
  line-height: 1.5;
  display: none;
}

/* ── Panel de chat ── */
.cb-panel {
  position: fixed;
  bottom: 96px;
  right: 24px;
  z-index: var(--cb-z);
  width: 340px;
  max-height: 560px;
  border-radius: var(--cb-radius);
  background: var(--cb-white);
  box-shadow: var(--cb-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(.92) translateY(12px);
  opacity: 0;
  pointer-events: none;
  transition: transform .22s cubic-bezier(.34,1.56,.64,1), opacity .18s;
}
.cb-panel.cb-open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* ── Header ── */
.cb-header {
  background: var(--cb-primary);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.cb-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.cb-header-info { flex: 1; min-width: 0; }
.cb-header-name  { font-weight: 700; font-size: .9rem; line-height: 1.2; }
.cb-header-sub   { font-size: .72rem; opacity: .85; }
.cb-header-close {
  background: none; border: none; color: rgba(255,255,255,.8);
  cursor: pointer; padding: 4px; border-radius: 6px;
  display: flex; align-items: center;
  transition: color .15s, background .15s;
}
.cb-header-close:hover { color: #fff; background: rgba(255,255,255,.15); }
.cb-header-close svg { width: 18px; height: 18px; }

/* ── Mensajes ── */
.cb-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--cb-bg);
  scroll-behavior: smooth;
}
.cb-messages::-webkit-scrollbar       { width: 4px; }
.cb-messages::-webkit-scrollbar-track { background: transparent; }
.cb-messages::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }

/* Burbuja individual */
.cb-bubble-wrap { display: flex; }
.cb-bubble-wrap.cb-user { justify-content: flex-end; }

.cb-bubble {
  max-width: 82%;
  padding: 9px 13px;
  border-radius: 16px;
  font-size: .84rem;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
}
.cb-bubble-wrap.cb-bot  .cb-bubble { background: var(--cb-white);  color: var(--cb-text);  border-bottom-left-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.cb-bubble-wrap.cb-user .cb-bubble { background: var(--cb-primary); color: #fff; border-bottom-right-radius: 4px; }

/* Negrita con asteriscos */
.cb-bubble b { font-weight: 700; }

/* Indicador de escritura */
.cb-typing .cb-bubble { padding: 10px 14px; }
.cb-typing-dots { display: flex; gap: 4px; align-items: center; }
.cb-typing-dots span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--cb-muted);
  animation: cb-bounce .9s infinite ease-in-out;
}
.cb-typing-dots span:nth-child(2) { animation-delay: .15s; }
.cb-typing-dots span:nth-child(3) { animation-delay: .30s; }
@keyframes cb-bounce {
  0%,80%,100% { transform: translateY(0); }
  40%          { transform: translateY(-6px); }
}

/* ── Opciones rápidas ── */
.cb-options {
  padding: 6px 12px 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: var(--cb-bg);
  border-top: 1px solid #e2e8f0;
  flex-shrink: 0;
}
.cb-opt-btn {
  padding: 6px 12px;
  border: 1.5px solid var(--cb-primary);
  border-radius: 20px;
  background: var(--cb-white);
  color: var(--cb-primary);
  font-size: .8rem;
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cb-opt-btn:hover { background: var(--cb-primary); color: #fff; }
/* Opción-link: botón sólido que abre URL externa */
.cb-opt-link {
  text-decoration: none;
  background: var(--cb-primary);
  color: #fff !important;
  font-weight: 600;
}
.cb-opt-link:hover { opacity: .85; color: #fff !important; }

/* ── Input de texto ── */
.cb-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--cb-gray);
  background: var(--cb-white);
  flex-shrink: 0;
}
.cb-input {
  flex: 1;
  border: 1.5px solid var(--cb-gray);
  border-radius: 22px;
  padding: 8px 14px;
  font-size: .84rem;
  outline: none;
  transition: border-color .15s;
  resize: none;
  font-family: inherit;
  color: var(--cb-text);
  background: var(--cb-bg);
}
.cb-input:focus { border-color: var(--cb-primary); background: #fff; }
.cb-send {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--cb-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background .15s, transform .1s;
}
.cb-send:hover  { background: var(--cb-primary-d); }
.cb-send:active { transform: scale(.9); }
.cb-send svg    { width: 16px; height: 16px; fill: currentColor; }
.cb-send:disabled { opacity: .45; cursor: not-allowed; }

/* ── Footer reiniciar ── */
.cb-footer {
  text-align: center;
  padding: 6px;
  border-top: 1px solid var(--cb-gray);
  background: var(--cb-white);
  flex-shrink: 0;
}
.cb-restart {
  font-size: .72rem;
  color: var(--cb-muted);
  background: none; border: none; cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color .15s;
}
.cb-restart:hover { color: var(--cb-primary); }

/* ── Responsive ── */
@media (max-width: 480px) {
  .cb-panel { width: calc(100vw - 16px); right: 8px; bottom: 80px; max-height: calc(100vh - 100px); }
  .cb-fab   { bottom: 16px; right: 16px; }
}
