/**
 * Cleatz Election Markets — styles
 * Dark, refined prediction-market grid. Scoped under .cleatz-election so
 * nothing leaks into the host theme. Kalshi green / Polymarket blue accents.
 */

.cleatz-election {
	--celec-bg:        #0a0b0d;
	--celec-card:      #121317;
	--celec-card-2:    #16181d;
	--celec-line:      #24262d;
	--celec-line-soft: #1b1d22;
	--celec-text:      #e9eaee;
	--celec-text-dim:  #8a8e98;
	--celec-text-mute: #5b5f69;
	--celec-kalshi:    #00a86b;
	--celec-kalshi-bg: rgba(0, 168, 107, 0.10);
	--celec-poly:      #2d9cdb;
	--celec-poly-bg:   rgba(45, 156, 219, 0.10);
	--celec-up:        #2ecc71;
	--celec-down:      #e35d6a;
	--celec-radius:    14px;

	background: var(--celec-bg);
	color: var(--celec-text);
	border-radius: var(--celec-radius);
	padding: 22px;
	font-family: ui-sans-serif, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 15px;
	line-height: 1.45;
	-webkit-font-smoothing: antialiased;
	box-sizing: border-box;
}
.cleatz-election *, .cleatz-election *::before, .cleatz-election *::after { box-sizing: border-box; }

/* ---- Loading / error ---- */
.celec-loading {
	display: flex; align-items: center; gap: 12px;
	padding: 40px 8px; color: var(--celec-text-dim);
}
.celec-loading__spinner {
	width: 18px; height: 18px; border-radius: 50%;
	border: 2px solid var(--celec-line); border-top-color: var(--celec-kalshi);
	animation: celec-spin 0.7s linear infinite;
}
@keyframes celec-spin { to { transform: rotate(360deg); } }
.celec-error, .celec-noscript {
	padding: 24px; color: var(--celec-text-dim);
	border: 1px solid var(--celec-line); border-radius: 10px;
}

/* ---- Header ---- */
.celec-head {
	display: flex; align-items: center; justify-content: space-between;
	gap: 16px; margin-bottom: 18px; flex-wrap: wrap;
}
.celec-head__title {
	font-size: 22px; font-weight: 700; letter-spacing: -0.02em;
}
.celec-head__controls { display: flex; align-items: center; gap: 16px; }

/* Toggle */
.celec-toggle { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.celec-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.celec-toggle__track {
	width: 38px; height: 22px; border-radius: 999px; background: var(--celec-line);
	position: relative; transition: background 0.18s ease;
}
.celec-toggle__thumb {
	position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
	border-radius: 50%; background: #fff; transition: transform 0.18s ease;
}
.celec-toggle input:checked + .celec-toggle__track { background: var(--celec-kalshi); }
.celec-toggle input:checked + .celec-toggle__track .celec-toggle__thumb { transform: translateX(16px); }
.celec-toggle__label { font-size: 13.5px; color: var(--celec-text-dim); }

/* ---- Category tabs ---- */
.celec-tabs {
	display: flex; gap: 4px; margin-bottom: 16px; flex-wrap: wrap;
	border-bottom: 1px solid var(--celec-line-soft); padding-bottom: 2px;
}
.celec-tab {
	background: none; border: none; cursor: pointer;
	font-family: inherit; font-size: 14px; font-weight: 550;
	color: var(--celec-text-dim); padding: 8px 14px; border-radius: 8px 8px 0 0;
	border-bottom: 2px solid transparent; margin-bottom: -3px;
	transition: color 0.14s ease, border-color 0.14s ease;
}
.celec-tab:hover { color: var(--celec-text); }
.celec-tab.is-active { color: var(--celec-text); border-bottom-color: var(--celec-kalshi); }

/* ---- Empty state ---- */
.celec-empty {
	grid-column: 1 / -1; padding: 28px; text-align: center;
	color: var(--celec-text-mute); font-size: 14px;
}

/* ---- Combo rows (balance of power: long scenario labels) ---- */
.celec-rows--combo .celec-row__name {
	font-size: 13px; white-space: normal; line-height: 1.35;
}
.celec-row--combo { align-items: flex-start; }
.celec-row--combo .celec-row__pcts { margin-top: 1px; }

/* ---- Grid ---- */
.celec-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
	gap: 16px;
}

/* ---- Card ---- */
.celec-card {
	background: var(--celec-card);
	border: 1px solid var(--celec-line-soft);
	border-radius: var(--celec-radius);
	padding: 18px 18px 14px;
	display: flex; flex-direction: column;
	transition: border-color 0.16s ease, transform 0.16s ease;
}
.celec-card:hover { border-color: var(--celec-line); }
.celec-card.is-expanded { border-color: var(--celec-line); }

.celec-card__head {
	display: flex; align-items: flex-start; justify-content: space-between;
	gap: 12px; margin-bottom: 14px;
}
.celec-card__title { font-size: 16.5px; font-weight: 650; letter-spacing: -0.01em; line-height: 1.3; }
.celec-card__date { font-size: 12.5px; color: var(--celec-text-mute); margin-top: 3px; }
.celec-card__plat { display: flex; gap: 5px; flex-shrink: 0; }
.celec-pdot {
	width: 22px; height: 22px; border-radius: 6px; font-size: 11px; font-weight: 700;
	display: inline-flex; align-items: center; justify-content: center;
}
.celec-pdot--kalshi { background: var(--celec-kalshi-bg); color: var(--celec-kalshi); }
.celec-pdot--poly   { background: var(--celec-poly-bg);   color: var(--celec-poly); }

