/* ========================================================
   WIDGET ASISTENTE VIRTUAL IA - TRANSPORTES FOX ANTOFAGASTA
   ======================================================== */

/* Botón flotante */
#fox-chat-trigger {
  position: fixed;
  bottom: 25px;
  right: 25px;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00468C 0%, #002c5c 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(0, 70, 140, 0.4);
  z-index: 99998;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  border: 2px solid rgba(255, 255, 255, 0.2);
}

#fox-chat-trigger:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 14px 30px rgba(0, 70, 140, 0.55);
}

/* Badge de notificación en el trigger */
.fox-chat-pulse {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  background-color: #25d366;
  border-radius: 50%;
  border: 2px solid #ffffff;
}

/* Tooltip emergente que invita a chatear (a la izquierda del botón flotante) */
#fox-chat-badge {
  position: fixed;
  bottom: 35px;
  right: 98px;
  background: #ffffff;
  color: #333333;
  padding: 8px 14px;
  border-radius: 18px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  z-index: 99997;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  animation: foxBounce 3s infinite;
  border-left: 3px solid #00468C;
}

@keyframes foxBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* Contenedor principal de la ventana */
#fox-chat-widget {
  position: fixed;
  bottom: 25px;
  right: 25px;
  width: 380px;
  max-width: calc(100vw - 30px);
  height: 560px;
  max-height: calc(100vh - 40px);
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Raleway', 'Segoe UI', Tahoma, sans-serif;
  transform: scale(0.85) translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

#fox-chat-widget.active {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* Cabecera del chat */
.fox-chat-header {
  background: linear-gradient(135deg, #00468C 0%, #002d5c 100%);
  color: #ffffff;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.fox-chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.fox-chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #00468C;
  font-size: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.fox-chat-title h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
}

.fox-chat-status {
  font-size: 12px;
  color: #e0ecfb;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}

.fox-status-dot {
  width: 8px;
  height: 8px;
  background-color: #25d366;
  border-radius: 50%;
  display: inline-block;
}

.fox-chat-close-btn {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 18px;
  cursor: pointer;
  padding: 6px;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.fox-chat-close-btn:hover {
  opacity: 1;
}

/* Área de mensajes */
.fox-chat-body {
  flex: 1;
  padding: 18px;
  overflow-y: auto;
  background: #f7f9fb;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.fox-chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  animation: foxFadeIn 0.25s ease;
}

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

.fox-chat-msg.bot {
  align-self: flex-start;
}

.fox-chat-msg.user {
  align-self: flex-end;
}

.fox-msg-bubble {
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  word-break: break-word;
}

.fox-chat-msg.bot .fox-msg-bubble {
  background: #ffffff;
  color: #2a2a2a;
  border-bottom-left-radius: 3px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  border: 1px solid #ebeff3;
}

.fox-chat-msg.user .fox-msg-bubble {
  background: #00468C;
  color: #ffffff;
  border-bottom-right-radius: 3px;
}

.fox-msg-time {
  font-size: 10px;
  color: #999999;
  margin-top: 4px;
}

.fox-chat-msg.user .fox-msg-time {
  text-align: right;
}

/* Sugerencias rápidas (chips) */
.fox-chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.fox-chip {
  background: #eef4fb;
  border: 1px solid #c8dcf2;
  color: #00468C;
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.fox-chip:hover {
  background: #00468C;
  color: #ffffff;
  border-color: #00468C;
}

/* Botón interactivo de WhatsApp dentro del mensaje */
.fox-btn-whatsapp-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: #25d366;
  color: #ffffff !important;
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
  padding: 9px 14px;
  border-radius: 8px;
  margin-top: 10px;
  transition: background-color 0.2s ease;
}

.fox-btn-whatsapp-action:hover {
  background-color: #1eb956;
}

/* Indicador de escribiendo */
.fox-typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: #ffffff;
  border-radius: 14px;
  width: fit-content;
  border: 1px solid #ebeff3;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.fox-typing-dot {
  width: 7px;
  height: 7px;
  background-color: #00468C;
  border-radius: 50%;
  animation: foxDotPulse 1.4s infinite ease-in-out both;
}

.fox-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.fox-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes foxDotPulse {
  0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Pie y formulario de input */
.fox-chat-footer {
  padding: 12px 14px;
  background: #ffffff;
  border-top: 1px solid #eceff1;
  display: flex;
  gap: 8px;
  align-items: center;
}

.fox-chat-input {
  flex: 1;
  border: 1px solid #dcdfe3;
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.2s;
  background: #fafbfc;
}

.fox-chat-input:focus {
  border-color: #00468C;
  background: #ffffff;
}

.fox-chat-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #00468C;
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: background-color 0.2s, transform 0.1s;
}

.fox-chat-send-btn:hover {
  background-color: #003366;
  transform: scale(1.05);
}

.fox-chat-send-btn:disabled {
  background-color: #cccccc;
  cursor: not-allowed;
  transform: none;
}

/* Adaptación Responsive para Móviles */
@media (max-width: 500px) {
  #fox-chat-widget {
    bottom: 0;
    right: 0;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
  }
  #fox-chat-trigger {
    bottom: 18px;
    right: 18px;
    width: 56px;
    height: 56px;
    font-size: 22px;
  }
  #fox-chat-badge {
    bottom: 24px;
    right: 84px;
    padding: 6px 10px;
    font-size: 12px;
  }
}
