/* ===== ICONO ROBOT =====
   Por defecto usa currentColor para que el padre controle el color
   (los SVGs vienen con stroke="currentColor"). Las secciones concretas
   pueden sobreescribir el color con reglas mas especificas. */

.robot-icon {
  display: inline-block;
  vertical-align: middle;
  color: var(--azul);
}

[data-theme="dark"] .robot-icon {
  color: var(--azul-claro);
}

/* ===== LOADING DOTS ===== */
.loading-dots {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 20px;
  background: var(--menu-bg);
  border: 2px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.loading-dots.small {
  padding: 8px 14px;
  gap: 4px;
}

.loading-dot {
  width: 8px;
  height: 8px;
  background: var(--azul);
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out;
}

.loading-dots.small .loading-dot {
  width: 6px;
  height: 6px;
}

.loading-dot:nth-child(1) {
  animation-delay: -0.32s;
}

.loading-dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes bounce {
  0%,
  80%,
  100% {
    transform: scale(0);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.ai-circle::before {
  content: "";
  position: absolute;
  inset: 1px;
  background: linear-gradient(#2196f3, #e91e63);
  mix-blend-mode: color-burn;
  border-radius: 50%;
  animation: aiLoaderAnim 2s linear infinite;
}

.ai-circle::after {
  content: "";
  position: absolute;
  inset: 6px;
  filter: blur(0.9px);
  background: #acbaca;
  border-radius: 50%;
  z-index: 1000;
}

@keyframes aiLoaderAnim {
  0% {
    transform: rotate(0deg);
    filter: blur(2px);
  }
  100% {
    transform: rotate(360deg);
    filter: blur(4px);
  }
}

/* ===== EMPTY STATE ===== */
.empty-state .robot-icon {
  width: 80px;
  height: 80px;
  margin-bottom: 24px;
}

/* ===== VARIABLES Y BASE ===== */
#ADMINISTRATOR {
  height: calc(100vh - 65px) !important;
  max-height: calc(100vh - 65px) !important;
  overflow: hidden !important;
  display: block !important;
}

.ia-container {
  display: flex;
  height: 100%;
  max-height: 100%;
  background: var(--body-bg);
  color: var(--text);
  font-family: "RobotoCondensed", sans-serif;
  overflow: hidden;
  position: relative;
}

/* ===== SIDEBAR ===== */
.ia-sidebar {
  width: 280px;
  min-width: 280px;
  background: var(--menu-bg);
  border-right: 2px solid var(--menu-border);
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.ia-sidebar-header {
  padding: 20px;
  border-bottom: 2px solid var(--menu-border);
  background: var(--table-filter-bg);
}

.ia-sidebar-header h2 {
  margin: 0 0 16px 0;
  color: var(--azul);
  font-size: 1.3em;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ia-sidebar-header h2 svg {
  width: 24px;
  height: 24px;
  fill: var(--azul);
}

.ia-sidebar-header h2 .robot-icon {
  width: 32px;
  height: 32px;
}

.ia-sidebar-header h2 .robot-icon {
  color: var(--azul-oscuro);
}

.ia-sidebar-header h2 .robot-icon path {
  fill: var(--azul-claro);
  fill-opacity: 0.3;
  stroke: currentColor;
}

[data-theme="dark"] .ia-sidebar-header h2 .robot-icon {
  color: var(--azul-claro);
}

[data-theme="dark"] .ia-sidebar-header h2 .robot-icon path {
  fill: var(--azul);
  fill-opacity: 0.4;
}

/* ===== BOTONES MODERNOS ===== */
.ia-button {
  padding: 11px 16px;
  background: linear-gradient(135deg, var(--azul) 0%, var(--azul-oscuro) 100%);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 10px;
  width: 100%;
  font-family: "RobotoCondensed", sans-serif;
  font-weight: 600;
  font-size: 13px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--sombra-1);
  position: relative;
  overflow: hidden;
}

.ia-button::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.ia-button:hover::before {
  left: 100%;
}

.ia-button:hover {
  background: linear-gradient(135deg, var(--azul-claro) 0%, var(--azul) 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 119, 182, 0.3);
}

.ia-button:active {
  transform: translateY(0);
  box-shadow: var(--sombra-1);
}

.ia-button.secondary {
  background: linear-gradient(135deg, var(--gris-3) 0%, var(--gris-4) 100%);
}

.ia-button.secondary:hover {
  background: linear-gradient(135deg, var(--gris-2) 0%, var(--gris-3) 100%);
}

.ia-button svg {
  width: 14px;
  height: 14px;
  fill: white;
}

/* ===== LISTA DE CONVERSACIONES ===== */
.conversations-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-1) var(--scrollbar-2);
}

.conversations-list::-webkit-scrollbar {
  width: 6px;
}

.conversations-list::-webkit-scrollbar-track {
  background: var(--scrollbar-2);
  border-radius: 3px;
}

.conversations-list::-webkit-scrollbar-thumb {
  background: var(--scrollbar-1);
  border-radius: 3px;
}

.conversation-item {
  padding: 14px;
  margin-bottom: 8px;
  background: var(--bg-even);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 4px;
}

.conversation-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--azul);
  transform: scaleY(0);
  transition: transform 0.3s ease;
}

