/**
 * Firestarter Chatbot - Estilos inspirados en Universal RAG Chatbot
 * Diseño moderno con gradientes y animaciones fluidas
 * 
 * Características:
 * - Diseño inspirado en Universal RAG Chatbot
 * - Gradientes y colores vibrantes
 * - Animaciones suaves y elegantes
 * - Diseño responsive completo
 */

/* CSS Custom Properties */
:root {
  /* Colores principales - Shadcn UI style */
  --firestarter-primary: hsl(224, 71.4%, 4.1%);
  --firestarter-primary-light: hsl(224, 71.4%, 8%);
  --firestarter-primary-dark: hsl(224, 71.4%, 2%);
  --firestarter-primary-foreground: hsl(0, 0%, 100%);
  
  /* Colores de fondo */
  --firestarter-background: hsl(0, 0%, 100%);
  --firestarter-foreground: hsl(224, 71.4%, 4.1%);
  --firestarter-muted: hsl(210, 40%, 94%);
  --firestarter-muted-foreground: hsl(215.4, 16.3%, 46.9%);
  
  /* Colores de borde y sombras */
  --firestarter-border: hsl(214.3, 31.8%, 91.4%);
  --firestarter-ring: hsl(221.2, 83.2%, 53.3%);
  --firestarter-radius: 20px;
  --firestarter-radius-sm: 12px;
  --firestarter-radius-full: 9999px;
  
  /* Sombras */
  --firestarter-shadow-sm: 0 1px 2px 0 hsl(0, 0%, 0%, 0.05);
  --firestarter-shadow: 0 1px 3px 0 hsl(0, 0%, 0%, 0.1), 0 1px 2px -1px hsl(0, 0%, 0%, 0.1);
  --firestarter-shadow-md: 0 4px 6px -1px hsl(0, 0%, 0%, 0.1), 0 2px 4px -2px hsl(0, 0%, 0%, 0.1);
  --firestarter-shadow-lg: 0 10px 15px -3px hsl(0, 0%, 0%, 0.1), 0 4px 6px -4px hsl(0, 0%, 0%, 0.1);
  --firestarter-shadow-xl: 0 20px 25px -5px hsl(0, 0%, 0%, 0.1), 0 8px 10px -6px hsl(0, 0%, 0%, 0.1);
  
  /* Colores de mensajes - inspirados en Universal RAG */
  --firestarter-user-bg: linear-gradient(135deg, #10b981 0%, #0ea5e9 100%);
  --firestarter-user-text: #ffffff;
  --firestarter-bot-bg: #ffffff;
  --firestarter-bot-text: #2d3748;
  
  /* Tamaños */
  --firestarter-header-height: 56px;
  --firestarter-input-height: 72px;
}

/* Reset para elementos del chatbot */
#firestarter-chatbot-container *,
.firestarter-chatbot-inline * {
  box-sizing: border-box;
}

/* ========================
   Botón Toggle Flotante
   ======================== */
.firestarter-toggle-btn {
  position: fixed !important;
  z-index: 1000000 !important;
  width: 60px !important;
  height: 60px !important;
  border-radius: 50% !important;
  border: none !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: transparent !important;
  color: hsl(224, 71.4%, 4.1%) !important;
  box-shadow: none !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  outline: none !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  user-select: none !important;
  -webkit-tap-highlight-color: transparent !important;
  min-width: 60px !important;
  max-width: 60px !important;
  min-height: 60px !important;
  max-height: 60px !important;
  padding: 0 !important;
  margin: 0 !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  box-sizing: border-box !important;
  overflow: visible !important;
  text-decoration: none !important;
  vertical-align: middle !important;
  white-space: nowrap !important;
}

.firestarter-toggle-btn:hover {
  transform: translateY(-2px) scale(1.05) !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.firestarter-toggle-btn:active {
  transform: scale(0.95) !important;
  transition: all 0.1s ease !important;
}

.firestarter-toggle-btn:focus {
  outline: none !important;
  box-shadow: none !important;
}

.firestarter-toggle-btn.position-bottom-right {
  bottom: 24px !important;
  right: 24px !important;
}

.firestarter-toggle-btn.position-bottom-left {
  bottom: 24px !important;
  left: 24px !important;
}

.firestarter-toggle-btn.position-top-right {
  top: 24px !important;
  right: 24px !important;
}

.firestarter-toggle-btn.position-top-left {
  top: 24px !important;
  left: 24px !important;
}

.firestarter-toggle-btn svg {
  width: 45px !important;
  height: 45px !important;
  transition: all 0.3s ease !important;
  color: hsl(224, 71.4%, 4.1%) !important;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.15)) !important;
}

