/**
 * AXXEL — widget de chat (estilos independientes)
 * Fuente por defecto si la página no define --font-primary
 */
#axxel-widget-root {
  --axxel-font: var(--font-primary, Inter, "Segoe UI", system-ui, sans-serif);
}

#axxel-widget-root .chatbot-toggle {
  position: fixed;
  width: auto;
  min-width: 140px;
  height: 60px;
  bottom: 110px;
  right: 30px;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #fff;
  border: none;
  border-radius: 30px;
  padding: 0 15px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  animation: axxel-pulse 2s infinite;
  font-family: var(--axxel-font);
}

#axxel-widget-root .chatbot-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.6);
}

#axxel-widget-root .chatbot-toggle-img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

#axxel-widget-root .chatbot-toggle-text {
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  font-family: var(--axxel-font);
}

#axxel-widget-root .ai-chatbot {
  position: fixed;
  bottom: 180px;
  right: 30px;
  width: 380px;
  height: 600px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  z-index: 1001;
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: axxel-slide-up 0.3s ease;
  font-family: var(--axxel-font);
}

#axxel-widget-root .ai-chatbot.active {
  display: flex;
}

@keyframes axxel-slide-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes axxel-pulse {
  0%,
  100% {
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
  }
  50% {
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.55);
  }
}

#axxel-widget-root .chatbot-header {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #fff;
  padding: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#axxel-widget-root .chatbot-header-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

#axxel-widget-root .chatbot-avatar {
  width: 45px;
  height: 45px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  overflow: hidden;
}

#axxel-widget-root .axxel-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

#axxel-widget-root .chatbot-info h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

#axxel-widget-root .chatbot-info p {
  margin: 0;
  font-size: 0.75rem;
  opacity: 0.9;
}

#axxel-widget-root .chatbot-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  padding: 5px;
  border-radius: 50%;
  transition: all 0.3s ease;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#axxel-widget-root .chatbot-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

#axxel-widget-root .chatbot-close svg {
  width: 18px;
  height: 18px;
  display: block;
}

#axxel-widget-root .chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

#axxel-widget-root .chatbot-messages::-webkit-scrollbar {
  width: 6px;
}

#axxel-widget-root .chatbot-messages::-webkit-scrollbar-track {
  background: transparent;
}

#axxel-widget-root .chatbot-messages::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

#axxel-widget-root .message {
  display: flex;
  gap: 0.75rem;
  animation: axxel-fade-in 0.3s ease;
}

@keyframes axxel-fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#axxel-widget-root .bot-message {
  justify-content: flex-start;
}

#axxel-widget-root .user-message {
  justify-content: flex-end;
}

#axxel-widget-root .message-avatar {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
  overflow: hidden;
}

#axxel-widget-root .bot-message .message-avatar {
  background: transparent;
  color: #fff;
  padding: 0;
}

#axxel-widget-root .bot-message .message-avatar .axxel-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

#axxel-widget-root .user-message .message-avatar {
  background: #e2e8f0;
  color: #475569;
}

#axxel-widget-root .user-message .message-avatar svg {
  width: 18px;
  height: 18px;
}

#axxel-widget-root .message-content {
  max-width: 75%;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  line-height: 1.5;
}

#axxel-widget-root .bot-message .message-content {
  background: #fff;
  color: #1e293b;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border-top-left-radius: 4px;
}

#axxel-widget-root .user-message .message-content {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #fff;
  border-top-right-radius: 4px;
}

#axxel-widget-root .message-content p {
  margin: 0.5rem 0;
  font-size: 0.9rem;
}

#axxel-widget-root .message-content p:first-child {
  margin-top: 0;
}

#axxel-widget-root .message-content p:last-child {
  margin-bottom: 0;
}

#axxel-widget-root .recommendation-card {
  background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
  border: 2px solid #3b82f6;
  border-radius: 12px;
  padding: 1rem;
  margin-top: 0.5rem;
}

#axxel-widget-root .recommendation-card h4 {
  margin: 0 0 0.5rem 0;
  color: #1e40af;
  font-size: 1rem;
  font-weight: 700;
}

#axxel-widget-root .recommendation-card .price {
  font-size: 1.5rem;
  font-weight: 700;
  color: #2563eb;
  margin: 0.5rem 0;
}

#axxel-widget-root .recommendation-card .period {
  font-size: 0.85rem;
  color: #64748b;
  margin-bottom: 0.5rem;
}

#axxel-widget-root .whatsapp-link {
  display: inline-block;
  margin-top: 0.75rem;
  padding: 0.5rem 1rem;
  background: #25d366;
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.3s ease;
}

#axxel-widget-root .whatsapp-link:hover {
  background: #128c7e;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
}

#axxel-widget-root .whatsapp-link svg {
  width: 14px;
  height: 14px;
  vertical-align: middle;
  margin-right: 6px;
}

#axxel-widget-root .chatbot-input-container {
  padding: 1rem;
  background: #fff;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

#axxel-widget-root .chatbot-input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 0.9rem;
  outline: none;
  transition: all 0.3s ease;
  font-family: var(--axxel-font);
}

#axxel-widget-root .chatbot-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

#axxel-widget-root .chatbot-send {
  width: 45px;
  height: 45px;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #fff;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

#axxel-widget-root .chatbot-send svg {
  width: 20px;
  height: 20px;
}

#axxel-widget-root .chatbot-send:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

#axxel-widget-root .chatbot-send:active {
  transform: scale(0.95);
}

@media (max-width: 768px) {
  #axxel-widget-root .chatbot-toggle {
    min-width: 120px;
    height: 55px;
    bottom: 90px;
    right: 20px;
    padding: 0 12px;
    gap: 8px;
  }

  #axxel-widget-root .chatbot-toggle-img {
    width: 35px;
    height: 35px;
  }

  #axxel-widget-root .chatbot-toggle-text {
    font-size: 12px;
  }

  #axxel-widget-root .ai-chatbot {
    width: calc(100% - 40px);
    height: calc(100vh - 120px);
    bottom: 100px;
    right: 20px;
    left: 20px;
    max-width: 380px;
    margin: 0 auto;
  }
}