.conversation-item:hover {
  background: var(--hover);
  transform: translateX(4px);
  box-shadow: var(--sombra-1);
}

.conversation-item:hover::before {
  transform: scaleY(1);
}

.conversation-item.active {
  background: linear-gradient(135deg, var(--azul-card) 0%, var(--azul-oscuro) 100%);
  color: white;
  border-color: var(--azul);
  box-shadow: 0 4px 15px rgba(0, 119, 182, 0.3);
  transform: translateX(0);
}

.conversation-item.active::before {
  transform: scaleY(1);
  background: white;
}

.conversation-title {
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 14px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.conversation-content {
  flex: 1;
  min-width: 0;
  padding-right: 8px;
}

.conversation-delete-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--gris-3);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease, background 0.2s ease, color 0.2s ease;
  padding: 0;
  flex-shrink: 0;
}

.conversation-delete-btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.conversation-item:hover .conversation-delete-btn,
.conversation-delete-btn:focus {
  opacity: 1;
}

.conversation-delete-btn:hover {
  background: rgba(231, 76, 60, 0.15);
  color: #e74c3c;
}

.conversation-item.active .conversation-delete-btn {
  color: rgba(255, 255, 255, 0.85);
}

.conversation-item.active .conversation-delete-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.conversation-date {
  font-size: 11px;
  opacity: 0.7;
  font-weight: 400;
}

.conversations-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--gris-3);
  font-style: italic;
}

.conversations-empty svg {
  width: 48px;
  height: 48px;
  margin-bottom: 15px;
  opacity: 0.5;
  fill: var(--gris-3);
}

/* ===== ÁREA PRINCIPAL ===== */
.ia-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--body-bg);
  min-width: 0;
  max-height: 100%;
  height: 100%;
  overflow: hidden;
}

.ia-chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
}

/* ===== ÁREA DE MENSAJES ===== */
.ia-messages {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 16px;
  padding: 20px;
  background: var(--table-result-bg);
  border: 2px solid var(--border);
  border-radius: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-1) var(--scrollbar-2);
  position: relative;
}

.ia-messages::-webkit-scrollbar {
  width: 8px;
}

.ia-messages::-webkit-scrollbar-track {
  background: var(--scrollbar-2);
  border-radius: 4px;
}

.ia-messages::-webkit-scrollbar-thumb {
  background: var(--scrollbar-1);
  border-radius: 4px;
}

/* ===== MENSAJES ===== */
.message {
  margin-bottom: 16px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

.message.user {
  justify-content: flex-end;
}

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-bottom: 4px;
}

.message-avatar svg {
  width: 18px;
  height: 18px;
}

.message.user .message-avatar {
  background: linear-gradient(135deg, var(--azul) 0%, var(--azul-oscuro) 100%);
  order: 2;
}

.message.user .message-avatar svg {
  fill: white;
}

.message.assistant .message-avatar {
  background: transparent;
  box-shadow: none;
}

.message.assistant .message-avatar .robot-icon {
  width: 32px;
  height: 32px;
}

.message.reasoning .message-avatar {
  background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
}

.message.reasoning .message-avatar svg {
  fill: white;
}

/* ===== GLOBO DE RAZONAMIENTO UNIFICADO ===== */
.reasoning-bubble-container {
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  animation: fadeInUp 0.3s ease;
}

.reasoning-bubble-container .message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--azul) 0%, var(--azul-oscuro) 100%);
}

.reasoning-bubble-container .message-avatar svg {
  width: 18px;
  height: 18px;
  fill: white;
}

.reasoning-bubble {
  max-width: 70%;
  min-width: 200px;
  background: var(--table-filter-bg);
  border: 2px solid var(--azul-claro);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  margin-left: 8px;
  overflow: hidden;
  box-shadow: var(--sombra-1);
}

[data-theme="dark"] .reasoning-bubble {
  background: var(--bg-odd);
  border-color: var(--azul);
}

