/* ── WP Municipal Portal — Enquetes (front-end) ─────────────────────────────── */

.wmp-poll {
	--wmp-poll-accent: #2563EB;
	--wmp-poll-ink: #0F172A;
	--wmp-poll-muted: #64748B;
	--wmp-poll-line: #E5E7EB;
	--wmp-poll-bg: #FFFFFF;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--wmp-poll-ink);
	box-sizing: border-box;
}
.wmp-poll *, .wmp-poll *::before, .wmp-poll *::after { box-sizing: border-box; }

/* ── Floating shell ─────────────────────────────────────────────────────────── */
.wmp-poll--floating {
	position: fixed;
	bottom: 24px;
	z-index: 99500;
	width: 360px;
	max-width: calc(100vw - 32px);
}
.wmp-poll--left  { left: 24px; }
.wmp-poll--right { right: 24px; }

/* Entrance animation, toggled by JS via .is-visible */
.wmp-poll--floating .wmp-poll-card {
	opacity: 0;
	transform: translateY(16px) scale(0.98);
	transition: opacity .28s ease, transform .28s cubic-bezier(.16,1,.3,1);
	pointer-events: none;
}
.wmp-poll--floating.is-visible .wmp-poll-card {
	opacity: 1;
	transform: translateY(0) scale(1);
	pointer-events: auto;
}
.wmp-poll--floating.is-collapsed .wmp-poll-card {
	opacity: 0;
	transform: translateY(16px) scale(0.96);
	pointer-events: none;
}

/* ── Re-open balloon (collapsed state) ──────────────────────────────────────── */
/* When collapsed, the (invisible) card must not block clicks on the page —
   only the balloon stays interactive. */
.wmp-poll--floating.is-collapsed { pointer-events: none; }
.wmp-poll--floating.is-collapsed .wmp-poll-bubble { pointer-events: auto; }

.wmp-poll-bubble {
	position: absolute;
	bottom: 0;
	display: none;
	align-items: center;
	gap: 9px;
	padding: 11px 17px 11px 13px;
	border: none;
	border-radius: 999px;
	background: var(--wmp-poll-accent);
	color: #fff;
	cursor: pointer;
	font-family: inherit;
	font-size: 13.5px;
	font-weight: 700;
	line-height: 1;
	white-space: nowrap;
	box-shadow: 0 12px 30px -6px color-mix(in srgb, var(--wmp-poll-accent) 55%, rgba(15,23,42,.5)), 0 4px 10px rgba(15,23,42,.18);
	transition: filter .15s ease;
}
.wmp-poll--left  .wmp-poll-bubble { left: 0; transform-origin: left bottom; }
.wmp-poll--right .wmp-poll-bubble { right: 0; transform-origin: right bottom; }
.wmp-poll-bubble:hover { filter: brightness(1.07); }

.wmp-poll-bubble-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	flex-shrink: 0;
}
.wmp-poll-bubble-text { position: relative; z-index: 1; }

/* Pulsing ring to draw the eye */
.wmp-poll-bubble-ring {
	position: absolute;
	inset: 0;
	border-radius: 999px;
	pointer-events: none;
	animation: wmpPollPulse 2.2s ease-out infinite;
}
@keyframes wmpPollPulse {
	0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--wmp-poll-accent) 55%, transparent); }
	70%  { box-shadow: 0 0 0 14px transparent; }
	100% { box-shadow: 0 0 0 0 transparent; }
}

