/* ==========================================================================
   LUCÍA — asistente virtual con avatar (ver /assets/bot.js)
   ========================================================================== */

/* ---------- Avatar: parpadeo y boca ---------- */
.rxb-face { display: block; width: 100%; height: 100%; }
.rxb-face .rxb-eyes { transform-box: fill-box; transform-origin: center; animation: rxb-blink 5.2s infinite; }
.rxb-face .rxb-mouth { transform-box: fill-box; transform-origin: center; transform: scale(.6, 0); }
/* solo hablan el avatar grande de la cabecera y el del botón flotante */
.rxb-talking :is(.rxb-avatar, .rxb-launch) .rxb-smile { opacity: 0; }
.rxb-talking :is(.rxb-avatar, .rxb-launch) .rxb-mouth { animation: rxb-talk .24s ease-in-out infinite alternate; }
.rxb-talking.rxb-word :is(.rxb-avatar, .rxb-launch) .rxb-mouth { animation: rxb-talk .24s ease-in-out infinite alternate, rxb-word .16s ease-out; }
@keyframes rxb-blink { 0%, 93%, 100% { transform: scaleY(1); } 95.5% { transform: scaleY(.08); } }
@keyframes rxb-talk {
  0% { transform: scale(.75, .2); }
  45% { transform: scale(1, .9); }
  100% { transform: scale(.9, .45); }
}
@keyframes rxb-word { 50% { transform: scale(1.05, 1.1); } }

