/* ============================================================
   Asistente virtual (chatbot) - DRTC
   Widget flotante usado en la página de login
   ============================================================ */
#cb-root {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 10000;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

#cb-fab {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  border: none;
  border-radius: 50%;
  background-color: #822737;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(130, 39, 55, 0.45);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#cb-fab:hover {
  transform: scale(1.06);
  box-shadow: 0 8px 24px rgba(130, 39, 55, 0.55);
}

#cb-fab svg {
  width: 26px;
  height: 26px;
}

#cb-panel {
  position: absolute;
  bottom: 72px;
  right: 0;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 500px;
  max-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.28);
  overflow: hidden;
  transform-origin: bottom right;
  transition: opacity 0.18s ease, transform 0.18s ease;
  opacity: 1;
  transform: scale(1);
}

#cb-panel.cb-hidden {
  opacity: 0;
  transform: scale(0.6);
  pointer-events: none;
}

#cb-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #822737 0%, #a33a4d 100%);
  color: #fff;
}

#cb-header-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

#cb-header-avatar svg {
  width: 22px;
  height: 22px;
}

#cb-header-txt {
  flex: 1;
  min-width: 0;
  line-height: 1.25;
}

#cb-header-txt strong {
  display: block;
  font-size: 14px;
}

#cb-header-txt span {
  display: block;
  font-size: 11.5px;
  opacity: 0.85;
}

#cb-close {
  border: none;
  background: transparent;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  opacity: 0.85;
}

#cb-close:hover {
  opacity: 1;
}

#cb-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f3f4f6;
}

#cb-messages::-webkit-scrollbar {
  width: 6px;
}

#cb-messages::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.cb-msg {
  max-width: 82%;
  padding: 9px 12px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.cb-msg-user {
  align-self: flex-end;
  background: #822737;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.cb-msg-bot {
  align-self: flex-start;
  background: #ffffff;
  color: #1f2937;
  border: 1px solid #e5e7eb;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.cb-msg-bot.cb-error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

/* Estados de acta con colores */
.cb-estado {
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 12px;
  letter-spacing: 0.02em;
}

.cb-estado-pendiente {
  color: #b45309;
  background: #fef3c7;
  border: 1px solid #fcd34d;
}

.cb-estado-pagado {
  color: #166534;
  background: #dcfce7;
  border: 1px solid #86efac;
}

.cb-estado-anulado {
  color: #991b1b;
  background: #fee2e2;
  border: 1px solid #fca5a5;
}

.cb-estado-en_tramite {
  color: #1d4ed8;
  background: #dbeafe;
  border: 1px solid #93c5fd;
}

/* Indicador "escribiendo" */
.cb-typing {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 12px 14px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
}

.cb-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9ca3af;
  animation: cb-blink 1.2s infinite ease-in-out;
}

.cb-typing span:nth-child(2) {
  animation-delay: 0.2s;
}

.cb-typing span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes cb-blink {
  0%, 80%, 100% { opacity: 0.25; }
  40% { opacity: 1; }
}

#cb-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #e5e7eb;
  background: #ffffff;
}

#cb-input {
  flex: 1;
  border: 1px solid #d1d5db;
  border-radius: 22px;
  padding: 9px 14px;
  font-size: 13.5px;
  outline: none;
  background: #f9fafb;
  color: #111827;
}

#cb-input:focus {
  border-color: #822737;
  background: #ffffff;
}

#cb-send {
  border: none;
  border-radius: 22px;
  padding: 9px 16px;
  background: #822737;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

#cb-send:hover {
  background: #9c2f42;
}

#cb-send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

@media (max-width: 480px) {
  #cb-panel {
    width: calc(100vw - 24px);
  }
}