/* =========================================================
   HERO CHATBOT
   ========================================================= */
#heroChatbotWrapper {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: min(450px, calc(100% - 24px));
  opacity: 0;
  transform: translateY(26px);
  pointer-events: none;
  transition: opacity 0.28s ease, transform 0.28s ease;
  z-index: 4900;
}

#heroChatbotWrapper.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* collapsed assistant bubble */
#heroChatbotWrapper .hero-bubble {
  width: 100%;
  max-width: 450px;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  border: none;
  background: #07182E; 
  border-radius: 24px;
  padding: 16px 18px;
  box-shadow: var(--liquid-glass-shadow);
  cursor: pointer;
  transition: opacity .25s ease, transform .25s ease, box-shadow .25s ease;
}

#heroChatbotWrapper .hero-bubble::before {
  content: "";
  position: absolute;
  left: 0%; 
  width: 450px;
  border-radius: 15px;
  height: 100px;
  background-image: linear-gradient(90deg, var(--accent) 0%, transparent 60%);
  animation: heroBubbleSpin 3s linear infinite;
  z-index: -1;
}

#heroChatbotWrapper .hero-bubble::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgb(3, 13, 33), rgb(3, 13, 33)),
    linear-gradient(180deg, rgb(7, 21, 44), rgb(3, 13, 33));
  border: 1px solid var(--liquid-glass-border);
  z-index: 1;
}

#heroChatbotWrapper .hero-bubble>* {
  position: relative;
  z-index: 2;
}
@keyframes heroBubbleSpin {
  0% {
    transform: rotate(0deg);
  }
 

  25% {
    transform: rotate(25deg);
  }

  37% {
    transform: rotate(55deg);
  }

  50% {
    transform: rotate(150deg);
  }

  62% {
    transform: rotate(200deg);
  }

  75% {
    transform: rotate(250deg);
  }

  87% {
    transform: rotate(300deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

#heroChatbotWrapper .hero-bubble:hover {
  transform: translateY(-2px);
  box-shadow: 0 24px 52px rgba(3, 10, 28, 0.45);
}

#heroChatbotWrapper .hero-bubble.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
}

#heroChatbotWrapper .bubble-avatar,
#heroChatbotWrapper .chatpersona-avatar {
  width: 56px;
  height: 64px;
  aspect-ratio: 7 / 8;
  border-radius: 10px;
  background-color: var(--accent);
  background-image: url("/img/hero/header_avatar.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 8px 20px rgba(3, 10, 28, 0.22);
  flex-shrink: 0;
}

#heroChatbotWrapper .bubble-text {
  flex: 1;
  margin: 0;
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.45;
  font-weight: 500;
}

#heroChatbotWrapper .bubble-icon {
  position: absolute;
  top: 5px;
  right: 5px;
  left: auto;
  width: 26px;
  height: 26px;
  opacity: 0.95;
  filter: none;
  z-index: 3;
}

/* open chat */
#heroChatbotWrapper .hero-chatbot {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 100%;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(16px) scale(.98);
  transition: opacity .3s ease, transform .3s ease, visibility .3s ease;
}

#heroChatbotWrapper .hero-chatbot.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) scale(1);
}

/* main chat shell */
#heroChatbotWrapper .chat-messaging {
  width: 100%;
  min-width: 100%;
  max-width: 100%;
  left: 50%;
  min-height: 520px;
  max-height: 520px;
  margin: 0;
  border-radius: 28px;
  overflow: hidden;
  border: 1px solid var(--liquid-glass-border);
  background:
    linear-gradient(180deg, rgba(10, 24, 48, 0.92), rgba(3, 13, 33, 0.98)),
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
  backdrop-filter: blur(var(--liquid-glass-blur));
  -webkit-backdrop-filter: blur(var(--liquid-glass-blur));
  box-shadow: var(--shadow-soft);
  padding: 0 18px;
}

/* nav */
#heroChatbotWrapper .chatbot-nav {
  padding: 16px 4px 14px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

#heroChatbotWrapper .chatpersona {
  display: flex;
  align-items: center;
  gap: 10px;
}

#heroChatbotWrapper .chatpersona-avatar {
  width: 42px;
  height: 48px;
  border-radius: 8px;
}

#heroChatbotWrapper .persona-txt h6 {
  margin: 0 0 4px;
  font-size: 13px;
  line-height: 1;
  font-weight: 600;
  color: var(--text-primary);
}

#heroChatbotWrapper .persona-txt p {
  margin: 0;
  font-size: 11px;
  line-height: 1;
  color: var(--text-muted);
}

