/* THP IA como asesor virtual de cuerpo completo. Se carga al final para dominar
   las reglas compactas del botón flotante original. */
.thp-assistant {
  width: 250px;
  height: 430px;
  right: clamp(12px, 2vw, 32px);
  bottom: 18px;
  pointer-events: none;
}

.home-active .thp-assistant { bottom: 210px; }

.thp-assistant-launcher {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 240px;
  height: 410px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background-color: transparent;
  background-image: url("../assets/asistente-thp/thp-ia-animado-lentes-cuerpo-completo-v3.png");
  background-repeat: no-repeat;
  background-position: right bottom;
  background-size: contain;
  box-shadow: none;
  overflow: visible;
  pointer-events: auto;
  filter: drop-shadow(0 20px 22px rgba(10, 36, 30, 0.28));
  transform-origin: bottom center;
  transition: transform 180ms ease, filter 180ms ease;
}

.thp-assistant-launcher:hover,
.thp-assistant-launcher:focus-visible {
  transform: translateY(-5px) scale(1.025);
  filter: drop-shadow(0 24px 26px rgba(10, 36, 30, 0.36));
}

.thp-assistant-launcher > * { display: none !important; }

.thp-assistant-launcher::after {
  content: "Hola, soy THP IA\A ¿Te ayudo a elegir?";
  white-space: pre;
  position: absolute;
  top: 24px;
  right: 174px;
  width: max-content;
  padding: 12px 16px;
  border: 1px solid rgba(27, 69, 58, 0.18);
  border-radius: 18px 18px 4px 18px;
  background: rgba(255, 255, 252, 0.96);
  color: #173c33;
  font-size: 14px;
  font-weight: 750;
  line-height: 1.3;
  text-align: left;
  box-shadow: 0 12px 30px rgba(15, 42, 35, 0.18);
  backdrop-filter: blur(12px);
}

.thp-assistant.is-open .thp-assistant-launcher::after,
.thp-assistant.open .thp-assistant-launcher::after { display: none; }

.thp-assistant-panel {
  right: 218px;
  bottom: 28px;
  width: min(390px, calc(100vw - 290px));
  max-height: min(650px, calc(100vh - 56px));
  pointer-events: auto;
  box-shadow: 0 26px 70px rgba(12, 38, 31, 0.26);
}

@media (max-width: 760px) {
  .thp-assistant,
  .home-active .thp-assistant {
    width: 168px;
    height: 292px;
    right: 2px;
    bottom: 74px;
  }

  .thp-assistant-launcher {
    width: 164px;
    height: 286px;
  }

  .thp-assistant-launcher::after {
    top: 12px;
    right: 118px;
    padding: 9px 12px;
    font-size: 12px;
  }

  .thp-assistant-panel {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 248px;
    width: auto;
    max-height: calc(100vh - 270px);
  }
}

.thp-assistant-figure {
  transform-origin: 50% 100%;
  animation: none !important;
}

.thp-assistant-panel {
  width: min(340px, calc(100vw - 190px)) !important;
  height: min(620px, calc(100vh - 32px)) !important;
  max-height: min(620px, calc(100vh - 32px)) !important;
  grid-template-rows: auto minmax(110px, 1fr) auto auto auto !important;
  overflow: hidden !important;
}

.thp-assistant-messages {
  min-height: 0 !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
}

.thp-assistant.is-speaking .thp-assistant-figure {
  animation: none !important;
}

.thp-assistant.is-dragging .thp-assistant-figure {
  animation: none;
}

.thp-assistant-voice {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  margin-left: auto;
  border: 1px solid rgba(25, 67, 56, 0.16);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.76);
  color: #173c33;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease;
}

.thp-assistant-voice:hover,
.thp-assistant-voice:focus-visible {
  background: #fff;
  transform: translateY(-1px);
}

.thp-assistant-voice.is-muted {
  opacity: 0.68;
}

@keyframes thp-character-idle {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-4px) rotate(0.35deg); }
}

@keyframes thp-character-speaking {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-3px) scale(1.018); }
}

@media (prefers-reduced-motion: reduce) {
  .thp-assistant-figure,
  .thp-assistant.is-speaking .thp-assistant-figure {
    animation: none;
  }
}

@media (max-height: 720px) and (min-width: 761px) {
  .thp-assistant,
  .home-active .thp-assistant {
    width: 205px;
    height: 350px;
    bottom: 12px;
  }

  .thp-assistant-launcher {
    width: 198px;
    height: 340px;
  }

  .thp-assistant-launcher::after { right: 145px; }
  .thp-assistant-panel { right: 184px; }
}

/* Variante mascota: sólo la silueta, compacta y arrastrable. */
.thp-assistant {
  width: 150px !important;
  height: 260px !important;
}

.thp-assistant:not(.is-dragging) {
  transition: left 320ms ease, right 320ms ease, top 320ms ease, bottom 320ms ease, width 220ms ease, height 220ms ease;
}

.thp-assistant.is-contextual .thp-assistant-figure {
  filter: drop-shadow(0 16px 18px rgba(5, 25, 21, .24)) !important;
}

.thp-assistant-launcher {
  width: 145px !important;
  height: 250px !important;
  background-image: none !important;
  cursor: grab !important;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.thp-assistant-launcher:active,
.thp-assistant.is-dragging .thp-assistant-launcher {
  cursor: grabbing !important;
}

.thp-assistant-launcher::after {
  display: none !important;
  content: none !important;
}

.thp-assistant-figure {
  -webkit-user-drag: none;
  user-select: none;
}

@media (max-width: 760px) {
  .thp-assistant {
    width: 112px !important;
    height: 196px !important;
  }

  .thp-assistant-launcher {
    width: 108px !important;
    height: 188px !important;
  }
}
