/* ============================================================
   Eleições 2026 — Clube dos Plugins · public stylesheet
   Tema padrão: branco/minimalista. Cores via CSS variables
   injetadas pela tela Configurações (admin).
   ============================================================ */

:root {
	--cdp-primary: #1d4ed8;
	--cdp-secondary: #0ea5e9;
	--cdp-bg: #ffffff;
	--cdp-surface: #ffffff;
	--cdp-surface-2: #f8fafc;
	--cdp-text: #0f172a;
	--cdp-text-muted: #64748b;
	--cdp-accent: #f59e0b;
	--cdp-success: #16a34a;
	--cdp-danger: #dc2626;
	--cdp-border: #e5e7eb;
	--cdp-radius: 10px;
	--cdp-radius-sm: 6px;
	--cdp-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
	--cdp-shadow-lg: 0 4px 16px rgba(15, 23, 42, 0.08);
	--cdp-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.cdp-eleicoes-root, .cdp-eleicoes-root * { box-sizing: border-box; }
.cdp-eleicoes-root {
	font-family: var(--cdp-font);
	color: var(--cdp-text);
	background: var(--cdp-bg);
	line-height: 1.5;
	max-width: 1200px;
	margin: 0 auto;
}

/* Hero / explanatory header */
.cdp-hero {
	padding: 2.5rem 2rem;
	border-radius: var(--cdp-radius);
	background: linear-gradient(135deg, var(--cdp-primary) 0%, var(--cdp-secondary) 100%);
	color: #fff;
	margin-bottom: 1.5rem;
	position: relative;
	overflow: hidden;
}
.cdp-hero::before {
	content: ""; position: absolute; inset: 0; opacity: .08;
	background-image: radial-gradient(circle at 1px 1px, #fff 1px, transparent 0);
	background-size: 24px 24px;
	pointer-events: none;
}
.cdp-hero-eyebrow {
	display: inline-block;
	font-size: .75rem; font-weight: 600; text-transform: uppercase;
	letter-spacing: .12em;
	padding: .25rem .625rem;
	background: rgba(255,255,255,.18);
	border-radius: 999px;
	margin-bottom: 1rem;
}
.cdp-hero-title {
	font-size: 2.25rem; font-weight: 800; line-height: 1.1;
	margin: 0 0 .75rem; letter-spacing: -0.02em;
	max-width: 720px;
}
.cdp-hero-sub {
	font-size: 1.0625rem; line-height: 1.55;
	max-width: 720px; opacity: .92; margin: 0;
}
.cdp-hero-pills {
	display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.5rem;
}
.cdp-hero-pill {
	font-size: .8125rem; padding: .375rem .75rem;
	background: rgba(255,255,255,.16);
	border: 1px solid rgba(255,255,255,.22);
	border-radius: 999px; color: #fff;
}
.cdp-hero-pill .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: .375rem; vertical-align: middle; }
.cdp-hero-pill.live .dot { background: #4ade80; box-shadow: 0 0 0 3px rgba(74,222,128,.3); animation: cdp-pulse 2s ease-in-out infinite; }
.cdp-hero-pill.soon .dot { background: #fbbf24; }
@keyframes cdp-pulse { 50% { box-shadow: 0 0 0 6px rgba(74,222,128,0); } }

/* Headings */
.cdp-h1 { font-size: 2rem; margin: 0 0 .25rem; font-weight: 700; letter-spacing: -0.02em; }
.cdp-h2 { font-size: 1.25rem; margin: 0 0 1rem; font-weight: 600; }
.cdp-h3 { font-size: 0.85rem; margin: 0 0 .5rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--cdp-text-muted); }
.cdp-lead { color: var(--cdp-text-muted); margin: 0 0 1.5rem; font-size: 1rem; }

/* Cards / surfaces */
.cdp-card {
	background: var(--cdp-surface);
	border: 1px solid var(--cdp-border);
	border-radius: var(--cdp-radius);
	padding: 1.25rem;
	box-shadow: var(--cdp-shadow);
}
.cdp-card + .cdp-card { margin-top: 1rem; }

/* Layout */
.cdp-grid-3 {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 1rem;
}
.cdp-grid-2 {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 1rem;
}
.cdp-grid-2-wide { grid-template-columns: 1.4fr 1fr; }
@media (max-width: 900px) {
	.cdp-grid-3, .cdp-grid-2, .cdp-grid-2-wide { grid-template-columns: 1fr; }
}

/* Mobile tightening */
@media (max-width: 640px) {
	.cdp-hero { padding: 1.5rem 1.25rem; }
	.cdp-hero-title, .cdp-eleicoes-root h1 { font-size: 1.5rem; }
	.cdp-hero-sub, .cdp-eleicoes-root .cdp-hero p { font-size: .9375rem; }
	.cdp-card { padding: 1rem; }
	.cdp-kpi-value { font-size: 1.75rem; }
	.cdp-ranking-wrap { overflow-x: visible; }
	.cdp-ranking { min-width: 0; width: 100%; }
	.cdp-ranking th, .cdp-ranking td { padding: .5rem .375rem; font-size: .8125rem; }
	.cdp-ranking td[data-col="sentimento"],
	.cdp-ranking th[data-col="sentimento"],
	.cdp-ranking td[data-col="pesquisas"],
	.cdp-ranking th[data-col="pesquisas"],
	.cdp-ranking td[data-col="2022"],
	.cdp-ranking th[data-col="2022"] { display: none; }
	.cdp-ranking .cdp-avatar { width: 26px !important; height: 26px !important; font-size: .625rem !important; }
	.cdp-ranking td a strong { font-size: .8125rem; }
}

/* KPI */
.cdp-kpi { display: flex; flex-direction: column; gap: .25rem; }
.cdp-kpi-value { font-size: 2.25rem; font-weight: 700; line-height: 1; letter-spacing: -0.02em; }
.cdp-kpi-label { font-size: .8125rem; color: var(--cdp-text-muted); text-transform: uppercase; letter-spacing: .04em; }
.cdp-kpi-delta { font-size: .875rem; }
.cdp-kpi-delta.up { color: var(--cdp-success); }
.cdp-kpi-delta.down { color: var(--cdp-danger); }

/* Avatar (deterministic color) — uses inline style for bg/fg/size */
.cdp-avatar {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	font-weight: 700;
	font-size: .75rem;
	letter-spacing: .02em;
	flex-shrink: 0;
}

/* Party badge — uses inline style for color */
.cdp-partido {
	display: inline-block;
	padding: .125rem .5rem;
	border-radius: 4px;
	font-size: .75rem;
	font-weight: 700;
	letter-spacing: .02em;
	line-height: 1.4;
	white-space: nowrap;
}

/* Badges */
.cdp-badge {
	display: inline-flex; align-items: center; gap: .25rem;
	padding: .125rem .5rem;
	border-radius: 999px;
	font-size: .75rem; font-weight: 500;
	background: var(--cdp-surface-2);
	color: var(--cdp-text-muted);
	border: 1px solid var(--cdp-border);
}
.cdp-badge.fresh   { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.cdp-badge.stale   { background: #fefce8; color: #854d0e; border-color: #fde68a; }
.cdp-badge.expired { background: #fef2f2; color: #991b1b; border-color: #fecaca; }

/* Sentiment gauge (-1 to +1) */
.cdp-sentiment {
	display: flex; align-items: center; gap: .75rem;
}
.cdp-sentiment-bar {
	position: relative; flex: 1; height: 8px;
	background: linear-gradient(90deg, #fca5a5 0%, #e5e7eb 50%, #86efac 100%);
	border-radius: 999px;
}
.cdp-sentiment-marker {
	position: absolute; top: -3px;
	width: 14px; height: 14px; border-radius: 50%;
	background: var(--cdp-surface); border: 2px solid var(--cdp-text);
	transform: translateX(-50%);
}

/* Candidate card */
.cdp-candidato-card {
	display: grid;
	gap: 1rem;
}
.cdp-candidato-header {
	display: flex; align-items: center; gap: 1rem;
	padding-bottom: 1rem; border-bottom: 1px solid var(--cdp-border);
}
.cdp-candidato-avatar {
	width: 64px; height: 64px; border-radius: 50%;
	background: var(--cdp-surface-2);
	display: flex; align-items: center; justify-content: center;
	font-weight: 700; font-size: 1.5rem; color: var(--cdp-text-muted);
	flex-shrink: 0;
}
.cdp-candidato-info h2 { margin: 0; font-size: 1.5rem; font-weight: 700; }
.cdp-candidato-meta { color: var(--cdp-text-muted); font-size: .875rem; margin-top: .25rem; }

/* Search */
.cdp-search { position: relative; }
.cdp-search input {
	width: 100%; padding: .75rem 1rem;
	font-size: 1rem; font-family: inherit;
	border: 1px solid var(--cdp-border);
	border-radius: var(--cdp-radius-sm);
	background: var(--cdp-surface);
	color: var(--cdp-text);
}
.cdp-search input:focus { outline: 2px solid var(--cdp-primary); outline-offset: 1px; }
.cdp-search-results {
	position: absolute; top: 100%; left: 0; right: 0;
	background: var(--cdp-surface);
	border: 1px solid var(--cdp-border);
	border-radius: var(--cdp-radius-sm);
	box-shadow: var(--cdp-shadow-lg);
	max-height: 320px; overflow-y: auto;
	margin-top: 4px; z-index: 100;
	display: none;
}
.cdp-search-results.open { display: block; }
.cdp-search-result {
	display: block; padding: .625rem .875rem;
	color: inherit; text-decoration: none;
	border-bottom: 1px solid var(--cdp-border);
	cursor: pointer;
}
.cdp-search-result:last-child { border-bottom: none; }
.cdp-search-result:hover, .cdp-search-result.active { background: var(--cdp-surface-2); }
.cdp-search-result-name { font-weight: 600; }
.cdp-search-result-meta { font-size: .75rem; color: var(--cdp-text-muted); }

/* Ranking table */
.cdp-ranking { width: 100%; border-collapse: collapse; }
.cdp-ranking th, .cdp-ranking td {
	padding: .75rem .875rem;
	text-align: left;
	border-bottom: 1px solid var(--cdp-border);
}
.cdp-ranking th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--cdp-text-muted); }
.cdp-ranking td.num { text-align: right; font-variant-numeric: tabular-nums; }
.cdp-ranking tbody tr:hover { background: var(--cdp-surface-2); }

/* Footer/credits */
.cdp-credits {
	font-size: .75rem; color: var(--cdp-text-muted);
	margin-top: 1.5rem; padding-top: 1rem;
	border-top: 1px solid var(--cdp-border);
	text-align: center;
}
.cdp-credits a { color: var(--cdp-primary); text-decoration: none; }

/* Skeleton loading */
.cdp-skeleton {
	background: linear-gradient(90deg, var(--cdp-surface-2) 0%, var(--cdp-border) 50%, var(--cdp-surface-2) 100%);
	background-size: 200% 100%;
	animation: cdp-shimmer 1.4s ease-in-out infinite;
	border-radius: var(--cdp-radius-sm);
	min-height: 1em;
}
@keyframes cdp-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Chart container */
.cdp-chart { position: relative; height: 220px; }

/* Empty/placeholder */
.cdp-empty {
	padding: 2rem; text-align: center;
	color: var(--cdp-text-muted);
	background: var(--cdp-surface-2);
	border-radius: var(--cdp-radius-sm);
	border: 1px dashed var(--cdp-border);
}

/* Utilities */
.cdp-stack > * + * { margin-top: 1rem; }
.cdp-row { display: flex; align-items: center; gap: .5rem; }
.cdp-row.between { justify-content: space-between; }
.cdp-muted { color: var(--cdp-text-muted); }
.cdp-mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
