/* ==========================================
   CHATBOT FAQ - PAANTEC
   ========================================== */

/* Widget flotante */
.chatbot-toggle {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 60px;
  height: 60px;
  background: var(--paantec-primary, #0B1D78);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 26px;
  cursor: pointer;
  z-index: 1029;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(11, 29, 120, 0.4);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  animation: chatPulse 3s ease-in-out infinite;
}

.chatbot-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(11, 29, 120, 0.5);
  animation: none;
}

.chatbot-toggle .badge-dot {
  position: absolute;
  top: 2px;
  left: 42px;
  width: 14px;
  height: 14px;
  background: var(--paantec-success, #16A34A);
  border: 2px solid white;
  border-radius: 50%;
}

@keyframes chatPulse {
  0%, 100% { box-shadow: 0 4px 15px rgba(11, 29, 120, 0.4); }
  50% { box-shadow: 0 4px 25px rgba(11, 29, 120, 0.6); }
}

/* Ventana del chat */
.chatbot-window {
  position: fixed;
  bottom: 90px;
  left: 20px;
  width: 370px;
  max-height: 500px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  z-index: 1031;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s ease;
}

.chatbot-window.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Header del chat */
.chatbot-header {
  background: linear-gradient(135deg, var(--paantec-primary, #0B1D78), #1a3a9e);
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.chatbot-avatar {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.chatbot-header-info h6 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.chatbot-header-info small {
  opacity: 0.8;
  font-size: 0.75rem;
}

.chatbot-close {
  margin-left: auto;
  background: none;
  border: none;
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
  padding: 4px;
}

.chatbot-close:hover {
  opacity: 1;
}

/* Area de mensajes */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 320px;
  scroll-behavior: smooth;
}

/* Burbujas de mensaje */
.chat-message {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.875rem;
  line-height: 1.5;
  animation: messageIn 0.3s ease;
}

@keyframes messageIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-message.bot {
  background: #f0f2f5;
  color: #333;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.chat-message.user {
  background: var(--paantec-primary, #0B1D78);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

/* Botones de opciones rapidas */
.chat-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.chat-option-btn {
  background: white;
  border: 1.5px solid var(--paantec-primary, #0B1D78);
  color: var(--paantec-primary, #0B1D78);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.chat-option-btn:hover {
  background: var(--paantec-primary, #0B1D78);
  color: white;
}

/* Input area */
.chatbot-input {
  display: flex;
  padding: 12px 16px;
  border-top: 1px solid #e9ecef;
  gap: 8px;
  background: #fafafa;
}

.chatbot-input input {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
}

.chatbot-input input:focus {
  border-color: var(--paantec-primary, #0B1D78);
}

.chatbot-input button {
  background: var(--paantec-primary, #0B1D78);
  color: white;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}

.chatbot-input button:hover {
  background: #1a3a9e;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  align-self: flex-start;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: #bbb;
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* Responsive */
@media (max-width: 480px) {
  .chatbot-window {
    width: calc(100vw - 20px);
    left: 10px;
    bottom: 70px;
    max-height: 70vh;
  }

  .chatbot-toggle {
    width: 50px;
    height: 50px;
    font-size: 22px;
    bottom: 15px;
    left: 15px;
  }
}

/* Print: ocultar chatbot */
@media print {
  .chatbot-toggle,
  .chatbot-window {
    display: none !important;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .chatbot-toggle {
    animation: none !important;
  }
  .chat-message,
  .chatbot-window {
    animation: none !important;
    transition: opacity 0.1s !important;
  }
}
