/* ── Variables ITA ── */
:root {
  --bf-chat-bg: #0E0E0E;
  --bf-chat-surface: #151515;
  --bf-chat-border: rgba(255,255,255,0.08);

  --bf-chat-purple: #D93B2B; /* ahora es brand */
  --bf-chat-purple-glow: rgba(217,59,43,0.35);

  --bf-chat-gold: #D93B2B;

  --bf-chat-text: #ffffff;
  --bf-chat-text-muted: rgba(255,255,255,0.5);

  --bf-chat-bubble-user: linear-gradient(135deg, #D93B2B, #BF2F20);
  --bf-chat-bubble-bot: #1A1A1A;

  --bf-chat-radius: 18px;
  --bf-chat-panel-w: 360px;
}

/* ── FAB ── */
.bf-chat-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, #D93B2B, #BF2F20);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 10px 30px rgba(217,59,43,0.4);
  transition: all .2s ease;
}

.bf-chat-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 16px 40px rgba(217,59,43,0.6);
}

/* pulso elegante */
.bf-chat-fab__pulse {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1px solid rgba(217,59,43,.4);
  animation: bf-pulse 2.5s ease-out infinite;
}

@keyframes bf-pulse {
  0% { transform: scale(1); opacity: .7; }
  70% { transform: scale(1.4); opacity: 0; }
  100% { opacity: 0; }
}

/* ── Panel ── */
.bf-chat-panel {
  position: fixed;
  bottom: 88px;
  right: 28px;
  width: var(--bf-chat-panel-w);
  max-height: min(520px, calc(100dvh - 120px));
  background: var(--bf-chat-bg);
  border: 1px solid var(--bf-chat-border);
  border-radius: var(--bf-chat-radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 80px rgba(0,0,0,.7);
  animation: bf-panel-in 0.28s cubic-bezier(0.34,1.56,0.64,1);
}

/* ── Header ── */
.bf-chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: linear-gradient(120deg, #0E0E0E, #1a1a1a);
  border-bottom: 1px solid var(--bf-chat-border);
}

.bf-chat-header__avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: #D93B2B;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  box-shadow: 0 0 12px rgba(217,59,43,0.4);
}

.bf-chat-header__name {
  font-size: 14px;
  font-weight: 700;
  color: var(--bf-chat-text);
}

.bf-chat-header__status {
  font-size: 11px;
  color: var(--bf-chat-text-muted);
}

.bf-chat-header__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
}

/* ── MENSAJES ── */
.bf-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* burbujas */
.bf-msg {
  max-width: 82%;
}

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

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

.bf-msg__bubble {
  padding: 11px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
}

/* user */
.bf-msg--user .bf-msg__bubble {
  background: var(--bf-chat-bubble-user);
  color: white;
}

/* bot */
.bf-msg--bot .bf-msg__bubble {
  background: var(--bf-chat-bubble-bot);
  border: 1px solid var(--bf-chat-border);
  color: white;
}

/* ── INPUT ── */
.bf-chat-input-area {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--bf-chat-border);
  background: var(--bf-chat-surface);
}

.bf-chat-input {
  flex: 1;
  border-radius: 12px;
  border: 1px solid var(--bf-chat-border);
  background: #1a1a1a;
  padding: 10px 14px;
  color: white;
  font-size: 14px;
  outline: none;
}

.bf-chat-input::placeholder {
  color: var(--bf-chat-text-muted);
}

.bf-chat-input:focus {
  border-color: #D93B2B;
}

/* botón enviar */
.bf-chat-send {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #D93B2B;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
  transition: .2s;
}

.bf-chat-send:hover {
  background: #BF2F20;
  transform: scale(1.05);
}

/* ── FOOTER ── */
.bf-chat-footer {
  text-align: center;
  font-size: 10px;
  color: var(--bf-chat-text-muted);
  padding: 6px;
}

.bf-chat-footer strong {
  color: #D93B2B;
}

/* ── Responsive ── */
@media (max-width: 420px) {
  .bf-chat-panel {
    left: 8px;
    right: 8px;
    bottom: 80px;
  }

  .bf-chat-input {
    font-size: 16px;
  }
}

/* Fix de visibilidad global */
.bf-chat-fab {
  z-index: 99999;
}

.bf-chat-panel {
  z-index: 99999;
  height: auto;
}

/* Asegura que hidden funcione siempre */
.bf-chat-panel[hidden] {
  display: none !important;
}