/* ===== Asistente de usuario (bot de ayuda) ===== */
.assistant-float {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 970;
  width: 3.6rem;
  height: 3.6rem;
  border: none;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #d4af37, #b8942a);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  color: #fff;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.assistant-float:hover {
  transform: scale(1.1);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
}

.assistant-float::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(212, 175, 55, 0.5);
  animation: whatsapp-pulse 2s infinite;
}

.assistant-float .assistant-open-icon {
  display: block !important;
}

.assistant-float .assistant-close-icon {
  display: none !important;
}

.assistant-float.is-open .assistant-open-icon {
  display: none !important;
}

.assistant-float.is-open .assistant-close-icon {
  display: block !important;
}

.assistant-window {
  position: fixed;
  right: 1.25rem;
  bottom: 5.25rem;
  z-index: 975;
  width: 360px;
  max-width: calc(100vw - 2.5rem);
  height: 520px;
  max-height: calc(100vh - 7rem);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #FFFDF7 0%, #FBF4E2 100%);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 22px;
  box-shadow: 0 32px 64px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  overflow: hidden;
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  transform-origin: bottom right;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
  font-family: 'Quicksand', sans-serif;
}

.assistant-window.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  visibility: visible;
  pointer-events: auto;
}

.assistant-header {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 1.1rem 1.2rem;
  background: linear-gradient(135deg, #1c1033, #2a1a4d);
  color: #FFD700;
}

.assistant-header .assistant-avatar {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #d4af37, #b8942a);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1c1033;
  font-weight: 800;
  font-size: 1.2rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.assistant-header h4 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.assistant-header p {
  margin: 0.15rem 0 0;
  font-size: 0.75rem;
  color: rgba(255, 215, 0, 0.75);
}

.assistant-close {
  margin-left: auto;
  border: none;
  background: transparent;
  color: #FFD700;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.15s ease;
}

.assistant-close:hover {
  background: rgba(255, 255, 255, 0.12);
}

.assistant-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.assistant-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.assistant-msg {
  max-width: 85%;
  padding: 0.75rem 0.95rem;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-line;
  word-break: break-word;
}

.assistant-msg.bot {
  align-self: flex-start;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-bottom-left-radius: 4px;
  color: #241A08;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.assistant-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #d4af37, #b8942a);
  border-bottom-right-radius: 4px;
  color: #fff;
}

.assistant-msg .assistant-link {
  color: #C44706;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.assistant-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.7rem 1rem 0.2rem;
}

.assistant-quick button {
  border: 1px solid rgba(196, 71, 6, 0.35);
  background: rgba(255, 255, 255, 0.7);
  color: #a63704;
  font-family: 'Quicksand', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.assistant-quick button:hover {
  background: #C44706;
  color: #fff;
}

.assistant-input {
  display: flex;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  background: #fff;
}

.assistant-input input {
  flex: 1;
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 999px;
  padding: 0.7rem 1rem;
  font-family: 'Quicksand', sans-serif;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.assistant-input input:focus {
  border-color: #d4af37;
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.25);
}

.assistant-input button {
  border: none;
  width: 2.7rem;
  height: 2.7rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #d4af37, #b8942a);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.assistant-input button:hover {
  transform: scale(1.08);
}

.assistant-footer-note {
  text-align: center;
  font-size: 0.68rem;
  color: rgba(36, 26, 8, 0.55);
  padding: 0.35rem 0 0.6rem;
}

/* ===== Formulario de contacto dentro del chat ===== */
.assistant-msg.lead-card {
  max-width: 100%;
  width: 100%;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.lead-card-inner {
  background: #ffffff;
  border: 1px solid rgba(212, 175, 55, 0.45);
  border-radius: 14px;
  padding: 1rem 1rem 1.1rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.lead-card-title {
  font-weight: 800;
  font-size: 0.95rem;
  color: #1c1033;
  margin-bottom: 0.2rem;
}

.lead-card-sub {
  font-size: 0.75rem;
  color: rgba(36, 26, 8, 0.62);
  margin: 0 0 0.6rem;
}

.lead-prefill {
  font-size: 0.78rem;
  background: #FBF4E2;
  border-left: 3px solid #d4af37;
  border-radius: 6px;
  padding: 0.45rem 0.6rem;
  margin-bottom: 0.6rem;
  color: #241A08;
  word-break: break-word;
}

.lead-form label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: #1c1033;
  margin-bottom: 0.55rem;
}

.lead-form input,
.lead-form textarea {
  width: 100%;
  margin-top: 0.28rem;
  box-sizing: border-box;
  border: 1px solid rgba(0, 0, 0, 0.16);
  border-radius: 9px;
  padding: 0.6rem 0.75rem;
  font-family: 'Quicksand', sans-serif;
  font-size: 0.86rem;
  color: #241A08;
  background: #FFFDF7;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.lead-form input:focus,
.lead-form textarea:focus {
  border-color: #d4af37;
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.22);
}

.lead-form textarea {
  resize: vertical;
  min-height: 70px;
}

.lead-submit {
  width: 100%;
  margin-top: 0.3rem;
  border: none;
  border-radius: 10px;
  padding: 0.8rem 1rem;
  background: linear-gradient(135deg, #d4af37, #b8942a);
  color: #fff;
  font-family: 'Quicksand', sans-serif;
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(184, 148, 42, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.lead-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(184, 148, 42, 0.45);
}

.lead-card.lead-done {
  opacity: 0.55;
  pointer-events: none;
  filter: grayscale(0.4);
}

.lead-card.lead-done .lead-form {
  display: none;
}

@media (max-width: 768px) {
  .assistant-float {
    right: max(0.8rem, var(--sar));
    bottom: max(0.8rem, calc(var(--sab) + 0.8rem));
    width: 3.2rem;
    height: 3.2rem;
  }

  .assistant-window {
    right: max(0.5rem, var(--sar));
    left: max(0.5rem, var(--sal));
    bottom: max(4.5rem, calc(var(--sab) + 4.5rem));
    width: auto;
    max-width: calc(100vw - 1rem);
    height: min(560px, calc(100dvh - 6rem));
    max-height: calc(100dvh - 6rem);
    border-radius: 18px;
  }

  .assistant-input input,
  .lead-form input,
  .lead-form textarea {
    font-size: 16px !important; /* Previene auto-zoom molesto en iOS Safari */
  }
}