.reasoning-bubble-header {
  padding: 10px 14px;
  background: linear-gradient(135deg, var(--azul) 0%, var(--azul-oscuro) 100%);
  color: white;
  font-weight: 600;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.reasoning-bubble-header svg {
  width: 14px;
  height: 14px;
  fill: white;
}

.reasoning-bubble-header .reasoning-title {
  flex: 1;
}

.reasoning-bubble-header .reasoning-status {
  font-size: 11px;
  font-weight: 400;
  opacity: 0.9;
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 8px;
  border-radius: 10px;
}

/* Barra de progreso */
.reasoning-progress-bar {
  height: 3px;
  background: rgba(255, 255, 255, 0.2);
  overflow: hidden;
}

.reasoning-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #00d4ff 0%, #00ff88 100%);
  transition: width 0.3s ease;
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

/* Placeholder */
.reasoning-placeholder {
  color: var(--gris-3);
  font-style: italic;
  text-align: center;
  padding: 20px;
}

.reasoning-bubble-content {
  max-height: 200px;
  overflow-y: auto;
  padding: 12px 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--azul-claro) var(--table-filter-bg);
}

.reasoning-bubble-content::-webkit-scrollbar {
  width: 6px;
}

.reasoning-bubble-content::-webkit-scrollbar-track {
  background: var(--table-filter-bg);
  border-radius: 3px;
}

[data-theme="dark"] .reasoning-bubble-content {
  scrollbar-color: var(--azul) var(--bg-odd);
}

[data-theme="dark"] .reasoning-bubble-content::-webkit-scrollbar-track {
  background: var(--bg-odd);
}

.reasoning-bubble-content::-webkit-scrollbar-thumb {
  background: var(--azul-claro);
  border-radius: 3px;
}

[data-theme="dark"] .reasoning-bubble-content::-webkit-scrollbar-thumb {
  background: var(--azul);
}

.reasoning-item {
  padding: 8px 0;
  border-bottom: 1px dashed var(--azul-claro);
  color: var(--table-filter-text);
  font-size: 13px;
  line-height: 1.5;
  animation: fadeIn 0.3s ease;
}

[data-theme="dark"] .reasoning-item {
  color: var(--text);
  border-color: var(--azul);
}

.reasoning-item:last-child {
  border-bottom: none;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.reasoning-bubble-loader {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--table-filter-text);
  font-size: 12px;
  font-style: italic;
}

[data-theme="dark"] .reasoning-bubble-loader {
  color: var(--text);
}

.reasoning-bubble-loader .loading-dots {
  padding: 0;
  background: none;
  border: none;
  box-shadow: none;
  gap: 4px;
}

.reasoning-bubble-loader .loading-dot {
  width: 6px;
  height: 6px;
  background: var(--azul);
}

.message-bubble {
  max-width: 70%;
  padding: 14px 18px;
  border-radius: 16px;
  word-wrap: break-word;
  position: relative;
  box-shadow: var(--sombra-1);
  line-height: 1.5;
  font-size: 14px;
}

.message.user .message-bubble {
  background: linear-gradient(135deg, var(--azul) 0%, var(--azul-oscuro) 100%);
  color: white;
  border-bottom-right-radius: 4px;
  margin-right: 8px;
}

.message.assistant .message-bubble {
  background: var(--bg-even);
  border: 2px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 4px;
  margin-left: 8px;
}

.message.reasoning .message-bubble {
  background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
  border: 2px solid #f39c12;
  color: #856404;
  font-style: italic;
  opacity: 0.9;
  font-size: 13px;
  border-bottom-left-radius: 4px;
  margin-left: 8px;
}

[data-theme="dark"] .message.reasoning .message-bubble {
  background: linear-gradient(135deg, #3d2914 0%, #5d4e37 100%);
  color: #ffeaa7;
  border-color: #d68910;
}

.message-time {
  font-size: 11px;
  opacity: 0.6;
  margin-top: 6px;
  font-weight: 400;
}

.message-file {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  font-size: 12px;
}

.message-file svg {
  width: 14px;
  height: 14px;
}

.empty-state {
  text-align: center;
  padding: 60px 40px;
  color: var(--gris-3);
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: 20px;
  opacity: 0.45;
}

.empty-state h3 {
  margin: 0 0 15px 0;
  color: var(--text);
  font-weight: 600;
}

.empty-state p {
  margin: 0;
  opacity: 0.7;
  line-height: 1.6;
  max-width: 500px;
}

/* ===== ONBOARDING: usuario nuevo sin tablas =====
   Diseno discreto y elegante con la paleta de la marca. El icono robot
   se reutiliza del modulo ia-icons.js, igual que en la sidebar "Chat IA",
   para mantener coherencia visual.
*/

.ia-onboarding {
  max-width: 560px;
  margin: 0 auto;
  padding: 24px 0;
}

.ia-onboarding-icon {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  color: var(--azul-oscuro);
}
.ia-onboarding-icon svg {
  width: 64px;
  height: 64px;
  margin: 0;
  opacity: 1;
}

[data-theme="dark"] .ia-onboarding-icon {
  color: var(--azul-claro);
}

.ia-onboarding-title {
  margin: 0 0 8px 0 !important;
  color: var(--text) !important;
  font-weight: 600;
  font-size: 1.15em;
  letter-spacing: -0.01em;
}

.ia-onboarding-subtitle {
  margin: 0 0 24px 0 !important;
  opacity: 0.7 !important;
  line-height: 1.5;
  max-width: 480px;
  color: var(--gris-3) !important;
  font-size: 0.92em;
}

.ia-onboarding-suggestions-label {
  font-size: 0.72em;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gris-3);
  opacity: 0.6;
  margin-bottom: 10px;
  font-weight: 600;
}

