/* Chatbot público Tecnoha — reemplazo del botón flotante */

.site-chat {
  position: fixed;
  right: 1.25rem;
  bottom: calc(1.25rem + 15px);
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.75rem;
  font-family: var(--font-heading, "Segoe UI", sans-serif);
}

.site-chat__fab {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  min-height: 56px;
  padding: 0.55rem 1.15rem 0.55rem 0.55rem;
  border: 1px solid rgba(159, 208, 240, 0.22);
  border-radius: 999px;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.14), transparent 42%),
    linear-gradient(135deg, #06101c 0%, #0d2140 42%, #0170b9 120%);
  background-size: 200% 200%, 100% 100%;
  color: #fff;
  box-shadow:
    0 14px 34px rgba(1, 112, 185, 0.28),
    0 10px 24px rgba(8, 17, 31, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  overflow: visible;
  animation: site-chat-fab-float 3.6s ease-in-out infinite;
  transition:
    transform 0.28s ease,
    box-shadow 0.28s ease,
    border-color 0.28s ease,
    filter 0.28s ease;
}

.site-chat__fab::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    110deg,
    transparent 20%,
    rgba(255, 255, 255, 0.22) 45%,
    transparent 70%
  );
  transform: translateX(-120%);
  animation: site-chat-fab-shine 4.8s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

.site-chat__fab > * {
  position: relative;
  z-index: 1;
}

.site-chat__fab:hover {
  transform: translateY(-5px) scale(1.03);
  border-color: rgba(159, 208, 240, 0.45);
  filter: saturate(1.08);
  box-shadow:
    0 20px 42px rgba(1, 112, 185, 0.36),
    0 12px 28px rgba(8, 17, 31, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
  animation-play-state: paused;
}

.site-chat__fab:active {
  transform: translateY(-1px) scale(0.99);
}

.site-chat__fab:focus-visible {
  outline: 2px solid #9fd0f0;
  outline-offset: 3px;
}

.site-chat.is-open .site-chat__fab {
  animation: none;
  background: linear-gradient(135deg, #08111f, #0f2744 70%);
}

.site-chat.is-open .site-chat__fab-pulse,
.site-chat.is-open .site-chat__fab-sub {
  display: none;
}

.site-chat__fab-pulse {
  position: absolute;
  left: 10px;
  top: 50%;
  width: 44px;
  height: 44px;
  margin-top: -22px;
  border-radius: 50%;
  border: 2px solid rgba(1, 112, 185, 0.45);
  pointer-events: none;
  animation: site-chat-fab-pulse 2.4s ease-out infinite;
  z-index: 0;
}

.site-chat__fab-pulse--delay {
  animation-delay: 1.1s;
}

.site-chat__fab-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #3aa0e6, #0170b9 55%, #0a4f86 100%);
  box-shadow:
    0 8px 18px rgba(1, 112, 185, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  flex-shrink: 0;
}

.site-chat__fab-icon svg {
  width: 20px;
  height: 20px;
  display: block;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.2));
}

.site-chat__fab-dot {
  position: absolute;
  right: 2px;
  top: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #32d583;
  border: 2px solid #0b1a2e;
  box-shadow: 0 0 0 0 rgba(50, 213, 131, 0.55);
  animation: site-chat-fab-dot 1.8s ease-out infinite;
}

.site-chat__fab-copy {
  display: grid;
  gap: 0.12rem;
  text-align: left;
  padding-right: 0.2rem;
}

.site-chat__fab-label {
  line-height: 1.1;
  color: rgba(255, 255, 255, 0.98);
}

.site-chat__fab-sub {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(159, 208, 240, 0.92);
  line-height: 1;
}

@keyframes site-chat-fab-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

@keyframes site-chat-fab-pulse {
  0% {
    transform: scale(0.85);
    opacity: 0.7;
  }
  70% {
    transform: scale(1.55);
    opacity: 0;
  }
  100% {
    opacity: 0;
  }
}

@keyframes site-chat-fab-shine {
  0%,
  55% {
    transform: translateX(-120%);
  }
  75%,
  100% {
    transform: translateX(120%);
  }
}

