/* ============================================================
 * 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) ──────────────────── */
.sgc-mini {
  position: fixed;
  top: 96px;
  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: pointer;
  overflow: hidden;
  z-index: 9000;
  animation: sgcPulse 2.4s ease-in-out infinite;
  user-select: none;
}

.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;
  }
}
