/* ==========================================================================
   GW AI Chat — Estilos principais
   REGRA: todas as cores vêm de CSS variables injetadas pelo shortcode PHP.
   Nenhuma cor hardcoded aqui — tudo controlado pelo painel de Aparência.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@600;700;800&family=Inter:wght@400;500;600&display=swap');

.gw-ai-wrap *,
.gw-ai-wrap *::before,
.gw-ai-wrap *::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

/* Reset agressivo — impede o tema WordPress de sobrescrever inputs/buttons */
.gw-ai-wrap input,
.gw-ai-wrap textarea,
.gw-ai-wrap button,
.gw-ai-wrap select {
	-webkit-appearance: none;
	appearance: none;
	font-family: inherit;
}

/* --------------------------------------------------------------------------
   Container principal
   -------------------------------------------------------------------------- */
.gw-ai-wrap {
	display: flex;
	width: 100%;
	height: var(--gw-ai-height, 600px);
	min-height: 480px;
	background: var(--gw-ai-bg, #060911);
	color: var(--gw-ai-text, #f5f7ff);
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	font-size: 15px;
	line-height: 1.6;
	position: relative;
	overflow: hidden;
	border-radius: var(--gw-ai-radius-wrap, 0px);
}

/* --------------------------------------------------------------------------
   Sidebar
   -------------------------------------------------------------------------- */
.gw-ai-sidebar {
	width: var(--gw-ai-sidebar-width, 260px);
	min-width: var(--gw-ai-sidebar-width, 260px);
	background: var(--gw-ai-sidebar, #070c17);
	display: flex;
	flex-direction: column;
	border-right: 1px solid var(--gw-ai-border, rgba(0,161,213,0.15));
	overflow: hidden;
	transition: transform 0.25s ease;
	z-index: 10;
}

.gw-ai-sidebar-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 14px;
	border-bottom: 1px solid var(--gw-ai-border, rgba(0,161,213,0.12));
	gap: 8px;
}

.gw-ai-brand {
	display: flex;
	align-items: center;
	gap: 10px;
	font-family: 'Sora', 'Inter', sans-serif;
	font-weight: 700;
	font-size: 15px;
	color: var(--gw-ai-brand-text, #f5f7ff);
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.gw-ai-brand-avatar {
	width: 30px;
	height: 30px;
	border-radius: 50%;
	object-fit: cover;
	flex-shrink: 0;
	box-shadow: 0 0 0 2px var(--gw-ai-border, rgba(0,161,213,0.3));
}

.gw-ai-new-chat-btn {
	background: transparent;
	border: 1px solid var(--gw-ai-border, rgba(0,161,213,0.2));
	color: var(--gw-ai-brand-text, #f5f7ff);
	padding: 7px;
	border-radius: 8px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: background 0.2s, border-color 0.2s;
}

.gw-ai-new-chat-btn:hover {
	background: var(--gw-ai-sidebar-hover-bg, rgba(6,100,185,0.09));
	border-color: var(--gw-ai-primary, #0664b9);
}

/* --------------------------------------------------------------------------
   Lista de conversas
   -------------------------------------------------------------------------- */
.gw-ai-conv-list {
	flex: 1;
	overflow-y: auto;
	padding: 8px;
	scrollbar-width: thin;
	scrollbar-color: var(--gw-ai-border, rgba(0,161,213,0.2)) transparent;
}

.gw-ai-conv-list::-webkit-scrollbar { width: 4px; }
.gw-ai-conv-list::-webkit-scrollbar-track { background: transparent; }
.gw-ai-conv-list::-webkit-scrollbar-thumb {
	background: var(--gw-ai-border, rgba(0,161,213,0.2));
	border-radius: 4px;
}

.gw-ai-conv-loading,
.gw-ai-conv-empty {
	padding: 16px 10px;
	color: var(--gw-ai-sidebar-text, rgba(245,247,255,0.4));
	font-size: 13px;
	opacity: 0.7;
}

/* Item de conversa */
.gw-ai-conv-item {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 9px 10px;
	border-radius: 8px;
	cursor: pointer;
	transition: background 0.15s;
	position: relative;
	border-left: 2px solid transparent;
}

.gw-ai-conv-item:hover {
	background: var(--gw-ai-sidebar-hover-bg, rgba(6,100,185,0.09));
}

.gw-ai-conv-item.active {
	background: var(--gw-ai-sidebar-active-bg, rgba(6,100,185,0.18));
	border-left-color: var(--gw-ai-primary, #0664b9);
}

.gw-ai-conv-title {
	flex: 1;
	font-size: 13px;
	color: var(--gw-ai-sidebar-text, rgba(245,247,255,0.65));
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	outline: none;
}

.gw-ai-conv-item.active .gw-ai-conv-title {
	color: var(--gw-ai-text, #f5f7ff);
	font-weight: 500;
}

.gw-ai-conv-title[contenteditable="true"] {
	background: var(--gw-ai-sidebar-hover-bg, rgba(6,100,185,0.08));
	border-radius: 4px;
	padding: 2px 4px;
	white-space: nowrap;
	overflow: hidden;
}

.gw-ai-conv-actions {
	display: none;
	gap: 2px;
	flex-shrink: 0;
}

.gw-ai-conv-item:hover .gw-ai-conv-actions,
.gw-ai-conv-item.active .gw-ai-conv-actions {
	display: flex;
}

.gw-ai-conv-action-btn {
	background: transparent;
	border: none;
	color: var(--gw-ai-sidebar-text, rgba(245,247,255,0.4));
	padding: 3px 4px;
	cursor: pointer;
	border-radius: 4px;
	display: flex;
	align-items: center;
	transition: color 0.15s, background 0.15s;
}

.gw-ai-conv-action-btn:hover {
	color: var(--gw-ai-text, #f5f7ff);
	background: var(--gw-ai-sidebar-hover-bg, rgba(6,100,185,0.1));
}

.gw-ai-conv-action-btn.delete:hover { color: #ff6b6b; }

/* --------------------------------------------------------------------------
   Toggle mobile
   -------------------------------------------------------------------------- */
.gw-ai-sidebar-toggle {
	display: none;
	position: absolute;
	top: 14px;
	left: 14px;
	z-index: 20;
	background: var(--gw-ai-sidebar, #070c17);
	border: 1px solid var(--gw-ai-border, rgba(0,161,213,0.2));
	color: var(--gw-ai-text, #f5f7ff);
	padding: 8px;
	border-radius: 9px;
	cursor: pointer;
	align-items: center;
	justify-content: center;
}

/* --------------------------------------------------------------------------
   Área principal
   -------------------------------------------------------------------------- */
.gw-ai-main {
	flex: 1;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background: var(--gw-ai-bg, #060911);
}

.gw-ai-messages {
	flex: 1;
	overflow-y: auto;
	padding: 28px 20px;
	scrollbar-width: thin;
	scrollbar-color: var(--gw-ai-border, rgba(0,161,213,0.15)) transparent;
}

.gw-ai-messages::-webkit-scrollbar { width: 5px; }
.gw-ai-messages::-webkit-scrollbar-track { background: transparent; }
.gw-ai-messages::-webkit-scrollbar-thumb {
	background: var(--gw-ai-border, rgba(0,161,213,0.15));
	border-radius: 4px;
}

/* --------------------------------------------------------------------------
   Estado vazio
   -------------------------------------------------------------------------- */
.gw-ai-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	height: 100%;
	gap: 20px;
	text-align: center;
	padding: 40px 20px;
}

.gw-ai-empty h2 {
	font-family: 'Sora', 'Inter', sans-serif;
	font-size: 24px;
	font-weight: 700;
	letter-spacing: -0.025em;
	color: var(--gw-ai-text, #f5f7ff);
}

.gw-ai-empty p {
	font-size: 14px;
	color: var(--gw-ai-sidebar-text, rgba(245,247,255,0.45));
	max-width: 300px;
	line-height: 1.65;
}

.gw-ai-empty-icon img {
	width: 84px;
	height: 84px;
	border-radius: 50%;
	object-fit: cover;
	box-shadow: 0 0 0 3px var(--gw-ai-border, rgba(0,161,213,0.25));
}

.gw-ai-empty-icon-placeholder {
	width: 84px;
	height: 84px;
	border-radius: 50%;
	/* Modo claro: fundo azul suave, ícone na cor primária */
	background: rgba(6,100,185,0.10);
	color: var(--gw-ai-primary, #0664b9);
	display: flex;
	align-items: center;
	justify-content: center;
	animation: gw-icon-glow 3s ease-in-out infinite;
}

.gw-ai-wrap.gw-ai-dark .gw-ai-empty-icon-placeholder {
	background: rgba(6,100,185,1);
	color: #fff;
}

@keyframes gw-icon-glow {
	0%, 100% { box-shadow: 0 0 0 6px var(--gw-ai-border, rgba(0,161,213,0.15)), 0 0 24px var(--gw-ai-border, rgba(0,161,213,0.1)); }
	50%       { box-shadow: 0 0 0 10px var(--gw-ai-border, rgba(0,161,213,0.08)), 0 0 40px var(--gw-ai-border, rgba(0,161,213,0.18)); }
}

/* --------------------------------------------------------------------------
   Mensagens
   -------------------------------------------------------------------------- */
.gw-ai-msg-wrap {
	display: flex;
	gap: 12px;
	max-width: 820px;
	margin: 0 auto 22px;
	animation: gw-msg-in 0.22s ease-out;
}

@keyframes gw-msg-in {
	from { opacity: 0; transform: translateY(8px); }
	to   { opacity: 1; transform: translateY(0); }
}

.gw-ai-msg-wrap.user { flex-direction: row-reverse; }

/* Avatar */
.gw-ai-msg-avatar {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	flex-shrink: 0;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 13px;
	font-weight: 600;
	margin-top: 2px;
}

.gw-ai-msg-avatar img { width: 100%; height: 100%; object-fit: cover; }

.gw-ai-msg-avatar.ai {
	background: var(--gw-ai-ai-avatar-bg, transparent);
	/* Ícone/letra em azul primário no modo claro (bg transparente) */
	color: var(--gw-ai-primary, #0664b9);
}

/* No modo escuro o avatar tem fundo sólido — ícone fica branco */
.gw-ai-wrap.gw-ai-dark .gw-ai-msg-avatar.ai {
	color: #fff;
}

.gw-ai-msg-avatar.user-avatar {
	background: var(--gw-ai-user-avatar-bg, rgba(6,100,185,0.25));
	color: var(--gw-ai-text, #f5f7ff);
}

/* Animação "pensando" */
.gw-ai-msg-avatar.thinking {
	animation: gw-pulse 1.4s ease-in-out infinite;
}

@keyframes gw-pulse {
	0%, 100% { box-shadow: 0 0 0 0 var(--gw-ai-ai-avatar-bg, rgba(6,100,185,0.4)); }
	50%       { box-shadow: 0 0 0 8px transparent; }
}

/* Conteúdo */
.gw-ai-msg-content { flex: 1; min-width: 0; }

.gw-ai-msg-name {
	font-size: 12px;
	color: var(--gw-ai-sidebar-text, rgba(245,247,255,0.4));
	margin-bottom: 5px;
	font-weight: 500;
}

.gw-ai-msg-wrap.user .gw-ai-msg-name { text-align: right; }

.gw-ai-msg-bubble {
	display: inline-block;
	max-width: 100%;
	padding: 12px 16px;
	border-radius: var(--gw-ai-radius-bubble, 14px);
	font-size: 14.5px;
	line-height: 1.65;
	word-break: break-word;
	border: 1px solid transparent;
}

/* Balão do usuário — usa exatamente a cor configurada no admin */
.gw-ai-msg-wrap.user .gw-ai-msg-content {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
}

.gw-ai-msg-wrap.user .gw-ai-msg-bubble {
	background: var(--gw-ai-user-msg, #0664b9);
	color: var(--gw-ai-user-text, #fff);
	border-bottom-right-radius: 4px;
}

/* Balão da IA — usa exatamente a cor configurada no admin */
.gw-ai-msg-wrap.assistant .gw-ai-msg-bubble {
	background: var(--gw-ai-ai-msg, #0d1525);
	color: var(--gw-ai-ai-text, #f5f7ff);
	border-bottom-left-radius: 4px;
	border-color: var(--gw-ai-border, rgba(0,161,213,0.12));
}

/* --------------------------------------------------------------------------
   Markdown dentro dos balões
   -------------------------------------------------------------------------- */
.gw-ai-msg-bubble p { margin-bottom: 10px; }
.gw-ai-msg-bubble p:last-child { margin-bottom: 0; }
.gw-ai-msg-bubble strong { font-weight: 600; }
.gw-ai-msg-bubble em { font-style: italic; }

.gw-ai-msg-bubble h1,
.gw-ai-msg-bubble h2,
.gw-ai-msg-bubble h3 {
	font-family: 'Sora', 'Inter', sans-serif;
	font-weight: 700;
	margin: 14px 0 6px;
	line-height: 1.3;
}
.gw-ai-msg-bubble h1 { font-size: 18px; }
.gw-ai-msg-bubble h2 { font-size: 16px; }
.gw-ai-msg-bubble h3 { font-size: 14px; }

.gw-ai-msg-bubble ul,
.gw-ai-msg-bubble ol { padding-left: 20px; margin-bottom: 10px; }
.gw-ai-msg-bubble li { margin-bottom: 4px; }

/* code/pre — modo claro (padrão): fundo cinza claro */
#gw-ai-chat .gw-ai-msg-bubble code,
.gw-ai-msg-bubble code {
	font-family: 'Fira Code', 'Consolas', 'Monaco', monospace !important;
	font-size: 13px !important;
	background: rgba(0,0,0,0.07) !important;
	background-color: rgba(0,0,0,0.07) !important;
	color: var(--gw-ai-ai-text, #111827) !important;
	padding: 2px 6px !important;
	border-radius: 4px !important;
	border: none !important;
}

#gw-ai-chat .gw-ai-msg-bubble pre,
.gw-ai-msg-bubble pre {
	background: rgba(0,0,0,0.05) !important;
	background-color: rgba(0,0,0,0.05) !important;
	color: var(--gw-ai-ai-text, #111827) !important;
	border: 1px solid var(--gw-ai-border, rgba(0,0,0,0.09)) !important;
	border-radius: 8px !important;
	padding: 14px 16px !important;
	overflow-x: auto;
	margin: 10px 0 !important;
}

#gw-ai-chat .gw-ai-msg-bubble pre code,
.gw-ai-msg-bubble pre code {
	background: transparent !important;
	background-color: transparent !important;
	padding: 0 !important;
	border: none !important;
}

/* code/pre — modo escuro: fundo preto translúcido */
#gw-ai-chat.gw-ai-dark .gw-ai-msg-bubble code {
	background: rgba(0,0,0,0.45) !important;
	background-color: rgba(0,0,0,0.45) !important;
	color: var(--gw-ai-ai-text, #f5f7ff) !important;
}

#gw-ai-chat.gw-ai-dark .gw-ai-msg-bubble pre {
	background: rgba(0,0,0,0.55) !important;
	background-color: rgba(0,0,0,0.55) !important;
	color: var(--gw-ai-ai-text, #f5f7ff) !important;
}

#gw-ai-chat.gw-ai-dark .gw-ai-msg-bubble pre code {
	background: transparent !important;
	background-color: transparent !important;
	color: var(--gw-ai-ai-text, #f5f7ff) !important;
}

.gw-ai-msg-bubble blockquote {
	border-left: 3px solid var(--gw-ai-primary, #0664b9);
	padding-left: 14px;
	margin: 10px 0;
	opacity: 0.8;
}

.gw-ai-msg-bubble a {
	color: var(--gw-ai-primary, #0664b9);
	text-decoration: underline;
}

.gw-ai-msg-bubble table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
	margin: 10px 0;
}

.gw-ai-msg-bubble th,
.gw-ai-msg-bubble td {
	padding: 7px 10px;
	border: 1px solid var(--gw-ai-border, rgba(0,161,213,0.1));
	text-align: left;
}

.gw-ai-msg-bubble th {
	background: var(--gw-ai-sidebar-active-bg, rgba(6,100,185,0.15));
	font-weight: 600;
}

/* --------------------------------------------------------------------------
   Input area — estilo Claude
   -------------------------------------------------------------------------- */
.gw-ai-input-area {
	padding: 0 20px 20px;
	background: var(--gw-ai-bg, #060911);
}

/* Separador suave entre mensagens e input */
.gw-ai-input-area::before {
	content: '';
	display: block;
	height: 1px;
	background: var(--gw-ai-border, rgba(0,161,213,0.1));
	margin-bottom: 16px;
}

/* Container do input — sempre visível, não some sem foco */
.gw-ai-input-wrap {
	display: flex;
	flex-direction: column;
	background: var(--gw-ai-input-bg, rgba(13,21,37,0.98));
	border: 1.5px solid var(--gw-ai-input-border, rgba(0,161,213,0.40));
	border-radius: var(--gw-ai-radius-input, 16px);
	padding: 14px 12px 10px 16px;
	box-shadow: 0 2px 16px rgba(0,0,0,0.25);
	transition: border-color 0.2s, box-shadow 0.2s;
}

.gw-ai-input-wrap:focus-within {
	border-color: var(--gw-ai-input-border-focus, #00a1d5);
	box-shadow: 0 0 0 3px var(--gw-ai-input-shadow-focus, rgba(0,161,213,0.18)),
	            0 2px 16px rgba(0,0,0,0.25);
}

/* ID duplo (#chat + #input) = especificidade (2,0,0) — vence qualquer CSS de tema */
#gw-ai-chat #gw-ai-input,
.gw-ai-wrap .gw-ai-input {
	background: transparent !important;
	background-color: transparent !important;
	background-image: none !important;
	border: none !important;
	border-radius: 0 !important;
	outline: none !important;
	box-shadow: none !important;
	-webkit-box-shadow: none !important;
	color: var(--gw-ai-input-text, #f5f7ff) !important;
	font-family: inherit !important;
	font-size: 15px !important;
	line-height: 1.55 !important;
	resize: none !important;
	max-height: 200px;
	min-height: 24px;
	overflow-y: auto;
	scrollbar-width: thin;
	width: 100% !important;
	padding: 0 !important;
	margin: 0 !important;
	display: block !important;
}

#gw-ai-chat #gw-ai-input::placeholder,
.gw-ai-wrap .gw-ai-input::placeholder {
	color: var(--gw-ai-placeholder, rgba(245,247,255,0.35)) !important;
	opacity: 1 !important;
}

/* Linha inferior: nome da IA (esquerda) + botão enviar (direita) */
.gw-ai-input-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-top: 10px;
}

.gw-ai-model-label {
	font-size: 12px;
	font-weight: 500;
	color: var(--gw-ai-sidebar-text, rgba(245,247,255,0.35));
	letter-spacing: 0.01em;
	user-select: none;
}

/* Botão enviar — circular, como Claude */
.gw-ai-wrap .gw-ai-send-btn {
	background: var(--gw-ai-send-bg, #0664b9) !important;
	background-color: var(--gw-ai-send-bg, #0664b9) !important;
	border: none !important;
	box-shadow: none !important;
	color: var(--gw-ai-send-text, #fff) !important;
	width: 34px;
	height: 34px;
	border-radius: var(--gw-ai-radius-send, 50%) !important;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: opacity 0.15s, transform 0.12s;
	padding: 0 !important;
	line-height: 1;
}

.gw-ai-send-btn:hover { opacity: 0.85; }
.gw-ai-send-btn:active { transform: scale(0.88); }
.gw-ai-send-btn:disabled {
	opacity: 0.25;
	cursor: not-allowed;
	transform: none;
}

.gw-ai-disclaimer {
	text-align: center;
	font-size: 11px;
	color: var(--gw-ai-sidebar-text, rgba(245,247,255,0.25));
	opacity: 0.55;
	margin-top: 10px;
}

/* --------------------------------------------------------------------------
   Modal de limite
   -------------------------------------------------------------------------- */
.gw-ai-modal {
	position: absolute;
	inset: 0;
	z-index: 100;
	display: flex;
	align-items: center;
	justify-content: center;
}

.gw-ai-modal[hidden] { display: none; }

.gw-ai-modal-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0,0,0,0.75);
	backdrop-filter: blur(6px);
}

.gw-ai-modal-box {
	position: relative;
	z-index: 1;
	background: var(--gw-ai-ai-msg, #0d1525);
	border: 1px solid var(--gw-ai-border, rgba(0,161,213,0.2));
	border-radius: calc(var(--gw-ai-radius-bubble, 14px) + 2px);
	padding: 36px;
	max-width: 480px;
	width: 90%;
	max-height: 80%;
	overflow-y: auto;
	animation: gw-modal-in 0.22s ease-out;
	color: var(--gw-ai-ai-text, #f5f7ff);
}

@keyframes gw-modal-in {
	from { opacity: 0; transform: scale(0.93) translateY(14px); }
	to   { opacity: 1; transform: scale(1) translateY(0); }
}

.gw-ai-modal-close {
	position: absolute;
	top: 14px;
	right: 14px;
	background: var(--gw-ai-sidebar-hover-bg, rgba(6,100,185,0.1));
	border: 1px solid var(--gw-ai-border, rgba(0,161,213,0.15));
	color: var(--gw-ai-sidebar-text, rgba(245,247,255,0.6));
	width: 30px;
	height: 30px;
	border-radius: 6px;
	cursor: pointer;
	font-size: 20px;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.15s, color 0.15s;
}

.gw-ai-modal-close:hover {
	background: var(--gw-ai-sidebar-active-bg, rgba(6,100,185,0.2));
	color: var(--gw-ai-text, #fff);
}

.gw-ai-modal-body h1,
.gw-ai-modal-body h2,
.gw-ai-modal-body h3 {
	font-family: 'Sora', 'Inter', sans-serif;
	font-weight: 700;
	color: var(--gw-ai-text, #f5f7ff);
	margin-bottom: 12px;
}

.gw-ai-modal-body p {
	margin-bottom: 12px;
	font-size: 14.5px;
	color: var(--gw-ai-ai-text, rgba(245,247,255,0.75));
	line-height: 1.65;
}

.gw-ai-modal-body a { color: var(--gw-ai-primary, #0664b9); }

/* --------------------------------------------------------------------------
   Botão de tema (claro/escuro)
   -------------------------------------------------------------------------- */
.gw-ai-theme-toggle {
	background: transparent;
	border: 1px solid var(--gw-ai-border, rgba(0,161,213,0.2));
	color: var(--gw-ai-brand-text, #f5f7ff);
	padding: 7px;
	border-radius: 8px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: background 0.2s, border-color 0.2s;
}

.gw-ai-theme-toggle:hover {
	background: var(--gw-ai-sidebar-hover-bg, rgba(6,100,185,0.09));
	border-color: var(--gw-ai-primary, #0664b9);
}

/* --------------------------------------------------------------------------
   Sidebar footer — nav menu
   -------------------------------------------------------------------------- */
.gw-ai-sidebar-footer {
	border-top: 1px solid var(--gw-ai-border, rgba(0,161,213,0.12));
	padding: 10px 8px;
	flex-shrink: 0;
}

.gw-ai-sidebar-footer-label {
	display: block;
	font-size: 10px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--gw-ai-sidebar-text, rgba(245,247,255,0.4));
	padding: 0 8px 6px;
	opacity: 0.6;
}

.gw-ai-nav-menu {
	list-style: none;
	padding: 0;
	margin: 0;
}

.gw-ai-nav-menu li { position: relative; }

.gw-ai-nav-menu li a {
	display: flex;
	align-items: center;
	padding: 8px 10px;
	border-radius: 8px;
	font-size: 13px;
	color: var(--gw-ai-sidebar-text, rgba(245,247,255,0.65));
	text-decoration: none !important;
	transition: background 0.15s, color 0.15s;
	gap: 8px;
}

.gw-ai-nav-menu li a:hover {
	background: var(--gw-ai-sidebar-hover-bg, rgba(6,100,185,0.09));
	color: var(--gw-ai-text, #f5f7ff);
}

/* Sub-menus — ocultar */
.gw-ai-nav-menu .sub-menu { display: none; }

/* --------------------------------------------------------------------------
   Turnstile Gate (verificação para anônimos)
   -------------------------------------------------------------------------- */
.gw-ai-turnstile-gate {
	position: absolute;
	inset: 0;
	z-index: 200;
	display: flex;
	align-items: center;
	justify-content: center;
	/* fallbacks = tema claro (padrão) */
	background: var(--gw-ai-bg, #f4f6fb);
}

.gw-ai-turnstile-box {
	text-align: center;
	padding: 40px 32px;
	background: var(--gw-ai-ai-msg, #ffffff);
	border: 1px solid var(--gw-ai-border, rgba(0,0,0,0.09));
	border-radius: calc(var(--gw-ai-radius-bubble, 14px) + 4px);
	box-shadow: 0 4px 24px rgba(0,0,0,0.08);
	max-width: 360px;
	width: 90%;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
}

.gw-ai-turnstile-icon {
	width: 56px;
	height: 56px;
	border-radius: 50%;
	background: rgba(6,100,185,0.10);
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--gw-ai-primary, #0664b9);
	flex-shrink: 0;
}

/* Ícone branco sobre fundo sólido no modo escuro */
.gw-ai-wrap.gw-ai-dark .gw-ai-turnstile-icon {
	background: rgba(6,100,185,1);
	color: #fff;
}

.gw-ai-turnstile-box h3 {
	font-family: 'Sora', 'Inter', sans-serif;
	font-weight: 700;
	font-size: 20px;
	color: var(--gw-ai-text, #111827);
	margin: 0;
}

.gw-ai-turnstile-box p {
	font-size: 13.5px;
	color: var(--gw-ai-sidebar-text, rgba(17,24,39,0.60));
	line-height: 1.6;
	margin: 0;
}

.gw-ai-turnstile-error {
	font-size: 13px;
	color: #dc2626;
	margin: 0;
}

/* --------------------------------------------------------------------------
   Tema Escuro — sobrescreve variáveis quando .gw-ai-dark está ativo
   (padrão do sistema é o tema claro; escuro é o alternativo)
   -------------------------------------------------------------------------- */
#gw-ai-chat.gw-ai-dark.gw-ai-wrap {
	--gw-ai-bg:                   #060911;
	--gw-ai-sidebar:              #070c17;
	--gw-ai-primary:              #0664b9;
	--gw-ai-text:                 #f5f7ff;
	--gw-ai-border:               rgba(0,161,213,0.15);

	--gw-ai-sidebar-text:         rgba(245,247,255,0.65);
	--gw-ai-sidebar-active-bg:    rgba(6,100,185,0.18);
	--gw-ai-sidebar-hover-bg:     rgba(6,100,185,0.09);
	--gw-ai-brand-text:           #f5f7ff;

	--gw-ai-user-msg:             #0664b9;
	--gw-ai-user-text:            #ffffff;
	--gw-ai-ai-msg:               #0d1525;
	--gw-ai-ai-text:              #f5f7ff;

	--gw-ai-ai-avatar-bg:         rgba(6,100,185,1);
	--gw-ai-user-avatar-bg:       rgba(6,100,185,0.25);

	--gw-ai-input-bg:             rgba(13,21,37,0.98);
	--gw-ai-input-border:         rgba(0,161,213,0.40);
	--gw-ai-input-text:           #f5f7ff;
	--gw-ai-placeholder:          rgba(245,247,255,0.35);

	--gw-ai-input-bg-focus:       rgba(13,21,37,1);
	--gw-ai-input-border-focus:   #00a1d5;
	--gw-ai-input-shadow-focus:   rgba(0,161,213,0.18);

	--gw-ai-send-bg:              #0664b9;
	--gw-ai-send-text:            #ffffff;
}

/* Sidebar com borda sutil no modo claro (padrão) */
#gw-ai-chat:not(.gw-ai-dark) .gw-ai-sidebar {
	box-shadow: 1px 0 0 0 rgba(0,0,0,0.08);
}

/* Input text no modo claro */
#gw-ai-chat:not(.gw-ai-dark) #gw-ai-input {
	color: #111827 !important;
}

/* --------------------------------------------------------------------------
   Responsivo — Mobile
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
	.gw-ai-sidebar {
		position: absolute;
		top: 0;
		left: 0;
		height: 100%;
		transform: translateX(-100%);
	}

	.gw-ai-sidebar.open {
		transform: translateX(0);
		box-shadow: 4px 0 32px rgba(0,0,0,0.6);
	}

	.gw-ai-sidebar-toggle { display: flex; }

	.gw-ai-main { width: 100%; }

	.gw-ai-messages { padding: 56px 14px 14px; }

	.gw-ai-modal-box { padding: 24px 18px; }
}

/* --------------------------------------------------------------------------
   Aviso flutuante (rede mudou, fila cheia, histórico vinculado)
   -------------------------------------------------------------------------- */
.gw-ai-toast {
	position: absolute;
	left: 50%;
	bottom: 108px;
	transform: translateX(-50%);
	z-index: 90;
	max-width: min(460px, 88%);
	padding: 11px 18px;
	border-radius: 10px;
	font-size: 13.5px;
	line-height: 1.5;
	text-align: center;
	background: var(--gw-ai-ai-msg, #ffffff);
	color: var(--gw-ai-ai-text, #111827);
	border: 1px solid var(--gw-ai-border, rgba(0,0,0,0.09));
	box-shadow: 0 6px 24px rgba(0,0,0,0.16);
	animation: gw-toast-in 0.22s ease-out;
}

.gw-ai-toast[hidden] { display: none; }

.gw-ai-toast.is-ok    { border-left: 3px solid #00a86b; }
.gw-ai-toast.is-warn  { border-left: 3px solid #fb831b; }
.gw-ai-toast.is-error { border-left: 3px solid #dc2626; }

@keyframes gw-toast-in {
	from { opacity: 0; transform: translate(-50%, 10px); }
	to   { opacity: 1; transform: translate(-50%, 0); }
}

/* Texto do "pensando" */
.gw-ai-thinking-text {
	opacity: 0.55;
	font-style: italic;
}

/* Markdown — riscado e tabelas roláveis em telas estreitas */
.gw-ai-msg-bubble del { opacity: 0.7; }

.gw-ai-msg-bubble table { display: block; overflow-x: auto; white-space: nowrap; }
.gw-ai-msg-bubble table th,
.gw-ai-msg-bubble table td { white-space: normal; }

/* Listas aninhadas */
.gw-ai-msg-bubble li > ul,
.gw-ai-msg-bubble li > ol { margin-top: 4px; margin-bottom: 0; }

@media (max-width: 640px) {
	.gw-ai-toast { bottom: 124px; }
}
