/* ====================================================== */
/* --- BOTÓN FLOTANTE (MANTENIDO Y REFORZADO) --- */
/* ====================================================== */
#chat-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 2000;
  padding: 0;
}

#chat-btn img {
  width: 170px;
  filter: brightness(1.1) drop-shadow(0px 8px 15px rgba(0,0,0,0.3));
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-12px) rotate(2deg); }
  100% { transform: translateY(0px) rotate(0deg); }
}

#chat-btn:hover img {
  transform: scale(1.1) translateY(-10px);
  filter: brightness(1.2) drop-shadow(0px 15px 20px rgba(30, 64, 175, 0.4));
}

/* ICONOS FLOTANTES SOBRE EL BOTÓN */
.hover-icons {
  position: absolute;
  top: -35px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}

#chat-btn:hover .hover-icons {
  opacity: 1;
  transform: translateX(-50%) translateY(-5px);
}

.hover-icons i {
  font-size: 22px;
  color: #ed1c24; /* Tu Rojo */
  background: white;
  padding: 8px;
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

/* ====================================================== */
/* --- POPUP DEL CHAT (MODERNIZADO 2026) --- */
/* ====================================================== */
#chat-popup {
  position: fixed;
  bottom: 120px; /* Ajustado para no solapar con el botón */
  right: 25px;
  width: 380px;
  max-width: 90%;
  height: 65vh;
  min-height: 450px;
  
  /* Efecto Glassmorphism */
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  
  /* Estética Moderna */
  border: 1px solid rgba(30, 64, 175, 0.2);
  border-radius: 24px; /* Bordes más redondeados */
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
  z-index: 1500;
  font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Marca de agua suavizada */
  background-image: url('vistas/imagenes/mascota.png');
  background-size: 40%;
  background-position: center 60%;
  background-repeat: no-repeat;
}

/* Header Moderno con Gradiente */
.chat-header {
  background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
  color: white;
  padding: 18px;
  text-align: left;
  padding-left: 25px;
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
}

/* Cuerpo de mensajes */
#chat-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: #1e40af transparent;
}

/* Burbujas de Mensaje Estilo 2026 */
.bot-message, .user-message {
  padding: 12px 16px;
  border-radius: 18px;
  max-width: 85%;
  font-size: 0.95rem;
  line-height: 1.4;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.bot-message {
  background: #1e40af; /* Tu Azul */
  color: white;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.user-message {
  background: #ffffff;
  color: #333;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  border: 1px solid #e5e7eb;
}

/* Footer (Input Area) */
.chat-footer {
  display: flex;
  background: white;
  padding: 15px;
  gap: 10px;
  border-top: 1px solid rgba(0,0,0,0.05);
}

#user-input {
  flex: 1;
  padding: 12px 18px;
  border-radius: 25px;
  border: 1px solid #e5e7eb;
  outline: none;
  font-size: 0.95rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#user-input:focus {
  border-color: #1e40af;
  box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

#send-btn {
  background: #1e40af;
  color: white;
  border: none;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

#send-btn:hover {
  background: #ed1c24; /* Cambio al rojo en hover */
  transform: scale(1.1);
}

/* Botón de Cerrar Flotante */
#close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(237, 28, 36, 0.9);
  color: white;
  border: none;
  font-size: 18px;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 20;
}

#close-btn:hover {
  background: #ed1c24;
  transform: rotate(90deg) scale(1.1);
}

/* ====================================================== */
/* --- RESPONSIVIDAD REFORZADA --- */
/* ====================================================== */

/* Tablets */
@media (max-width: 992px) {
  #chat-popup {
    width: 340px;
    bottom: 110px;
  }
}

/* Móviles */
@media (max-width: 576px) {
  #chat-popup {
    width: 95%;
    right: 2.5%;
    bottom: 100px;
    height: 70%;
    border-radius: 20px;
  }
  #chat-btn img {
    width: 75px;
  }
  .chat-header {
    padding: 15px;
  }
}

/* iPhone SE y pantallas muy pequeñas */
@media (max-width: 400px) {
  #chat-btn {
    bottom: 15px;
    right: 15px;
  }
  #chat-popup {
    bottom: 95px;
    height: 75%;
  }
}

/* Modo Horizontal */
@media (max-height: 450px) {
  #chat-popup {
    height: 85%;
    bottom: 10px;
    right: 90px;
  }
}