/* Grokify: tema estilo Grok Bot para o OpenBot (só CSS por cima, sem tocar no código). */

/* fundo preto e cinzas neutros, como no Grok Bot */
html.grokify.dark, html.grokify .dark {
  --background: #000;
  --card: #111113;
  --popover: #141416;
  --muted: #18181b;
  --accent: #1f1f23;
  --border: #232326;
  --input: #232326;
  --sidebar: #0a0a0b;
  --sidebar-accent: rgba(255, 255, 255, .07);
  --radius: 1rem;
}
html.grokify body { background: #000; }

/* avatares: troca o orb gradiente pelo desenho do Grok */
html.grokify [data-grok-bot] {
  background: var(--grok-avatar) center / 100% 100% no-repeat !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  --tw-ring-color: transparent !important;
  animation: none !important;
}
html.grokify [data-grok-bot] * { opacity: 0 !important; animation: none !important; }

/* barra lateral agrupada em seções */
html.grokify li[data-grok-titulo] { margin-top: 14px; }
html.grokify li[data-grok-titulo]::before {
  content: attr(data-grok-titulo);
  display: block;
  padding: 4px 10px 6px;
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, .45);
  letter-spacing: .01em;
}

/* itens da lista mais altos e arredondados, como no Grok */
html.grokify a[href^="/bots/agent_"] { border-radius: 12px; }
html.grokify a[href^="/bots/agent_"] [data-grok-bot] { width: 30px !important; height: 30px !important; }

/* "Mensagem para <bot>" no lugar de "Pergunte qualquer coisa" */
html.grokify [data-grok-ph] { font-size: 0 !important; }
html.grokify [data-grok-ph]::before { content: attr(data-grok-ph); font-size: 14px; }

/* logo do canto: ícone circular do MeuBot no lugar do orb do OpenBot */
html.grokify a[data-grok-marca] {
  background: url(/__ptbr/marca-meubot/circulo-escuro.svg) center / 100% 100% no-repeat !important;
  border-radius: 50%;
}
html.grokify a[data-grok-marca] > * { opacity: 0 !important; }

/* tela de entrada: logo circular do MeuBot no lugar do orb do OpenBot (a classe vem do grokify.js) */
html.grok-entrada .agent-orb {
  background: url(/__ptbr/marca-meubot/circulo-escuro.svg) center / 100% 100% no-repeat !important;
  border-radius: 50%;
  box-shadow: none !important;
  width: 64px !important;
  height: 64px !important;
  filter: none !important;
}
html.grok-entrada .agent-orb > * { opacity: 0 !important; }
/* o orb é desenhado com ::before e ::after; sem tirar os dois, a esfera colorida fica por cima do logo */
html.grok-entrada .agent-orb::before,
html.grok-entrada .agent-orb::after { content: none !important; display: none !important; }

