/* ══════════════════════════════════════════
   Chat asistente (Lucy) — widget flotante
   Reutiliza el lenguaje liquid glass grayscale del sitio.
   ══════════════════════════════════════════ */

/* Etiqueta solo para lectores de pantalla */
.chat-widget .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.chat-widget {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 900;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .75rem;
  font-family: var(--font);
}

/* ── Botón lanzador ── */
.chat-fab {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-full);
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--white);
  background: rgba(255, 255, 255, .04);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .45), inset 0 1px 1px rgba(255, 255, 255, .18);
  transition: transform var(--transition), background var(--transition);
  position: relative;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, .35);
}

.chat-fab:hover { transform: translateY(-2px); background: rgba(255, 255, 255, .09); }
.chat-fab:active { transform: translateY(0); }

.chat-fab img { width: 100%; height: 100%; object-fit: cover; }
.chat-fab i { font-size: 1.25rem; }

/* Alterna icono según estado abierto/cerrado */
.chat-fab .chat-fab__close { display: none; }
.chat-widget.is-open .chat-fab .chat-fab__open { display: none; }
.chat-widget.is-open .chat-fab .chat-fab__close { display: block; }

/* Punto pulsante de "novedad", se apaga al abrir por primera vez */
.chat-fab__dot {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 9px;
  height: 9px;
  border-radius: var(--radius-full);
  background: var(--white);
  box-shadow: 0 0 0 0 rgba(255, 255, 255, .5);
  animation: chatPulse 2.4s ease-out infinite;
}

.chat-widget.is-open .chat-fab__dot,
.chat-widget.is-seen .chat-fab__dot { display: none; }

@keyframes chatPulse {
  0%   { box-shadow: 0 0 0 0 rgba(255, 255, 255, .5); }
  70%  { box-shadow: 0 0 0 10px rgba(255, 255, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

/* ── Panel ── */
.chat-panel {
  width: min(380px, calc(100vw - 2.5rem));
  height: min(560px, calc(100dvh - 7.5rem));
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: rgba(10, 15, 26, .55);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .55), inset 0 1px 1px rgba(255, 255, 255, .15);
  transform-origin: bottom right;
  transform: translateY(12px) scale(.96);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}

.chat-widget.is-open .chat-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.chat-panel[hidden] { display: none; }

/* ── Cabecera ── */
.chat-header {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .9rem 1rem;
  border-bottom: 1px solid var(--white-border);
  flex-shrink: 0;
}

.chat-header img { width: 34px; height: 34px; border-radius: var(--radius-full); object-fit: cover; flex-shrink: 0; }

.chat-header__info { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.chat-header__name { font-size: .95rem; font-weight: 500; color: var(--white); }
.chat-header__status { font-size: .72rem; color: var(--white-50); display: flex; align-items: center; gap: .35rem; }
.chat-header__status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, .7);
}

.chat-header__close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--white-50);
  font-size: 1rem;
  cursor: pointer;
  padding: .35rem .5rem;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
}
.chat-header__close:hover { color: var(--white); background: var(--white-10); }

/* ── Mensajes ── */
.chat-log {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .7rem;
  scrollbar-width: thin;
}

.chat-msg {
  max-width: 86%;
  padding: .65rem .85rem;
  border-radius: var(--radius-md);
  font-size: .875rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
  animation: chatIn .25s ease both;
}

@keyframes chatIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.chat-msg--bot {
  align-self: flex-start;
  background: rgba(255, 255, 255, .07);
  color: var(--text-primary);
  border-bottom-left-radius: .25rem;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, .08);
}

.chat-msg--user {
  align-self: flex-end;
  background: rgba(255, 255, 255, .16);
  color: var(--white);
  border-bottom-right-radius: .25rem;
}

.chat-msg--error {
  align-self: center;
  max-width: 100%;
  text-align: center;
  background: none;
  color: var(--white-50);
  font-size: .78rem;
  padding: .3rem;
}

.chat-msg strong { font-weight: 600; color: var(--white); }
.chat-msg a { color: var(--white); text-decoration: underline; text-underline-offset: 2px; }
.chat-msg ul { margin: .4rem 0 0; padding-left: 1.1rem; }
.chat-msg li { margin-bottom: .2rem; }

