/* =====================================================================
   Insights › Dados IDEX — "janela" do produto IDEX Analytics embutida.
   FUNDO AZUL (#0080FF) = contraste "site dentro do site"; elementos CLAROS
   (painel/cards/CTA brancos) + logo/textos brancos sobre o azul.
   Logo oficial: assets/svg/idex-logo.svg. Ref.: idexanalytics.com.br
   ===================================================================== */
.page-insights .ins-idex {
	--idex-blue: #0080ff;   /* campo azul (fundo) */
	--idex-card: #ffffff;   /* painel/cards CLAROS sobre o azul */
	--idex-ink:  #0e1b2a;   /* texto escuro nos cards claros */
	--idex-mut:  rgba(14,27,42,.58);  /* texto secundário nos cards */
	--idex-line: rgba(255,255,255,.32);
	background: var(--idex-blue);
	padding-block: clamp(2.25rem, 1.5rem + 3vw, 56px) clamp(3rem, 2rem + 4vw, 80px);
}
.page-insights .ins-idex .stage { display: flex; flex-direction: column; }

/* --- Faixa de marca (sobre o azul) --- */
.page-insights .idex-bar {
	padding-bottom: clamp(1.25rem, 1rem + 1.5vw, 28px);
	margin-bottom: clamp(1.25rem, 1rem + 1.5vw, 28px);
	border-bottom: 1px solid var(--idex-line);
}
.page-insights .idex-bar__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1.5rem;
	flex-wrap: wrap;
}
.page-insights .idex-logo { display: inline-flex; align-items: center; }
.page-insights .idex-logo__svg { height: clamp(26px, 22px + 1vw, 34px); width: auto; display: block; }

