/* ===========================
   CHAT N8N - DISEÑO MODERNO
   Versión 2.2.3 - Interfaz de mensajería moderna
   =========================== */

#chat-n8n-widget {
  /* Colores principales */
  --primary-blue: #4A90E2;
  --primary-blue-light: #6B9FE8;
  --bubble-bot: #C8E0F4;
  --bubble-user: #A8E6CF;
  --background: #F5F6F8;
  --text-primary: #2C3E50;
  --text-secondary: #7F8C8D;
  --border-color: #E1E8ED;
  --white: #FFFFFF;
  --online-green: #48BB78;

  /* Sombras */
  --shadow-soft: 0 4px 20px rgba(74, 144, 226, 0.15);
  --shadow-medium: 0 8px 30px rgba(74, 144, 226, 0.2);

  /* Transiciones */
  --transition-smooth: all 0.3s ease-out;

  /* Reset de fuentes para el widget */
  line-height: 1.5;
  text-align: left;
  box-sizing: border-box;
}

#chat-n8n-widget * {
  box-sizing: border-box;
}

/* ===========================
   WIDGET CONTAINER
   =========================== */
#chat-n8n-widget {
  position: fixed;
  bottom: 100px;
  right: 20px;
  /* Default fallback */
  width: 60px;
  height: 60px;
  max-width: 60px;
  max-height: 60px;
  z-index: 999999;
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  direction: ltr;
  /* Reset direction */
  text-align: left;
  /* Reset alignment */
  /* Prevent widget from affecting page layout */
  pointer-events: auto;
  /* Removed contain: paint as it traps fixed children */
}

#chat-n8n-widget.chat-widget-right {
  right: 20px;
}

#chat-n8n-widget.chat-widget-left {
  left: 20px;
}

/* ===========================
   BOTÓN FLOTANTE
   =========================== */
#chat-n8n-widget #chat-bubble {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-blue), var(--primary-blue-light));
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  transition: var(--transition-smooth);
  position: relative;
  overflow: visible;
  margin: 0;
  /* Reset */
  padding: 0;
  /* Reset */
}

#chat-n8n-widget #chat-bubble:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-medium);
}

#chat-n8n-widget #chat-bubble svg {
  width: 28px;
  height: 28px;
  display: block;
}

/* Eliminar el texto del bubble */
#chat-n8n-widget .bubble-text {
  display: none;
}

/* ===========================
   VENTANA DE CHAT
   =========================== */
#chat-n8n-widget #chat-window {
  position: fixed;
  bottom: 20px;
  /* Anchored to bottom regardless of button height */
  width: 400px;
  max-width: calc(100vw - 40px);
  height: 650px;
  max-height: calc(100vh - 100px);
  /* Restored height capacity */
  background: var(--white);
  border-radius: 20px;
  box-shadow: var(--shadow-medium);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  transition: var(--transition-smooth);
  pointer-events: none;
  border: 1px solid var(--border-color);
  /* Added border for contrast */
  /* Prevent window from affecting page layout */
  contain: layout style paint;
  will-change: transform, opacity;
}

/* Force SVG visibility and color */
#chat-n8n-widget svg {
  display: inline-block !important;
  vertical-align: middle;
}

#chat-n8n-widget .close-button svg {
  stroke: #ffffff !important;
}

#chat-n8n-widget #send-button svg {
  stroke: #ffffff !important;
}

#chat-n8n-widget .attachment-btn svg {
  stroke: #7F8C8D !important;
}

#chat-n8n-widget .attachment-btn:hover svg {
  stroke: #4A90E2 !important;
}

#chat-n8n-widget #chat-window.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

#chat-n8n-widget.chat-widget-right #chat-window {
  right: 20px;
}

#chat-n8n-widget.chat-widget-left #chat-window {
  left: 20px;
}

/* ===========================
   HEADER DEL CHAT
   =========================== */
#chat-n8n-widget .chat-header {
  background: linear-gradient(135deg, var(--primary-blue), var(--primary-blue-light));
  color: var(--white);
  padding: 24px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  min-height: 88px;
  border-radius: 20px 20px 0 0;
  /* Match container radius */
}

