/* ===========================
   CHATBOT LICEBOT
   Asistente inteligente del convenio
   =========================== */

/* Botón flotante del chatbot */
#licebot-toggle {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #E41E26 0%, #B71C1C 100%);
  border: none;
  border-radius: 50%;
  box-shadow: 0 4px 16px rgba(228, 30, 38, 0.4);
  cursor: pointer;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#licebot-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(228, 30, 38, 0.5);
}

#licebot-toggle::before {
  content: '💬';
  font-size: 1.75rem;
}

#licebot-toggle.active::before {
  content: '✕';
  font-size: 1.5rem;
  color: #FFFFFF;
}

/* Badge de notificación */
#licebot-toggle .notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background-color: #6A1B9A;
  color: #FFFFFF;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #FFFFFF;
}

/* Ventana del chatbot */
#licebot-window {
  position: fixed;
  bottom: 6rem;
  right: 2rem;
  width: 380px;
  max-width: calc(100vw - 4rem);
  height: 600px;
  max-height: calc(100vh - 10rem);
  background: #FFFFFF;
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.2);
  z-index: 9998;
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#licebot-window.active {
  display: flex;
}

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

/* Header del chatbot */
.licebot-header {
  background: linear-gradient(135deg, #E41E26 0%, #B71C1C 100%);
  color: #FFFFFF;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.licebot-avatar {
  width: 40px;
  height: 40px;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.licebot-info h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  color: #FFFFFF;
}

.licebot-info p {
  font-size: 0.75rem;
  margin: 0;
  opacity: 0.9;
}

.licebot-status {
  display: inline-block;
  width: 8px;
  height: 8px;
  background-color: #4CAF50;
  border-radius: 50%;
  margin-right: 0.5rem;
  animation: pulse 2s infinite;
}

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

/* Área de mensajes */
.licebot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  background-color: #F5F5F5;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.licebot-messages::-webkit-scrollbar {
  width: 6px;
}

.licebot-messages::-webkit-scrollbar-track {
  background: #E0E0E0;
}

.licebot-messages::-webkit-scrollbar-thumb {
  background: #9E9E9E;
  border-radius: 3px;
}

/* Mensaje individual */
.licebot-message {
  display: flex;
  gap: 0.75rem;
  animation: messageIn 0.3s ease;
}

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

.licebot-message.user {
  flex-direction: row-reverse;
}

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.licebot-message.bot .message-avatar {
  background: linear-gradient(135deg, #E41E26 0%, #B71C1C 100%);
  color: #FFFFFF;
}

.licebot-message.user .message-avatar {
  background-color: #6A1B9A;
  color: #FFFFFF;
}

.message-content {
  max-width: 75%;
  padding: 0.875rem 1.125rem;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.5;
}

.licebot-message.bot .message-content {
  background-color: #FFFFFF;
  color: #212121;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.licebot-message.user .message-content {
  background-color: #E41E26;
  color: #FFFFFF;
  border-bottom-right-radius: 4px;
}

.message-time {
  font-size: 0.7rem;
  color: #9E9E9E;
  margin-top: 0.25rem;
  text-align: right;
}

.licebot-message.user .message-time {
  text-align: left;
}

/* Indicador de escritura */
.licebot-typing {
  display: flex;
  gap: 0.75rem;
  padding: 1rem 0;
}

.licebot-typing .message-avatar {
  background: linear-gradient(135deg, #E41E26 0%, #B71C1C 100%);
  color: #FFFFFF;
}

.typing-indicator {
  background-color: #FFFFFF;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  border-bottom-left-radius: 4px;
  display: flex;
  gap: 0.375rem;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background-color: #9E9E9E;
  border-radius: 50%;
  animation: typingDot 1.4s infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingDot {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.7;
  }
  30% {
    transform: translateY(-8px);
    opacity: 1;
  }
}

/* Sugerencias rápidas */
.licebot-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.suggestion-btn {
  background-color: #FFFFFF;
  border: 1px solid #E41E26;
  color: #E41E26;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.suggestion-btn:hover {
  background-color: #E41E26;
  color: #FFFFFF;
}

/* Área de input */
.licebot-input-area {
  padding: 1rem 1.5rem;
  background-color: #FFFFFF;
  border-top: 1px solid #E0E0E0;
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.licebot-input {
  flex: 1;
  border: 1px solid #E0E0E0;
  border-radius: 24px;
  padding: 0.75rem 1.25rem;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.licebot-input:focus {
  border-color: #E41E26;
}

.licebot-send-btn {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #E41E26 0%, #B71C1C 100%);
  border: none;
  border-radius: 50%;
  color: #FFFFFF;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

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

.licebot-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.licebot-send-btn::before {
  content: '➤';
  font-size: 1rem;
}

/* Mensaje de bienvenida */
.welcome-message {
  background: linear-gradient(135deg, #E41E26 0%, #6A1B9A 100%);
  color: #FFFFFF;
  padding: 1.5rem;
  border-radius: 12px;
  margin-bottom: 1rem;
}

.welcome-message h4 {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
  color: #FFFFFF;
}

.welcome-message p {
  margin: 0;
  font-size: 0.85rem;
  opacity: 0.95;
}

/* Responsive */
@media (max-width: 480px) {
  #licebot-window {
    bottom: 5rem;
    right: 1rem;
    left: 1rem;
    width: auto;
    max-width: none;
  }
  
  #licebot-toggle {
    bottom: 1.5rem;
    right: 1.5rem;
  }
  
  .message-content {
    max-width: 85%;
  }
}

/* Accesibilidad */
.licebot-input:focus,
.licebot-send-btn:focus,
.suggestion-btn:focus {
  outline: 2px solid #E41E26;
  outline-offset: 2px;
}

/* Estados de error */
.licebot-error {
  background-color: #FFEBEE;
  color: #C62828;
  padding: 1rem;
  border-radius: 8px;
  border-left: 4px solid #E41E26;
  margin: 0.5rem 0;
  font-size: 0.85rem;
}