/* CTA: pílula BRANCA (texto azul) sobre o azul */
.page-insights .idex-bar__cta {
	display: inline-flex;
	align-items: center;
	gap: 9px;
	white-space: nowrap;
	height: 46px;
	padding: 0 22px;
	border-radius: 999px;
	background: var(--idex-card);
	color: var(--idex-blue);
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	transition: transform .25s var(--ease), background .25s var(--ease);
}
.page-insights .idex-bar__cta:hover { background: #eaf3ff; transform: translateY(-1px); }
.page-insights .idex-bar__cta svg { width: 17px; height: 17px; }
.page-insights .idex-bar__desc {
	margin: clamp(1rem, .8rem + 1vw, 20px) 0 0;
	max-width: 92ch;
	font-size: clamp(14px, 13px + .35vw, 16px);
	font-weight: 500;
	line-height: 1.6;
	color: #fff;
}

/* --- Painel de dados (claro) --- */
.page-insights .ins-idex__panel {
	position: relative;
	background: var(--idex-card);
	border-radius: 16px;
	padding: clamp(1.5rem, 1rem + 2vw, 36px) clamp(1.25rem, 1rem + 2vw, 40px);
	box-shadow: 0 18px 40px rgba(7, 35, 70, .18);
}
.page-insights .ins-idex__chart {
	display: grid;
	grid-template-columns: 56px 1fr;
	grid-template-rows: 1fr auto;
	gap: 8px 14px;
	min-height: 320px;
}
.page-insights .ins-idex__yaxis {
	grid-row: 1;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	font-size: 10px;
	font-weight: 500;
	color: var(--idex-mut);
}
.page-insights .ins-idex__svg { grid-column: 2; grid-row: 1; width: 100%; height: 100%; }
.page-insights .ins-idex__xaxis {
	grid-column: 2; grid-row: 2;
	display: flex;
	justify-content: space-between;
	font-size: 10px;
	font-weight: 500;
	color: var(--idex-mut);
}
.page-insights .ins-idex__caption {
	margin-top: clamp(1rem, .8rem + 1vw, 24px);
	font-size: 10.8px;
	font-weight: 500;
	color: var(--idex-mut);
}

/* --- Stats (cards claros, número azul) --- */
.page-insights .ins-idex__stats {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: clamp(1rem, .8rem + 1vw, 18px);
	margin-top: clamp(1.25rem, 1rem + 1.5vw, 24px);
}
.page-insights .ins-stat {
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 10px;
	min-height: 110px;
	padding: 24px 28px;
	border-radius: 14px;
	background: var(--idex-card);
	color: var(--idex-ink);
	box-shadow: 0 12px 30px rgba(7, 35, 70, .16);
}
.page-insights .ins-stat__v { font-size: clamp(1.4rem, 1rem + 1.2vw, 30px); font-weight: 700; line-height: 1; color: var(--idex-blue); }
.page-insights .ins-stat__l { font-size: 12.6px; font-weight: 400; color: var(--idex-mut); }

@media (max-width: 980px) {
	.page-insights .ins-idex__stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 680px) {
	.page-insights .idex-bar__head { flex-direction: column; align-items: flex-start; gap: 1rem; }
	.page-insights .ins-idex__stats { grid-template-columns: 1fr; }
}

/* Gráfico ao vivo via Chart.js (2026-06-24): dados do proxy IDEX → render local.
   Substitui o SVG ilustrativo. Altura fixa pra evitar layout shift do canvas. */
.page-insights .ins-idex__chart--live {
	display: block;
	background: #fff;
	border-radius: 10px;
	padding: clamp(1rem, .8rem + 1vw, 1.6rem) clamp(1rem, .8rem + 1vw, 1.6rem) clamp(.5rem, .4rem + .5vw, .8rem);
	position: relative;
	height: clamp(340px, 26vw, 480px);
	border: 1px solid rgba(255,255,255,.08);
}
.page-insights .ins-idex__chart--live canvas {
	display: block; width: 100% !important; height: 100% !important;
}
.page-insights .ins-idex__chart--live .ins-idex__caption {
	color: rgba(0,0,0,.55); margin: .8rem 0 0; font-size: 12.5px; text-align: center;
}
@media (max-width: 760px) {
	.page-insights .ins-idex__chart--live { height: clamp(300px, 60vw, 400px); }
}

/* Controles do gráfico IDEX (filtros 1M/3M/6M/12M/Máx) + readout (2026-06-24)
   IMPORTANTE: os controles ficam DENTRO do painel branco (ins-idex__panel),
   então as cores precisam contrastar com fundo CLARO, não com o azul. */
.page-insights .ins-idex__controls {
	display: flex; align-items: center; justify-content: space-between;
	gap: 1rem; flex-wrap: wrap;
	margin-bottom: clamp(.8rem, .6rem + .6vw, 1rem);
}
.page-insights .ins-idex__periods {
	display: inline-flex; align-items: center; gap: 2px;
	padding: 4px; border-radius: 999px;
	background: rgba(14,27,42,.06);                /* cinza-azulado claro sobre branco */
}
.page-insights .ins-idex__periods button {
	appearance: none; border: 0; background: transparent;
	color: var(--idex-ink, #0e1b2a);                /* texto escuro */
	font-family: inherit; font-size: 12.5px; font-weight: 500;
	padding: 6px 14px; border-radius: 999px;
	cursor: pointer; transition: background .2s, color .2s, opacity .2s;
}
.page-insights .ins-idex__periods button:hover:not([disabled]) { background: rgba(14,27,42,.10); }
.page-insights .ins-idex__periods button.is-active {
	background: var(--idex-blue, #0080ff);
	color: #fff;
}
.page-insights .ins-idex__periods button[disabled] { opacity: .35; cursor: not-allowed; }

.page-insights .ins-idex__readout {
	display: inline-flex; gap: 14px;
	font-size: 12.5px; color: var(--idex-mut, rgba(14,27,42,.58));
}
.page-insights .ins-idex__readout .rd-fund { font-weight: 600; color: var(--idex-ink, #0e1b2a); }
.page-insights .ins-idex__readout .rd-bench { color: var(--idex-mut, rgba(14,27,42,.58)); }

/* Loader sobreposto enquanto o fetch está em curso. */
.page-insights .ins-idex__chart--live { position: relative; }
.page-insights .ins-idex__loader {
	position: absolute; inset: 0; z-index: 2;
	display: flex; flex-direction: column; align-items: center; justify-content: center;
	gap: 14px; background: #fff; border-radius: 10px;
	transition: opacity .3s ease;
}
.page-insights .ins-idex__loader.is-hidden { opacity: 0; pointer-events: none; }
.page-insights .ins-idex__spinner {
	width: 32px; height: 32px;
	border: 2.5px solid rgba(0,128,255,.18);
	border-top-color: #0080ff;
	border-radius: 50%;
	animation: leto-idex-spin 0.8s linear infinite;
}
.page-insights .ins-idex__loader-text { font-size: 13px; color: var(--leto-gray, #666); font-weight: 500; }
@keyframes leto-idex-spin { to { transform: rotate(360deg); } }
