/* ═══════════════════════════════════════════════════════════
   HOSTIBERI — Chatbot & Sistema de Citas
   ═══════════════════════════════════════════════════════════ */

/* Botón flotante launcher */
#hb-chatbot-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 990;
  display: flex;
  align-items: center;
  gap: 10px;
}

#hb-chatbot-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--sea) 0%, var(--sea-dk) 100%);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(13, 77, 92, 0.35);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
  position: relative;
}

#hb-chatbot-btn:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 12px 30px rgba(13, 77, 92, 0.45);
}

#hb-chatbot-btn svg {
  width: 28px;
  height: 28px;
  fill: currentColor;
  transition: transform 0.25s ease, opacity 0.2s ease;
}

#hb-chatbot-btn .icon-close {
  display: none;
}

#hb-chatbot-launcher.active #hb-chatbot-btn .icon-chat {
  display: none;
}

#hb-chatbot-launcher.active #hb-chatbot-btn .icon-close {
  display: block;
}

/* Indicador de estado en línea (pulsante) */
.hb-online-dot {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #22c55e;
  border: 2.5px solid #fff;
  box-shadow: 0 0 0 rgba(34, 197, 94, 0.5);
  animation: hbPulse 2s infinite;
}

@keyframes hbPulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6); }
  70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* Burbuja teaser / tooltip */
#hb-chatbot-teaser {
  background: #fff;
  color: var(--text);
  padding: 10px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 6px 20px rgba(13, 77, 92, 0.15);
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  white-space: nowrap;
  animation: hbFadeIn 0.4s ease;
  transition: opacity 0.2s ease, transform 0.2s ease;
  border: 1px solid rgba(26, 122, 140, 0.15);
}

[data-variant="b"] #hb-chatbot-teaser {
  background: #0d233a;
  color: #fff;
  border-color: rgba(76, 191, 160, 0.25);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

#hb-chatbot-teaser:hover {
  transform: translateY(-2px);
}

#hb-chatbot-teaser .close-teaser {
  background: none;
  border: none;
  color: var(--lite);
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
  cursor: pointer;
}

/* Ventana de Chat */
#hb-chatbot-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 420px;
  max-width: calc(100vw - 24px);
  height: 600px;
  max-height: calc(100vh - 120px);
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 16px 48px rgba(13, 77, 92, 0.25);
  border: 1px solid rgba(26, 122, 140, 0.12);
  display: flex;
  flex-direction: column;
  z-index: 991;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px) scale(0.95);
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-variant="b"] #hb-chatbot-window {
  background: #081728;
  border-color: rgba(76, 191, 160, 0.2);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
}

#hb-chatbot-window.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* Cabecera del Chat */
.hb-chat-header {
  background: linear-gradient(135deg, var(--sea-dk) 0%, var(--sea) 100%);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.hb-chat-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hb-chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  font-size: 18px;
}

.hb-chat-avatar .hb-avatar-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid #0d4d5c;
}

.hb-chat-info h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.hb-chat-info p {
  margin: 2px 0 0;
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  gap: 4px;
}

.hb-chat-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.hb-action-btn {
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

.hb-action-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}

/* Área de mensajes */
.hb-chat-body {
  flex: 1;
  padding: 14px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg);
  scroll-behavior: smooth;
}

[data-variant="b"] .hb-chat-body {
  background: #06121f;
}

/* Burbujas de chat */
.hb-msg {
  display: flex;
  width: 100%;
  animation: hbFadeIn 0.3s ease;
}

.hb-msg.bot {
  align-self: flex-start;
  width: 100%;
  max-width: 100%;
}

.hb-msg.user {
  align-self: flex-end;
  width: auto;
  max-width: 85%;
  margin-left: auto;
}

.hb-msg-avatar {
  display: none !important;
}

.hb-msg-content {
  background: #fff;
  color: var(--text);
  padding: 13px 15px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  box-shadow: 0 2px 8px rgba(13, 77, 92, 0.06);
  border: 1px solid rgba(26, 122, 140, 0.08);
  width: 100%;
  box-sizing: border-box;
}

[data-variant="b"] .hb-msg-content {
  background: #0d233a;
  color: #e2e8f0;
  border-color: rgba(76, 191, 160, 0.15);
}

.hb-msg.user .hb-msg-content {
  background: var(--sea);
  color: #fff;
  border-radius: 14px;
  border-top-right-radius: 4px;
  border-color: transparent;
  width: auto;
}

/* Botones de opciones interactivas */
.hb-options-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  width: 100%;
}

.hb-opt-btn {
  background: #fff;
  color: var(--text);
  border: 1.5px solid rgba(26, 122, 140, 0.2);
  border-radius: 12px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s ease;
}

[data-variant="b"] .hb-opt-btn {
  background: #0d233a;
  color: #fff;
  border-color: rgba(76, 191, 160, 0.25);
}

.hb-opt-btn:hover {
  background: var(--sea);
  color: #fff;
  border-color: var(--sea);
  transform: translateX(3px);
}

.hb-opt-btn .opt-icon {
  font-size: 18px;
  flex-shrink: 0;
}

/* Botones específicos de gravedad */
.hb-opt-btn.gravedad-alta {
  border-color: rgba(220, 38, 38, 0.3);
}
.hb-opt-btn.gravedad-alta:hover {
  background: #dc2626;
  border-color: #dc2626;
}

.hb-opt-btn.gravedad-media {
  border-color: rgba(217, 119, 6, 0.3);
}
.hb-opt-btn.gravedad-media:hover {
  background: #d97706;
  border-color: #d97706;
}