/* engrenagem das configurações do bot (fora da árvore do React) */
.grok-gear {
  position: fixed; z-index: 60; display: none; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 8px; border: 0; cursor: pointer;
  background: rgba(255, 255, 255, .08); color: rgba(255, 255, 255, .7);
}
.grok-gear:hover { background: rgba(255, 255, 255, .16); color: #fff; }
.grok-gear.grok-gear-topo { width: 36px; height: 36px; border-radius: 12px; }

/* campo de mensagem arredondado */
html.grokify textarea { border-radius: 22px; }

/* ---------- Fase 2: foto do Google e perfil ---------- */
html.grokify [data-grok-foto] { position: relative; }
html.grokify [data-grok-foto] > img[data-grok-foto-img] { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.grok-perfil-fundo { position: fixed; inset: 0; z-index: 2147483000; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; padding: 16px; animation: grokFade .15s ease-out; }
.grok-perfil { position: relative; width: 100%; max-width: 420px; max-height: calc(100vh - 32px); overflow: auto; border-radius: 20px; background: var(--popover, #fff); color: var(--popover-foreground, #0A0A0B); border: 1px solid var(--border, rgba(127,127,127,.25)); box-shadow: 0 24px 64px rgba(0,0,0,.35); font-size: 14px; animation: grokSobe .18s ease-out; }
.grok-perfil-capa { height: 84px; background: linear-gradient(120deg, #0A0A0B 0%, #2F6BFF 100%); border-radius: 20px 20px 0 0; }
.grok-perfil-foto { position: relative; width: 96px; height: 96px; margin: -48px auto 0; border-radius: 50%; overflow: hidden; background: #2F6BFF; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 32px; font-weight: 700; border: 4px solid var(--popover, #fff); }
.grok-perfil-foto img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.grok-perfil-x { position: absolute; top: 10px; right: 12px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(0,0,0,.35); color: #fff; font-size: 20px; line-height: 1; cursor: pointer; }
.grok-perfil-x:hover { background: rgba(0,0,0,.55); }
.grok-perfil-corpo { padding: 16px 24px 24px; }
.grok-perfil-rotulo { display: block; font-size: 12px; opacity: .65; margin-bottom: 6px; }
.grok-perfil-linha { display: flex; gap: 8px; }
.grok-perfil-linha input { flex: 1; min-width: 0; height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border, rgba(127,127,127,.35)); background: transparent; color: inherit; font: inherit; font-size: 15px; font-weight: 600; }
.grok-perfil-linha input:focus { outline: 2px solid #2F6BFF; outline-offset: 1px; }
.grok-perfil-salvar { height: 38px; padding: 0 14px; border-radius: 10px; border: 0; background: #2F6BFF; color: #fff; font-weight: 600; cursor: pointer; }
.grok-perfil-salvar:disabled { opacity: .4; cursor: default; }
.grok-perfil-msg { min-height: 18px; margin: 6px 0 4px; font-size: 12px; opacity: .75; }
.grok-perfil dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 4px 0 16px; }
.grok-perfil dt { opacity: .6; }
.grok-perfil dd { margin: 0; overflow-wrap: anywhere; }
.grok-perfil-ok { font-size: 11px; padding: 1px 6px; border-radius: 99px; background: rgba(47,107,255,.15); color: #2F6BFF; margin-left: 4px; }
.grok-perfil-dica { font-size: 12px; opacity: .7; margin: 0 0 16px; }
.grok-perfil-dica a { color: #2F6BFF; text-decoration: underline; }
.grok-perfil-acoes { display: flex; gap: 8px; }
.grok-perfil-acoes > * { flex: 1; height: 38px; display: flex; align-items: center; justify-content: center; border-radius: 10px; border: 1px solid var(--border, rgba(127,127,127,.35)); background: transparent; color: inherit; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.grok-perfil-acoes > *:hover { background: rgba(127,127,127,.12); }
.grok-perfil-sair { color: #e5484d !important; }
@keyframes grokFade { from { opacity: 0; } }
@keyframes grokSobe { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* ---------- Fase 3: mini-avatar e cor do bot nas respostas ---------- */
html.grokify [data-slot="message"][data-grok-msg]::before {
  content: ''; flex: 0 0 28px; width: 28px; height: 28px; margin-top: 4px;
  background: var(--grok-av) center / 100% 100% no-repeat;
}
html.grokify [data-slot="message"][data-grok-msg] [data-slot="bubble"][data-align="start"] > [data-slot="bubble-content"] {
  background: color-mix(in srgb, var(--grok-cor) 11%, transparent);
  border-color: color-mix(in srgb, var(--grok-cor) 28%, transparent);
  border-radius: 4px 18px 18px 18px;
  padding: 10px 14px;
}
html.grokify [data-slot="message"][data-grok-msg] [data-slot="bubble-content"] a { color: var(--grok-cor); }
html.grokify [data-grok-pensa-txt] {
  min-height: 28px; padding-left: 38px; display: flex; align-items: center;
  background: var(--grok-av-pensa) left center / 28px 28px no-repeat;
}

/* ---------- Fase 4: layout Grok ---------- */
/* prévia da última mensagem sob o nome do bot */
html.grokify a[href^="/bots/agent_"][data-grok-com-previa] { height: auto !important; min-height: 46px; padding-top: 5px; padding-bottom: 5px; }
html.grokify a[data-grok-com-previa] > span.truncate { line-height: 18px; }
html.grokify a[data-grok-com-previa] > span.truncate::after {
  content: attr(data-grok-previa); display: block; font-size: 12px; line-height: 16px; opacity: .55;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* favoritos grandes no topo da lista */
.grok-favs-caixa { padding: 2px 6px 8px; margin-bottom: 4px; border-bottom: 1px solid color-mix(in srgb, currentColor 10%, transparent); }
.grok-favs-rotulo { padding: 4px 6px 4px; font-size: 12px; font-weight: 500; opacity: .45; }
.grok-favs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.grok-favs::-webkit-scrollbar { display: none; }
.grok-fav { flex: 0 0 66px; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 8px 2px 6px; border: 0; border-radius: 14px; background: transparent; color: inherit; cursor: pointer; }
.grok-fav:hover { background: color-mix(in srgb, currentColor 8%, transparent); }
.grok-fav.ativo { background: color-mix(in srgb, var(--grok-cor) 16%, transparent); }
.grok-fav-av { width: 48px; height: 48px; background: var(--grok-av) center / 100% 100% no-repeat; transition: transform .15s ease-out; }
.grok-fav:hover .grok-fav-av { transform: scale(1.06); }
.grok-fav-nome { max-width: 62px; font-size: 11px; line-height: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .85; }
/* chip do bot no centro do cabeçalho da conversa */
html.grokify [data-slot="conversation-header"][data-grok-centro] { justify-content: flex-end; min-height: 56px; }
html.grokify [data-grok-centro] > [data-grok-chip] {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  max-width: min(440px, calc(100% - 140px)); gap: 9px; padding: 4px 16px 4px 5px; border-radius: 999px;
  background: color-mix(in srgb, var(--grok-cor) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--grok-cor) 32%, transparent);
}
html.grokify [data-grok-chip] [data-grok-bot] { width: 30px !important; height: 30px !important; }
html.grokify [data-grok-chip] > span.truncate { font-weight: 600; line-height: 16px; }
html.grokify [data-grok-chip] > span[data-grok-sub]:not([data-grok-sub=""])::after {
  content: attr(data-grok-sub); display: block; font-size: 11px; font-weight: 400; line-height: 14px; opacity: .6;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
html.grok-pensando [data-grok-chip] > span[data-grok-sub]::after { color: var(--grok-cor); opacity: 1; }
/* prévia nas linhas de conversa */
html.grokify a[href^="/channel/channel_"][data-grok-com-previa] { padding-top: 6px; padding-bottom: 6px; align-items: flex-start; }
html.grokify a[href^="/channel/channel_"][data-grok-com-previa] span.truncate::after {
  content: attr(data-grok-previa); display: block; font-size: 12px; line-height: 16px; opacity: .55;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
html.grokify a[href^="/channel/channel_"][data-grok-com-previa]:not([data-slot="bot-conversation-row"]) [data-grok-bot] { width: 34px !important; height: 34px !important; }
html.grokify a[href^="/channel/channel_"][data-grok-com-previa]:not([data-slot="bot-conversation-row"]) > div > div.shrink-0 { width: 34px; height: 34px; margin-right: 4px; }
