/* Asistente Peña Sacra — botón flotante + panel de chat.
   Usa los tokens del tema (con fallback por si el módulo se usa solo). */
:root {
  --asis-verde: var(--ps-verde, #2f3a2a);
  --asis-terra: var(--ps-terracota, #c07a55);
  --asis-crema: var(--ps-crema, #f4efe4);
  --asis-borde: var(--ps-borde, #e3dcc9);
}

.ps-asis { position: fixed; right: 20px; bottom: 20px; z-index: 70; font-family: var(--ps-sans, system-ui, sans-serif); }

/* Botón flotante */
.ps-asis__fab {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 18px 12px 14px; border: none; cursor: pointer;
  background: var(--asis-verde); color: var(--asis-crema);
  border-radius: 999px; font-weight: 700; font-size: 14.5px;
  box-shadow: 0 14px 30px -12px rgba(47,58,42,.7);
  transition: transform .25s cubic-bezier(.22,.61,.36,1), background .25s;
}
.ps-asis__fab:hover { transform: translateY(-2px); background: #3c4a34; }
.ps-asis__fab-icon { font-size: 19px; color: var(--asis-terra); }
@media (max-width: 480px) { .ps-asis__fab-label { display: none; } .ps-asis__fab { padding: 14px; } .ps-asis__fab-icon { font-size: 22px; } }

/* Panel */
.ps-asis__panel {
  position: absolute; right: 0; bottom: 70px; width: min(370px, calc(100vw - 32px));
  background: #fff; border: 1px solid var(--asis-borde); border-radius: 18px; overflow: hidden;
  box-shadow: 0 30px 70px -30px rgba(47,58,42,.55);
  display: flex; flex-direction: column; max-height: min(70vh, 560px);
  animation: ps-asis-in .28s cubic-bezier(.16,1,.3,1);
}
@keyframes ps-asis-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .ps-asis__panel { animation: none; } }

.ps-asis__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; background: var(--asis-verde); color: var(--asis-crema); }
.ps-asis__head-id { display: flex; align-items: center; gap: 10px; }
.ps-asis__head-id small { display: block; opacity: .8; font-size: 11.5px; }
.ps-asis__avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.12); color: var(--asis-terra); font-size: 17px; }
.ps-asis__close { background: none; border: none; color: var(--asis-crema); font-size: 24px; line-height: 1; cursor: pointer; opacity: .85; }
.ps-asis__close:hover { opacity: 1; }

.ps-asis__log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--asis-crema); }
.ps-asis__log--full { max-height: 52vh; border-radius: 14px; border: 1px solid var(--asis-borde); }

.ps-asis__msg { max-width: 85%; padding: 10px 13px; border-radius: 14px; font-size: 14px; line-height: 1.5; word-wrap: break-word; }
.ps-asis__msg--bot { background: #fff; border: 1px solid var(--asis-borde); border-bottom-left-radius: 4px; align-self: flex-start; color: #2a2722; }
.ps-asis__msg--user { background: var(--asis-terra); color: #fff; border-bottom-right-radius: 4px; align-self: flex-end; }
.ps-asis__msg--error { background: #fbeaea; border-color: #e7b8b8; color: #8a2b2b; }
.ps-asis__msg a { color: inherit; text-decoration: underline; }
.ps-asis__msg--bot a { color: var(--asis-terra); }

/* Indicador "escribiendo" */
.ps-asis__typing { display: inline-flex; gap: 4px; align-items: center; }
.ps-asis__typing span { width: 7px; height: 7px; border-radius: 50%; background: #b9b2a0; animation: ps-asis-blink 1.2s infinite ease-in-out; }
.ps-asis__typing span:nth-child(2) { animation-delay: .2s; }
.ps-asis__typing span:nth-child(3) { animation-delay: .4s; }
@keyframes ps-asis-blink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }

.ps-asis__form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--asis-borde); background: #fff; }
.ps-asis__form input { flex: 1; border: 1px solid var(--asis-borde); border-radius: 999px; padding: 10px 14px; font-size: 14px; outline: none; }
.ps-asis__form input:focus { border-color: var(--asis-terra); }
.ps-asis__form button { border: none; cursor: pointer; background: var(--asis-verde); color: #fff; border-radius: 50%; width: 40px; height: 40px; font-size: 18px; flex: none; }
.ps-asis__form--full button { border-radius: 999px; width: auto; padding: 0 22px; }
.ps-asis__legal { margin: 0; padding: 0 14px 12px; font-size: 11px; color: #9a917e; background: #fff; }
.ps-asis__legal a { color: var(--asis-terra); }

/* Página completa */
.ps-asis-page { max-width: 760px; margin: 0 auto; padding: 2rem 1rem 4rem; }
.ps-asis-page__intro { text-align: center; margin-bottom: 2rem; }
.ps-asis-embed { background: #fff; border: 1px solid var(--asis-borde); border-radius: 20px; padding: 18px; box-shadow: 0 18px 40px -28px rgba(47,58,42,.4); }
.ps-asis__form--full { margin-top: 14px; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