/* ---- Rows ---- */
.celec-rows { display: flex; flex-direction: column; gap: 2px; }
.celec-row {
	display: flex; align-items: center; justify-content: space-between;
	gap: 12px; padding: 8px 0; border-top: 1px solid var(--celec-line-soft);
}
.celec-row:first-child { border-top: none; }
.celec-row__name {
	font-size: 14.5px; color: var(--celec-text);
	overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.celec-row.is-lead .celec-row__name { font-weight: 600; }
.celec-row__pcts { display: flex; gap: 8px; flex-shrink: 0; }

/* ---- Pills ---- */
.celec-pill {
	display: inline-flex; align-items: center; gap: 5px;
	min-width: 62px; justify-content: center;
	padding: 5px 9px; border-radius: 8px;
	font-variant-numeric: tabular-nums; font-weight: 650; font-size: 14px;
	border: 1px solid transparent;
}
.celec-pill--kalshi { background: var(--celec-kalshi-bg); color: var(--celec-kalshi); border-color: rgba(0,168,107,0.22); }
.celec-pill--poly   { background: var(--celec-poly-bg);   color: var(--celec-poly);   border-color: rgba(45,156,219,0.22); }
.celec-pill.is-empty { background: transparent; color: var(--celec-text-mute); border-color: var(--celec-line-soft); font-weight: 500; }
.celec-pill__mv { font-size: 11px; font-weight: 700; opacity: 0.9; }
.celec-pill__mv--up   { color: var(--celec-up); }
.celec-pill__mv--down { color: var(--celec-down); }

/* Independent-markets note (binary races whose sides don't sum to 100) */
.celec-note {
	font-size: 11.5px; color: var(--celec-text-mute); font-style: italic;
	margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--celec-line-soft);
	cursor: help;
}

/* ---- Card footer ---- */
.celec-card__foot {
	display: flex; align-items: center; justify-content: space-between;
	margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--celec-line-soft);
}
.celec-card__vol { font-size: 12.5px; color: var(--celec-text-mute); }
.celec-analysis-btn {
	background: none; border: none; cursor: pointer;
	color: var(--celec-text-dim); font-size: 13px; font-weight: 550;
	display: inline-flex; align-items: center; gap: 5px; padding: 4px 2px;
	font-family: inherit; transition: color 0.14s ease;
}
.celec-analysis-btn:hover { color: var(--celec-text); }
.celec-analysis-btn__caret { font-size: 10px; }

/* ---- Drawer ---- */
.celec-drawer { overflow: hidden; }
.celec-drawer:not([hidden]) {
	margin-top: 12px; padding-top: 14px; border-top: 1px solid var(--celec-line-soft);
	animation: celec-drawer-in 0.22s ease;
}
@keyframes celec-drawer-in {
	from { opacity: 0; transform: translateY(-4px); }
	to   { opacity: 1; transform: translateY(0); }
}
.celec-drawer__sec { margin-bottom: 16px; }
.celec-drawer__label {
	font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
	color: var(--celec-text-mute); margin-bottom: 7px;
}
.celec-drawer__text { font-size: 13.5px; color: var(--celec-text-dim); line-height: 1.55; margin: 0; }
.celec-drawer__warming { font-size: 13px; color: var(--celec-text-mute); font-style: italic; margin: 0 0 8px; }

/* Movement list */
.celec-mvlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.celec-mvrow {
	display: flex; align-items: center; justify-content: space-between; gap: 10px;
	font-size: 13px;
}
.celec-mvrow__name { color: var(--celec-text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.celec-mvrow__data { display: inline-flex; align-items: center; gap: 10px; flex-shrink: 0; }
.celec-mv { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.celec-mv--up   { color: var(--celec-up); }
.celec-mv--down { color: var(--celec-down); }

/* Sparkline */
.celec-spark { display: inline-flex; align-items: center; gap: 6px; }
.celec-spark svg { display: block; }
.celec-spark--up svg polyline   { stroke: var(--celec-up); }
.celec-spark--down svg polyline { stroke: var(--celec-down); }
.celec-spark__val { font-size: 12px; font-weight: 650; font-variant-numeric: tabular-nums; color: var(--celec-text-dim); }

/* CTAs */
.celec-drawer__ctas { display: flex; gap: 10px; flex-wrap: wrap; }
.celec-cta {
	flex: 1 1 auto; text-align: center; min-width: 130px;
	padding: 9px 14px; border-radius: 9px; font-size: 13.5px; font-weight: 650;
	text-decoration: none; transition: filter 0.14s ease, transform 0.14s ease;
}
.celec-cta:hover { filter: brightness(1.08); transform: translateY(-1px); }
.celec-cta--kalshi { background: var(--celec-kalshi); color: #04130c; }
.celec-cta--poly   { background: var(--celec-poly);   color: #04141f; }

/* ---- Footer ---- */
.celec-foot {
	display: flex; align-items: center; justify-content: space-between;
	gap: 12px; margin-top: 18px; padding-top: 14px;
	border-top: 1px solid var(--celec-line-soft); flex-wrap: wrap;
}
.celec-foot__legend { display: inline-flex; gap: 8px; }
.celec-chip {
	font-size: 11.5px; font-weight: 650; padding: 3px 9px; border-radius: 6px;
}
.celec-chip--kalshi { background: var(--celec-kalshi-bg); color: var(--celec-kalshi); }
.celec-chip--poly   { background: var(--celec-poly-bg);   color: var(--celec-poly); }
.celec-foot__updated { font-size: 12px; color: var(--celec-text-mute); }

/* ---- Responsive ---- */
@media (max-width: 600px) {
	.cleatz-election { padding: 16px 14px; }
	.celec-grid { grid-template-columns: 1fr; gap: 12px; }
	.celec-head__title { font-size: 19px; }
	.celec-pill { min-width: 56px; font-size: 13.5px; }
}
