/* ============================================================
 * SmartGuideCard — estilos isolados (todos com prefixo .sgc-)
 * Dark + neon violeta. Zero !important. Não vaza pro host.
 * ============================================================ */

/* Reset interno mínimo (escopado) */
.sgc-root, .sgc-root * {
  box-sizing: border-box;
  font-family: inherit;
}

/* ─── Card flutuante principal ─────────────────────────────── */
.sgc-root {
  position: fixed;
  top: 100px;
  right: 24px;
  width: 340px;
  max-height: 80vh;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  background: rgba(15, 10, 30, 0.85);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(139, 92, 246, 0.3);
  box-shadow:
    0 0 40px rgba(139, 92, 246, 0.2),
    0 8px 32px rgba(0, 0, 0, 0.4);
  border-radius: 16px;
  color: #e6e1f5;
  font-size: 13px;
  line-height: 1.5;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 300ms ease, transform 300ms ease;
  overflow: hidden;
  user-select: none;
}

.sgc-root.sgc-visible {
  opacity: 1;
  transform: translateY(0);
}

.sgc-root.sgc-hidden {
  display: none;
}

/* ─── Header (alça de drag) ────────────────────────────────── */
.sgc-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  cursor: grab;
  background: linear-gradient(180deg, rgba(139, 92, 246, 0.18), rgba(139, 92, 246, 0.04));
  border-bottom: 1px solid rgba(139, 92, 246, 0.18);
  flex-shrink: 0;
}

.sgc-header:active {
  cursor: grabbing;
}

.sgc-grip {
  display: inline-flex;
  align-items: center;
  font-size: 14px;
  color: rgba(167, 139, 250, 0.7);
  letter-spacing: -2px;
  flex-shrink: 0;
}

.sgc-title {
  flex: 1;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: #f3eeff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sgc-header-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid rgba(139, 92, 246, 0.25);
  background: rgba(139, 92, 246, 0.1);
  color: #d4c5ff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.sgc-header-btn:hover {
  background: rgba(139, 92, 246, 0.25);
  border-color: rgba(139, 92, 246, 0.55);
  color: #fff;
}

/* ─── Body (rolável) ───────────────────────────────────────── */
.sgc-body {
  padding: 14px;
  overflow-y: auto;
  flex: 1;
  user-select: text;
}

.sgc-body::-webkit-scrollbar { width: 6px; }
.sgc-body::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.35);
  border-radius: 4px;
}

.sgc-description {
  margin: 0 0 12px;
  color: #cdc4e8;
  font-size: 13px;
}

.sgc-bullets {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sgc-bullets li {
  position: relative;
  padding-left: 18px;
  color: #d8d0ee;
  font-size: 12.5px;
}

.sgc-bullets li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 7px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #a78bfa;
  box-shadow: 0 0 8px rgba(167, 139, 250, 0.7);
}

/* ─── Vídeo lazy (thumbnail + player) ──────────────────────── */
.sgc-video-wrap {
  position: relative;
  margin: 0 0 14px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(139, 92, 246, 0.2);
  cursor: pointer;
  aspect-ratio: 16 / 9;
}

.sgc-video-wrap.sgc-no-video { display: none; }

.sgc-video-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-color: #1a1230;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: filter 0.3s ease;
}

.sgc-video-wrap:hover .sgc-video-thumb {
  filter: brightness(1.1);
}

.sgc-video-play {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(139, 92, 246, 0.85);
  border: 2px solid rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
  box-shadow: 0 0 24px rgba(139, 92, 246, 0.8);
  pointer-events: none;
  transition: transform 0.2s ease;
}

.sgc-video-wrap:hover .sgc-video-play {
  transform: scale(1.08);
}

.sgc-video-wrap iframe,
.sgc-video-wrap video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

/* ─── Botão primário ───────────────────────────────────────── */
.sgc-cta {
  display: block;
  width: 100%;
  padding: 11px 14px;
  margin: 0 0 12px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 4px 18px rgba(139, 92, 246, 0.4);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.sgc-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(139, 92, 246, 0.55);
}

.sgc-cta.sgc-hidden { display: none; }

/* ─── Botão IA + chat ──────────────────────────────────────── */
.sgc-ai-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  margin: 0 0 10px;
  background: rgba(139, 92, 246, 0.10);
  border: 1px solid rgba(139, 92, 246, 0.28);
  border-radius: 10px;
  color: #d4c5ff;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sgc-ai-toggle:hover {
  background: rgba(139, 92, 246, 0.18);
  border-color: rgba(139, 92, 246, 0.5);
}