#heroChatbotWrapper .chat-control {
  display: flex;
  align-items: center;
}

#heroChatbotWrapper .close-chat {
  border: 1px solid rgba(78, 246, 209, 0.18);
  background: rgba(78, 246, 209, 0.16);
  color: var(--accent);
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 999px;
  font-size: 15px;
  line-height: 1;
  padding: 0;
  transition: all .25s ease;
}

#heroChatbotWrapper .close-chat:hover {
  background: var(--accent);
  color: var(--bg-dark);
  transform: scale(1.06);
}

/* scrollable body */
#heroChatbotWrapper #chatbotform {
  min-height: 430px;
  max-height: 430px;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 10px 0 14px;
}

#heroChatbotWrapper #chatbotform::-webkit-scrollbar {
  display: none;
}

/* steps */
#heroChatbotWrapper .form-step {
  display: none;
  position: relative;
  opacity: 0;
}

#heroChatbotWrapper .form-step.active {
  display: block;
  animation: chatbotFadeIn .5s ease forwards;
}

@keyframes chatbotFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* loading */
#heroChatbotWrapper .message-load {
  width: 100%;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  margin: 2px 0 10px;
  position: relative;
}

#heroChatbotWrapper .lds-ellipsis,
#heroChatbotWrapper .lds-ellipsis div {
  box-sizing: border-box;
}

#heroChatbotWrapper .lds-ellipsis {
  position: relative;
  width: 70px;
  height: 16px;
}

#heroChatbotWrapper .lds-ellipsis div {
  position: absolute;
  top: 5px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.8;
  animation-timing-function: cubic-bezier(0, 1, 1, 0);
}

#heroChatbotWrapper .lds-ellipsis div:nth-child(1) {
  left: 8px;
  animation: lds-ellipsis1 0.6s infinite;
}

#heroChatbotWrapper .lds-ellipsis div:nth-child(2) {
  left: 8px;
  animation: lds-ellipsis2 0.6s infinite;
}

#heroChatbotWrapper .lds-ellipsis div:nth-child(3) {
  left: 28px;
  animation: lds-ellipsis2 0.6s infinite;
}

#heroChatbotWrapper .lds-ellipsis div:nth-child(4) {
  left: 48px;
  animation: lds-ellipsis3 0.6s infinite;
}

@keyframes lds-ellipsis1 {
  0% {
    transform: scale(0);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes lds-ellipsis2 {
  0% {
    transform: translate(0, 0);
  }

  100% {
    transform: translate(20px, 0);
  }
}

@keyframes lds-ellipsis3 {
  0% {
    transform: scale(1);
  }

  100% {
    transform: scale(0);
  }
}

/* bot / user messages */
#heroChatbotWrapper .message-bot {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 18px 18px 18px 8px;
  padding: 14px;
  max-width: 94%;
  margin: 0 0 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

#heroChatbotWrapper .message-bot p {
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-primary);
  font-weight: 400;
  margin: 0 0 8px;
}

#heroChatbotWrapper .message-bot p:last-child {
  margin-bottom: 0;
}

#heroChatbotWrapper .message-bot p b,
#heroChatbotWrapper .name-placeholder {
  font-weight: 600;
}

#heroChatbotWrapper .message-bot p a,
#heroChatbotWrapper .message-bot #politica-link,
#heroChatbotWrapper .message-bot #chatbot-politica-link {
  color: var(--accent);
  text-decoration: underline;
}

#heroChatbotWrapper .message-answer {
  max-width: 88%;
  margin: 0 0 10px auto;
  text-align: right;
  display: none;
  animation: chatbotFadeIn .35s ease forwards;
}

#heroChatbotWrapper .message-answer p {
  display: inline-block;
  margin: 0;
  padding: 10px 12px;
  border-radius: 16px 16px 8px 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: var(--bg-dark);
  font-weight: 600;
  font-size: 13px;
  line-height: 1.3;
  text-align: left;
}

/* radio options */
#heroChatbotWrapper .radio-button:first-of-type {
  margin-top: 10px;
}

#heroChatbotWrapper .radio-button input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

#heroChatbotWrapper .radio-button label {
  width: 100%;
  min-height: 38px;
  font-size: 13px;
  line-height: 1.2;
  font-weight: 400;
  border-radius: 12px;
  background: var(--bg-card-strong);
  color: var(--text-primary);
  border: 1px solid var(--border-soft);
  margin: 8px 0 0;
  padding: 10px 12px;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  cursor: pointer;
  transition: all .25s ease;
}