@keyframes site-chat-fab-dot {
  0% {
    box-shadow: 0 0 0 0 rgba(50, 213, 131, 0.55);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(50, 213, 131, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(50, 213, 131, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-chat__fab,
  .site-chat__fab::before,
  .site-chat__fab-pulse,
  .site-chat__fab-dot {
    animation: none !important;
  }
}

.site-chat__panel {
  width: min(380px, calc(100vw - 1.6rem));
  height: min(560px, calc(100vh - 7rem));
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  border-radius: 22px;
  border: 1px solid rgba(8, 17, 31, 0.12);
  background: #fff;
  box-shadow: 0 24px 60px rgba(8, 17, 31, 0.28);
  color: #132033;
}

.site-chat__panel[hidden] {
  display: none !important;
}

.site-chat__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1rem 0.85rem;
  background: linear-gradient(160deg, #08111f, #0f2744 70%);
  color: #fff;
}

.site-chat__head strong {
  display: block;
  font-size: 0.98rem;
  font-weight: 800;
}

.site-chat__head p {
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.78);
  font-weight: 500;
}

.site-chat__close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.site-chat__messages {
  padding: 0.9rem;
  overflow-y: auto;
  background:
    radial-gradient(circle at top right, rgba(1, 112, 185, 0.06), transparent 40%),
    #f5f8fc;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.site-chat__bubble {
  max-width: 88%;
  padding: 0.72rem 0.85rem;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.45;
  white-space: normal;
  word-break: break-word;
}

.site-chat__bubble br {
  display: block;
  content: "";
  margin-top: 0.35em;
}

.site-chat__bubble--bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid rgba(8, 17, 31, 0.08);
  color: #1a2b40;
  border-bottom-left-radius: 6px;
}

.site-chat__bubble--user {
  align-self: flex-end;
  background: #0170b9;
  color: #fff;
  border-bottom-right-radius: 6px;
}

.site-chat__bubble--meta {
  align-self: center;
  max-width: 95%;
  background: transparent;
  color: #5b6b7c;
  font-size: 0.78rem;
  text-align: center;
  padding: 0.2rem 0.4rem;
}

.site-chat__composer {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid rgba(8, 17, 31, 0.08);
  background: #fff;
}

.site-chat__composer input[type="text"] {
  flex: 1;
  min-width: 0;
  height: 44px;
  border: 1px solid rgba(8, 17, 31, 0.12);
  border-radius: 12px;
  padding: 0 0.85rem;
  font: inherit;
  font-size: 0.9rem;
  color: #132033;
  background: #f7fafc;
}

.site-chat__composer input[type="text"]:focus {
  outline: 2px solid rgba(1, 112, 185, 0.35);
  outline-offset: 1px;
  background: #fff;
}

.site-chat__send {
  height: 44px;
  padding: 0 1rem;
  border: 0;
  border-radius: 12px;
  background: #0170b9;
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.site-chat__send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.site-chat__hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
}

@media (max-width: 480px) {
  .site-chat {
    right: max(0.85rem, env(safe-area-inset-right));
    bottom: calc(max(0.85rem, env(safe-area-inset-bottom)) + 15px);
  }

  .site-chat__fab {
    min-height: 52px;
    gap: 0.55rem;
    padding: 0.45rem 0.9rem 0.45rem 0.45rem;
    font-size: 0.8rem;
  }

  .site-chat__fab-icon {
    width: 38px;
    height: 38px;
  }

  .site-chat__fab-pulse {
    left: 8px;
    width: 40px;
    height: 40px;
    margin-top: -20px;
  }

  .site-chat__fab-label {
    max-width: 11ch;
    white-space: normal;
    line-height: 1.15;
  }

  .site-chat__fab-sub {
    font-size: 0.62rem;
  }

  .site-chat__panel {
    width: min(100vw - 1.2rem, 380px);
    height: min(70vh, 560px);
  }
}

body.nav-open .site-chat {
  visibility: hidden;
  pointer-events: none;
}
