/**
 * Finanzas Decodificadas · Asistente Oficial Hipotecario
 * Estilos de Chatbot Flotante Accesible y Responsive
 */
:root {
  --fd-bot-primario: #047857;
  --fd-bot-secundario: #0a1222;
  --fd-bot-fondo: #ffffff;
  --fd-bot-gris: #f1f5f9;
  --fd-bot-borde: #e2e8f0;
  --fd-bot-texto: #0a1222;
  --fd-bot-texto-suave: #475569;
  --fd-bot-brillo: #10b981;
}

/* Botón Flotante */
.fd-chat-flotante {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: inherit;
}

.fd-chat-btn-abrir {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--fd-bot-primario);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(4, 120, 87, 0.35);
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}

.fd-chat-btn-abrir:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 14px 28px rgba(4, 120, 87, 0.45);
}

.fd-chat-btn-abrir svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

/* Ventana de Chat */
.fd-chat-ventana {
  position: fixed;
  bottom: 84px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 540px;
  max-height: calc(100vh - 120px);
  background: var(--fd-bot-fondo);
  border-radius: 20px;
  box-shadow: 0 20px 45px rgba(10, 18, 34, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--fd-bot-borde);
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.96);
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s;
}

.fd-chat-ventana.abierta {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Cabecera */
.fd-chat-header {
  background: var(--fd-bot-secundario);
  color: #fff;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 3px solid var(--fd-bot-brillo);
}

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

.fd-chat-avatar {
  width: 34px;
  height: 34px;
  background: var(--fd-bot-primario);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
}

.fd-chat-titulo {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
  line-height: 1.2;
}

.fd-chat-subtitulo {
  font-size: 11px;
  color: #94a3b8;
  margin: 0;
}

.fd-chat-btn-cerrar {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}

.fd-chat-btn-cerrar:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

/* Cuerpo de Mensajes */
.fd-chat-mensajes {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #fafcfa;
}

.fd-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.45;
  word-break: break-word;
}

.fd-msg-bot {
  align-self: flex-start;
  background: #ffffff;
  color: var(--fd-bot-texto);
  border: 1px solid var(--fd-bot-borde);
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.fd-msg-user {
  align-self: flex-end;
  background: var(--fd-bot-primario);
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* Chips Rápidos */
.fd-chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 0 8px;
}

.fd-chip {
  background: #e6f4ea;
  color: #047857;
  border: 1px solid #c2e7cc;
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
}

.fd-chip:hover {
  background: #047857;
  color: #ffffff;
  border-color: #047857;
}

/* Input y Envío */
.fd-chat-form {
  padding: 12px 14px;
  background: #ffffff;
  border-top: 1px solid var(--fd-bot-borde);
  display: flex;
  gap: 8px;
}

.fd-chat-input {
  flex: 1;
  border: 1px solid var(--fd-bot-borde);
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.fd-chat-input:focus {
  border-color: var(--fd-bot-primario);
}

.fd-chat-btn-enviar {
  background: var(--fd-bot-primario);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}

.fd-chat-btn-enviar:hover {
  background: #065f46;
  transform: scale(1.05);
}

.fd-chat-aviso-guardrail {
  font-size: 10.5px;
  color: #64748b;
  text-align: center;
  padding: 6px 10px 8px;
  background: #fff;
  border-top: 1px solid #f1f5f9;
}

.fd-chat-aviso-guardrail a {
  color: #047857;
  font-weight: 700;
  text-decoration: none;
}

.fd-chat-aviso-guardrail a:hover {
  text-decoration: underline;
}

.fd-chip-wa {
  display: inline-block;
  text-decoration: none;
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
  font-weight: 700;
}

.fd-chip-wa:hover {
  background: #25d366;
  color: #021a12;
  border-color: #25d366;
}

/* Botón Flotante Global de WhatsApp (Contacto Persistente en toda la web) */
.btn-wa-flotante {
  position: fixed;
  bottom: 24px;
  left: 24px;
  background: #25d366;
  color: #021a12;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 9999px;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  box-shadow: 0 8px 24px rgba(37, 211, 102, 0.4);
  z-index: 9998;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-wa-flotante:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 12px 28px rgba(37, 211, 102, 0.55);
  color: #021a12;
}

.btn-wa-flotante svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

@media (max-width: 480px) {
  .fd-chat-flotante {
    right: 12px;
    bottom: 16px;
  }
  .fd-chat-btn-abrir {
    padding: 10px 15px;
    font-size: 13.5px;
  }
  .btn-wa-flotante {
    left: 12px;
    bottom: 16px;
    padding: 10px 14px;
    font-size: 13.5px;
  }
  .fd-chat-ventana {
    right: 12px;
    bottom: 72px;
    width: calc(100vw - 24px);
    height: 75vh;
  }
}

@media print {
  .btn-wa-flotante,
  .fd-chat-flotante {
    display: none !important;
  }
}