#heroChatbotWrapper .radio-button label:hover,
#heroChatbotWrapper .radio-button input[type="radio"]:checked+label {
  background: rgba(78, 246, 209, 0.18);
  border-color: rgba(78, 246, 209, 0.55);
  color: var(--white);
  box-shadow: 0 0 0 1px rgba(78, 246, 209, 0.08);
}

/* inputs */
#heroChatbotWrapper .form-input {
  width: 100%;
  border-radius: 12px;
  background: var(--bg-card-strong);
  border: 1px solid var(--border-soft);
  margin-top: 10px;
  padding: 0 12px;
  display: flex;
  align-items: center;
}

#heroChatbotWrapper .form-input input,
#heroChatbotWrapper .form-input select {
  width: 100%;
  min-height: 42px;
  border: none;
  background: transparent;
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 400;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
}

#heroChatbotWrapper .form-input input:focus-visible,
#heroChatbotWrapper .form-input select:focus-visible {
  outline: none;
}

#heroChatbotWrapper .form-input input::placeholder {
  color: var(--text-muted);
}

/* checkbox */
#heroChatbotWrapper .form-check {
  border: none;
  background: transparent;
  padding: 0;
  margin-top: 14px;
}

#heroChatbotWrapper .form-check label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.4;
}

#heroChatbotWrapper .form-check input[type="checkbox"] {
  margin-top: 2px;
  accent-color: var(--accent);
}

/* errors */
#heroChatbotWrapper label.error {
  display: none;
  color: #ff8e8e;
  font-size: 12px;
  font-weight: 400;
  width: 100%;
  text-align: left;
  margin-top: 6px;
}

/* buttons */
#heroChatbotWrapper .next_chatbot,
#heroChatbotWrapper .form-button {
  width: 100%;
  min-height: 44px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  border: none;
  color: var(--bg-dark);
  margin-top: 18px;
  font-size: 14px;
  font-weight: 700;
  transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease;
}

#heroChatbotWrapper .next_chatbot:hover,
#heroChatbotWrapper .form-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(48, 229, 189, 0.28);
}

/* disabled / locked */
#heroChatbotWrapper .step-locked {
  pointer-events: none;
}

#heroChatbotWrapper .form-input.disabled-step,
#heroChatbotWrapper .next_chatbot.disabled-step,
#heroChatbotWrapper .radio-button label.disabled-step,
#heroChatbotWrapper .radio-button input[type="radio"]:checked+label.disabled-step {
  opacity: 0.55;
  filter: grayscale(0.15);
}

#heroChatbotWrapper .radio-button input[type="radio"]:checked+label.disabled-step {
  background: rgba(78, 246, 209, 0.14);
  border-color: rgba(78, 246, 209, 0.35);
  color: var(--text-primary);
}

/* autofill */
#heroChatbotWrapper input:-webkit-autofill,
#heroChatbotWrapper input:-webkit-autofill:hover,
#heroChatbotWrapper input:-webkit-autofill:focus,
#heroChatbotWrapper input:-webkit-autofill:active {
  -webkit-text-fill-color: var(--text-primary);
  transition: background-color 5000000s ease-in-out 0s;
} 
/* responsive */
@media only screen and (max-width: 650px) {
  #heroChatbotWrapper {
    right: auto;
    left: 50%;
    bottom: 12px;
    width: min(390px, calc(100% - 16px));
    transform: translate(-50%, 26px);
    margin-top: 0;
    z-index: 4900;
  }

  #heroChatbotWrapper.is-visible {
    transform: translate(-50%, 0);
  }

  #heroChatbotWrapper .chat-messaging {
    min-height: 500px;
    max-height: 500px;
    left: 0;
  }

  #heroChatbotWrapper #chatbotform {
    min-height: 410px;
    max-height: 410px;
  }

  #heroChatbotWrapper .hero-bubble {
    left: 50%;
  }

  #heroChatbotWrapper .hero-chatbot.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(0%) scale(1);
  }
}

@media only screen and (max-width: 475px) {
  #heroChatbotWrapper .hero-bubble{
    width: 100%;
  }
  
  #heroChatbotWrapper .chat-messaging {
    padding: 0 14px;
    border-radius: 22px;
  }

  #heroChatbotWrapper .message-bot {
    max-width: 100%;
    padding: 12px;
  }

  #heroChatbotWrapper .message-bot p,
  #heroChatbotWrapper .message-answer p {
    font-size: 13px;
  }

  #heroChatbotWrapper .radio-button label {
    justify-content: center;
    text-align: center;
  }
}
