/* === HOMOLOGA.PRO CHATBOT WIDGET V2 === */

/* Pulse ring animation around bubble */
.hp-chatbot-bubble {
  position: fixed !important;
  right: 20px !important;
  bottom: 20px !important;
  width: 64px !important;
  height: 64px !important;
  border-radius: 50% !important;
  background: #FFC400 !important;
  color: #0B2F3A !important;
  border: none !important;
  cursor: pointer !important;
  box-shadow: 0 8px 24px rgba(0,0,0,.25) !important;
  z-index: 2147483646 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 0 !important;
  -webkit-tap-highlight-color: transparent !important;
  animation: hpPulse 2s infinite;
}
.hp-chatbot-bubble::before {
  content: "";
  position: absolute;
  top: -4px; left: -4px; right: -4px; bottom: -4px;
  border-radius: 50%;
  border: 3px solid #FFC400;
  opacity: .6;
  animation: hpRing 1.8s ease-out infinite;
  pointer-events: none;
}
@keyframes hpPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}
@keyframes hpRing {
  0% { transform: scale(1); opacity: .7; }
  100% { transform: scale(1.6); opacity: 0; }
}
.hp-chatbot-bubble:hover {
  transform: scale(1.1) !important;
  animation: none;
}
.hp-chatbot-bubble svg {
  width: 30px !important;
  height: 30px !important;
  fill: #0B2F3A !important;
  position: relative;
  z-index: 1;
}
.hp-chatbot-bubble.hp-hidden { display: none !important; }
.hp-chatbot-badge {
  position: absolute !important;
  top: -4px; right: -4px;
  background: #e53935 !important;
  color: #fff !important;
  border-radius: 50% !important;
  width: 22px; height: 22px;
  font-size: 12px !important;
  font-weight: 700 !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff !important;
  z-index: 2;
}