.sgc-ai-panel {
  margin: 0 0 12px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(139, 92, 246, 0.18);
  border-radius: 10px;
  display: none;
  flex-direction: column;
  gap: 8px;
}

.sgc-ai-panel.sgc-open { display: flex; }

.sgc-ai-messages {
  max-height: 140px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: #c8bdea;
  user-select: text;
}

.sgc-ai-msg {
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(139, 92, 246, 0.10);
  border: 1px solid rgba(139, 92, 246, 0.15);
  line-height: 1.45;
}

.sgc-ai-msg.sgc-ai-msg-user {
  background: rgba(167, 139, 250, 0.18);
  align-self: flex-end;
  max-width: 90%;
}

.sgc-ai-input-row {
  display: flex;
  gap: 6px;
}

.sgc-ai-input {
  flex: 1;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 8px;
  color: #f3eeff;
  font-size: 12px;
  outline: none;
  font-family: inherit;
}

.sgc-ai-input:focus {
  border-color: rgba(167, 139, 250, 0.7);
}

.sgc-ai-send {
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: #8b5cf6;
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.sgc-ai-send:hover { background: #7c3aed; }

/* ─── Checkbox "não mostrar novamente" ─────────────────────── */
.sgc-dismiss-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 10px;
  margin-top: 4px;
  border-top: 1px solid rgba(139, 92, 246, 0.15);
  font-size: 12px;
  color: #a99cc4;
  cursor: pointer;
  user-select: none;
}

.sgc-dismiss-row input {
  width: 14px;
  height: 14px;
  accent-color: #8b5cf6;
  cursor: pointer;
}

/* ─── Estado minimizado (balãozinho 56px) ──────────────────── */
/* SMART_GUIDE_REVIVE_V2: top 96->470 (longe do JARVIS Bot top:140) + cursor grab (arrastavel) */
.sgc-mini {
  position: fixed;
  top: 470px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background-color: #0b1020;
  background-image: url('robot-avatar.png');
  background-size: cover;
  background-position: center 18%;
  background-repeat: no-repeat;
  border: 1px solid rgba(167, 139, 250, 0.6);
  box-shadow:
    0 0 28px rgba(139, 92, 246, 0.55),
    0 8px 24px rgba(0, 0, 0, 0.5);
  color: transparent;
  font-size: 0;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: grab;
  overflow: hidden;
  z-index: 9000;
  animation: sgcPulse 2.4s ease-in-out infinite;
  user-select: none;
}
.sgc-mini:active { cursor: grabbing; }

.sgc-mini.sgc-visible { display: flex; }
.sgc-mini:hover { transform: scale(1.06); }

@keyframes sgcPulse {
  0%, 100% { box-shadow: 0 0 22px rgba(139, 92, 246, 0.45), 0 8px 24px rgba(0,0,0,0.5); }
  50%      { box-shadow: 0 0 38px rgba(139, 92, 246, 0.85), 0 8px 28px rgba(0,0,0,0.5); }
}

/* ─── Mobile (bottom sheet) ───────────────────────────────── */
@media (max-width: 768px) {
  .sgc-root {
    top: auto;
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    max-height: 60vh;
    border-radius: 16px 16px 0 0;
    border-bottom: 0;
    transform: translateY(20px);
  }
  .sgc-root.sgc-visible { transform: translateY(0); }

  .sgc-mini {
    right: 16px;
    bottom: 16px;
  }
}


/* ═══════════════════════════════════════════════════════════════
   SMART_GUIDE_REVIVE_V1 - grid de multiplos videos por rota
   ═══════════════════════════════════════════════════════════════ */
/* SMART_GUIDE_REVIVE_V3: carrossel horizontal - todos os videos lado a lado, scroll-x pros demais */
.sgc-video-grid {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 8px;
  padding: 4px 2px 8px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: rgba(139, 92, 246, 0.35) transparent;
}
.sgc-video-grid::-webkit-scrollbar {
  height: 6px;
}
.sgc-video-grid::-webkit-scrollbar-track {
  background: transparent;
}
.sgc-video-grid::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.35);
  border-radius: 3px;
}
.sgc-video-grid::-webkit-scrollbar-thumb:hover {
  background: rgba(167, 139, 250, 0.6);
}
.sgc-video-card {
  cursor: pointer;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(139, 92, 246, 0.06);
  border: 1px solid rgba(139, 92, 246, 0.15);
  transition: transform 0.18s ease, border-color 0.18s ease;
  display: flex;
  flex-direction: column;
  /* largura fixa pra manter carrossel uniforme; ~2 cards visiveis no card de 340px */
  flex: 0 0 150px;
  width: 150px;
  scroll-snap-align: start;
}
.sgc-video-card:hover {
  transform: translateY(-2px);
  border-color: rgba(167, 139, 250, 0.5);
}
.sgc-video-card .sgc-video-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background-size: cover;
  background-position: center;
  background-color: #1a1340;
}
.sgc-video-card .sgc-video-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 13px;
}
.sgc-video-title {
  padding: 6px 8px;
  font-size: 0.74rem;
  color: #e6e1f5;
  line-height: 1.25;
  font-weight: 600;
  min-height: 32px;
}
.sgc-video-back {
  width: 100%;
  background: rgba(139, 92, 246, 0.10);
  border: 1px solid rgba(139, 92, 246, 0.25);
  color: #d4c5ff;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.78rem;
  cursor: pointer;
  margin-bottom: 8px;
  font-family: inherit;
}
.sgc-video-back:hover {
  background: rgba(139, 92, 246, 0.18);
}


