/* ── HelpBot — estilos del asistente virtual ── */
:root {
  --hb-rojo: #C8102E;
  --hb-rojo-d: #A00D24;
  --hb-dark: #1A1A1A;
  --hb-muted: #6B7280;
  --hb-bg: #F9FAFB;
  --hb-white: #FFFFFF;
  --hb-border: #E5E7EB;
  --hb-shadow: 0 20px 60px rgba(0,0,0,0.18);
  --hb-radius: 16px;
  --hb-z: 9000;
}

/* ── Botón flotante ── */
#hb-trigger {
  position: fixed;
  bottom: 96px;
  right: 20px;
  z-index: var(--hb-z);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
}

#hb-trigger-btn {
  width: 56px;
  height: 56px;
  background: var(--hb-rojo);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(200,16,46,0.45);
  transition: transform 0.2s, background 0.2s;
  position: relative;
}

#hb-trigger:hover #hb-trigger-btn {
  background: var(--hb-rojo-d);
  transform: scale(1.08);
}

#hb-trigger-btn svg {
  width: 26px;
  height: 26px;
  color: #fff;
  fill: currentColor;
}

#hb-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  background: #F59E0B;
  border-radius: 50%;
  border: 2px solid #fff;
  animation: hb-pulse 2s infinite;
}

@keyframes hb-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.8; }
}

#hb-trigger-label {
  background: var(--hb-dark);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s;
  font-family: 'Inter', sans-serif;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

#hb-trigger:hover #hb-trigger-label {
  opacity: 1;
}

/* ── Ventana del chat ── */
#hb-window {
  position: fixed;
  bottom: 160px;
  right: 20px;
  width: 370px;
  max-width: calc(100vw - 24px);
  height: 560px;
  max-height: calc(100vh - 180px);
  background: var(--hb-white);
  border-radius: var(--hb-radius);
  box-shadow: var(--hb-shadow);
  display: flex;
  flex-direction: column;
  z-index: var(--hb-z);
  overflow: hidden;
  transform-origin: bottom right;
  transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1), opacity 0.2s;
}

#hb-window.hb-hidden {
  transform: scale(0.85) translateY(20px);
  opacity: 0;
  pointer-events: none;
}

/* ── Header del chat ── */
#hb-header {
  background: var(--hb-rojo);
  color: #fff;
  padding: 14px 16px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

#hb-avatar {
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 20px;
}

#hb-header-info {
  flex: 1;
  min-width: 0;
}

#hb-header-name {
  font-size: 14px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  line-height: 1.2;
}

#hb-header-status {
  font-size: 11px;
  opacity: 0.85;
  font-family: 'Inter', sans-serif;
  margin-top: 1px;
}

#hb-close {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 4px;
  opacity: 0.8;
  transition: opacity 0.15s;
  flex-shrink: 0;
  line-height: 1;
}

#hb-close:hover { opacity: 1; }

/* ── Barra de acción rápida (llamar / horario) ── */
#hb-action-bar {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: #FEF2F2;
  border-bottom: 1px solid #FECACA;
  flex-shrink: 0;
}

#hb-action-bar.hb-closed-hours {
  background: #F0F9FF;
  border-bottom-color: #BAE6FD;
}

.hb-action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: filter 0.15s, transform 0.1s;
  line-height: 1.2;
  text-align: center;
}

.hb-action-btn:hover {
  filter: brightness(0.92);
  transform: translateY(-1px);
}

.hb-btn-call {
  background: var(--hb-rojo);
  color: #fff;
}

.hb-btn-hours {
  background: #E5E7EB;
  color: var(--hb-dark);
  font-size: 11px;
  font-weight: 500;
}

.hb-btn-whatsapp {
  background: #25D366;
  color: #fff;
}

.hb-action-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* ── Zona de mensajes ── */
#hb-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--hb-bg);
  scroll-behavior: smooth;
}

#hb-messages::-webkit-scrollbar { width: 4px; }
#hb-messages::-webkit-scrollbar-track { background: transparent; }
#hb-messages::-webkit-scrollbar-thumb { background: #D1D5DB; border-radius: 4px; }