#chat-n8n-widget .chat-header-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

#chat-n8n-widget .chat-logo {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  color: var(--primary-blue);
  border: 3px solid rgba(255, 255, 255, 0.3);
  flex-shrink: 0;
  margin: 0;
  /* Reset */
}

#chat-n8n-widget .chat-logo img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  margin: 0;
  /* Reset */
  padding: 0;
  /* Reset */
}

#chat-n8n-widget .chat-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#chat-n8n-widget .chat-title h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  color: #1a202c;
  /* Fallback */
  letter-spacing: -0.02em;
  line-height: 1.2;
}

#chat-n8n-widget .chat-status {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
  color: rgba(44, 62, 80, 0.7);
  /* Fallback */
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  line-height: 1;
}

#chat-n8n-widget .chat-status::before {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--online-green);
  border-radius: 50%;
  display: inline-block;
  animation: pulse-status 2s infinite;
  box-shadow: 0 0 0 0 rgba(72, 187, 120, 0.4);
}

@keyframes pulse-status {

  0%,
  100% {
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(72, 187, 120, 0.4);
  }

  50% {
    opacity: 0.8;
    box-shadow: 0 0 0 4px rgba(72, 187, 120, 0);
  }
}

#chat-n8n-widget .close-button {
  background: rgba(0, 0, 0, 0.2);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  transition: var(--transition-smooth);
  flex-shrink: 0;
  padding: 0;
  margin: 0;
}

#chat-n8n-widget .close-button:hover {
  background: rgba(0, 0, 0, 0.3);
  transform: rotate(90deg);
}

/* ===========================
   ÁREA DE MENSAJES
   =========================== */
#chat-n8n-widget .chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: var(--background);
  scroll-behavior: smooth;
  /* Optimizaciones de rendimiento */
  will-change: scroll-position;
  contain: layout style paint;
  -webkit-overflow-scrolling: touch;
}

#chat-n8n-widget .chat-messages::-webkit-scrollbar {
  width: 6px;
}

#chat-n8n-widget .chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

#chat-n8n-widget .chat-messages::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

#chat-n8n-widget .chat-messages::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* ===========================
   BURBUJAS DE MENSAJES
   =========================== */
#chat-n8n-widget .message {
  margin-bottom: 12px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  animation: messageSlideIn 0.3s ease-out;
  /* Optimizaciones de rendimiento */
  will-change: transform, opacity;
  transform: translateZ(0);
  backface-visibility: hidden;
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#chat-n8n-widget .message.user {
  flex-direction: row-reverse;
}

/* Avatares */
#chat-n8n-widget .message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
  margin: 0;
}

#chat-n8n-widget .message.bot .message-avatar {
  background: linear-gradient(135deg, var(--primary-blue), var(--primary-blue-light));
  color: var(--white);
  font-weight: 600;
}

#chat-n8n-widget .message.user .message-avatar {
  background: var(--bubble-user);
  color: var(--text-primary);
  font-weight: 600;
}

#chat-n8n-widget .message-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  margin: 0;
}

/* Contenedor del mensaje */
#chat-n8n-widget .message>div {
  display: flex;
  flex-direction: column;
  max-width: 75%;
}

/* Burbujas */
#chat-n8n-widget .message-bubble {
  padding: 12px 16px;
  border-radius: 18px;
  word-wrap: break-word;
  position: relative;
  box-shadow: none;
  /* Reset shadow */
}

#chat-n8n-widget .message.bot .message-bubble {
  background: var(--bubble-bot);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

#chat-n8n-widget .message.user .message-bubble {
  background: var(--bubble-user);
  color: var(--text-primary);
  border-bottom-right-radius: 4px;
}

#chat-n8n-widget .message-text {
  margin: 0;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.5;
  white-space: pre-wrap;
  /* Preserva saltos de línea y espacios */
  word-wrap: break-word;
  /* Rompe palabras largas */
  color: inherit;
}