.ia-onboarding-suggestions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  max-width: 480px;
  align-items: center;
}

.ia-onboarding-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 11px;
  background: transparent;
  border: 1px solid var(--menu-border);
  border-radius: 14px;
  cursor: pointer;
  font-size: 0.8em;
  color: var(--gris-3);
  text-align: left;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
  font-family: inherit;
  line-height: 1.3;
  max-width: 100%;
}

.ia-onboarding-chip:hover {
  border-color: var(--azul);
  color: var(--azul);
  background: var(--hover, #CAF0F8);
}

[data-theme="dark"] .ia-onboarding-chip:hover {
  background: rgba(134, 182, 251, 0.1);
}

.ia-onboarding-chip:active {
  opacity: 0.75;
}

.ia-onboarding-chip:focus-visible {
  outline: 1px solid var(--azul);
  outline-offset: 1px;
}

.ia-onboarding-chip-text {
  flex: 0 1 auto;
  line-height: 1.3;
  white-space: normal;
}

/* Sin icono de flecha: el usuario lo prefiere sin nada. Se omite .ia-onboarding-chip-icon. */

/* ===== ÁREA DE ENTRADA ===== */
.ia-input-area {
  background: var(--menu-bg);
  border: 2px solid var(--menu-border);
  border-radius: 12px;
  padding: 14px;
  box-shadow: var(--sombra-1);
}

.ia-input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.ia-input {
  flex: 1;
  min-height: 46px;
  max-height: 120px;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--bg-even);
  color: var(--text);
  resize: none;
  font-family: "RobotoCondensed", sans-serif;
  font-size: 14px;
  line-height: 1.4;
  transition: all 0.3s ease;
  scrollbar-width: none;
}

.ia-input::-webkit-scrollbar {
  display: none;
}

.ia-input:focus {
  outline: none;
  border-color: var(--azul);
  box-shadow: 0 0 0 3px rgba(0, 119, 182, 0.1);
}

.ia-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.ia-input::placeholder {
  color: var(--gris-3);
  font-style: italic;
}

.ia-input-button {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  font-size: 18px;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  box-shadow: var(--sombra-1);
}

.ia-input-button svg {
  width: 20px;
  height: 20px;
}

.ia-file-button {
  background: linear-gradient(135deg, var(--gris-3) 0%, var(--gris-4) 100%);
  color: white;
  position: relative;
}

.ia-file-button svg {
  fill: white;
}

.file-count-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #e74c3c;
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: bold;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.file-count-badge.visible {
  display: flex;
}

.ia-send-button {
  background: linear-gradient(135deg, var(--azul) 0%, var(--azul-oscuro) 100%);
  color: white;
}

.ia-send-button svg {
  fill: white;
}

.ia-stop-button {
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
  color: white;
}

.ia-stop-button svg {
  fill: white;
}

.ia-input-button:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 119, 182, 0.3);
}

.ia-input-button:active {
  transform: scale(0.95);
}

.ia-input-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.attached-files-list {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  padding: 8px;
  background: var(--bg-odd);
  border-radius: 8px;
}

.attached-files-list.visible {
  display: flex;
}

.attached-file-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg-even);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
}

.attached-file-item svg {
  width: 14px;
  height: 14px;
  fill: var(--azul);
}

.remove-file {
  cursor: pointer;
  color: #e74c3c;
  margin-left: 4px;
  font-weight: bold;
}

/* ===== MODAL ===== */
#context-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
  animation: fadeIn 0.3s ease;
}

#context-modal[style*="display: block"] {
  display: flex !important;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
}

.modal-content {
  background: var(--menu-bg);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  position: relative;
  z-index: 1;
  max-height: 85vh;
  width: 600px;
  max-width: 90vw;
  overflow: hidden;
  animation: slideInUp 0.3s ease;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 2px solid var(--menu-border);
  background: var(--bg-th);
  color: var(--color-th);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.2em;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-header svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.modal-close {
  background: none;
  border: none;
  color: var(--color-th);
  font-size: 24px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

.modal-body {
  padding: 24px;
  color: var(--text);
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  box-sizing: border-box;
  width: 100%;
}

.modal-body *,
.modal-body input[type="file"],
.modal-body textarea,
.modal-body label,
.modal-body small,
.modal-body div {
  box-sizing: border-box;
  max-width: 100%;
}

.modal-body label {
  display: block;
  margin-bottom: 12px;
  font-weight: 600;
  color: var(--azul);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-body label svg {
  width: 16px;
  height: 16px;
  fill: var(--azul);
}

#context-textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin-top: 10px;
  padding: 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--bg-even);
  color: var(--text);
  font-family: "RobotoCondensed", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
  transition: border-color 0.3s ease;
}

#context-file-input {
  max-width: 100%;
  box-sizing: border-box;
}