.firestarter-toggle-btn:hover svg {
  color: hsl(224, 71.4%, 20%) !important;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.2)) !important;
  transform: scale(1.1) !important;
}

.firestarter-toggle-btn.is-open svg {
  display: none !important;
}

/* Animación de entrada del botón */
/*.firestarter-toggle-btn {
  animation: bounceIn 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55), 
             floatBob 3s ease-in-out 3s infinite !important;
}*/

@keyframes bounceIn {
  0% { 
    transform: scale(0) rotate(-180deg) !important; 
    opacity: 0 !important; 
  }
  60% { 
    transform: scale(1.15) rotate(-45deg) !important; 
    opacity: 0.9 !important; 
  }
  80% {
    transform: scale(0.95) rotate(10deg) !important;
    opacity: 1 !important;
  }
  100% { 
    transform: scale(1) rotate(0deg) !important; 
    opacity: 1 !important; 
  }
}

@keyframes floatBob {
  0%, 100% { 
    transform: translateY(0) !important; 
  }
  50% { 
    transform: translateY(-8px) !important; 
  }
}

/* Estado oculto del botón */
.firestarter-toggle-btn.hidden {
  transform: scale(0) !important;
  opacity: 0 !important;
  pointer-events: none !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* ========================
   Ventana del Chat
   ======================== */
.firestarter-chat-window {
  position: fixed !important;
  z-index: 999999 !important;
  width: 450px !important;
  max-width: 450px !important;
  height: 550px !important;
  max-height: 550px !important;
  background: white !important;
  border: none !important;
  border-radius: 20px !important;
  box-shadow: 0 10px 40px rgba(0,0,0,0.15) !important;
  display: none !important;
  flex-direction: column;
  overflow: hidden !important;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

.firestarter-chat-window.is-open {
  display: flex !important;
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

@keyframes slideUp {
  from { 
    transform: translateY(40px) scale(0.9); 
    opacity: 0; 
  }
  60% {
    transform: translateY(-5px) scale(1.02); 
    opacity: 0.8; 
  }
  to { 
    transform: translateY(0) scale(1); 
    opacity: 1; 
  }
}

.firestarter-chat-window.position-bottom-right {
  bottom: 20px !important;
  right: 20px !important;
}

.firestarter-chat-window.position-bottom-left {
  bottom: 20px !important;
  left: 20px !important;
}

.firestarter-chat-window.position-top-right {
  top: 20px !important;
  right: 20px !important;
}

.firestarter-chat-window.position-top-left {
  top: 20px !important;
  left: 20px !important;
}

/* Animación según posición */
.firestarter-chat-window.position-top-right,
.firestarter-chat-window.position-top-left {
  transform: translateY(-20px) scale(0.95);
}

.firestarter-chat-window.position-top-right.is-open,
.firestarter-chat-window.position-top-left.is-open {
  transform: translateY(0) scale(1);
}

/* ========================
   Modo Inline
   ======================== */
.firestarter-chatbot-inline .firestarter-chat-window {
  position: relative;
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: none;
  bottom: auto;
  right: auto;
  left: auto;
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

/* ========================
   Encabezado del Chat
   ======================== */
.firestarter-chat-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 16px 20px !important;
  background: hsl(0, 0%, 100%) !important;
  border-bottom: 1px solid hsl(214.3, 31.8%, 91.4%) !important;
  box-shadow: 0 1px 2px 0 hsl(0, 0%, 0%, 0.05) !important;
  flex-shrink: 0;
  min-height: var(--firestarter-header-height);
  position: relative !important;
  border-radius: 12px 12px 0 0 !important;
  color: hsl(224, 71.4%, 4.1%) !important;
}

.firestarter-chat-header::before {
  display: none !important;
}

.firestarter-chat-header-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.firestarter-chat-header-icon {
  display: none;
}

.firestarter-chat-header h3 {
  font-size: 16px !important;
  font-weight: 600 !important;
  color: hsl(224, 71.4%, 4.1%) !important;
  line-height: 1.5 !important;
  margin: 0 !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

.firestarter-chat-subtitle {
  font-size: 12px !important;
  margin-top: 2px !important;
  font-weight: 400 !important;
  color: hsl(215.4, 16.3%, 46.9%) !important;
  line-height: 1.4 !important;
}

.firestarter-chat-header-actions {
  display: flex !important;
  gap: 8px !important;
  align-items: center !important;
  position: relative !important;
}

.firestarter-header-btn {
  width: 32px !important;
  height: 32px !important;
  border-radius: 6px !important;
  border: 1px solid hsl(214.3, 31.8%, 91.4%) !important;
  background: transparent !important;
  color: hsl(215.4, 16.3%, 46.9%) !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all 0.15s ease !important;
  flex-shrink: 0 !important;
  padding: 8px !important;
}

.firestarter-header-btn:hover {
  background: hsl(210, 40%, 94%) !important;
  color: hsl(222.2, 84%, 4.9%) !important;
  border-color: hsl(214.3, 31.8%, 87.4%) !important;
}

.firestarter-header-btn:focus {
  outline: 2px solid hsl(221.2, 83.2%, 53.3%) !important;
  outline-offset: 2px !important;
}

.firestarter-header-btn svg {
  width: 16px !important;
  height: 16px !important;
  color: inherit !important;
  stroke: currentColor !important;
  fill: none !important;
  pointer-events: none !important;
}

/* ========================
   Área de Mensajes del Chat
   ======================== */
.firestarter-chat-messages {
  flex: 1;
  overflow-y: scroll !important;
  overflow-x: hidden !important;
  padding: 24px !important;
  display: flex;
  flex-direction: column;
  gap: 20px !important;
  scroll-behavior: smooth;
  background: linear-gradient(to bottom, #f8fafc, #e2e8f0) !important;
  height: 400px !important;
  overscroll-behavior: auto !important;
  -webkit-overflow-scrolling: touch;
  pointer-events: auto !important;
  touch-action: auto !important;
}

/* Scrollbar personalizada */
.firestarter-chat-messages::-webkit-scrollbar {
  width: 6px;
}

.firestarter-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.firestarter-chat-messages::-webkit-scrollbar-thumb {
  background: var(--firestarter-border);
  border-radius: 3px;
}

.firestarter-chat-messages::-webkit-scrollbar-thumb:hover {
  background: var(--firestarter-muted-foreground);
}

/* Firefox scrollbar */
.firestarter-chat-messages {
  scrollbar-width: thin;
  scrollbar-color: var(--firestarter-border) transparent;
}

/* ========================
   Burbujas de Mensajes
   ======================== */
.firestarter-message {
  display: flex !important;
  gap: 14px !important;
  max-width: 85%;
  width: fit-content;
  align-items: flex-end !important;
  animation: firestarter-message-in 0.3s ease;
  margin-bottom: 20px !important;
}

@keyframes firestarter-message-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.firestarter-message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
  justify-content: flex-end !important;
}

.firestarter-message.assistant,
.firestarter-message.bot {
  align-self: flex-start;
  justify-content: flex-start !important;
}

.firestarter-message-avatar {
  display: none;
}

.firestarter-message-content {
  padding: 16px 20px !important;
  border-radius: 20px !important;
  font-size: 14px !important;
  line-height: 1.5 !important;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  word-wrap: break-word !important;
  position: relative !important;
  width: fit-content;
  max-width: 100% !important;
}

.firestarter-message.user .firestarter-message-content {
  background: linear-gradient(135deg, #10b981 0%, #0ea5e9 100%) !important;
  color: white !important;
  border-bottom-right-radius: 6px !important;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3) !important;
}

.firestarter-message.assistant .firestarter-message-content,
.firestarter-message.bot .firestarter-message-content {
  background: white !important;
  color: #2d3748 !important;
  border: 1px solid #e2e8f0 !important;
  border-bottom-left-radius: 6px !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
  white-space: normal !important;
  line-height: 1.6 !important;
}

/* Formato del contenido del mensaje */
.firestarter-message-content p {
  margin: 0 0 12px !important;
  line-height: 1.6 !important;
}

.firestarter-message-content p:last-child {
  margin-bottom: 0 !important;
}

/* Secciones de chat */
.firestarter-message.bot .firestarter-message-content .chat-section {
  background: #f8f9fa !important;
  border-left: 4px solid #10b981 !important;
  padding: 12px 16px !important;
  margin: 12px 0 !important;
  border-radius: 0 8px 8px 0 !important;
}

/* Contenido destacado */
.firestarter-message.bot .firestarter-message-content .chat-highlight {
  background: linear-gradient(135deg, #e3f2fd 0%, #f1f8e9 100%) !important;
  border: 1px solid #bbdefb !important;
  padding: 12px 16px !important;
  margin: 12px 0 !important;
  border-radius: 8px !important;
}

/* Títulos h4 */
.firestarter-message.bot .firestarter-message-content h4 {
  margin: 8px 0 !important;
  font-size: 15px !important;
  color: #1a365d !important;
}

/* Texto en negrita */
.firestarter-message.bot .firestarter-message-content strong {
  color: #1a365d !important;
  font-weight: 600 !important;
}

/* Enlaces como botones atractivos */
.firestarter-message.bot .firestarter-message-content .chat-link,
.firestarter-message.bot .firestarter-message-content a {
  display: inline-block !important;
  background: linear-gradient(135deg, #10b981 0%, #0ea5e9 100%) !important;
  color: white !important;
  padding: 8px 16px !important;
  border-radius: 20px !important;
  text-decoration: none !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  margin: 8px 0 !important;
  transition: all 0.3s ease !important;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3) !important;
}

.firestarter-message.bot .firestarter-message-content .chat-link:hover,
.firestarter-message.bot .firestarter-message-content a:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4) !important;
  background: linear-gradient(135deg, #0ea5e9 0%, #10b981 100%) !important;
}

/* Separadores elegantes */
.firestarter-message.bot .firestarter-message-content .chat-separator,
.firestarter-message.bot .firestarter-message-content hr {
  border: none !important;
  height: 1px !important;
  background: linear-gradient(to right, transparent, #e0e0e0, transparent) !important;
  margin: 20px 0 !important;
}

/* Listas con mejor formato */
.firestarter-message.bot .firestarter-message-content ul {
  margin: 8px 0 !important;
  padding-left: 20px !important;
}

.firestarter-message.bot .firestarter-message-content li {
  margin: 4px 0 !important;
  line-height: 1.5 !important;
  color: #555 !important;
}

/* ========================
   Indicador de Escritura
   ======================== */
.firestarter-typing-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.firestarter-typing-text {
  font-size: 14px;
  color: #64748b;
  font-style: italic;
}

.firestarter-typing {
  display: flex;
  align-items: center;
  gap: 5px;
}

.firestarter-typing.show {
  display: flex !important;
}

.firestarter-typing::before {
  content: "" !important;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.firestarter-typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  animation: firestarter-typing-bounce 1.4s ease-in-out infinite;
}

.firestarter-typing-dot:nth-child(1) {
  animation-delay: 0s;
}

.firestarter-typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.firestarter-typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes firestarter-typing-bounce {
  0%, 60%, 100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-6px);
  }
}

/* ========================
   Sección de Fuentes
   ======================== */
.firestarter-sources {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--firestarter-border);
}

.firestarter-sources-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--firestarter-muted-foreground);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.firestarter-sources-title svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.firestarter-sources-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.firestarter-source-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--firestarter-muted);
  border: 1px solid var(--firestarter-border);
  border-radius: var(--firestarter-radius-sm);
  font-size: 12px;
  font-weight: 500;
  color: var(--firestarter-foreground);
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.firestarter-source-tag:hover {
  background: var(--firestarter-primary);
  color: var(--firestarter-primary-foreground);
  border-color: var(--firestarter-primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(99, 102, 241, 0.2);
}

.firestarter-source-tag svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  opacity: 0.7;
}