/* Indicador de escritura */
.chat-typing { display: flex; gap: .3rem; align-items: center; padding: .8rem .85rem; }
.chat-typing span {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--white-50);
  animation: chatBounce 1.2s infinite ease-in-out;
}
.chat-typing span:nth-child(2) { animation-delay: .15s; }
.chat-typing span:nth-child(3) { animation-delay: .3s; }

@keyframes chatBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .4; }
  30%           { transform: translateY(-4px); opacity: 1; }
}

/* ── Sugerencias rápidas ── */
.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  padding: 0 1rem .6rem;
  flex-shrink: 0;
}

.chat-suggestions button {
  font-family: inherit;
  font-size: .74rem;
  color: var(--white-80);
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--white-border);
  border-radius: var(--radius-full);
  padding: .35rem .7rem;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.chat-suggestions button:hover { background: rgba(255, 255, 255, .14); color: var(--white); }
.chat-suggestions:empty { display: none; }

/* ── Formulario ── */
.chat-form {
  display: flex;
  align-items: flex-end;
  gap: .5rem;
  padding: .75rem 1rem 1rem;
  border-top: 1px solid var(--white-border);
  flex-shrink: 0;
}

.chat-form textarea {
  flex: 1;
  resize: none;
  font-family: inherit;
  font-size: .85rem;
  line-height: 1.45;
  color: var(--white);
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--white-border);
  border-radius: var(--radius-md);
  padding: .55rem .75rem;
  max-height: 96px;
  min-height: 40px;
  transition: border-color var(--transition);
}
.chat-form textarea::placeholder { color: var(--white-50); }
.chat-form textarea:focus { outline: none; border-color: rgba(255, 255, 255, .3); }

.chat-send {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--bg-primary);
  background: rgba(255, 255, 255, .9);
  transition: background var(--transition), opacity var(--transition);
}
.chat-send:hover:not(:disabled) { background: var(--white); }
.chat-send:disabled { opacity: .35; cursor: not-allowed; }

.chat-disclaimer {
  font-size: .66rem;
  color: var(--white-50);
  text-align: center;
  padding: 0 1rem .7rem;
  line-height: 1.4;
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .chat-widget { right: 1rem; bottom: 1rem; }
  .chat-panel {
    width: calc(100vw - 2rem);
    height: min(70dvh, calc(100dvh - 6.5rem));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }
  .chat-fab { width: 64px; height: 64px; }
}

@media (prefers-reduced-motion: reduce) {
  .chat-panel, .chat-msg, .chat-fab { transition: none; animation: none; }
  .chat-fab__dot, .chat-typing span { animation: none; }
}


/* ══════════════════════════════════════════════════════════
   RETEMATIZADO 2026-08-10 — acentos naranjos de marca.
   Se agrega al final como capa de override para no reescribir
   la estructura original del widget.
   ══════════════════════════════════════════════════════════ */
.chat-panel {
  background: rgba(11, 13, 16, .92);
  border: 1px solid var(--line);
}

.chat-fab {
  background: var(--ink-700);
  border: 1px solid var(--brand-line);
}

.chat-fab:hover {
  background: var(--ink-600);
  border-color: var(--brand);
}

.chat-fab__dot { background: var(--live); }

.chat-header { border-bottom-color: var(--line); }

.chat-header__status::before { background: var(--live); }

/* Burbuja del usuario: el único bloque naranjo del chat */
.chat-msg--user {
  background: var(--brand);
  color: var(--brand-ink);
}

.chat-msg--user strong { color: var(--brand-ink); }
.chat-msg--user a { color: var(--brand-ink); }

.chat-msg--bot { background: rgba(255, 255, 255, .05); }
.chat-msg--bot a { color: var(--brand); }

.chat-suggestions button { border-color: var(--line); }

.chat-suggestions button:hover {
  background: var(--brand-dim);
  border-color: var(--brand-line);
  color: var(--brand);
}

.chat-form { border-top-color: var(--line); }
.chat-form textarea { border-color: var(--line); }
.chat-form textarea:focus { border-color: var(--brand-line); }

.chat-send {
  background: var(--brand);
  color: var(--brand-ink);
}

.chat-send:hover:not(:disabled) { background: var(--brand-2); }
