/* ===== CHATBOT WIDGET ===== */
#fsChat-launcher {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 1200;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--blue);
  color: var(--white);
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  transition: transform var(--transition), box-shadow var(--transition);
}

#fsChat-launcher:hover {
  transform: scale(1.08);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3);
}

#fsChat-launcher .fsChat-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--green);
  border: 2px solid var(--white);
}

#fsChat-launcher.hidden {
  display: none;
}

/* Sube el botón "volver arriba" para que no se solape con el chat */
#backToTop {
  bottom: 6rem;
}

#fsChat-window {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 1300;
  width: 370px;
  max-width: calc(100vw - 2rem);
  height: 560px;
  max-height: calc(100vh - 3rem);
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: fsChatIn 0.3s ease;
}

#fsChat-window.open {
  display: flex;
}

@keyframes fsChatIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.fsChat-header {
  background: var(--blue);
  color: var(--white);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.fsChat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.fsChat-title {
  flex: 1;
  line-height: 1.25;
}

.fsChat-title strong {
  font-family: var(--font-display);
  font-size: 1.15rem;
  display: block;
}

.fsChat-title span {
  font-size: 0.75rem;
  opacity: 0.9;
}

.fsChat-title span::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #7CFC9B;
  margin-right: 6px;
}

.fsChat-close {
  color: var(--white);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}

.fsChat-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.fsChat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.fsChat-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.55;
  white-space: pre-line;
  word-wrap: break-word;
  animation: fsMsgIn 0.25s ease;
}

@keyframes fsMsgIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fsChat-msg.bot {
  background: var(--white);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}

.fsChat-msg.user {
  background: var(--blue);
  color: var(--white);
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

.fsChat-msg a {
  color: var(--blue);
  font-weight: 600;
  text-decoration: underline;
}

.fsChat-typing {
  align-self: flex-start;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  padding: 12px 16px;
  display: flex;
  gap: 4px;
}

.fsChat-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-light);
  opacity: 0.4;
  animation: fsTyping 1s infinite;
}

.fsChat-typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.fsChat-typing span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes fsTyping {

  0%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }

  50% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.fsChat-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-self: flex-start;
  max-width: 95%;
}

.fsChat-chip {
  background: var(--white);
  color: var(--blue);
  border: 1.5px solid var(--blue);
  border-radius: 20px;
  padding: 6px 13px;
  font-size: 0.8rem;
  font-weight: 600;
  transition: background var(--transition), color var(--transition);
}

.fsChat-chip:hover {
  background: var(--blue);
  color: var(--white);
}

.fsChat-wa {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  background: #25D366;
  color: var(--white);
  padding: 10px 18px;
  border-radius: 24px;
  font-size: 0.85rem;
  font-weight: 700;
  transition: transform var(--transition);
}

.fsChat-wa:hover {
  transform: translateY(-2px);
}

.fsChat-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
  background: var(--white);
}

.fsChat-form input {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 24px;
  font-size: 0.88rem;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition);
}

.fsChat-form input:focus {
  border-color: var(--blue);
}

.fsChat-form button {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--blue);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform var(--transition);
}

.fsChat-form button:hover {
  transform: scale(1.06);
}

@media (max-width: 480px) {
  #fsChat-window {
    right: 0;
    bottom: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }

  #fsChat-launcher {
    right: 1rem;
    bottom: 1rem;
  }

  #backToTop {
    bottom: 5.5rem;
    right: 1rem;
  }
}