/* ========================
   Área de Input del Chat
   ======================== */
.firestarter-chat-input-container {
  padding: 16px 24px !important;
  border-top: 1px solid #e2e8f0 !important;
  background: white !important;
  border-radius: 0 0 20px 20px !important;
  flex-shrink: 0;
}

.firestarter-chat-input-wrapper {
  display: flex !important;
  gap: 12px !important;
  align-items: center !important;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  transition: none;
}

.firestarter-chat-input-wrapper:focus-within {
  border-color: transparent;
  box-shadow: none;
}

.firestarter-chat-input {
  flex: 1 !important;
  border: 2px solid #e2e8f0 !important;
  background: white !important;
  padding: 10px 20px !important;
  font-size: 14px !important;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: black !important;
  resize: none !important;
  min-height: 44px !important;
  max-height: 55px !important;
  height: 55px !important;
  line-height: 1.5;
  outline: none !important;
  border-radius: 25px !important;
  transition: all 0.3s !important;
  overflow: hidden !important;
  overflow-y: hidden !important;
  scrollbar-width: none !important;
  margin: 8px;
  align-content: center !important;
}

.firestarter-chat-input::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

.firestarter-chat-input::placeholder {
  color: var(--firestarter-muted-foreground);
}

.firestarter-chat-input:focus {
  border-color: hsl(224, 71.4%, 4.1%) !important;
  box-shadow: 0 0 0 3px hsl(224, 71.4%, 4.1%, 0.1) !important;
}