/* Burbujas */
.hb-msg {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  max-width: 90%;
}

.hb-msg.hb-bot { align-self: flex-start; }
.hb-msg.hb-user { align-self: flex-end; flex-direction: row-reverse; }

.hb-msg-avatar {
  width: 28px;
  height: 28px;
  background: var(--hb-rojo);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

.hb-msg-bubble {
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
  font-family: 'Inter', sans-serif;
  max-width: 280px;
}

.hb-bot .hb-msg-bubble {
  background: var(--hb-white);
  color: var(--hb-dark);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.hb-user .hb-msg-bubble {
  background: var(--hb-rojo);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.hb-msg-bubble a {
  color: var(--hb-rojo);
  font-weight: 600;
  text-decoration: underline;
}

.hb-bot .hb-msg-bubble a { color: var(--hb-rojo); }
.hb-user .hb-msg-bubble a { color: #fff; }

/* Indicador de escritura */
.hb-typing-dots {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 12px 16px;
}

.hb-typing-dots span {
  width: 7px;
  height: 7px;
  background: #9CA3AF;
  border-radius: 50%;
  animation: hb-dot 1.2s infinite;
}

.hb-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.hb-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes hb-dot {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-5px); }
}

/* Quick replies */
.hb-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
  padding-left: 36px;
}

.hb-qr {
  background: var(--hb-white);
  border: 1.5px solid var(--hb-rojo);
  color: var(--hb-rojo);
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  line-height: 1;
}

.hb-qr:hover {
  background: var(--hb-rojo);
  color: #fff;
}

/* ── Área de entrada ── */
#hb-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--hb-border);
  background: var(--hb-white);
  flex-shrink: 0;
}

#hb-input {
  flex: 1;
  border: 1.5px solid var(--hb-border);
  border-radius: 22px;
  padding: 9px 14px;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  outline: none;
  color: var(--hb-dark);
  background: var(--hb-bg);
  transition: border-color 0.15s;
  resize: none;
  height: 38px;
  line-height: 1.4;
}

#hb-input:focus { border-color: var(--hb-rojo); background: #fff; }
#hb-input::placeholder { color: #9CA3AF; }

#hb-send {
  width: 38px;
  height: 38px;
  background: var(--hb-rojo);
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}

#hb-send:hover { background: var(--hb-rojo-d); transform: scale(1.05); }
#hb-send svg { width: 16px; height: 16px; color: #fff; fill: currentColor; }

/* ── Launcher (pantalla de inicio con 3 opciones) ── */
#hb-launcher {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 14px 12px;
  gap: 8px;
  background: var(--hb-bg);
  overflow-y: auto;
}

#hb-launcher-heading {
  font-size: 12px;
  font-weight: 600;
  color: var(--hb-muted);
  font-family: 'Inter', sans-serif;
  margin: 0 0 4px 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.hb-launcher-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 12px;
  background: var(--hb-white);
  border: 1.5px solid var(--hb-border);
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  width: 100%;
  font-family: 'Inter', sans-serif;
}

.hb-launcher-opt:hover {
  border-color: var(--hb-rojo);
  box-shadow: 0 2px 10px rgba(200,16,46,0.12);
  transform: translateY(-1px);
}

.hbl-icon {
  font-size: 22px;
  flex-shrink: 0;
  width: 32px;
  text-align: center;
}

.hbl-txt {
  flex: 1;
  min-width: 0;
}

.hbl-txt strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--hb-dark);
  margin-bottom: 2px;
  line-height: 1.3;
}

.hbl-txt span {
  font-size: 11px;
  color: var(--hb-muted);
  line-height: 1.3;
}

.hbl-arrow {
  width: 16px;
  height: 16px;
  color: var(--hb-muted);
  flex-shrink: 0;
}

/* ── Mobile ── */
@media (max-width: 480px) {
  #hb-window {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
  }

  #hb-trigger {
    bottom: 84px;
    right: 16px;
  }
}
