/* ══════════════════════════════════════════
   SOFTBYTE CHATBOX WIDGET
══════════════════════════════════════════ */

/* Botón flotante */
.sb-btn {
  position: fixed;
  bottom: 28px; /* encima del botón de WhatsApp */
  right: 28px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0f172a, #1e40af);
  box-shadow: 0 6px 24px rgba(30, 64, 175, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 9997;
  transition: transform .25s, box-shadow .25s;
  border: none;
  outline: none;
}
.sb-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 10px 30px rgba(30, 64, 175, 0.55);
}
.sb-btn svg { width: 26px; height: 26px; }

/* Ventana de chat */
.sb-popup {
  position: fixed;
  bottom: 90px;
  right: 28px;
  width: 340px;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 16px 56px rgba(0,0,0,0.18);
  z-index: 9996;
  overflow: hidden;
  transform: scale(.85) translateY(20px);
  transform-origin: bottom right;
  opacity: 0;
  pointer-events: none;
  transition: transform .3s cubic-bezier(.34,1.56,.64,1), opacity .25s ease;
  display: flex;
  flex-direction: column;
  max-height: 500px;
}
.sb-popup.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* Cabecera */
.sb-header {
  background: linear-gradient(135deg, #0f172a, #1e40af);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.sb-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.sb-header-info h3 {
  color: #fff;
  font-size: .9rem;
  font-weight: 600;
  margin: 0;
}
.sb-header-info span {
  color: rgba(255,255,255,.65);
  font-size: .75rem;
  display: flex; align-items: center; gap: 5px;
}
.sb-online-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #4ade80;
  display: inline-block;
  animation: sb-blink 1.6s ease-in-out infinite;
}
@keyframes sb-blink { 0%,100%{opacity:1} 50%{opacity:.3} }
.sb-close {
  margin-left: auto;
  background: transparent;
  border: none;
  color: rgba(255,255,255,.7);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 50%;
  transition: background .2s;
  line-height: 1;
}
.sb-close:hover { background: rgba(255,255,255,.15); color: #fff; }

/* Mensajes */
.sb-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f8fafc;
  scroll-behavior: smooth;
}
.sb-messages::-webkit-scrollbar { width: 4px; }
.sb-messages::-webkit-scrollbar-track { background: transparent; }
.sb-messages::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

/* Burbuja de mensaje */
.sb-msg {
  display: flex;
  flex-direction: column;
  max-width: 82%;
}
.sb-msg.bot  { align-self: flex-start; }
.sb-msg.user { align-self: flex-end; }

.sb-msg .bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: .85rem;
  line-height: 1.55;
  word-break: break-word;
}
.sb-msg.bot .bubble {
  background: #ffffff;
  color: #1e293b;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.sb-msg.user .bubble {
  background: linear-gradient(135deg, #1e40af, #3b82f6);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}
.sb-msg .time {
  font-size: .7rem;
  color: #94a3b8;
  margin-top: 3px;
  padding: 0 4px;
}
.sb-msg.user .time { text-align: right; }

/* Typing indicator */
.sb-typing .bubble {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
}
.sb-typing .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #94a3b8;
  animation: sb-bounce .9s ease-in-out infinite;
}
.sb-typing .dot:nth-child(2) { animation-delay: .15s; }
.sb-typing .dot:nth-child(3) { animation-delay: .3s; }
@keyframes sb-bounce {
  0%,60%,100% { transform: translateY(0); }
  30%          { transform: translateY(-6px); }
}

/* Input */
.sb-footer {
  background: #ffffff;
  padding: 12px 14px;
  display: flex;
  gap: 8px;
  align-items: center;
  border-top: 1px solid #e2e8f0;
  flex-shrink: 0;
}
.sb-input {
  flex: 1;
  border: 1.5px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 24px;
  padding: 9px 16px;
  font-size: .85rem;
  font-family: inherit;
  outline: none;
  color: #1e293b;
  transition: border-color .2s;
}
.sb-input:focus { border-color: #3b82f6; background: #fff; }
.sb-send {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e40af, #3b82f6);
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: transform .15s, opacity .2s;
}
.sb-send:hover { transform: scale(1.08); }
.sb-send:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.sb-send svg { width: 16px; height: 16px; fill: white; }
@media (max-width: 768px) {
  .sb-btn {
    bottom: 20px;
    right: 16px;
    width: 50px;
    height: 50px;
  }

  .sb-popup {
    bottom: 80px;
    right: 16px;
    left: 16px;
    width: auto;
    max-height: 70vh;  /* que no tape toda la pantalla */
  }
}
/* ══════════════════════════════════════════
   ESTILOS DE OPCIONES Y FORMULARIO (LEADS)
══════════════════════════════════════════ */

.sb-options-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  width: 100%;
}

.sb-option-btn {
  background: white;
  border: 1px solid #e2e8f0;
  color: #1e293b;
  padding: 12px 16px;
  border-radius: 8px;
  text-align: left;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.sb-option-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.sb-lead-form {
  background: white;
  border: 1px solid #e2e8f0;
  padding: 15px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 85%;
  margin-top: 5px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.sb-lead-form input {
  padding: 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  outline: none;
}

.sb-lead-form input:focus {
  border-color: #3b82f6;
}

.sb-submit-btn {
  background: #2563eb; /* Azul corporativo */
  color: white;
  border: none;
  padding: 12px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.sb-submit-btn:hover {
  background: #1d4ed8;
}

.sb-submit-btn:disabled {
  background: #94a3b8;
  cursor: not-allowed;
}