.context-files-section,
.context-files-list {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

#context-textarea:focus {
  outline: none;
  border-color: var(--azul);
  box-shadow: 0 0 0 3px rgba(0, 119, 182, 0.1);
}

.modal-body small {
  color: var(--gris-3);
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.4;
}

.modal-body small svg {
  width: 14px;
  height: 14px;
  fill: var(--gris-3);
  flex-shrink: 0;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 2px solid var(--menu-border);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  background: var(--table-result-bg);
}

.context-files-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 2px solid var(--menu-border);
}

.context-files-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
  padding: 10px;
  background: var(--bg-odd);
  border-radius: 8px;
  margin-top: 10px;
}

.context-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px;
  background: var(--bg-even);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
}

.context-file-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.context-file-info svg {
  width: 16px;
  height: 16px;
  fill: var(--azul);
  flex-shrink: 0;
}

.context-file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.context-file-size {
  font-size: 11px;
  color: var(--gris-3);
  flex-shrink: 0;
}

.file-status-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  flex-shrink: 0;
}

.file-status-badge.existing {
  background: var(--verde);
  color: white;
}

.file-status-badge.new {
  background: var(--azul);
  color: white;
}

.context-file-item.existing {
  border-color: var(--verde);
  border-width: 1px;
}

.context-file-item.new {
  border-color: var(--azul);
  border-style: dashed;
}

/* Archivos en mensajes */
.message-files {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.message-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--azul-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-primary);
}

.message-file svg {
  width: 14px;
  height: 14px;
  fill: var(--azul-claro);
  flex-shrink: 0;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .ia-container {
    flex-direction: column;
  }

  .ia-sidebar {
    width: 100%;
    min-width: 0;
    height: 180px;
    border-right: none;
    border-bottom: 2px solid var(--menu-border);
  }

  .conversations-list {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 12px;
  }

  .conversation-item {
    min-width: 180px;
    margin-right: 10px;
    margin-bottom: 0;
  }

  .message-bubble {
    max-width: 85%;
  }

  .modal-content {
    width: 95vw;
    margin: 20px;
  }
}

/* ===== MARKDOWN CONTENT STYLES ===== */
.message-content {
  line-height: 1.6;
}

.message-content p {
  margin: 0 0 12px 0;
}

.message-content p:last-child {
  margin-bottom: 0;
}

.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4,
.message-content h5,
.message-content h6 {
  margin: 16px 0 8px 0;
  font-weight: 600;
  line-height: 1.3;
}

.message-content h1:first-child,
.message-content h2:first-child,
.message-content h3:first-child {
  margin-top: 0;
}

.message-content h1 { font-size: 1.4em; }
.message-content h2 { font-size: 1.25em; }
.message-content h3 { font-size: 1.1em; }

.message-content ul,
.message-content ol {
  margin: 8px 0;
  padding-left: 24px;
}

.message-content li {
  margin: 4px 0;
}

.message-content code {
  background: rgba(0, 0, 0, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.9em;
}

.message.user .message-content code {
  background: rgba(255, 255, 255, 0.2);
}

.message-content pre {
  background: var(--bg-odd);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  margin: 12px 0;
  overflow-x: auto;
  max-width: 100%;
}

.message-content pre code {
  background: none;
  padding: 0;
  font-size: 13px;
  line-height: 1.5;
}

.message.user .message-content pre {
  background: rgba(0, 0, 0, 0.2);
  border-color: rgba(255, 255, 255, 0.1);
}

.message-content blockquote {
  border-left: 4px solid var(--azul);
  margin: 12px 0;
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 0 8px 8px 0;
}

.message.user .message-content blockquote {
  border-left-color: rgba(255, 255, 255, 0.5);
  background: rgba(0, 0, 0, 0.1);
}

.message-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 12px 0;
  font-size: 13px;
}

.message-content th,
.message-content td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
}

.message-content th {
  background: var(--bg-odd);
  font-weight: 600;
}

.message-content a {
  color: var(--azul);
  text-decoration: none;
}

.message-content a:hover {
  text-decoration: underline;
}

.message.user .message-content a {
  color: #a8d4ff;
}

.message-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

.message-content strong {
  font-weight: 600;
}

.message-content em {
  font-style: italic;
}

