/* =========================================================
   AbrilLLM: panel flotante con el sistema del sitio:
   Arial, chips grises que se invierten, negro como acento.
   ========================================================= */
.chat-trigger-icon { flex-shrink: 0; width: 14px; height: 14px; }
.chat-trigger-label-short { display: none; }

.chat-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(17, 17, 17, 0.16);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.chat-overlay.is-open { opacity: 1; }

/* Tarjeta flotante, separada del borde */
.chat-panel {
  position: fixed;
  top: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 201;
  width: 420px;
  max-width: calc(100% - 24px);
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  border-radius: 20px;
  box-shadow: 0 24px 64px -16px rgba(17, 17, 17, 0.28), 0 0 0 1px rgba(17, 17, 17, 0.06);
  overflow: hidden;
  opacity: 0;
  transform: translateX(24px) scale(0.98);
  transform-origin: top right;
  transition: opacity 0.3s ease, transform 0.45s cubic-bezier(0.2, 0, 0, 1);
}
.chat-panel.is-open { opacity: 1; transform: none; }

.chat-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 14px 16px;
}
.chat-panel-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: var(--color-surface-strong);
  color: #fff;
  font-size: 14px;
  font-weight: 400;
}
.chat-panel-actions { display: flex; gap: 4px; }
.chat-icon-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.chat-icon-btn:hover { background: var(--color-surface-strong); color: #fff; }
.chat-icon-btn svg { width: 15px; height: 15px; }
.chat-icon-tooltip {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--color-surface-strong);
  color: #fff;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.chat-icon-btn:hover .chat-icon-tooltip { opacity: 1; }

.chat-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-welcome { padding: 24px 0 8px; }
.chat-welcome-heading { font-size: 22px; line-height: 1.25; letter-spacing: -0.02em; }
.chat-welcome-sub { margin-top: 6px; color: var(--color-text-muted); font-size: 15px; line-height: 1.45; }

.chat-thread { display: flex; flex-direction: column; gap: 14px; }
.chat-bubble-user {
  align-self: flex-end;
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px 16px 4px 16px;
  background: var(--color-surface-strong);
  color: #fff;
  font-size: 15px;
  line-height: 1.4;
}
.chat-answer {
  max-width: 100%;
  padding: 14px 16px;
  border-radius: 16px 16px 16px 4px;
  background: var(--color-surface);
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: 0;
}
.chat-answer a { text-decoration: underline; text-underline-offset: 3px; }

.chat-typing {
  align-self: flex-start;
  display: inline-flex;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 16px 16px 16px 4px;
  background: var(--color-surface);
}
.chat-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-text-muted);
  animation: chat-dot 1s infinite ease-in-out;
}
.chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes chat-dot { 0%, 80%, 100% { opacity: 0.3; transform: none; } 40% { opacity: 1; transform: translateY(-3px); } }

/* Sugerencias: los mismos chips del sitio */
.chat-suggestions { display: flex; flex-wrap: wrap; gap: 6px; transition: opacity 0.2s ease; }
.chat-suggestions.is-swapping { opacity: 0; }
.chat-chip {
  padding: 6px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-radius 0.25s ease;
}
.chat-chip:hover { background: var(--color-surface-strong); color: #fff; border-radius: var(--radius-pill); }

.chat-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 12px 12px;
  padding: 6px 6px 6px 16px;
  border-radius: var(--radius-pill);
  background: var(--color-surface);
}
.chat-input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--color-text);
  font: inherit;
  font-size: 15px;
  outline: none;
}
.chat-input::placeholder { color: var(--color-text-muted); }
.chat-input-row:focus-within { box-shadow: 0 0 0 2px var(--color-text); }
.chat-send-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: var(--color-surface-strong);
  color: #fff;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.chat-send-btn svg { width: 16px; height: 16px; }
.chat-send-btn.is-empty { opacity: 0.25; }
.chat-send-btn:not(.is-empty):hover { transform: scale(1.06); }

@media (prefers-reduced-motion: reduce) {
  .chat-panel, .chat-overlay { transition: none; }
  .chat-typing span { animation: none; }
}
@media (max-width: 600px) {
  .chat-panel { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; max-width: none; height: 82vh; transform: translateY(24px); transform-origin: bottom center; }
}

/* Cerrado = fuera del layout. Sin esto el panel invisible tapaba el nav. */
.chat-panel[hidden], .chat-overlay[hidden] { display: none; }

/* Un solo indicador de foco: el de la fila, no el del input */
.chat-input:focus-visible { outline: none; }
