/* =========================================
   CHATBOT FLOTANTE
   ========================================= */
.chat-boton {
  position: fixed; right: 20px; bottom: 20px; z-index: 200;
  width: 62px; height: 62px; border-radius: 50%;
  border: 0; cursor: pointer;
  background: var(--color-primario);
  color: #fff; font-size: 1.7rem;
  box-shadow: 0 10px 30px rgba(255, 77, 0, .45);
  transition: transform .2s;
}
.chat-boton:hover { transform: scale(1.08); }
.chat-boton__aviso {
  position: absolute; top: 2px; right: 2px;
  width: 14px; height: 14px; border-radius: 50%;
  background: #3ddc84; border: 2px solid var(--fondo);
}

.chat {
  position: fixed; right: 20px; bottom: 96px; z-index: 200;
  width: 370px; height: 540px; max-height: calc(100vh - 120px);
  display: flex; flex-direction: column;
  background: var(--fondo-alt);
  border: 1px solid var(--borde);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
  opacity: 0; transform: translateY(20px) scale(.97); pointer-events: none;
  transition: opacity .25s, transform .25s;
}
.chat.abierto { opacity: 1; transform: none; pointer-events: auto; }

.chat__cabecera {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--color-primario), #ff7a3d);
}
.chat__avatar { width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,.2); display: grid; place-items: center; font-size: 1.3rem; }
.chat__titulo { flex: 1; line-height: 1.3; }
.chat__titulo strong { display: block; }
.chat__modo { font-size: .75rem; opacity: .9; }
.chat__cerrar { background: none; border: 0; color: #fff; font-size: 1.6rem; cursor: pointer; line-height: 1; }

.chat__mensajes { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.msg {
  max-width: 85%; padding: 10px 14px; border-radius: 16px;
  font-size: .93rem; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word;
  animation: aparecer .25s ease both;
}
.msg--bot { background: var(--tarjeta); border: 1px solid var(--borde); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg--usuario { background: var(--color-primario); align-self: flex-end; border-bottom-right-radius: 4px; }

.escribiendo { display: inline-flex; gap: 4px; }
.escribiendo span { width: 7px; height: 7px; border-radius: 50%; background: var(--texto-suave); animation: rebote 1s infinite; }
.escribiendo span:nth-child(2) { animation-delay: .15s; }
.escribiendo span:nth-child(3) { animation-delay: .3s; }
@keyframes rebote { 0%, 60%, 100% { transform: none; opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }

.chat__sugerencias { display: flex; gap: 8px; padding: 0 16px 10px; overflow-x: auto; }
.chip {
  flex-shrink: 0;
  background: transparent; color: var(--texto);
  border: 1px solid var(--color-primario);
  border-radius: 50px; padding: 6px 12px;
  font-size: .8rem; font-family: inherit; cursor: pointer;
}
.chip:hover { background: var(--color-primario); }
.chip--destacado { background: var(--color-primario); font-weight: 600; }

/* Formulario «Que me llamen» dentro del chat */
.chat-contacto { display: grid; gap: 8px; margin-top: 10px; }
.chat-contacto input {
  background: var(--fondo); color: var(--texto);
  border: 1px solid var(--borde); border-radius: 8px;
  padding: 8px 10px; font-family: inherit; font-size: .9rem;
}
.chat-contacto input:focus { outline: none; border-color: var(--color-primario); }
.chat-contacto button {
  background: var(--color-primario); color: #fff; border: 0; border-radius: 8px;
  padding: 8px; font-family: inherit; font-weight: 600; cursor: pointer;
}
.chat-contacto button:disabled { opacity: .6; cursor: default; }
.chat-contacto__error { color: #ff6b81; font-size: .78rem; min-height: 1em; }

.chat__form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--borde); }
.chat__form input {
  flex: 1; background: var(--fondo); color: var(--texto);
  border: 1px solid var(--borde); border-radius: 50px;
  padding: 10px 16px; font-family: inherit; font-size: .95rem;
}
.chat__form input:focus { outline: none; border-color: var(--color-primario); }
.chat__form button {
  width: 42px; height: 42px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--color-primario); color: #fff; font-size: 1.1rem;
}
.chat__form button:disabled { opacity: .5; cursor: default; }

@media (max-width: 500px) {
  .chat { right: 8px; left: 8px; bottom: 88px; width: auto; height: calc(100vh - 110px); }
  .chat-boton { right: 16px; bottom: 16px; }
}
