/* =============================================
   CHATBOT BALLOON — Balão de Engajamento
   Apenas desktop (>= 768px)
   Speech bubble transparente no header
   ============================================= */

/* --- Container: hidden on mobile --- */
.chatbot-widget {
  display: none;
}

@media (min-width: 768px) {
  .chatbot-widget {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 51;
    pointer-events: none;
  }
}

/* --- Balloon Wrapper --- */
.chatbot-balloon {
  position: fixed;
  top: 14px;
  z-index: 51;
  display: flex;
  align-items: stretch; /* Stretch to make SVG match body height */
  pointer-events: auto;

  /* Drop-shadow for the overall continuous shape */
  filter: drop-shadow(0 0 1px rgba(255, 255, 255, 0.15))
    drop-shadow(0 4px 12px rgba(0, 0, 0, 0.08));

  /* Hidden by default */
  opacity: 0;
  visibility: hidden;
  transform: translateX(-8px);
  transition:
    opacity 0.4s ease,
    transform 0.4s ease,
    visibility 0.4s;
}

/* MD header = h-16 (64px) */
@media (min-width: 768px) and (max-width: 1023px) {
  .chatbot-balloon {
    top: 14px;
  }
}

/* LG+ header = h-20 (80px) */
@media (min-width: 1024px) {
  .chatbot-balloon {
    top: 22px;
  }
}

/* Visible states */
.chatbot-widget[data-state="showing"] .chatbot-balloon,
.chatbot-widget[data-state="input"] .chatbot-balloon,
.chatbot-widget[data-state="thanking"] .chatbot-balloon {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}

/* --- Balloon Left Cap (SVG Arrow) --- */
.chatbot-balloon-arrow {
  color: rgba(255, 255, 255, 0.12); /* Matches background */
  width: 24px;
  flex-shrink: 0;
  /* Apply glassmorphism to the SVG too so it blends perfectly */
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  /* No margin-right to avoid alpha doubling! */
  transition: color 0.15s ease;
}

/* --- Balloon Body --- */
.chatbot-balloon-body {
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  /* Left side is flat to perfectly join the SVG cap */
  border-radius: 0 18px 18px 0;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
  transition: background 0.15s ease;
}

/* --- Phrase --- */
.chatbot-balloon-phrase {
  padding: 9px 18px 9px 0;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* --- Hover State --- */
.chatbot-balloon:hover .chatbot-balloon-body {
  background: rgba(255, 255, 255, 0.25);
}

.chatbot-balloon:hover .chatbot-balloon-arrow {
  color: rgba(255, 255, 255, 0.33) !important;
}

/* --- CTA --- */
.chatbot-balloon-cta {
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0.4;
  color: rgba(255, 255, 255, 0.9);
  transition: opacity 0.2s ease;
  position: relative;
  z-index: 1;
}

.chatbot-balloon-phrase:hover .chatbot-balloon-cta {
  opacity: 0.9;
}

.chatbot-balloon-cta svg {
  width: 14px;
  height: 14px;
}

.chatbot-balloon-cta-text {
  font-size: 10px;
  font-family: "Inter", sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* --- Progress Bar --- */
.chatbot-balloon-progress {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  height: 100%;
  background: rgba(255, 255, 255, 0.08);
  width: 0%;
  z-index: 0;
}

@keyframes balloon-progress {
  from {
    width: 100%;
  }
  to {
    width: 0%;
  }
}

.chatbot-balloon-text {
  font-size: 13px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.9);
  margin: 0;
  font-family: "Inter", sans-serif;
  font-weight: 500;
  white-space: nowrap;
  position: relative;
  z-index: 1;
}

/* Hide phrase when in input/thanking state */
.chatbot-widget[data-state="input"] .chatbot-balloon-phrase,
.chatbot-widget[data-state="thanking"] .chatbot-balloon-phrase {
  display: none;
}

/* Phrase animation */
.chatbot-balloon-phrase.fading-out {
  animation: balloon-fade-out 0.35s ease-out forwards;
}

.chatbot-balloon-phrase.fading-in {
  animation: balloon-fade-in 0.35s ease-out forwards;
}

@keyframes balloon-fade-out {
  to {
    opacity: 0;
    transform: translateX(-6px);
  }
}

@keyframes balloon-fade-in {
  from {
    opacity: 0;
    transform: translateX(6px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* --- Input Area --- */
.chatbot-balloon-input-area {
  display: none;
  padding: 5px;
}

.chatbot-widget[data-state="input"] .chatbot-balloon-input-area {
  display: block;
  animation: balloon-fade-in 0.25s ease-out;
}

.chatbot-balloon-input-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

.chatbot-balloon-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  font-family: "Inter", sans-serif;
  font-weight: 400;
  padding: 5px 12px;
  min-width: 250px;
  -webkit-appearance: none;
  appearance: none;
  box-shadow: none;
}

.chatbot-balloon-input:focus {
  outline: none;
  border: none;
  box-shadow: none;
}

.chatbot-balloon-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.chatbot-balloon-send {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s ease;
  outline: none;
}

.chatbot-balloon-send svg {
  width: 12px;
  height: 12px;
}

.chatbot-balloon-send:not(:disabled):hover {
  background: rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.9);
}

.chatbot-balloon-send:disabled {
  opacity: 0.2;
  cursor: not-allowed;
}

/* --- Thank You --- */
.chatbot-balloon-thanks {
  padding: 9px 18px;
  text-align: center;
}

.chatbot-balloon-thanks-text {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.75);
  font-weight: 500;
  font-family: "Inter", sans-serif;
}

/* --- Cooldown --- */
.chatbot-balloon-cooldown {
  text-align: center;
  padding: 2px 10px 4px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.3);
  display: none;
  font-family: "Inter", sans-serif;
}

.chatbot-balloon-cooldown.visible {
  display: block;
}