#chat-n8n-widget .message-time {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-secondary);
  margin-top: 4px;
  padding: 0 4px;
  line-height: normal;
}

#chat-n8n-widget .message.bot .message-time {
  text-align: left;
}

#chat-n8n-widget .message.user .message-time {
  text-align: right;
}

/* ===========================
   INDICADOR DE ESCRITURA
   =========================== */
#chat-n8n-widget .typing-indicator {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  /* Optimización de rendimiento */
  will-change: transform;
}

#chat-n8n-widget .typing-dot {
  width: 8px;
  height: 8px;
  background: var(--text-secondary);
  border-radius: 50%;
  animation: typing-bounce 1.4s infinite ease-in-out;
  /* Optimización de rendimiento - usar GPU */
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
}

#chat-n8n-widget .typing-dot:nth-child(1) {
  animation-delay: 0s;
}

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

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

@keyframes typing-bounce {

  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.7;
  }

  30% {
    transform: translateY(-8px);
    opacity: 1;
  }
}

/* ===========================
   INPUT DE MENSAJE
   =========================== */
#chat-n8n-widget .chat-input-wrapper {
  background: var(--white);
  padding: 16px;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
  border-radius: 0 0 20px 20px;
  /* Match container radius */
}

#chat-n8n-widget .chat-input-container {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

/* Botones de adjuntos */
#chat-n8n-widget .attachment-buttons {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

#chat-n8n-widget .attachment-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--background);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
  padding: 0;
  margin: 0;
}

#chat-n8n-widget .attachment-btn:hover {
  background: var(--border-color);
  color: var(--primary-blue);
  transform: scale(1.05);
}

#chat-n8n-widget .attachment-btn.recording {
  background: #fee;
  color: #c00;
  animation: pulse-recording 1s infinite;
}

@keyframes pulse-recording {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.6;
  }
}

#chat-n8n-widget .attachment-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}

#chat-n8n-widget #chat-input {
  flex: 1;
  border: 2px solid var(--primary-blue-light);
  border-radius: 28px;
  padding: 14px 20px;
  font-size: 15px;
  font-family: inherit;
  resize: none;
  max-height: 120px;
  min-height: 52px;
  transition: var(--transition-smooth);
  outline: none;
  background: var(--white);
  color: var(--text-primary);
  line-height: 1.5;
  margin: 0;
  box-shadow: none;
}

#chat-n8n-widget #chat-input::placeholder {
  color: var(--text-secondary);
  opacity: 0.7;
}

#chat-n8n-widget #chat-input:focus {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

#chat-n8n-widget #send-button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--primary-blue);
  color: var(--white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
  flex-shrink: 0;
  padding: 0;
  margin: 0;
}

#chat-n8n-widget #send-button:hover:not(:disabled) {
  transform: scale(1.05);
  background: var(--primary-blue-light);
  box-shadow: 0 4px 12px rgba(74, 144, 226, 0.4);
}

#chat-n8n-widget #send-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#chat-n8n-widget #send-button svg {
  width: 20px;
  height: 20px;
  display: block;
}

/* ===========================
   MODAL DE CONSENTIMIENTO
   =========================== */
#chat-n8n-widget .consent-modal {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--white);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
  text-align: center;
  z-index: 10;
  border-radius: 20px;
}

#chat-n8n-widget .consent-modal h3 {
  color: var(--text-primary);
  margin: 0 0 16px 0;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
}

#chat-n8n-widget .consent-modal p {
  color: var(--text-secondary);
  margin: 0 0 24px 0;
  font-size: 14px;
  line-height: 1.6;
}

#chat-n8n-widget .consent-modal a {
  color: var(--primary-blue);
  text-decoration: none;
  font-weight: 500;
}

#chat-n8n-widget .consent-modal a:hover {
  text-decoration: underline;
}

#chat-n8n-widget .consent-email {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  font-size: 14px;
  margin-bottom: 16px;
  outline: none;
  transition: var(--transition-smooth);
  color: var(--text-primary);
  background: var(--white);
}

