/* === SECCIÓN CHATBOT Y WHATSAPP FLOTANTE === */

/* Contenedor del Widget */
.chatbot-widget {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

/* Botón Flotante */
.chatbot-btn {
  width: 60px;
  height: 60px;
  background-color: #25D366; /* Verde WhatsApp */
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 2rem;
  box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4);
  cursor: pointer;
  transition: transform var(--transition-normal);
  position: relative;
}

.chatbot-btn:hover {
  transform: scale(1.1);
}

.chatbot-btn::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 50%;
  border: 2px solid #25D366;
  opacity: 0;
  animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(1.3); opacity: 0; }
}

.chatbot-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background-color: var(--color-error);
  width: 15px;
  height: 15px;
  border-radius: 50%;
  animation: pulse-badge 1.5s infinite;
}

@keyframes pulse-badge {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.chatbot-tooltip {
  position: absolute;
  right: 75px;
  top: 50%;
  transform: translateY(-50%);
  background-color: var(--color-surface);
  color: var(--color-accent);
  padding: 8px 15px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
  border: 1px solid var(--color-border);
}

.chatbot-tooltip::after {
  content: '';
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  border-width: 6px 0 6px 6px;
  border-style: solid;
  border-color: transparent transparent transparent var(--color-surface);
}

.chatbot-widget:hover .chatbot-tooltip {
  opacity: 1;
  visibility: visible;
}

/* Panel del Chatbot */
.chatbot-panel {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 340px;
  height: 500px;
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--color-border);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transform-origin: bottom right;
}

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

.chatbot-header {
  background: linear-gradient(135deg, #128C7E, #25D366);
  padding: 20px;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chatbot-header__info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chatbot-header__icon {
  font-size: 1.5rem;
}

.chatbot-header__text h3 {
  margin: 0 0 5px 0;
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 600;
  text-transform: none;
}

.chatbot-header__text p {
  margin: 0;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  gap: 5px;
}

.chatbot-header__status {
  width: 8px;
  height: 8px;
  background-color: #fff;
  border-radius: 50%;
  animation: blink 2s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.chatbot-header__close {
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity var(--transition-fast);
}

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

/* Cuerpo del chat */
.chatbot-body {
  flex-grow: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
  background-color: #0A0A0A;
  background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 20px 20px;
}

.chat-message {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 15px;
  font-size: 0.95rem;
  line-height: 1.4;
  animation: slideIn 0.3s ease;
}

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

.chat-message.bot {
  background-color: var(--color-surface);
  color: var(--color-accent);
  border-bottom-left-radius: 5px;
  align-self: flex-start;
  border: 1px solid var(--color-border);
}

.chat-message.user {
  background-color: var(--color-primary);
  color: white;
  border-bottom-right-radius: 5px;
  align-self: flex-end;
}

/* Opciones del bot */
.chat-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-self: flex-start;
  width: 100%;
  animation: slideIn 0.3s ease 0.2s both;
}

.chat-option-btn {
  background-color: transparent;
  border: 1px solid var(--color-primary);
  color: var(--color-primary);
  padding: 10px 15px;
  border-radius: 20px;
  font-size: 0.9rem;
  text-align: left;
  transition: all var(--transition-fast);
}

.chat-option-btn:hover {
  background-color: var(--color-primary);
  color: white;
}

/* Footer / Input (opcional, si quisieramos que escriba, por ahora guiado por botones) */
.chatbot-footer {
  padding: 15px;
  background-color: var(--color-surface);
  border-top: 1px solid var(--color-border);
  text-align: center;
  font-size: 0.8rem;
  color: var(--color-muted);
}

@media (max-width: 480px) {
  .chatbot-panel {
    width: calc(100vw - 40px);
    right: -10px;
  }
}