/* ---------- Botón flotante con avatar ---------- */
.rxb { position: relative; display: flex; justify-content: flex-end; margin-right: 2px; font-family: "Plus Jakarta Sans", system-ui, sans-serif; }
.rxb:not(.rxb-docked) { position: fixed; right: 24px; bottom: 96px; z-index: 60; }
.rxb-launch {
  position: relative;
  width: 58px;
  height: 58px;
  padding: 0;
  border-radius: 50%;
  border: 3px solid #fff;
  background: #e3ddd2;
  cursor: pointer;
  overflow: visible;
  box-shadow: 0 12px 28px -10px rgba(20, 20, 22, .55), 0 0 0 1px rgba(20, 20, 22, .08);
  transition: transform .2s ease;
}
.rxb-launch .rxb-face { border-radius: 50%; }
.rxb-launch:hover { transform: translateY(-2px) scale(1.04); }
.rxb-launch:focus-visible { outline: 3px solid #e5a93c; outline-offset: 4px; }
.rxb-launch-dot {
  position: absolute;
  right: -1px;
  bottom: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #2fbf71;
  border: 2px solid #fff;
}
.rxb-teaser {
  position: absolute;
  right: 72px;
  top: 50%;
  transform: translateY(-50%);
  width: max-content;
  max-width: 230px;
  padding: 11px 30px 11px 14px;
  border-radius: 14px 14px 4px 14px;
  background: #fff;
  color: #141416;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.35;
  border: 1px solid #ddd8ce;
  box-shadow: 0 14px 30px -14px rgba(20, 20, 22, .45);
  cursor: pointer;
  animation: rxb-pop .3s cubic-bezier(.2, .7, .2, 1);
}
.rxb-teaser[hidden] { display: none; }
.rxb-teaser-x {
  position: absolute;
  top: 4px;
  right: 6px;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #76777b;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.rxb-teaser-x:hover { background: #f1ede5; }
@keyframes rxb-pop { from { opacity: 0; transform: translateY(-40%) scale(.96); } }

/* el dock de contacto se aparta mientras el chat está abierto */
html.rxb-open .rx-dock, html.rxb-open .rx-bar { visibility: hidden; }

/* ---------- Panel de chat ---------- */
.rxb-panel {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 80;
  width: min(390px, calc(100vw - 32px));
  height: min(640px, calc(100vh - 110px));
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  overflow: hidden;
  background: #fdf9f1;
  border: 1px solid #ddd8ce;
  box-shadow: 0 40px 80px -30px rgba(20, 20, 22, .6);
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  color: #1c1c17;
  animation: rxb-panel-in .28s cubic-bezier(.2, .7, .2, 1);
}
.rxb-panel[hidden] { display: none; }
@keyframes rxb-panel-in { from { opacity: 0; transform: translateY(14px) scale(.98); } }

.rxb-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 12px 14px 16px;
  color: #fdf9f1;
  background:
    radial-gradient(120% 160% at 100% 0%, rgba(229, 169, 60, .22), transparent 55%),
    #1c1d1f;
}
.rxb-avatar { position: relative; width: 52px; height: 52px; flex: 0 0 auto; }
.rxb-avatar .rxb-face { border-radius: 50%; box-shadow: 0 0 0 2px rgba(253, 249, 241, .9); }
.rxb-online {
  position: absolute;
  right: 0;
  bottom: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #2fbf71;
  border: 2px solid #1c1d1f;
}
.rxb-talking .rxb-avatar .rxb-face { box-shadow: 0 0 0 2px #e5a93c, 0 0 0 6px rgba(229, 169, 60, .25); }
.rxb-who { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.rxb-who strong { font: 500 18px/1.2 "Noto Serif", Georgia, serif; }
.rxb-ai-badge {
  display: none;
  margin-left: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  vertical-align: 2px;
  background: #e5a93c;
  color: #141416;
  font: 700 10.5px/1.3 "Plus Jakarta Sans", system-ui, sans-serif;
  font-style: normal;
  letter-spacing: .06em;
}
.rxb-ai .rxb-ai-badge { display: inline-block; }
.rxb-who span { font-size: 12px; color: rgba(253, 249, 241, .7); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rxb-tools { display: flex; gap: 4px; }
.rxb-tool {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: rgba(253, 249, 241, .85);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.rxb-tool:hover { background: rgba(253, 249, 241, .1); color: #fff; }
.rxb-tool:focus-visible { outline: 2px solid #e5a93c; outline-offset: 1px; }
.rxb-tool .material-symbols-outlined { font-size: 21px; }
.rxb-voice[aria-pressed="true"] { color: #e5a93c; }

.rxb-log {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background:
    linear-gradient(rgba(123, 88, 39, .045) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, rgba(123, 88, 39, .045) 1px, transparent 1px) 0 0 / 24px 24px,
    #fdf9f1;
  scroll-behavior: smooth;
}
.rxb-row { display: flex; gap: 8px; align-items: flex-end; max-width: 100%; }
.rxb-row.rxb-in { animation: rxb-msg .3s cubic-bezier(.2, .7, .2, 1); }
@keyframes rxb-msg { from { opacity: 0; transform: translateY(8px); } }
.rxb-mini { width: 30px; height: 30px; flex: 0 0 auto; border-radius: 50%; overflow: hidden; }
.rxb-col { display: flex; flex-direction: column; gap: 8px; min-width: 0; max-width: calc(100% - 38px); }
.rxb-bubble {
  padding: 11px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.rxb-bot .rxb-bubble {
  background: #fff;
  border: 1px solid #e6e0d4;
  border-bottom-left-radius: 5px;
  box-shadow: 0 6px 16px -12px rgba(20, 20, 22, .35);
}
.rxb-user { justify-content: flex-end; }
.rxb-user .rxb-bubble {
  max-width: 82%;
  background: #1c1d1f;
  color: #fdf9f1;
  border-bottom-right-radius: 5px;
}
.rxb-bubble b { font-weight: 700; }
.rxb-bubble a { color: #7b5827; text-decoration: underline; text-underline-offset: 2px; }
.rxb-bubble ul, .rxb-bubble ol { margin: 6px 0 4px; padding-left: 18px; }
.rxb-bubble ul { list-style: disc; }
.rxb-bubble ol { list-style: decimal; }
.rxb-bubble li { margin: 2px 0; }
.rxb-bubble .rxb-cols { columns: 2; column-gap: 18px; }
.rxb-note { display: block; margin-top: 6px; font-size: 12px; color: #6b6b66; }

.rxb-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.rxb-act {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 11px;
  border-radius: 999px;
  border: 1px solid #ddd8ce;
  background: #fff;
  color: #141416;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  transition: border-color .2s ease, background .2s ease;
}
.rxb-act:hover { border-color: #7b5827; }
.rxb-act .material-symbols-outlined { font-size: 16px; }
.rxb-act-dark { background: #141416; border-color: #141416; color: #fdf9f1; }
.rxb-act-dark:hover { background: #2a2b2e; }
.rxb-act-wa { background: #25d366; border-color: #25d366; color: #0b3d20; }
.rxb-act-wa:hover { background: #1fbf5b; border-color: #1fbf5b; }
.rxb-act:focus-visible, .rxb-chip:focus-visible { outline: 2px solid #e5a93c; outline-offset: 2px; }

.rxb-typing .rxb-bubble { display: inline-flex; gap: 4px; padding: 14px 16px; }
.rxb-typing i { width: 7px; height: 7px; border-radius: 50%; background: #b9b2a5; animation: rxb-dot 1s infinite ease-in-out; }
.rxb-typing i:nth-child(2) { animation-delay: .15s; }
.rxb-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes rxb-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }

.rxb-chips {
  display: flex;
  gap: 6px;
  padding: 8px 12px 2px;
  overflow-x: auto;
  scrollbar-width: none;
  background: #fdf9f1;
}
.rxb-chips::-webkit-scrollbar { display: none; }
.rxb-chips[hidden] { display: none; }
.rxb-chip {
  flex: 0 0 auto;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid #c9b48f;
  background: #fff8ea;
  color: #5c421c;
  font: 600 12.5px/1.2 "Plus Jakarta Sans", system-ui, sans-serif;
  cursor: pointer;
  white-space: nowrap;
}
.rxb-chip:hover { background: #f6ead2; }

.rxb-form {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 8px 12px 6px;
  padding: 5px 5px 5px 14px;
  border-radius: 999px;
  border: 1px solid #ddd8ce;
  background: #fff;
}
.rxb-form:focus-within { border-color: #7b5827; box-shadow: 0 0 0 3px rgba(123, 88, 39, .12); }
.rxb-input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: 400 14.5px/1.4 "Plus Jakarta Sans", system-ui, sans-serif; color: #141416; padding: 8px 0; }
.rxb-mic, .rxb-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: 0 0 auto;
}
.rxb-mic { background: transparent; color: #45474a; }
.rxb-mic:hover { background: #f3efe7; }
.rxb-mic.rxb-listening { background: #c0392b; color: #fff; animation: rxb-rec 1.2s infinite; }
@keyframes rxb-rec { 50% { box-shadow: 0 0 0 6px rgba(192, 57, 43, .2); } }
.rxb-send { background: #141416; color: #fdf9f1; }
.rxb-send:hover { background: #2a2b2e; }
.rxb-mic .material-symbols-outlined, .rxb-send .material-symbols-outlined { font-size: 20px; }
.rxb-mic:focus-visible, .rxb-send:focus-visible { outline: 2px solid #e5a93c; outline-offset: 2px; }
.rxb-disc { margin: 0; padding: 0 16px 10px; font-size: 10.5px; line-height: 1.35; color: #8a8a84; text-align: center; }

/* ---------- Móvil: chat a pantalla completa ---------- */
@media (max-width: 767px) {
  .rxb-panel {
    inset: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    border-radius: 0;
    border: 0;
  }
  .rxb-form { margin-bottom: calc(6px + env(safe-area-inset-bottom, 0px)); }
  .rxb-input { font-size: 16px; } /* evita el zoom automático de iOS */
  .rxb-launch { width: 54px; height: 54px; }
  .rxb-teaser { right: 66px; max-width: 200px; }
}

@media (prefers-reduced-motion: reduce) {
  .rxb-face .rxb-eyes, .rxb-talking :is(.rxb-avatar, .rxb-launch) .rxb-mouth { animation: none !important; }
  .rxb-talking :is(.rxb-avatar, .rxb-launch) .rxb-mouth { transform: scale(.9, .6); }
  .rxb-panel, .rxb-row.rxb-in, .rxb-teaser { animation: none; }
}