/* Dark theme adjustments for markdown */
[data-theme="dark"] .message-content code {
  background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .message-content pre {
  background: #1a1a2e;
  border-color: var(--border);
}

[data-theme="dark"] .message-content blockquote {
  background: rgba(255, 255, 255, 0.03);
}

/* ===== DOWNLOAD BUTTONS FOR GENERATED FILES ===== */
.ia-download-button-container {
  margin: 12px 0;
  display: inline-block;
  width: 100%;
}

.ia-download-button {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--azul-claro) 0%, var(--azul) 100%);
  color: white !important;
  border-radius: 12px;
  text-decoration: none !important;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(33, 150, 243, 0.3);
  max-width: 100%;
  overflow: hidden;
}

.ia-download-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(33, 150, 243, 0.4);
  text-decoration: none !important;
}

.ia-download-button:active {
  transform: translateY(0);
}

.ia-download-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.ia-download-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.ia-download-type {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.9;
}

.ia-download-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ia-download-action {
  font-size: 14px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.2);
  padding: 6px 12px;
  border-radius: 8px;
  flex-shrink: 0;
  transition: background 0.3s ease;
}

.ia-download-button:hover .ia-download-action {
  background: rgba(255, 255, 255, 0.3);
}

/* User message download button variation */
.message.user .ia-download-button {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0.15) 100%);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.message.user .ia-download-button:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* Dark theme adjustments */
[data-theme="dark"] .ia-download-button {
  background: linear-gradient(135deg, var(--azul) 0%, #1565c0 100%);
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .ia-download-button {
    padding: 10px 12px;
    gap: 8px;
  }
  
  .ia-download-icon {
    font-size: 24px;
  }
  
  .ia-download-name {
    font-size: 12px;
  }
  
  .ia-download-action {
    font-size: 12px;
    padding: 4px 8px;
  }
}

/* ===== MULTI-AGENT PROGRESS ===== */
.multiagent-progress-container {
  margin: 12px 0;
  padding: 12px 14px;
  background: var(--card-bg, #fff);
  border: 1px solid var(--border-color, #e0e0e0);
  border-radius: 10px;
  font-family: 'RobotoCondensed', sans-serif;
}

.multiagent-progress-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.multiagent-icon {
  color: var(--primary, #3498db);
  flex-shrink: 0;
}

.multiagent-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-color, #333);
  flex: 1;
}

.multiagent-counter {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary, #3498db);
  background: rgba(52, 152, 219, 0.1);
  padding: 2px 10px;
  border-radius: 12px;
}

.multiagent-progress-bar {
  height: 5px;
  background: var(--border-color, #e0e0e0);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 10px;
}

.multiagent-progress-fill {
  height: 100%;
  background: var(--primary, #3498db);
  border-radius: 3px;
  transition: width 0.4s ease, background-color 0.4s ease;
}

.multiagent-tasks-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 200px;
  overflow-y: auto;
}

.multiagent-task {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 12px;
  transition: background 0.2s ease;
}

.multiagent-task.pending {
  color: #888;
  background: rgba(136, 136, 136, 0.05);
}

.multiagent-task.processing {
  color: var(--primary, #3498db);
  background: rgba(52, 152, 219, 0.08);
}

.multiagent-task.completed {
  color: var(--success-color, #27ae60);
  background: rgba(39, 174, 96, 0.06);
}

.multiagent-task.failed {
  color: var(--error-color, #e74c3c);
  background: rgba(231, 76, 60, 0.06);
}

.multiagent-task-active {
  border: 1px dashed rgba(52, 152, 219, 0.3);
}

.multiagent-task-icon {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.multiagent-task-desc {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.multiagent-task-type {
  font-size: 10px;
  text-transform: uppercase;
  opacity: 0.7;
  flex-shrink: 0;
  padding: 1px 6px;
  background: rgba(128, 128, 128, 0.1);
  border-radius: 4px;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.spin {
  animation: spin 1.5s linear infinite;
  transform-origin: center;
}

/* Dark theme overrides */
[data-theme="dark"] .multiagent-progress-container {
  background: var(--card-bg, #1e1e2e);
  border-color: var(--border-color, #2a2a3d);
}

[data-theme="dark"] .multiagent-task.pending {
  background: rgba(136, 136, 136, 0.1);
}

[data-theme="dark"] .multiagent-task.processing {
  background: rgba(52, 152, 219, 0.12);
}

[data-theme="dark"] .multiagent-task.completed {
  background: rgba(39, 174, 96, 0.08);
}

[data-theme="dark"] .multiagent-task.failed {
  background: rgba(231, 76, 60, 0.08);
}

@media (max-width: 600px) {
  .multiagent-progress-container {
    padding: 10px;
    margin: 8px 0;
  }
  
  .multiagent-task-desc {
    font-size: 11px;
  }
}

/* ===== BOTONES MICROFONO Y CAMARA ===== */
.ia-mic-button {
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
  color: white;
}

.ia-mic-button svg {
  fill: white;
}

.ia-camera-button {
  background: linear-gradient(135deg, #27ae60 0%, #1e8449 100%);
  color: white;
}

.ia-camera-button svg {
  fill: white;
}

/* ===== UPLOAD PROGRESS BAR ===== */
.upload-progress-bar {
  margin-bottom: 10px;
  background: var(--bg-odd);
  border-radius: 8px;
  padding: 8px 12px;
  position: relative;
  overflow: hidden;
}

.upload-progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: linear-gradient(135deg, var(--azul) 0%, var(--azul-oscuro) 100%);
  transition: width 0.3s ease;
  opacity: 0.3;
  border-radius: 8px;
}

.upload-progress-text {
  position: relative;
  z-index: 1;
  font-size: 12px;
  color: var(--text);
  font-weight: 500;
}

/* ===== MICROFONO MODAL ===== */
.ia-microphone-modal {
  max-width: 420px;
}

.ia-recording-body {
  text-align: center;
  padding: 30px 20px;
}

.recording-timer {
  font-size: 42px;
  font-weight: 700;
  color: var(--text);
  font-family: monospace;
  letter-spacing: 4px;
  margin-bottom: 20px;
}

.recording-wave {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 6px;
  height: 60px;
  margin-bottom: 20px;
}

.wave-bar {
  width: 6px;
  background: var(--gris-3);
  border-radius: 3px;
  transition: height 0.15s ease;
  height: 8px;
}

.recording-active .wave-bar {
  animation: waveAnimation 0.6s ease-in-out infinite;
}

.recording-active .wave-bar:nth-child(1) { animation-delay: 0s; height: 30px; }
.recording-active .wave-bar:nth-child(2) { animation-delay: 0.12s; height: 45px; }
.recording-active .wave-bar:nth-child(3) { animation-delay: 0.24s; height: 55px; }
.recording-active .wave-bar:nth-child(4) { animation-delay: 0.36s; height: 40px; }
.recording-active .wave-bar:nth-child(5) { animation-delay: 0.48s; height: 25px; }

@keyframes waveAnimation {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(0.4); }
}

.recording-status {
  font-size: 14px;
  color: var(--gris-3);
  margin-bottom: 10px;
}

.ia-record-btn,
.ia-stop-record-btn {
  min-width: 140px;
}

.ia-stop-record-btn.recording {
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
  color: white;
}

/* ===== CAMARA MODAL ===== */
.ia-camera-modal {
  max-width: 560px;
}

.ia-camera-body {
  padding: 0;
}

.camera-preview-container {
  position: relative;
  width: 100%;
  min-height: 300px;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.camera-preview-container video,
.camera-preview-container img {
  width: 100%;
  height: auto;
  display: block;
}

/* Override modal-body padding for camera */
#camera-modal .modal-body {
  padding: 0;
}

/* ===== MICROPHONE MODAL ===== */
#microphone-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
  animation: fadeIn 0.3s ease;
}

#microphone-modal[style*="display: block"] {
  display: flex !important;
}

/* ===== CAMERA MODAL ===== */
#camera-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
  animation: fadeIn 0.3s ease;
}

#camera-modal[style*="display: block"] {
  display: flex !important;
}

/* ============================================================ */
/* CHAT TOOLBAR - Fase 5                                          */
/* ============================================================ */

.chat-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px;
  background: var(--menu-bg);
  border-top: 1px solid var(--menu-border);
  border-bottom: 1px solid var(--menu-border);
  justify-content: center;
}

.chat-toolbar-btn-wrapper {
  position: relative;
}

.chat-toolbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border: 1px solid var(--menu-border);
  border-radius: 4px;
  background: transparent;
  color: var(--gris-3);
  font-size: 0.78em;
  font-weight: 400;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
  white-space: nowrap;
  font-family: inherit;
}

.chat-toolbar-btn:hover {
  border-color: var(--text);
  color: var(--text);
}

.chat-toolbar-btn:focus-visible {
  outline: 1px solid var(--text);
  outline-offset: 1px;
}

.chat-toolbar-btn.active {
  background: transparent;
  color: var(--text);
  border-color: var(--text);
  font-weight: 500;
}

.chat-toolbar-btn svg {
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  opacity: 0.6;
  stroke: currentColor;
}

.chat-toolbar-btn.active svg,
.chat-toolbar-btn:hover svg {
  opacity: 0.95;
}

.chat-toolbar-btn span {
  font-weight: inherit;
}

/* Toolbar Dropdown */
.chat-toolbar-dropdown {
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 4px;
  min-width: 220px;
  max-height: 350px;
  background: var(--card-bg, #fff);
  border: 1px solid var(--gris-3, #dee2e6);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  z-index: 1000;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.chat-toolbar-dropdown-header {
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted, #6c757d);
  border-bottom: 1px solid var(--gris-2, #e9ecef);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.chat-toolbar-dropdown-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

.chat-toolbar-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.chat-toolbar-dropdown-item:hover {
  background: var(--gris-1, #f0f0f0);
}

.chat-toolbar-dropdown-item input[type="checkbox"] {
  margin: 0;
  accent-color: var(--azul, #3498db);
}

.chat-toolbar-dropdown-item span {
  flex: 1;
}

.chat-toolbar-dropdown-empty {
  padding: 12px;
  text-align: center;
  color: var(--text-muted, #999);
  font-size: 12px;
}

.chat-toolbar-dropdown-info {
  padding: 12px;
  color: var(--text-muted, #666);
  font-size: 12px;
  line-height: 1.4;
}

.chat-toolbar-dropdown-footer {
  display: flex;
  gap: 4px;
  padding: 6px 8px;
  border-top: 1px solid var(--gris-2, #e9ecef);
}

.chat-toolbar-dropdown-footer button {
  flex: 1;
  padding: 4px 8px;
  border: 1px solid var(--gris-3, #dee2e6);
  border-radius: 4px;
  background: var(--card-bg, #fff);
  color: var(--azul, #3498db);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chat-toolbar-dropdown-footer button:hover {
  background: var(--azul, #3498db);
  color: #fff;
  border-color: var(--azul, #3498db);
}

/* C-06: Vista previa de etiqueta disenada por la IA */
.ia-label-preview-wrapper {
  margin-top: 12px;
  border: 1px solid var(--gris-3, #dee2e6);
  border-radius: 8px;
  background: var(--card-bg, #fff);
  overflow: hidden;
}

.ia-label-preview-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--gris-1, #f8f9fa);
  border-bottom: 1px solid var(--gris-2, #e9ecef);
  font-size: 13px;
}

.ia-label-preview-meta {
  font-size: 11px;
  color: var(--text-muted, #6c757d);
  font-weight: 400;
}

.ia-label-preview-sample {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 500;
  color: #856404;
  background: #fff3cd;
  border: 1px solid #ffe69c;
  border-radius: 3px;
}

[data-theme="dark"] .ia-label-preview-sample {
  color: #f0c674;
  background: rgba(255, 220, 100, 0.12);
  border-color: rgba(255, 220, 100, 0.3);
}

.ia-label-preview {
  overflow: auto;
  max-height: 600px;
  background: #f5f5f5;
  padding: 16px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.ia-label-preview-actions {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  background: var(--gris-1, #f8f9fa);
  border-top: 1px solid var(--gris-2, #e9ecef);
  justify-content: flex-end;
}

.ia-label-btn {
  padding: 6px 14px;
  border: 1px solid var(--gris-3, #dee2e6);
  border-radius: 6px;
  background: var(--card-bg, #fff);
  color: var(--text-color, #495057);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ia-label-btn:hover:not(:disabled) {
  background: var(--azul, #3498db);
  color: #fff;
  border-color: var(--azul, #3498db);
}

.ia-label-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* === Vista previa de etiqueta: boton + overlay (aislado con iframe) === */
.zyneko-ia-preview-wrapper {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--gris-3, #dee2e6);
}

.zyneko-ia-preview-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  background: var(--azul, #3498db);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease;
  font-family: inherit;
}

.zyneko-ia-preview-button:hover {
  background: #2980b9;
}

.zyneko-ia-preview-button svg {
  flex-shrink: 0;
}

.zyneko-ia-skill-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  background: #8e44ad;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease;
  font-family: inherit;
  margin-left: 8px;
}
.zyneko-ia-skill-button:hover {
  background: #6c3483;
}
.zyneko-ia-skill-button svg {
  flex-shrink: 0;
}

.zyneko-ia-label-preview-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
}

.zyneko-ia-label-preview-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.zyneko-ia-label-preview-overlay-panel {
  position: relative;
  z-index: 1;
  max-width: 90vw;
  max-height: 90vh;
  margin: 5vh auto;
  background: var(--card-bg, #fff);
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.zyneko-ia-label-preview-overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: var(--gris-1, #f8f9fa);
  border-bottom: 1px solid var(--gris-2, #e9ecef);
}

.zyneko-ia-label-preview-overlay-close {
  background: none;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: var(--text-muted, #6c757d);
  cursor: pointer;
  padding: 0 4px;
}

.zyneko-ia-label-preview-overlay-close:hover {
  color: #c0392b;
}

.zyneko-ia-label-preview-overlay-body {
  padding: 0;
  overflow: hidden;
  max-height: calc(90vh - 60px);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  background: #f5f5f5;
}

.zyneko-ia-label-preview-iframe {
  width: 100%;
  height: calc(90vh - 60px);
  border: 0;
  background: #fff;
}