.firestarter-send-btn {
  background: hsl(224, 71.4%, 4.1%) !important;
  color: hsl(0, 0%, 100%) !important;
  border: 1px solid hsl(214.3, 31.8%, 91.4%) !important;
  border-radius: 8px !important;
  width: 44px !important;
  height: 44px !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 20px !important;
  transition: all 0.15s ease !important;
  box-shadow: 0 1px 2px 0 hsl(0, 0%, 0%, 0.05) !important;
  margin: 0 !important;
  padding: 0 !important;
  outline: none !important;
  flex-shrink: 0 !important;
}

.firestarter-send-btn:hover:not(:disabled) {
  background: hsl(224, 71.4%, 8%) !important;
  box-shadow: 0 1px 3px 0 hsl(0, 0%, 0%, 0.1), 0 1px 2px -1px hsl(0, 0%, 0%, 0.1) !important;
  transform: translateY(-1px) !important;
}

.firestarter-send-btn:focus {
  outline: 2px solid hsl(221.2, 83.2%, 53.3%) !important;
  outline-offset: 2px !important;
}

.firestarter-send-btn:disabled {
  background: hsl(210, 40%, 94%) !important;
  color: hsl(215.4, 16.3%, 46.9%) !important;
  border-color: hsl(214.3, 31.8%, 91.4%) !important;
  transform: none !important;
  cursor: not-allowed !important;
  box-shadow: none !important;
  opacity: 0.5 !important;
}

