/* ══════════════════════════════════════════════════════════
   ASISTENTE DE DEMOSTRACIÓN — hoja compartida por los demos de portfolio/
   Las respuestas son predefinidas: no hay API ni costo por uso.
   El color lo inyecta cada demo desde su assets/js/assistant.js
   (window.LK_ASSISTANT.theme) como custom properties en .lkda.
   ══════════════════════════════════════════════════════════ */
.lkda {
  --lkda-accent: #f97316;
  --lkda-on-accent: #0a0a0a;
  --lkda-surface: #16181d;
  --lkda-soft: rgba(255, 255, 255, .06);
  --lkda-text: #f4f4f5;
  --lkda-muted: rgba(244, 244, 245, .58);
  --lkda-line: rgba(255, 255, 255, .12);
  --lkda-radius: 16px;
  --lkda-font: inherit;

  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 9000;
  font-family: var(--lkda-font);
  line-height: 1.5;
}

.lkda *, .lkda *::before, .lkda *::after { box-sizing: border-box; }

/* ── Botón flotante ── */
.lkda__fab {
  position: relative;
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  margin-left: auto;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  background: var(--lkda-accent);
  color: var(--lkda-on-accent);
  box-shadow: 0 12px 30px -8px rgba(0, 0, 0, .55);
  transition: transform .25s ease, box-shadow .25s ease;
}

.lkda__fab:hover { transform: translateY(-3px) scale(1.04); }
.lkda__fab:active { transform: scale(.96); }

.lkda__fab svg { width: 26px; height: 26px; }
.lkda__fab .lkda__ico-close { display: none; }

.lkda[data-open="true"] .lkda__ico-open { display: none; }
.lkda[data-open="true"] .lkda__ico-close { display: block; }

/* Punto que invita a abrir; desaparece tras el primer uso */
.lkda__ping {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid var(--lkda-surface);
  animation: lkdaPing 2.2s ease-out infinite;
}

.lkda[data-seen="true"] .lkda__ping { display: none; }

@keyframes lkdaPing {
  0%   { box-shadow: 0 0 0 0 rgba(34, 197, 94, .55); }
  70%  { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* ── Panel ── */
.lkda__panel {
  display: flex;
  flex-direction: column;
  width: 360px;
  height: min(520px, calc(100dvh - 7.5rem));
  margin-bottom: .85rem;
  overflow: hidden;
  border: 1px solid var(--lkda-line);
  border-radius: var(--lkda-radius);
  background: var(--lkda-surface);
  color: var(--lkda-text);
  box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .65);
  transform-origin: bottom right;
  animation: lkdaIn .28s cubic-bezier(.22, 1, .36, 1);
}

.lkda__panel[hidden] { display: none; }

@keyframes lkdaIn {
  from { opacity: 0; transform: translateY(10px) scale(.97); }
  to   { opacity: 1; transform: none; }
}

/* ── Cabecera ── */
.lkda__head {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--lkda-line);
  background: var(--lkda-soft);
}

.lkda__avatar {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--lkda-accent);
  color: var(--lkda-on-accent);
  font-weight: 700;
  font-size: .95rem;
}

.lkda__id { flex: 1; min-width: 0; }

.lkda__name {
  display: block;
  font-size: .92rem;
  font-weight: 600;
}

.lkda__role {
  display: block;
  font-size: .68rem;
  color: var(--lkda-muted);
}

.lkda__close {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--lkda-muted);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  transition: background .2s ease, color .2s ease;
}

.lkda__close:hover {
  background: var(--lkda-soft);
  color: var(--lkda-text);
}

/* ── Conversación ── */
.lkda__log {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

.lkda__log::-webkit-scrollbar { width: 6px; }
.lkda__log::-webkit-scrollbar-thumb {
  background: var(--lkda-line);
  border-radius: 99px;
}

.lkda__msg {
  max-width: 85%;
  padding: .6rem .8rem;
  border-radius: 14px;
  font-size: .86rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  animation: lkdaMsg .25s ease both;
}

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

.lkda__msg--bot {
  align-self: flex-start;
  background: var(--lkda-soft);
  border-bottom-left-radius: 4px;
}

.lkda__msg--user {
  align-self: flex-end;
  background: var(--lkda-accent);
  color: var(--lkda-on-accent);
  border-bottom-right-radius: 4px;
}

.lkda__msg b { font-weight: 700; }

/* Puntos de "escribiendo" */
.lkda__typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: .75rem .85rem;
}

.lkda__typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--lkda-muted);
  animation: lkdaDot 1.2s ease-in-out infinite;
}

.lkda__typing i:nth-child(2) { animation-delay: .15s; }
.lkda__typing i:nth-child(3) { animation-delay: .3s; }

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

/* ── Sugerencias ── */
.lkda__chips {
  display: flex;
  gap: .4rem;
  padding: 0 1rem .7rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.lkda__chips::-webkit-scrollbar { display: none; }

.lkda__chips button {
  flex-shrink: 0;
  padding: .35rem .75rem;
  border: 1px solid var(--lkda-line);
  border-radius: 999px;
  background: none;
  color: var(--lkda-muted);
  font-family: inherit;
  font-size: .74rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}

.lkda__chips button:hover {
  background: var(--lkda-accent);
  border-color: var(--lkda-accent);
  color: var(--lkda-on-accent);
}

/* ── Entrada ── */
.lkda__form {
  display: flex;
  gap: .5rem;
  padding: .7rem 1rem;
  border-top: 1px solid var(--lkda-line);
}

.lkda__form input {
  flex: 1;
  min-width: 0;
  padding: .6rem .8rem;
  border: 1px solid var(--lkda-line);
  border-radius: 10px;
  background: var(--lkda-soft);
  color: var(--lkda-text);
  font-family: inherit;
  font-size: .85rem;
}

.lkda__form input::placeholder { color: var(--lkda-muted); }

.lkda__form input:focus {
  outline: none;
  border-color: var(--lkda-accent);
}

.lkda__send {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 10px;
  background: var(--lkda-accent);
  color: var(--lkda-on-accent);
  cursor: pointer;
  transition: opacity .2s ease;
}

.lkda__send svg { width: 17px; height: 17px; }
.lkda__send:disabled { opacity: .4; cursor: not-allowed; }

.lkda__note {
  margin: 0;
  padding: 0 1rem .7rem;
  font-size: .63rem;
  text-align: center;
  color: var(--lkda-muted);
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .lkda { right: 1rem; bottom: 1rem; left: 1rem; }

  .lkda__panel {
    width: 100%;
    height: min(70dvh, calc(100dvh - 6.5rem));
  }

  .lkda__fab { width: 54px; height: 54px; }
}

@media (prefers-reduced-motion: reduce) {
  .lkda__panel, .lkda__msg { animation: none; }
  .lkda__ping, .lkda__typing i { animation: none; }
  .lkda__fab { transition: none; }
}