#chat-n8n-widget .consent-email:focus {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

#chat-n8n-widget .consent-buttons {
  display: flex;
  gap: 10px;
  width: 100%;
}

#chat-n8n-widget .consent-btn {
  flex: 1;
  padding: 12px 24px;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  margin: 0;
}

#chat-n8n-widget .consent-btn-accept {
  background: linear-gradient(135deg, var(--primary-blue), var(--primary-blue-light));
  color: var(--white);
}

#chat-n8n-widget .consent-btn-accept:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(74, 144, 226, 0.4);
}

#chat-n8n-widget .consent-btn-decline {
  background: var(--border-color);
  color: var(--text-primary);
}

#chat-n8n-widget .consent-btn-decline:hover {
  background: #cbd5e0;
}

/* ===========================
   PREVISUALIZACIÓN DE ARCHIVOS
   =========================== */
#chat-n8n-widget .file-preview-area {
  padding: 12px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#chat-n8n-widget .file-preview-item {
  background: var(--background);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
}

#chat-n8n-widget .file-preview-icon {
  font-size: 24px;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--white);
  overflow: hidden;
}

#chat-n8n-widget .file-preview-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  margin: 0;
}

#chat-n8n-widget .file-preview-icon.loading {
  opacity: 0.5;
}

#chat-n8n-widget .file-preview-info {
  flex: 1;
  min-width: 0;
}

#chat-n8n-widget .file-preview-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
  line-height: normal;
}

#chat-n8n-widget .file-preview-size {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

#chat-n8n-widget .file-preview-remove {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: var(--transition-smooth);
  flex-shrink: 0;
  margin: 0;
}

#chat-n8n-widget .file-preview-remove:hover {
  background: rgba(255, 0, 0, 0.1);
  color: #c00;
}

/* ===========================
   ARCHIVOS ADJUNTOS EN MENSAJES
   =========================== */
#chat-n8n-widget .message-attachments {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#chat-n8n-widget .message-attachment {
  border-radius: 8px;
  overflow: hidden;
}

/* Imágenes adjuntas */
#chat-n8n-widget .image-attachment {
  max-width: 100%;
}

#chat-n8n-widget .image-attachment a {
  display: block;
  text-decoration: none;
}

#chat-n8n-widget .image-attachment img {
  max-width: 100%;
  height: auto;
  max-height: 300px;
  border-radius: 8px;
  display: block;
  object-fit: cover;
  cursor: pointer;
  transition: var(--transition-smooth);
  margin: 0;
}

#chat-n8n-widget .image-attachment img:hover {
  opacity: 0.9;
  transform: scale(1.02);
}

/* Audio adjunto */
#chat-n8n-widget .audio-attachment {
  background: rgba(0, 0, 0, 0.05);
  padding: 12px;
  border-radius: 8px;
}

#chat-n8n-widget .audio-attachment audio {
  width: 100%;
  max-width: 300px;
  height: 32px;
}

#chat-n8n-widget .audio-attachment .attachment-info {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

#chat-n8n-widget .audio-attachment .attachment-name {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: normal;
}

#chat-n8n-widget .audio-attachment .attachment-size {
  font-size: 11px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

/* Archivo genérico adjunto */
#chat-n8n-widget .file-attachment {
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  transition: var(--transition-smooth);
}

#chat-n8n-widget .file-attachment:hover {
  background: rgba(0, 0, 0, 0.05);
  border-color: var(--primary-blue);
}

#chat-n8n-widget .file-attachment a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  text-decoration: none;
  color: var(--text-primary);
}

#chat-n8n-widget .file-attachment .attachment-icon {
  font-size: 28px;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--white);
  border-radius: 8px;
}

#chat-n8n-widget .file-attachment .attachment-info {
  flex: 1;
  min-width: 0;
}

#chat-n8n-widget .file-attachment .attachment-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
  line-height: normal;
  margin-bottom: 2px;
}

#chat-n8n-widget .file-attachment .attachment-size {
  font-size: 11px;
  color: var(--text-secondary);
  display: block;
  margin-top: 2px;
}