.firestarter-send-btn svg {
  width: 20px !important;
  height: 20px !important;
  transform: none;
}

/* ========================
   Estado de Bienvenida
   ======================== */
.firestarter-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px 24px;
  gap: 16px;
  flex: 1;
}

.firestarter-welcome-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.firestarter-welcome-icon::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
  animation: firestarter-welcome-pulse 2s ease-in-out infinite;
  z-index: -1;
}

@keyframes firestarter-welcome-pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.2;
  }
}

.firestarter-welcome-icon svg {
  width: 36px;
  height: 36px;
  color: var(--firestarter-primary);
}

.firestarter-welcome h4 {
  font-size: 14px;
  font-weight: 400;
  color: var(--firestarter-muted-foreground);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  margin-top: 8px;
}

.firestarter-welcome p {
  display: none;
}


/* ========================
   Estado de Error
   ======================== */
.firestarter-error {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--firestarter-radius-sm);
  color: #dc2626;
  font-size: 13px;
  animation: firestarter-shake 0.5s ease;
}

@keyframes firestarter-shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-2px); }
  20%, 40%, 60%, 80% { transform: translateX(2px); }
}

.firestarter-error svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}


/* ========================
   Responsive para Móviles
   ======================== */
@media (max-width: 768px) {
  .firestarter-chat-window {
    width: calc(100vw - 20px) !important;
    max-width: calc(100vw - 20px) !important;
    right: 10px !important;
    left: 10px !important;
    bottom: 80px !important;
    max-height: calc(80vh - 120px) !important;
    margin: 0 !important;
  }

  .firestarter-toggle-btn {
    right: 16px !important;
    bottom: 16px !important;
    width: 45px !important;
    height: 45px !important;
    min-width: 45px !important;
    max-width: 45px !important;
    min-height: 45px !important;
    max-height: 45px !important;
    font-size: 20px !important;
  }
  
  .firestarter-chat-window.position-bottom-right,
  .firestarter-chat-window.position-bottom-left,
  .firestarter-chat-window.position-top-right,
  .firestarter-chat-window.position-top-left {
    right: 10px !important;
    left: 10px !important;
    width: calc(100vw - 20px) !important;
  }
  
  .firestarter-chat-window.position-top-right,
  .firestarter-chat-window.position-top-left {
    top: 10px !important;
    bottom: auto !important;
  }
}

