/*
 * Custom styles for the application.
 * Site-specific visual customizations (sin posicionamiento).
 */

/* --- WhatsApp widget (contenedor relativo dentro del wrapper) --- */
.whatsapp-chat-widget {
  position: relative; /* el wrapper fija la esquina */
  bottom: auto;
  right: auto;
  z-index: 1;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* --- Botón flotante de WhatsApp (visual) --- */
.whatsapp-float-button {
  background: linear-gradient(135deg, #25d366, #128c7e);
  color: #FFF;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;

  /* NO definimos width/height aquí: vienen desde floating-buttons.css */
  box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  text-decoration: none;
  border: none;
  outline: none;
}

.whatsapp-float-button:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 25px rgba(37, 211, 102, 0.6);
  color: #FFF;
  text-decoration: none;
}

.whatsapp-float-button.chat-open {
  background: #dc3545;
}

.whatsapp-float-button.chat-open:hover {
  background: #c82333;
  box-shadow: 0 6px 25px rgba(220, 53, 69, 0.6);
}

/* Iconos: tamaño proporcional a las variables de tamaño */
.whatsapp-float-button i {
  font-size: calc(var(--wa-size, 68px) * 0.62); /* un poco más grande */
  line-height: 1;
  transition: transform 0.3s ease;
}

.whatsapp-float-button.chat-open i {
  transform: rotate(45deg);
}

/* --- Ventana del chat: absoluta respecto al widget --- */
.whatsapp-chat-box {
  position: absolute;
  bottom: calc(var(--wa-size, 68px) + 12px); /* se abre justo encima del botón */
  right: 0;
  width: 350px;
  max-height: 500px;
  background: #fff;
  border-radius: 15px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  transform: translateY(20px) scale(0.9);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  overflow: hidden;
}

.whatsapp-chat-box.active {
  transform: translateY(0) scale(1);
  opacity: 1;
  visibility: visible;
}

/* Header */
.whatsapp-chat-header {
  background: linear-gradient(135deg, #25d366, #128c7e);
  color: white;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
}

.whatsapp-avatar {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.whatsapp-chat-info h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.whatsapp-chat-info p {
  margin: 5px 0 0 0;
  font-size: 12px;
  opacity: 0.9;
}

.whatsapp-online-status {
  display: flex;
  align-items: center;
  gap: 5px;
}

.whatsapp-online-dot {
  width: 8px;
  height: 8px;
  background: #4CAF50;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.5; }
  100% { opacity: 1; }
}

/* Body */
.whatsapp-chat-body {
  padding: 20px;
  max-height: 300px;
  overflow-y: auto;
}

.whatsapp-message {
  background: #f8f9fa;
  padding: 12px 15px;
  border-radius: 15px;
  margin-bottom: 15px;
  position: relative;
  animation: fadeInUp 0.5s ease;
}

.whatsapp-message::before {
  content: '';
  position: absolute;
  top: 10px;
  left: -8px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 8px 10px 0;
  border-color: transparent #f8f9fa transparent transparent;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Input */
.whatsapp-chat-input {
  padding: 20px;
  border-top: 1px solid #eee;
}

.whatsapp-input-wrapper {
  display: flex;
  gap: 10px;
}

.whatsapp-chat-input textarea {
  flex: 1;
  border: 2px solid #e9ecef;
  border-radius: 20px;
  padding: 12px 15px;
  resize: none;
  outline: none;
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.3s ease;
  min-height: 40px;
  max-height: 100px;
}

.whatsapp-chat-input textarea:focus {
  border-color: #25d366;
}

.whatsapp-send-button {
  width: 40px;
  height: 40px;
  background: #25d366;
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  font-size: 16px;
}

.whatsapp-send-button:hover {
  background: #128c7e;
  transform: scale(1.05);
}

/* Quick messages */
.whatsapp-quick-messages {
  padding: 0 20px 20px;
}

.whatsapp-quick-message {
  display: block;
  width: 100%;
  background: transparent;
  border: 1px solid #e9ecef;
  border-radius: 20px;
  padding: 10px 15px;
  margin-bottom: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: left;
}

.whatsapp-quick-message:hover {
  background: #f8f9fa;
  border-color: #25d366;
  color: #25d366;
}

/* Detalles visuales del scrollbar del chat */
.whatsapp-chat-body::-webkit-scrollbar { width: 4px; }
.whatsapp-chat-body::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 10px; }
.whatsapp-chat-body::-webkit-scrollbar-thumb { background: #25d366; border-radius: 10px; }

/* Responsive visual (no posicionamiento) */
@media (max-width: 768px) {
  .whatsapp-float-button { /* icono sigue proporcional por var --wa-size */ }
  .whatsapp-chat-box {
    width: calc(100vw - 40px);
    max-width: 320px;
    right: 0;
  }
  .whatsapp-chat-header { padding: 15px; }
  .whatsapp-avatar { width: 40px; height: 40px; font-size: 18px; }
  .whatsapp-chat-info h4 { font-size: 14px; }
}

@media (max-width: 480px) {
  .whatsapp-chat-box { width: calc(100vw - 30px); }
}