#chat-n8n-widget .file-attachment .attachment-download {
  color: var(--primary-blue);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(74, 144, 226, 0.1);
  transition: var(--transition-smooth);
}

#chat-n8n-widget .file-attachment:hover .attachment-download {
  background: var(--primary-blue);
  color: var(--white);
  transform: scale(1.1);
}

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 768px) {
  #chat-n8n-widget {
    /* Ensure widget doesn't cause horizontal overflow on tablets */
    right: 10px;
    bottom: 80px;
  }

  #chat-n8n-widget #chat-window {
    width: calc(100vw - 40px);
    max-width: calc(100vw - 40px);
    height: calc(100vh - 120px);
    max-height: calc(100vh - 120px);
    bottom: 10px;
    right: 20px;
  }

  #chat-n8n-widget.chat-widget-right #chat-window {
    right: 20px;
    left: auto;
  }

  #chat-n8n-widget.chat-widget-left #chat-window {
    left: 20px;
    right: auto;
  }
}

@media (max-width: 480px) {
  #chat-n8n-widget {
    /* Ensure widget container is properly constrained on mobile */
    right: 10px;
    bottom: 60px;
    max-width: 56px;
    max-height: 56px;
  }

  #chat-n8n-widget #chat-window {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    max-height: 100vh !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: 0 !important;
    border-radius: 0;
    margin: 0;
  }

  #chat-n8n-widget #chat-bubble {
    width: 56px;
    height: 56px;
  }

  #chat-n8n-widget #chat-bubble svg {
    width: 24px;
    height: 24px;
  }

  #chat-n8n-widget .message-bubble {
    max-width: 80%;
  }

  #chat-n8n-widget .chat-header {
    padding: 18px 16px;
    min-height: 76px;
  }

  #chat-n8n-widget .chat-logo {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

  #chat-n8n-widget .chat-title h3 {
    font-size: 16px;
  }

  #chat-n8n-widget .chat-status {
    font-size: 12px;
  }

  #chat-n8n-widget .attachment-btn {
    width: 32px;
    height: 32px;
  }

  #chat-n8n-widget .attachment-btn svg {
    width: 16px;
    height: 16px;
  }

  #chat-n8n-widget .file-preview-name {
    max-width: 120px;
  }

  #chat-n8n-widget .file-attachment .attachment-name {
    max-width: 150px;
  }

  #chat-n8n-widget .image-attachment img {
    max-height: 200px;
  }
}

/* ===========================
   ANIMACIONES ADICIONALES
   =========================== */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* Mejora de accesibilidad */
@media (prefers-reduced-motion: reduce) {
  #chat-n8n-widget * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===========================
   ESTILOS MARKDOWN
   =========================== */
#chat-n8n-widget .markdown-content {
  line-height: 1.5;
  white-space: pre-wrap;
  /* Preserva espacios en blanco y saltos de línea */
  word-wrap: break-word;
  /* Rompe palabras largas */
}

#chat-n8n-widget .markdown-content p {
  margin: 0 0 6px 0;
  /* Reducido de 12px a 6px */
  white-space: pre-wrap;
  /* Preserva saltos de línea en párrafos */
}

#chat-n8n-widget .markdown-content p:last-child {
  margin-bottom: 0;
}

/* Asegurar que los <br> se muestren correctamente */
#chat-n8n-widget .markdown-content br {
  display: block;
  content: "";
  margin: 0;
  /* Reducido de 4px a 0 */
}

/* Encabezados */
#chat-n8n-widget .markdown-content h1,
#chat-n8n-widget .markdown-content h2,
#chat-n8n-widget .markdown-content h3,
#chat-n8n-widget .markdown-content h4,
#chat-n8n-widget .markdown-content h5,
#chat-n8n-widget .markdown-content h6 {
  margin: 10px 0 6px 0;
  /* Reducido de 16px/8px a 10px/6px */
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}

#chat-n8n-widget .markdown-content h1 {
  font-size: 1.5em;
}