/* Entrance pop, then a periodic attention wiggle */
.wmp-poll--floating.is-collapsed .wmp-poll-bubble {
	display: inline-flex;
	animation: wmpPollPop .3s ease, wmpPollWiggle 3s ease-in-out 1.4s infinite;
}
@keyframes wmpPollPop { from { transform: scale(.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes wmpPollWiggle {
	0%, 84%, 100% { transform: translateY(0) rotate(0); }
	88%  { transform: translateY(-5px) rotate(-3.5deg); }
	92%  { transform: translateY(-2px) rotate(2.5deg); }
	96%  { transform: translateY(-3px) rotate(-1.5deg); }
}

/* ── Card ───────────────────────────────────────────────────────────────────── */
.wmp-poll-card {
	position: relative;
	background: var(--wmp-poll-bg);
	border: 1px solid var(--wmp-poll-line);
	border-radius: 18px;
	box-shadow: 0 20px 48px rgba(15, 23, 42, .18), 0 2px 8px rgba(15, 23, 42, .06);
	overflow: hidden;
}
.wmp-poll--inline .wmp-poll-card {
	box-shadow: 0 1px 3px rgba(15, 23, 42, .08);
	max-width: 560px;
	margin: 24px auto;
}

/* Accent top strip */
.wmp-poll-card::before {
	content: "";
	display: block;
	height: 4px;
	background: linear-gradient(90deg, var(--wmp-poll-accent), color-mix(in srgb, var(--wmp-poll-accent) 55%, #fff));
}

.wmp-poll-close {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 30px;
	height: 30px;
	border: none;
	border-radius: 50%;
	background: rgba(15, 23, 42, .05);
	color: var(--wmp-poll-muted);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background .15s, color .15s;
	z-index: 2;
}
.wmp-poll-close:hover { background: rgba(15, 23, 42, .1); color: var(--wmp-poll-ink); }

.wmp-poll-head {
	padding: 18px 20px 6px;
}
.wmp-poll-eyebrow {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .04em;
	text-transform: uppercase;
	color: var(--wmp-poll-accent);
	margin-bottom: 8px;
}
.wmp-poll-title {
	margin: 0;
	font-size: 17px;
	font-weight: 800;
	line-height: 1.25;
	color: var(--wmp-poll-ink);
}
.wmp-poll-desc {
	margin: 6px 0 0;
	font-size: 13px;
	line-height: 1.5;
	color: var(--wmp-poll-muted);
}

/* ── Form ───────────────────────────────────────────────────────────────────── */
.wmp-poll-form { padding: 14px 20px 20px; }
.wmp-poll-q { border: none; padding: 0; margin: 0 0 14px; }
.wmp-poll-q:last-of-type { margin-bottom: 8px; }
.wmp-poll-q-text {
	padding: 0;
	font-size: 14px;
	font-weight: 700;
	color: var(--wmp-poll-ink);
	margin-bottom: 10px;
}
.wmp-poll-q-hint {
	display: block;
	font-size: 11.5px;
	color: var(--wmp-poll-muted);
	margin: -6px 0 10px;
}
.wmp-poll-options { display: flex; flex-direction: column; gap: 8px; }

.wmp-poll-option {
	display: flex;
	align-items: center;
	gap: 11px;
	padding: 12px 14px;
	border: 1.5px solid var(--wmp-poll-line);
	border-radius: 11px;
	cursor: pointer;
	transition: border-color .15s, background .15s, box-shadow .15s;
	background: #fff;
}
.wmp-poll-option:hover {
	border-color: color-mix(in srgb, var(--wmp-poll-accent) 45%, #fff);
	background: color-mix(in srgb, var(--wmp-poll-accent) 5%, #fff);
}
.wmp-poll-input { position: absolute; opacity: 0; width: 0; height: 0; }
.wmp-poll-option-mark {
	flex-shrink: 0;
	width: 20px;
	height: 20px;
	border: 2px solid #CBD5E1;
	border-radius: 50%;
	position: relative;
	transition: border-color .15s, background .15s;
}
.wmp-poll-q[data-type="multiple"] .wmp-poll-option-mark { border-radius: 6px; }
.wmp-poll-option-mark::after {
	content: "";
	position: absolute;
	inset: 0;
	margin: auto;
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: #fff;
	opacity: 0;
	transform: scale(.4);
	transition: opacity .15s, transform .15s;
}
.wmp-poll-q[data-type="multiple"] .wmp-poll-option-mark::after {
	width: 11px; height: 6px;
	border-radius: 0;
	background: transparent;
	border-left: 2.5px solid #fff;
	border-bottom: 2.5px solid #fff;
	transform: rotate(-45deg) scale(.5) translate(1px,-1px);
	margin-top: -1px;
}
.wmp-poll-option-text { font-size: 13.5px; line-height: 1.35; color: var(--wmp-poll-ink); }

.wmp-poll-input:checked + .wmp-poll-option-mark {
	border-color: var(--wmp-poll-accent);
	background: var(--wmp-poll-accent);
}
.wmp-poll-input:checked + .wmp-poll-option-mark::after { opacity: 1; transform: scale(1); }
.wmp-poll-q[data-type="multiple"] .wmp-poll-input:checked + .wmp-poll-option-mark::after {
	transform: rotate(-45deg) scale(1) translate(1px,-1px);
}
.wmp-poll-option:has(.wmp-poll-input:checked) {
	border-color: var(--wmp-poll-accent);
	background: color-mix(in srgb, var(--wmp-poll-accent) 8%, #fff);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--wmp-poll-accent) 14%, transparent);
}
.wmp-poll-input:focus-visible + .wmp-poll-option-mark {
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--wmp-poll-accent) 30%, transparent);
}

.wmp-poll-error {
	margin: 4px 0 12px;
	font-size: 12.5px;
	color: #DC2626;
	font-weight: 600;
}

.wmp-poll-submit {
	width: 100%;
	border: none;
	border-radius: 11px;
	padding: 13px 18px;
	background: var(--wmp-poll-accent);
	color: #fff;
	font-size: 14px;
	font-weight: 700;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 9px;
	transition: filter .15s, transform .1s;
}
.wmp-poll-submit:hover { filter: brightness(1.06); }
.wmp-poll-submit:active { transform: translateY(1px); }
.wmp-poll-submit:disabled { opacity: .7; cursor: not-allowed; }
.wmp-poll-spinner {
	display: none;
	width: 15px; height: 15px;
	border: 2.5px solid rgba(255,255,255,.4);
	border-top-color: #fff;
	border-radius: 50%;
	animation: wmpPollSpin .7s linear infinite;
}
.wmp-poll.is-submitting .wmp-poll-spinner { display: inline-block; }
@keyframes wmpPollSpin { to { transform: rotate(360deg); } }

/* ── Results ────────────────────────────────────────────────────────────────── */
.wmp-poll-results { padding: 6px 20px 16px; }
.wmp-poll-rq { margin-bottom: 18px; }
.wmp-poll-rq:last-child { margin-bottom: 4px; }
.wmp-poll-rq-text {
	font-size: 13.5px;
	font-weight: 700;
	color: var(--wmp-poll-ink);
	margin: 0 0 12px;
}
.wmp-poll-rrow { margin-bottom: 12px; }
.wmp-poll-rrow-top {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 10px;
	margin-bottom: 6px;
}
.wmp-poll-rrow-label {
	font-size: 13px;
	color: var(--wmp-poll-ink);
	display: inline-flex;
	align-items: center;
	gap: 6px;
}
.wmp-poll-rrow.is-winner .wmp-poll-rrow-label { font-weight: 800; }
.wmp-poll-winner-star { color: var(--wmp-poll-accent); }
.wmp-poll-rrow-pct {
	font-size: 13px;
	font-weight: 800;
	color: var(--wmp-poll-muted);
	white-space: nowrap;
}
.wmp-poll-rrow.is-winner .wmp-poll-rrow-pct { color: var(--wmp-poll-accent); }
.wmp-poll-track {
	height: 10px;
	border-radius: 6px;
	background: #EEF1F6;
	overflow: hidden;
}
.wmp-poll-fill {
	height: 100%;
	width: 0;
	border-radius: 6px;
	background: #94A3B8;
	transition: width .8s cubic-bezier(.16,1,.3,1);
}
.wmp-poll-rrow.is-winner .wmp-poll-fill {
	background: linear-gradient(90deg, var(--wmp-poll-accent), color-mix(in srgb, var(--wmp-poll-accent) 65%, #fff));
}

/* ── Vote again (unlimited mode) ────────────────────────────────────────────── */
.wmp-poll-revote {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	margin: 0 20px 16px;
	padding: 9px 16px;
	border: 1.5px solid var(--wmp-poll-accent);
	background: transparent;
	color: var(--wmp-poll-accent);
	font-size: 13px;
	font-weight: 700;
	border-radius: 10px;
	cursor: pointer;
	transition: background .15s, color .15s;
}
.wmp-poll-revote:hover {
	background: var(--wmp-poll-accent);
	color: #fff;
}
.wmp-poll-revote[hidden] { display: none; }

/* ── Footer ─────────────────────────────────────────────────────────────────── */
.wmp-poll-foot {
	padding: 12px 20px 16px;
	border-top: 1px solid var(--wmp-poll-line);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	font-size: 12px;
	color: var(--wmp-poll-muted);
}
.wmp-poll-foot:empty, .wmp-poll-foot[hidden] { display: none; }
.wmp-poll-count { display: inline-flex; align-items: center; gap: 6px; }
.wmp-poll-thanks { font-weight: 700; color: var(--wmp-poll-accent); }

/* ── State helpers ──────────────────────────────────────────────────────────── */
.wmp-poll.is-voted .wmp-poll-form { display: none; }
.wmp-poll.is-voted .wmp-poll-thanks { display: inline; }

/* ── Mobile: bottom sheet ───────────────────────────────────────────────────── */
@media (max-width: 560px) {
	.wmp-poll--floating {
		left: 0 !important;
		right: 0 !important;
		bottom: 0;
		width: 100%;
		max-width: 100%;
	}
	.wmp-poll--floating .wmp-poll-card {
		border-radius: 18px 18px 0 0;
		max-height: 86vh;
		overflow-y: auto;
		transform: translateY(100%);
	}
	.wmp-poll--floating.is-visible .wmp-poll-card { transform: translateY(0); }
	.wmp-poll--floating.is-collapsed .wmp-poll-card { transform: translateY(100%); }
	.wmp-poll-bubble { bottom: 16px; }
	.wmp-poll--left .wmp-poll-bubble { left: 16px; }
	.wmp-poll--right .wmp-poll-bubble { right: 16px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
	.wmp-poll-card, .wmp-poll-fill, .wmp-poll-bubble, .wmp-poll-submit { transition: none !important; }
	.wmp-poll--floating.is-collapsed .wmp-poll-bubble,
	.wmp-poll-bubble-ring { animation: none !important; }
}
