/* =========================================================
   TOUR GUIDE — CLINEO HEALTH  v4.5
   Personagem flutuante (esq) + balão de fala clássico (dir)
   ========================================================= */

/* ===== OVERLAY ===== */
.tour-overlay {
  position: fixed;
  inset: 0;
  background: transparent;
  z-index: 10000;
  pointer-events: auto;
  transition: opacity 0.3s ease;
}

/* ===== HIGHLIGHT ===== */
.tour-highlight {
  position: fixed;
  z-index: 10001;
  border-radius: 14px;
  /* O box-shadow enorme escurece o resto da tela, deixando apenas o elemento claro */
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.65);
  border: 2px solid var(--brand, #106EBE);
  pointer-events: none;
  transition:
    top    0.35s cubic-bezier(0.4, 0, 0.2, 1),
    left   0.35s cubic-bezier(0.4, 0, 0.2, 1),
    width  0.35s cubic-bezier(0.4, 0, 0.2, 1),
    height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Remove o pseudo-elemento que estava adicionando borda extra */
.tour-highlight::after {
  display: none;
}


.tour-highlight {
  animation: tourHighlightPulse 2s ease-in-out infinite;
}

/* ===== CONTAINER PRINCIPAL (flex row) ===== */
.tour-balloon {
  position: fixed;
  z-index: 10002;
  /* posição padrão: centro-inferior */
  bottom: 48px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-end; /* ancora ambos na base */
  gap: 0;
  pointer-events: none;
}

.tour-balloon.positioned {
  bottom: auto;
  left: auto;
  transform: none;
}

/* =====================================================
   ANIMAÇÕES DE ENTRADA POR STEP
   ===================================================== */
.tour-balloon.tour-step-enter .tour-character {
  animation: tourCharSlideIn 0.5s cubic-bezier(0.34, 1.2, 0.64, 1) both;
}

.tour-balloon.tour-step-enter .tour-speech {
  animation: tourSpeechSlideIn 0.5s cubic-bezier(0.34, 1.2, 0.64, 1) 0.3s both;
}

@keyframes tourCharSlideIn {
  from { opacity: 0; transform: translateX(-48px); }
  to   { opacity: 1; transform: translateX(0);     }
}

@keyframes tourSpeechSlideIn {
  from { opacity: 0; transform: translateX(48px); }
  to   { opacity: 1; transform: translateX(0);    }
}

@keyframes balloonFadeIn {
  from {
    opacity: 0;
    transform: translateY(15px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.tour-balloon.positioned.tour-step-enter {
  animation: balloonFadeInPositioned 0.5s ease forwards;
}

@keyframes balloonFadeInPositioned {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ===== PERSONAGEM FLUTUANTE ===== */
.tour-character {
  flex-shrink: 0;
  width: 120px;
  pointer-events: none;
  align-self: flex-end;
  margin-bottom: -40px;    
  margin-right: 30px;
}

.tour-character img {
  width: 100%;
  height: auto;
  display: block;
  filter:
    drop-shadow(0 10px 20px rgba(16, 110, 190, 0.28))
    drop-shadow(0 3px 6px rgba(0, 0, 0, 0.15));
  animation: tourCharBreathe 3s ease-in-out infinite;
  transform-origin: bottom center;
}

@keyframes tourCharBreathe {
  0%,  100% { transform: scale(1)    translateY(0px);  }
  40%        { transform: scale(1.06) translateY(-4px); }
  70%        { transform: scale(1.03) translateY(-2px); }
}

/* ===== BALÃO DE FALA CLÁSSICO ===== */
.tour-speech {
  position: relative;
  pointer-events: all;
  background: var(--card-bg, #ffffff);
  border-radius: 18px;
  border: 2px solid var(--brand, #106EBE);
  box-shadow:
    0 8px 28px rgba(16, 110, 190, 0.16),
    0 2px 8px  rgba(0, 0, 0, 0.10);
  padding: 20px 40px 18px 20px;
  min-width: 240px;
  max-width: 420px;
  width: clamp(240px, 34vw, 420px);
}

/* Perninha: triângulo apontando para a esquerda (→ personagem) */
.tour-speech-tail {
  position: absolute;
  left: -20px;
  bottom: 28px;
  width: 0;
  height: 0;
  border-top:    10px solid transparent;
  border-bottom: 10px solid transparent;
  border-right:  20px solid var(--brand, #106EBE);
}

.tour-speech-tail::after {
  content: '';
  position: absolute;
  left: 4px;
  top: -8px;
  width: 0;
  height: 0;
  border-top:    8px solid transparent;
  border-bottom: 8px solid transparent;
  border-right:  17px solid var(--card-bg, #ffffff);
}

/* Tail para quando o balão está acima do elemento */
.tour-speech.tail-down .tour-speech-tail {
  left: 22px;
  bottom: auto;
  top: -18px;
  border-left:   9px solid transparent;
  border-right:  9px solid transparent;
  border-bottom: 18px solid var(--brand, #106EBE);
  border-top:    none;
  border-right-color: transparent;
}

.tour-speech.tail-down .tour-speech-tail::after {
  left: -7px;
  top: 3px;
  border-left:   7px solid transparent;
  border-right:  7px solid transparent;
  border-bottom: 15px solid var(--card-bg, #ffffff);
  border-top:    none;
  border-right-color: transparent;
}

/* ===== MENSAGEM ===== */
.tour-message {
  font-size: clamp(12px, 1.1vw, 18px);
  font-family: 'Poppins', sans-serif;
  font-weight: 500;
  line-height: 1.6;
  color: var(--text, #000);
  margin-bottom: 16px;
}

.tour-message p           { margin: 0 0 5px; }
.tour-message p:last-child { margin-bottom: 0; }

.tour-message strong {
  font-weight: 700;
  color: var(--brand, #106EBE);
}

/* Ícones dentro do balão */
.tour-message i[class*="bi"] {
  display: inline-block;
  font-size: 1em;
  margin-right: 5px;
  margin-left: 5px;
  line-height: 1;
  transition: color 0.2s;
}

.tour-message .icon-primary,
.tour-message .icon-info,
.tour-message .icon-ai,
.tour-message .icon-warning,
.tour-message .icon-success,
.tour-message .icon-neutral {
  color: #06b6d4;
}

/* ===== BOTÕES ===== */
.tour-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.tour-btn {
  padding: 8px 18px;
  border-radius: 30px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  line-height: 1.5;
}

.tour-btn-primary {
  background: linear-gradient(135deg, var(--brand, #106EBE) 0%, #14B8A6 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(16, 110, 190, 0.28);
}
.tour-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(16, 110, 190, 0.40);
}

.tour-btn-secondary {
  background: rgba(16, 110, 190, 0.08);
  color: var(--brand, #106EBE);
  border: 1.5px solid rgba(16, 110, 190, 0.22);
}
.tour-btn-secondary:hover { background: rgba(16, 110, 190, 0.14); }

.tour-btn-skip {
  background: none;
  color: var(--sidebar-muted, #64748b);
  font-size: 0.76rem;
  font-weight: 500;
  padding: 3px 8px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.tour-btn-skip:hover { color: var(--brand, #106EBE); }

/* ===== BOTÃO FECHAR (X) ===== */
.tour-balloon-close {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--sidebar-muted, #64748b);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  transition: all 0.2s;
  pointer-events: all;
}
.tour-balloon-close:hover {
  background: rgba(16, 110, 190, 0.10);
  color: var(--brand, #106EBE);
  transform: rotate(90deg);
}

/* ===== DARK MODE ===== */
[data-theme="dark"]    .tour-speech,
[data-bs-theme="dark"] .tour-speech {
  background: #252525;
  border-color: var(--brand, #106EBE);
  box-shadow: 0 8px 28px rgba(0,0,0,0.45), 0 2px 8px rgba(0,0,0,0.25);
}

[data-theme="dark"]    .tour-speech-tail::after,
[data-bs-theme="dark"] .tour-speech-tail::after { border-right-color: #252525; }

[data-theme="dark"]    .tour-message,
[data-bs-theme="dark"] .tour-message            { color: #e2e8f0; }

[data-theme="dark"]    .tour-message strong,
[data-bs-theme="dark"] .tour-message strong     { color: #60a5fa; }

[data-theme="dark"]    .tour-message .icon-primary,
[data-theme="dark"]    .tour-message .icon-info,
[data-theme="dark"]    .tour-message .icon-ai,
[data-theme="dark"]    .tour-message .icon-warning,
[data-theme="dark"]    .tour-message .icon-success,
[data-theme="dark"]    .tour-message .icon-neutral,
[data-bs-theme="dark"] .tour-message .icon-primary,
[data-bs-theme="dark"] .tour-message .icon-info,
[data-bs-theme="dark"] .tour-message .icon-ai,
[data-bs-theme="dark"] .tour-message .icon-warning,
[data-bs-theme="dark"] .tour-message .icon-success,
[data-bs-theme="dark"] .tour-message .icon-neutral {
  color: #67e8f9;
}

[data-theme="dark"]    .tour-btn-secondary,
[data-bs-theme="dark"] .tour-btn-secondary {
  background: rgba(96,165,250,0.10);
  color: #60a5fa;
  border-color: rgba(96,165,250,0.28);
}

[data-theme="dark"]    .tour-overlay,
[data-bs-theme="dark"] .tour-overlay { background: transparent; }

[data-theme="dark"]    .tour-character img,
[data-bs-theme="dark"] .tour-character img {
  filter:
    drop-shadow(0 10px 20px rgba(16,110,190,0.42))
    drop-shadow(0 3px 6px rgba(0,0,0,0.38));
}

/* ===== MOBILE (≤768px) ===== */
@media (max-width: 768px) {
  .tour-balloon {
    bottom: 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
  }

  .tour-character {
    width: 78px;
    margin-left: -10px;
    margin-bottom: -10px;
    align-self: auto;
  }

  .tour-speech-tail {
    left: 22px;
    bottom: auto;
    top: -18px;
    border-left:   9px solid transparent;
    border-right:  9px solid transparent;
    border-bottom: 18px solid var(--brand, #106EBE);
    border-top:    none;
  }

  .tour-speech-tail::after {
    left: -7px;
    top: 3px;
    border-left:   7px solid transparent;
    border-right:  7px solid transparent;
    border-bottom: 15px solid var(--card-bg, #ffffff);
    border-top:    none;
    border-right-color: transparent;
  }

  [data-theme="dark"]    .tour-speech-tail::after,
  [data-bs-theme="dark"] .tour-speech-tail::after {
    border-bottom-color: #252525;
    border-right-color:  transparent;
  }

  .tour-speech {
    max-width: 90vw;
    width: 90vw;
    padding: 14px 34px 12px 14px;
  }

  .tour-message { font-size: 0.88rem; }
  .tour-btn     { padding: 6px 13px; font-size: 0.8rem; }
}