/* "Estamos online" teaser tooltip */
.hp-chatbot-teaser {
  position: fixed;
  right: 96px;
  bottom: 28px;
  background: #fff;
  color: #0B2F3A !important;
  padding: 10px 14px;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  font-size: 14px !important;
  font-weight: 600 !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  z-index: 2147483645;
  cursor: pointer;
  display: none;
  white-space: nowrap;
  animation: hpTeaserIn .4s ease;
  max-width: 240px;
}
.hp-chatbot-teaser::after {
  content: "";
  position: absolute;
  right: -8px;
  top: 50%;
  transform: translateY(-50%);
  border-style: solid;
  border-width: 8px 0 8px 8px;
  border-color: transparent transparent transparent #fff;
}
.hp-chatbot-teaser-close {
  position: absolute;
  top: -6px; right: -6px;
  background: #0B2F3A;
  color: #fff !important;
  width: 18px; height: 18px;
  border-radius: 50%;
  font-size: 12px !important;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  font-weight: 700;
  line-height: 1;
}
@keyframes hpTeaserIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Panel */
.hp-chatbot-panel {
  position: fixed !important;
  right: 20px !important;
  bottom: 96px !important;
  width: 380px !important;
  max-width: calc(100vw - 40px) !important;
  height: 580px !important;
  max-height: calc(100vh - 120px) !important;
  background: #fff !important;
  border-radius: 16px !important;
  box-shadow: 0 16px 48px rgba(0,0,0,.32) !important;
  z-index: 2147483647 !important;
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}
.hp-chatbot-panel.hp-open {
  display: flex !important;
  animation: hpSlideUp .25s ease;
}
@keyframes hpSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Header */
.hp-chatbot-header {
  background: #0B2F3A !important;
  color: #fff !important;
  padding: 16px 18px !important;
  display: flex !important;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.hp-chatbot-avatar {
  width: 42px; height: 42px;
  border-radius: 50% !important;
  background: #FFC400 !important;
  color: #0B2F3A !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  font-weight: 700 !important;
  font-size: 18px !important;
  flex-shrink: 0;
}
.hp-chatbot-header-info { flex: 1; min-width: 0; }
.hp-chatbot-header-title {
  font-weight: 700 !important;
  font-size: 16px !important;
  line-height: 1.2 !important;
  color: #fff !important;
}
.hp-chatbot-header-status {
  font-size: 13px !important;
  opacity: .9 !important;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  color: #fff !important;
}
.hp-chatbot-header-status::before {
  content: "";
  width: 9px; height: 9px;
  background: #4ade80;
  border-radius: 50%;
  display: inline-block;
  animation: hpDot 1.4s infinite;
  box-shadow: 0 0 0 0 rgba(74,222,128,.7);
}
@keyframes hpDot {
  0% { box-shadow: 0 0 0 0 rgba(74,222,128,.7); }
  70% { box-shadow: 0 0 0 8px rgba(74,222,128,0); }
  100% { box-shadow: 0 0 0 0 rgba(74,222,128,0); }
}
.hp-chatbot-close {
  background: transparent !important;
  border: none !important;
  color: #fff !important;
  cursor: pointer;
  padding: 4px 8px !important;
  border-radius: 6px;
  opacity: .85;
  font-size: 26px !important;
  line-height: 1 !important;
}
.hp-chatbot-close:hover {
  opacity: 1;
  background: rgba(255,255,255,.12) !important;
}

/* Messages area */
.hp-chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px !important;
  background: #f7f9fa !important;
  display: flex;
  flex-direction: column;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
}
.hp-msg {
  max-width: 85%;
  padding: 12px 15px !important;
  border-radius: 16px;
  font-size: 15px !important;
  line-height: 1.5 !important;
  word-wrap: break-word;
  animation: hpFadeIn .25s ease;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  letter-spacing: 0;
}
@keyframes hpFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.hp-msg.hp-bot {
  background: #ffffff !important;
  color: #1a2a33 !important;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,.07);
}
.hp-msg.hp-user {
  background: #0B2F3A !important;
  color: #ffffff !important;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.hp-msg.hp-bot * { color: #1a2a33 !important; }
.hp-msg.hp-user * { color: #ffffff !important; }
.hp-msg a {
  color: #B8860B !important;
  text-decoration: underline !important;
  font-weight: 700 !important;
}
.hp-msg.hp-user a { color: #FFC400 !important; }
.hp-msg strong, .hp-msg b { font-weight: 700 !important; }

/* Typing indicator */
.hp-typing {
  display: inline-flex;
  gap: 5px;
  padding: 4px 0;
}
.hp-typing span {
  width: 8px; height: 8px;
  background: #0B2F3A !important;
  border-radius: 50%;
  opacity: .4;
  animation: hpBlink 1.2s infinite;
}
.hp-typing span:nth-child(2) { animation-delay: .2s; }
.hp-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes hpBlink {
  0%, 80%, 100% { opacity: .3; }
  40% { opacity: .9; }
}

/* Quick replies (CTA buttons) */
.hp-chatbot-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 16px 0;
}
.hp-chatbot-quick button {
  background: #fff !important;
  color: #0B2F3A !important;
  border: 1.5px solid #0B2F3A !important;
  border-radius: 18px;
  padding: 6px 12px;
  font-size: 13px !important;
  font-weight: 600 !important;
  cursor: pointer;
  font-family: inherit !important;
}
.hp-chatbot-quick button:hover {
  background: #0B2F3A !important;
  color: #fff !important;
}

/* Form */
.hp-chatbot-form {
  padding: 12px !important;
  border-top: 1px solid #e5e7eb !important;
  background: #fff !important;
  display: flex !important;
  gap: 8px;
  flex-shrink: 0;
}
.hp-chatbot-input {
  flex: 1 !important;
  border: 1.5px solid #d1d5db !important;
  border-radius: 24px !important;
  padding: 11px 16px !important;
  font-size: 15px !important;
  outline: none !important;
  font-family: inherit !important;
  background: #fff !important;
  color: #1a2a33 !important;
  -webkit-appearance: none;
}
.hp-chatbot-input:focus {
  border-color: #FFC400 !important;
  box-shadow: 0 0 0 3px rgba(255,196,0,.25) !important;
}
.hp-chatbot-input::placeholder {
  color: #9ca3af !important;
  opacity: 1 !important;
}
.hp-chatbot-send {
  background: #FFC400 !important;
  color: #0B2F3A !important;
  border: none !important;
  border-radius: 50% !important;
  width: 44px; height: 44px;
  cursor: pointer !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform .1s ease;
}
.hp-chatbot-send:active { transform: scale(.92); }
.hp-chatbot-send:disabled { opacity: .4 !important; cursor: not-allowed !important; }
.hp-chatbot-send svg {
  width: 18px; height: 18px;
  fill: #0B2F3A !important;
}

/* Footer CTA */
.hp-chatbot-footer {
  padding: 8px 12px 10px !important;
  text-align: center !important;
  font-size: 11px !important;
  color: #6b7280 !important;
  background: #fff !important;
  flex-shrink: 0;
  border-top: 1px solid #f3f4f6;
  font-family: inherit !important;
}
.hp-chatbot-footer a {
  color: #0B2F3A !important;
  text-decoration: none !important;
  font-weight: 700 !important;
}
.hp-chatbot-footer a:hover { color: #FFC400 !important; }

/* === MOBILE FULLSCREEN (iOS + Android) === */
@media (max-width: 600px) {
  .hp-chatbot-bubble {
    right: 14px !important;
    bottom: 14px !important;
    width: 58px !important;
    height: 58px !important;
  }
  .hp-chatbot-bubble svg {
    width: 28px !important;
    height: 28px !important;
  }
  .hp-chatbot-teaser {
    right: 82px;
    bottom: 22px;
    font-size: 13px !important;
    max-width: 200px;
  }
  .hp-chatbot-panel {
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
  }
  .hp-chatbot-panel.hp-open {
    animation: hpSlideUpMobile .3s ease;
  }
  @keyframes hpSlideUpMobile {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }
  .hp-chatbot-header {
    padding-top: max(16px, env(safe-area-inset-top)) !important;
  }
  .hp-chatbot-form {
    padding-bottom: max(12px, env(safe-area-inset-bottom)) !important;
  }
  .hp-msg { font-size: 15px !important; }
}

/* iOS bug fix: prevent input zoom */
@supports (-webkit-touch-callout: none) {
  .hp-chatbot-input { font-size: 16px !important; }
}