@media (max-width: 480px) {
  .firestarter-chat-window {
    width: calc(100vw - 16px) !important;
    max-width: calc(100vw - 16px) !important;
    right: 8px !important;
    left: 8px !important;
    bottom: 90px !important;
    max-height: calc(100vh - 130px) !important;
  }
  
  .firestarter-chat-window.position-bottom-right,
  .firestarter-chat-window.position-bottom-left,
  .firestarter-chat-window.position-top-right,
  .firestarter-chat-window.position-top-left {
    right: 8px !important;
    left: 8px !important;
    width: calc(100vw - 16px) !important;
  }
  
  .firestarter-toggle-btn {
    right: 16px !important;
    bottom: 16px !important;
    width: 50px !important;
    height: 50px !important;
    min-width: 50px !important;
    max-width: 50px !important;
    min-height: 50px !important;
    max-height: 50px !important;
    font-size: 20px !important;
  }
  
  .firestarter-toggle-btn svg {
    width: 38px !important;
    height: 38px !important;
  }
  
  .firestarter-chat-messages {
    max-height: calc(100vh - 250px) !important;
    padding: 15px !important;
  }
  
  .firestarter-chat-input-container {
    padding: 12px !important;
  }
  
  .firestarter-chat-input {
    padding: 12px 16px !important;
    font-size: 16px !important; /* Evita zoom en iOS */
  }
}

@media (max-width: 360px) {
  .firestarter-toggle-btn {
    width: 46px !important;
    height: 46px !important;
    min-width: 46px !important;
    max-width: 46px !important;
    min-height: 46px !important;
    max-height: 46px !important;
    font-size: 18px !important;
  }
  
  .firestarter-toggle-btn svg {
    width: 34px !important;
    height: 34px !important;
  }
}

/* Asegurar que no hay conflictos con otros elementos */
.firestarter-chat-window * {
  box-sizing: border-box !important;
}

/* ========================
   Soporte Modo Oscuro (Opcional)
   ======================== */
@media (prefers-color-scheme: dark) {
  :root {
    --firestarter-primary: hsl(224, 71.4%, 20%);
    --firestarter-primary-light: hsl(224, 71.4%, 25%);
    --firestarter-primary-dark: hsl(224, 71.4%, 15%);
    --firestarter-primary-foreground: hsl(0, 0%, 100%);
    --firestarter-background: hsl(224, 71.4%, 8%);
    --firestarter-foreground: hsl(0, 0%, 100%);
    --firestarter-muted: hsl(224, 71.4%, 15%);
    --firestarter-muted-foreground: hsl(215.4, 16.3%, 60%);
    --firestarter-border: hsl(214.3, 31.8%, 20%);
  }
}

/* ========================
   Estilos de Impresión
   ======================== */
@media print {
  #firestarter-chatbot-container,
  .firestarter-toggle-btn {
    display: none !important;
  }
}

/* ========================
   Movimiento Reducido
   ======================== */
@media (prefers-reduced-motion: reduce) {
  .firestarter-toggle-btn::after,
  .firestarter-typing-dot,
  .firestarter-message,
  .firestarter-welcome-icon::before {
    animation: none;
  }
  
  .firestarter-chat-window,
  .firestarter-toggle-btn,
  * {
    transition-duration: 0.01ms !important;
  }
}
