/* ==========================================================================
   BearBull Poll – Frontend Styles
   ========================================================================== */

.bpoll-container {
	margin: 48px 0 24px;
	padding: 28px 32px;
	background: var(--bpoll-bg, #ffffff) !important;
	border: 1px solid #e5e9f0;
	border-radius: 16px;
	box-shadow: 0 4px 24px rgba(0, 0, 0, 0.07);
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
}

/* Header */
.bpoll-header {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 22px;
}

.bpoll-icon {
	font-size: 22px;
	line-height: 1;
}

.bpoll-title {
	font-size: 1.15rem;
	font-weight: 700;
	color: var(--bpoll-text, #1a1a2e) !important;
	margin: 0;
	line-height: 1.3;
}

/* ── Option Buttons ─────────────────────────────────────────────────── */

.bpoll-options {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

/* Horizontal layout: buttons side by side */
.bpoll-layout-horizontal .bpoll-options {
	flex-direction: row;
	flex-wrap: wrap;
	gap: 12px;
}

.bpoll-layout-horizontal .bpoll-option-btn {
	flex: 1 1 0;
	min-width: 100px;
	text-align: center;
}

.bpoll-option-btn {
	display: block;
	width: 100%;
	padding: 14px 20px;
	background: var(--bpoll-btn-bg, #f4f6fb) !important;
	color: var(--bpoll-text, #1a1a2e) !important;
	border: 2px solid var(--bpoll-btn-border, transparent) !important;
	border-radius: 10px;
	font-size: 1.1rem;
	font-weight: 500;
	text-align: left;
	cursor: pointer;
	transition: all 0.2s ease;
	outline: none;
}

.bpoll-option-btn:hover {
	background: #eaf0ff;
	border-color: #4f6ef7;
	color: #4f6ef7;
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(79, 110, 247, 0.12);
}

.bpoll-option-btn:active {
	transform: translateY(0);
}

.bpoll-option-btn:disabled {
	opacity: 0.6;
	cursor: not-allowed;
	transform: none;
}

/* ── Results ─────────────────────────────────────────────────────────── */

.bpoll-results-section {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

/* Horizontal results: side by side */
.bpoll-layout-horizontal .bpoll-results-section {
	flex-direction: row;
	flex-wrap: wrap;
	gap: 16px;
	align-items: flex-end;
}

.bpoll-layout-horizontal .bpoll-result-row {
	flex: 1 1 0;
	min-width: 100px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
}

.bpoll-layout-horizontal .bpoll-result-bar-wrap {
	width: 100%;
	height: 12px;
}

.bpoll-layout-horizontal .bpoll-result-label {
	flex-direction: column;
	align-items: center;
	gap: 4px;
	text-align: center;
}

.bpoll-layout-horizontal .bpoll-result-pct {
	text-align: center;
}

.bpoll-layout-horizontal .bpoll-result-votes {
	text-align: center;
}

.bpoll-result-row {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.bpoll-result-label {
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.bpoll-result-text {
	font-size: 15px !important;
	line-height: 1.4;
	font-weight: 500;
	color: var(--bpoll-text, #1a1a2e) !important;
}

.bpoll-result-pct {
	font-size: 1.2rem;
	font-weight: 700;
	color: #4f6ef7;
	min-width: 60px;
	text-align: right;
}

.bpoll-result-bar-wrap {
	background: #e9ecf5;
	border-radius: 999px;
	height: 12px;
	overflow: hidden;
}

.bpoll-result-bar {
	height: 100%;
	background: linear-gradient(90deg, #4f6ef7, #7c9cff);
	border-radius: 999px;
	width: 0%;
	transition: width 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.bpoll-result-votes {
	font-size: 0.95rem;
	color: #888;
}

.bpoll-total {
	margin: 10px 0 0;
	font-size: 0.95rem;
	color: #888;
	text-align: right;
}

/* ── Loading ─────────────────────────────────────────────────────────── */

.bpoll-loading {
	display: flex;
	align-items: center;
	gap: 10px;
	color: #666;
	font-size: 0.92rem;
}

.bpoll-spinner {
	display: inline-block;
	width: 18px;
	height: 18px;
	border: 3px solid #dde2f0;
	border-top-color: #4f6ef7;
	border-radius: 50%;
	animation: bpoll-spin 0.7s linear infinite;
}

@keyframes bpoll-spin {
	to {
		transform: rotate(360deg);
	}
}

/* ── Dark mode (Triggered by Site Toggle Theme) ──────────── */
html[data-theme="dark"] .bpoll-container,
body.newsarc-dark-mode .bpoll-container {
	background: var(--bpoll-bg, #1e2235) !important;
	border-color: #2d3348;
	box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

html[data-theme="dark"] .bpoll-title,
body.newsarc-dark-mode .bpoll-title,
html[data-theme="dark"] .bpoll-result-text,
body.newsarc-dark-mode .bpoll-result-text {
	color: var(--bpoll-text, #e8eaf6) !important;
}

html[data-theme="dark"] .bpoll-option-btn,
body.newsarc-dark-mode .bpoll-option-btn {
	background: var(--bpoll-btn-bg, #252a40) !important;
	color: var(--bpoll-text, #e8eaf6) !important;
}

html[data-theme="dark"] .bpoll-option-btn:hover,
body.newsarc-dark-mode .bpoll-option-btn:hover {
	background: #2c3556 !important;
}

html[data-theme="dark"] .bpoll-result-bar-wrap,
body.newsarc-dark-mode .bpoll-result-bar-wrap {
	background: #2d3348;
}

/* ── Light mode fallback overrides ───────────────────────────────────── */
html[data-theme="light"] .bpoll-container,
body.newsarc-light-mode .bpoll-container {
	background: var(--bpoll-bg, #ffffff) !important;
	border-color: #e5e9f0;
	box-shadow: 0 4px 24px rgba(0, 0, 0, 0.07);
}

html[data-theme="light"] .bpoll-title,
body.newsarc-light-mode .bpoll-title,
html[data-theme="light"] .bpoll-result-text,
body.newsarc-light-mode .bpoll-result-text {
	color: var(--bpoll-text, #1a1a2e) !important;
}

html[data-theme="light"] .bpoll-option-btn,
body.newsarc-light-mode .bpoll-option-btn {
	background: var(--bpoll-btn-bg, #f4f6fb) !important;
	color: var(--bpoll-text, #1a1a2e) !important;
}

html[data-theme="light"] .bpoll-option-btn:hover,
body.newsarc-light-mode .bpoll-option-btn:hover {
	background: #eaf0ff !important;
}

html[data-theme="light"] .bpoll-result-bar-wrap,
body.newsarc-light-mode .bpoll-result-bar-wrap {
	background: #e9ecf5;
}

/* ── Explicit JS Toggles (Highest Specificity - Wins EVERYTHING) ──────────── */
html body .bpoll-container.bpoll-is-dark {
	background: var(--bpoll-bg, #1e2235) !important;
	border-color: #2d3348 !important;
	box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3) !important;
}

html body .bpoll-container.bpoll-is-dark .bpoll-title,
html body .bpoll-container.bpoll-is-dark .bpoll-result-text {
	color: var(--bpoll-text, #e8eaf6) !important;
}

html body .bpoll-container.bpoll-is-dark .bpoll-option-btn {
	background: var(--bpoll-btn-bg, #252a40) !important;
	color: var(--bpoll-text, #e8eaf6) !important;
}

html body .bpoll-container.bpoll-is-dark .bpoll-option-btn:hover {
	background: #2c3556 !important;
}

html body .bpoll-container.bpoll-is-dark .bpoll-result-bar-wrap {
	background: #2d3348 !important;
}

/* Explicit Light overrides */
html body .bpoll-container.bpoll-is-light {
	background: var(--bpoll-bg, #ffffff) !important;
	border-color: #e5e9f0 !important;
	box-shadow: 0 4px 24px rgba(0, 0, 0, 0.07) !important;
}

html body .bpoll-container.bpoll-is-light .bpoll-title,
html body .bpoll-container.bpoll-is-light .bpoll-result-text {
	color: var(--bpoll-text, #1a1a2e) !important;
}

html body .bpoll-container.bpoll-is-light .bpoll-option-btn {
	background: var(--bpoll-btn-bg, #f4f6fb) !important;
	color: var(--bpoll-text, #1a1a2e) !important;
}

html body .bpoll-container.bpoll-is-light .bpoll-option-btn:hover {
	background: #eaf0ff !important;
}

html body .bpoll-container.bpoll-is-light .bpoll-result-bar-wrap {
	background: #e9ecf5 !important;
}

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 600px) {
	.bpoll-container {
		padding: 20px 18px;
		border-radius: 12px;
	}

	/* On mobile, horizontal layout stacks vertically */
	.bpoll-layout-horizontal .bpoll-options,
	.bpoll-layout-horizontal .bpoll-results-section {
		flex-direction: column;
	}

	.bpoll-layout-horizontal .bpoll-result-label {
		flex-direction: row;
		justify-content: space-between;
		text-align: left;
	}
}