.hb-opt-btn.gravedad-baja {
  border-color: rgba(16, 185, 129, 0.3);
}
.hb-opt-btn.gravedad-baja:hover {
  background: #10b981;
  border-color: #10b981;
}

/* Tarjeta interactiva de formulario */
.hb-form-card {
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  margin-top: 10px;
  border: 1px solid rgba(26, 122, 140, 0.15);
  box-shadow: 0 4px 14px rgba(13, 77, 92, 0.08);
}

[data-variant="b"] .hb-form-card {
  background: #0d233a;
  border-color: rgba(76, 191, 160, 0.2);
}

.hb-field {
  margin-bottom: 11px;
}

.hb-field:last-child {
  margin-bottom: 0;
}

.hb-field label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--mid);
  margin-bottom: 4px;
}

[data-variant="b"] .hb-field label {
  color: var(--turq-l);
}

.hb-field input,
.hb-field select,
.hb-field textarea {
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid #d1e2e7;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  background: #fdfefe;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

[data-variant="b"] .hb-field input,
[data-variant="b"] .hb-field select,
[data-variant="b"] .hb-field textarea {
  background: #081728;
  border-color: rgba(76, 191, 160, 0.25);
  color: #fff;
}

.hb-field input:focus,
.hb-field select:focus,
.hb-field textarea:focus {
  border-color: var(--sea);
  box-shadow: 0 0 0 3px rgba(26, 122, 140, 0.15);
}

.hb-field textarea {
  resize: vertical;
  min-height: 55px;
}

/* Selector de slots de hora */
.hb-slots-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 8px;
  max-height: 140px;
  overflow-y: auto;
  padding-right: 4px;
}

.hb-slot-btn {
  background: #f2fafc;
  color: var(--sea-dk);
  border: 1px solid rgba(26, 122, 140, 0.2);
  border-radius: 8px;
  padding: 7px 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}

[data-variant="b"] .hb-slot-btn {
  background: #081728;
  color: var(--turq-l);
  border-color: rgba(76, 191, 160, 0.25);
}

.hb-slot-btn:hover {
  background: var(--sea);
  color: #fff;
  border-color: var(--sea);
}

.hb-slot-btn.selected {
  background: var(--sea);
  color: #fff;
  border-color: var(--sea);
  box-shadow: 0 2px 8px rgba(26, 122, 140, 0.35);
}

/* Botón principal de acción en formulario */
.hb-submit-btn {
  width: 100%;
  padding: 11px;
  border-radius: 50px;
  border: none;
  background: var(--sea);
  color: #fff;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  transition: background 0.2s ease, transform 0.15s ease;
}

.hb-submit-btn:hover {
  background: var(--sea-dk);
  transform: translateY(-1px);
}

.hb-submit-btn.btn-whatsapp {
  background: #25d366;
}
.hb-submit-btn.btn-whatsapp:hover {
  background: #1eb857;
}

/* Footer / Entrada de texto */
.hb-chat-footer {
  padding: 12px 16px;
  background: #fff;
  border-top: 1px solid rgba(26, 122, 140, 0.1);
  display: flex;
  align-items: center;
  gap: 8px;
}

[data-variant="b"] .hb-chat-footer {
  background: #081728;
  border-top-color: rgba(76, 191, 160, 0.15);
}

.hb-chat-footer input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 50px;
  border: 1px solid #d1e2e7;
  font-family: inherit;
  font-size: 13px;
  outline: none;
  background: #f8fafc;
  color: var(--text);
  transition: border-color 0.2s ease;
}

[data-variant="b"] .hb-chat-footer input {
  background: #0d233a;
  border-color: rgba(76, 191, 160, 0.2);
  color: #fff;
}

.hb-chat-footer input:focus {
  border-color: var(--sea);
}

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

.hb-send-btn:hover {
  background: var(--sea-dk);
  transform: scale(1.05);
}

.hb-send-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* Botones de Calendarios */
.hb-calendar-links {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 8px;
  width: 100%;
}

.hb-cal-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  background: #fdfefe;
  border: 1px solid rgba(26, 122, 140, 0.18);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  box-sizing: border-box;
  transition: all 0.2s ease;
}

[data-variant="b"] .hb-cal-link {
  background: #0d233a;
  border-color: rgba(76, 191, 160, 0.25);
  color: #fff;
}

.hb-cal-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(13, 77, 92, 0.1);
}

.hb-cal-link.cal-google:hover {
  border-color: #4285F4;
  color: #1a73e8;
  background: #f8fbff;
}

.hb-cal-link.cal-apple:hover {
  border-color: #000;
  color: #000;
  background: #f5f5f7;
}

[data-variant="b"] .hb-cal-link.cal-apple:hover {
  border-color: #fff;
  color: #fff;
  background: #132d4a;
}

.hb-cal-link.cal-outlook:hover {
  border-color: #0078D4;
  color: #0078D4;
  background: #f0f7ff;
}

.hb-cal-link svg {
  flex-shrink: 0;
}

/* Animaciones */
@keyframes hbFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive móvil */
@media (max-width: 480px) {
  #hb-chatbot-window {
    right: 12px;
    left: 12px;
    bottom: 84px;
    width: auto;
    max-width: none;
    height: calc(100vh - 100px);
    border-radius: 16px;
  }

  #hb-chatbot-launcher {
    right: 16px;
    bottom: 16px;
  }

  #hb-chatbot-btn {
    width: 54px;
    height: 54px;
  }

  #hb-chatbot-teaser {
    display: none;
  }
}