/* ═══════════════════════════════════════════════════════════════
   SGC_HINT_V2 — balão + seta apontando pro CAD do Smart Guide
   Usa elemento .sgc-mini-hint como SIBLING do .sgc-mini
   (pseudo-elements V1 eram cortados pelo overflow:hidden do .sgc-mini)
   ═══════════════════════════════════════════════════════════════ */
.sgc-mini-hint {
  /* SGC_HINT_TOP_V1: layout vertical, balao em cima do CAD com seta apontando p baixo */
  position: fixed;
  top: 488px;                /* tracker JS sobrescreve com inline style */
  right: 92px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 9001;             /* acima do mini */
  transition: opacity 0.25s ease, visibility 0.25s;
  user-select: none;
}
.sgc-mini-hint-text {
  display: inline-block;
  font-family: 'JetBrains Mono', 'Menlo', monospace;
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(196, 181, 253, 0.92);
  padding: 5px 10px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(139, 92, 246, 0.32);
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.4);
  white-space: nowrap;
  animation: sgcHintPulse 2.6s ease-in-out infinite;
}
.sgc-mini-hint-arrow {
  /* SGC_HINT_TOP_V1: triangulo CSS apontando pra baixo */
  display: inline-block;
  width: 0; height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid rgba(167, 139, 250, 0.85);
  filter: drop-shadow(0 1px 4px rgba(139,92,246,0.45));
  animation: sgcArrowPulseV 1.4s ease-in-out infinite;
}
.sgc-mini-hint[data-flip="down"] .sgc-mini-hint-arrow {
  /* hint cai abaixo do CAD (sem espaco em cima) -> seta vira pra cima */
  border-top: 0;
  border-bottom: 8px solid rgba(167, 139, 250, 0.85);
  order: -1; /* seta vem antes do texto quando flipado */
}
/* Mostra hint quando o .sgc-mini esta visivel (CAD fechado).
   Como .sgc-mini eh sibling anterior, usa selector ~ (geral) */
.sgc-mini.sgc-visible ~ .sgc-mini-hint {
  opacity: 1;
  visibility: visible;
}
@keyframes sgcHintPulse {
  0%, 100% { opacity: 0.75; }
  50%      { opacity: 1; }
}
@keyframes sgcArrowPulseV {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(4px); }
}
/* SGC_HINT_V2.1: habilitado no mobile (hint compacto, posicao especifica) */
@media (max-width: 768px) {
  .sgc-mini-hint {
    top: auto;
    bottom: 26px;            /* alinhado com o CAD mobile (bottom:16 + height/2 - hint_h/2) */
    right: 80px;             /* CAD mobile right:16 + width:56 + gap:8 */
  }
  .sgc-mini-hint-text {
    font-size: 0.5rem;
    padding: 4px 8px;
    letter-spacing: 0.06em;
  }
  .sgc-mini-hint-arrow {
    font-size: 0.6rem;
  }
}
@media (max-width: 380px) {
  .sgc-mini-hint-text { font-size: 0.46rem; padding: 3px 7px; }
}


/* ═══════════════════════════════════════════════════════════════
   SGC_HINT_TRACKER_V1 — quando JS tracker esta ativo,
   posicao eh via inline style (top/left). Mantemos so estilo visual.
   ═══════════════════════════════════════════════════════════════ */
.sgc-mini-hint {
  z-index: 9001 !important;        /* acima do mini (9000) */
}
