/* ═══════════════════════════════════════
   CHATBOT — Estilos avanzados
═══════════════════════════════════════ */

.chatbot-panel {
  position: fixed;
  bottom: 84px;
  right: 18px;
  width: 340px;
  max-width: calc(100vw - 28px);
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.16);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(14px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.28s ease, transform 0.28s ease;
  z-index: 1000;
  max-height: 580px;
}

.chatbot-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Header */
.chatbot-header {
  background: linear-gradient(135deg, #1a5ea4 0%, #2172b8 100%);
  color: #fff;
  padding: 13px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.chatbot-header-info {
  display: flex;
  align-items: center;
  gap: 9px;
}

.chatbot-status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.35);
  animation: pulse-green 2s infinite;
  flex-shrink: 0;
}

@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.35); }
  50% { box-shadow: 0 0 0 5px rgba(74, 222, 128, 0.12); }
}

.chatbot-header strong {
  font-size: 0.88rem;
  font-weight: 700;
}

.chatbot-close {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  line-height: 1;
}

.chatbot-close:hover {
  background: rgba(255,255,255,0.28);
}

/* Mensajes */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
}

.chatbot-messages::-webkit-scrollbar { width: 5px; }
.chatbot-messages::-webkit-scrollbar-track { background: transparent; }
.chatbot-messages::-webkit-scrollbar-thumb { background: #d0daea; border-radius: 10px; }

.chatbot-msg {
  max-width: 86%;
  padding: 9px 12px;
  border-radius: 14px;
  font-size: 0.82rem;
  line-height: 1.45;
  word-break: break-word;
}

.chatbot-msg.bot {
  background: #f1f5fb;
  color: #1e293b;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.chatbot-msg.user {
  background: #2172b8;
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

/* Typing indicator */
.chatbot-typing {
  display: flex !important;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
}

.chatbot-typing span {
  width: 7px;
  height: 7px;
  background: #94a3b8;
  border-radius: 50%;
  animation: typing-bounce 1.2s infinite ease-in-out;
}

.chatbot-typing span:nth-child(1) { animation-delay: 0s; }
.chatbot-typing span:nth-child(2) { animation-delay: 0.18s; }
.chatbot-typing span:nth-child(3) { animation-delay: 0.36s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* Área de chips */
.chatbot-chips-area {
  padding: 6px 10px 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
  border-top: 1px solid #f0f4f9;
  background: #fafcff;
  min-height: 0;
}

.chatbot-chips-area:empty {
  display: none;
}

.chatbot-chip {
  background: #fff;
  border: 1.5px solid #cfe3f5;
  color: #1a5ea4;
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.chatbot-chip:hover:not(:disabled) {
  background: #2172b8;
  color: #fff;
  border-color: #2172b8;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(33, 114, 184, 0.2);
}

.chatbot-chip:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Input */
.chatbot-input-wrap {
  display: flex;
  border-top: 1px solid #e9eff7;
  flex-shrink: 0;
}

.chatbot-input-wrap input {
  flex: 1;
  border: none;
  padding: 11px 13px;
  font-size: 0.82rem;
  outline: none;
  background: #fff;
  color: #1e293b;
  font-family: inherit;
}

.chatbot-input-wrap input::placeholder {
  color: #9fb0c4;
}

.chatbot-input-wrap button {
  border: none;
  background: #2172b8;
  color: #fff;
  padding: 0 16px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chatbot-input-wrap button:hover {
  background: #1a5ea4;
}

/* WhatsApp cards */
.wa-tecnico {
  margin-bottom: 6px;
}

.wa-prioridad {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 5px;
}

.wa-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #25d366;
  color: #fff !important;
  text-decoration: none !important;
  padding: 9px 16px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 700;
  transition: all 0.2s ease;
  box-shadow: 0 3px 10px rgba(37, 211, 102, 0.3);
}

.wa-btn:hover {
  background: #1ebe5d;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 211, 102, 0.38);
}

.wa-btn i {
  font-size: 1rem;
}

.wa-hint {
  font-size: 0.72rem;
  color: #94a3b8;
  margin: 5px 0 10px;
  font-style: italic;
}

/* Responsive */
@media (max-width: 420px) {
  .chatbot-panel {
    width: calc(100vw - 20px);
    right: 10px;
    bottom: 74px;
    max-height: 500px;
  }
}