#chat-n8n-widget .markdown-content h2 {
  font-size: 1.3em;
}

#chat-n8n-widget .markdown-content h3 {
  font-size: 1.15em;
}

#chat-n8n-widget .markdown-content h4 {
  font-size: 1.05em;
}

#chat-n8n-widget .markdown-content h5 {
  font-size: 1em;
}

#chat-n8n-widget .markdown-content h6 {
  font-size: 0.95em;
}

#chat-n8n-widget .markdown-content h1:first-child,
#chat-n8n-widget .markdown-content h2:first-child,
#chat-n8n-widget .markdown-content h3:first-child,
#chat-n8n-widget .markdown-content h4:first-child,
#chat-n8n-widget .markdown-content h5:first-child,
#chat-n8n-widget .markdown-content h6:first-child {
  margin-top: 0;
}

/* Listas */
#chat-n8n-widget .markdown-content ul,
#chat-n8n-widget .markdown-content ol {
  margin: 6px 0;
  /* Reducido de 8px a 6px */
  padding-left: 24px;
}

#chat-n8n-widget .markdown-content li {
  margin: 2px 0;
  /* Reducido de 4px a 2px */
  line-height: 1.4;
  /* Agregado para líneas más compactas */
}

#chat-n8n-widget .markdown-content ul>li {
  list-style-type: disc;
}

#chat-n8n-widget .markdown-content ol>li {
  list-style-type: decimal;
}

#chat-n8n-widget .markdown-content ul ul,
#chat-n8n-widget .markdown-content ol ul {
  margin: 4px 0;
}

#chat-n8n-widget .markdown-content ul ul>li {
  list-style-type: circle;
}

/* Código */
#chat-n8n-widget .markdown-content code {
  background: rgba(0, 0, 0, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
  font-size: 0.9em;
  color: #e83e8c;
}

#chat-n8n-widget .markdown-content pre {
  background: rgba(0, 0, 0, 0.05);
  padding: 12px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 12px 0;
  border-left: 3px solid var(--primary-blue);
}

#chat-n8n-widget .markdown-content pre code {
  background: transparent;
  padding: 0;
  color: var(--text-primary);
  font-size: 0.85em;
  line-height: 1.5;
}

/* Enlaces */
#chat-n8n-widget .markdown-content a {
  color: var(--primary-blue);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition-smooth);
}

#chat-n8n-widget .markdown-content a:hover {
  text-decoration: underline;
  color: var(--primary-blue-light);
}

/* Énfasis */
#chat-n8n-widget .markdown-content strong,
#chat-n8n-widget .markdown-content b {
  font-weight: 600;
  color: var(--text-primary);
}

#chat-n8n-widget .markdown-content em,
#chat-n8n-widget .markdown-content i {
  font-style: italic;
}

/* Bloques de cita */
#chat-n8n-widget .markdown-content blockquote {
  margin: 12px 0;
  padding: 8px 16px;
  border-left: 4px solid var(--primary-blue);
  background: rgba(74, 144, 226, 0.05);
  border-radius: 0 8px 8px 0;
  color: var(--text-secondary);
}

#chat-n8n-widget .markdown-content blockquote p {
  margin: 4px 0;
}

/* Línea horizontal */
#chat-n8n-widget .markdown-content hr {
  border: none;
  border-top: 2px solid var(--border-color);
  margin: 16px 0;
}

/* Tablas */
#chat-n8n-widget .markdown-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 12px 0;
  font-size: 0.9em;
}

#chat-n8n-widget .markdown-content table th,
#chat-n8n-widget .markdown-content table td {
  border: 1px solid var(--border-color);
  padding: 8px 12px;
  text-align: left;
}

#chat-n8n-widget .markdown-content table th {
  background: rgba(74, 144, 226, 0.1);
  font-weight: 600;
  color: var(--text-primary);
}

#chat-n8n-widget .markdown-content table tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.02);
}

/* Imágenes */
#chat-n8n-widget .markdown-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 8px 0;
}