/**
 * Valhalla Pro — Polls module styles.
 *
 * Vikinger look: 12px radius boxes, Rajdhani weights, gradient progress lines, colors from the
 * theme's --color-* custom properties (with light-preset fallbacks for other themes).
 */

/* 1. Widget ------------------------------------------------------------------------------- */
.vhl-poll {
	margin: 20px 28px 0;
	color: var(--color-text, #3e3f5e);
	font-family: var(--vikinger-font-family-primary, inherit);
}

.widget-box-status-content > .vhl-poll:first-child {
	margin-top: 0;
}

.vhl-poll-mount > .vhl-poll,
.vhl-poll-embed-box .vhl-poll {
	margin: 0;
}

.widget-box-status-content > .vhl-poll-mount > .vhl-poll {
	margin: 20px 28px 0;
}

.vhl-poll-body {
	transition: opacity .2s ease-in-out;
}

.vhl-poll.is-busy .vhl-poll-body {
	opacity: .6;
	pointer-events: none;
}

.vhl-poll-head {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: center;
	gap: 8px;
	margin-bottom: 14px;
}

.vhl-poll-kicker {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	color: var(--color-text-alt, #8f91ac);
	font-size: calc((12 / var(--vikinger-font-size-base, 16)) * 1rem);
	font-weight: 700;
	line-height: 1em;
	text-transform: uppercase;
}

.vhl-poll-kicker .vhl-poll-kicker-icon {
	width: 16px;
	height: 16px;
	fill: var(--color-primary, #23d2e2);
}

.vhl-poll-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.vhl-poll-tag {
	display: inline-flex;
	align-items: center;
	height: 22px;
	padding: 0 10px;
	border-radius: 200px;
	background-color: var(--color-box-highlight-background, #f7f7fb);
	color: var(--color-text-alt, #8f91ac);
	font-size: calc((11 / var(--vikinger-font-size-base, 16)) * 1rem);
	font-weight: 700;
	line-height: 1em;
	text-transform: uppercase;
	white-space: nowrap;
}

.vhl-poll-tag.is-closed {
	background-color: var(--color-secondary, #615dfa);
	color: #fff;
}

.vhl-poll-question {
	margin: 0 0 16px;
	color: var(--color-text, #3e3f5e);
	font-size: calc((16 / var(--vikinger-font-size-base, 16)) * 1rem);
	font-weight: 700;
	line-height: 1.4em;
	word-break: break-word;
}

/* 2. Answers ------------------------------------------------------------------------------ */
.vhl-poll-options {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.vhl-poll-option {
	position: relative;
	padding: 13px 16px;
	border: 1px solid var(--color-border, #dedeea);
	border-radius: 12px;
	background-color: var(--color-box-background, #fff);
	transition: border-color .2s ease-in-out, box-shadow .2s ease-in-out, background-color .2s ease-in-out;
}

.vhl-poll-option.is-interactive:hover {
	border-color: var(--color-secondary, #615dfa);
}

.vhl-poll-option.is-selected,
.vhl-poll-option.is-mine {
	border-color: var(--color-primary, #23d2e2);
	box-shadow: var(--color-primary-shadow, 4px 7px 12px 0 rgba(35, 210, 226, .2));
}

.vhl-poll.is-closed .vhl-poll-option {
	background-color: var(--color-box-background-alt, #fcfcfd);
	box-shadow: none;
}

.vhl-poll-choice {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	min-height: 22px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: transparent;
	color: inherit;
	font: inherit;
	text-align: left;
	cursor: pointer;
}

.vhl-poll-choice.is-static {
	cursor: default;
}

.vhl-poll-choice:disabled {
	cursor: default;
}

.vhl-poll-input {
	width: 1px;
	height: 1px;
	margin: 0;
	padding: 0;
	position: absolute;
	top: 0;
	left: 0;
	opacity: 0;
	pointer-events: none;
}

.vhl-poll-choice:focus-visible,
.vhl-poll-input:focus-visible + .vhl-poll-choice,
.vhl-poll-voters-link:focus-visible,
.vhl-poll-link:focus-visible,
.vhl-poll-create-action:focus-visible,
.vhl-poll-form-remove:focus-visible {
	outline: 2px solid var(--color-secondary, #615dfa);
	outline-offset: 4px;
	border-radius: 6px;
}

.vhl-poll-check {
	display: flex;
	flex: 0 0 auto;
	justify-content: center;
	align-items: center;
	width: 20px;
	height: 20px;
	border: 1px solid var(--color-border, #dedeea);
	border-radius: 6px;
	background-color: var(--color-box-background, #fff);
	transition: border-color .2s ease-in-out, background-color .2s ease-in-out, border-width .2s ease-in-out;
}

.vhl-poll-check.is-round {
	border-radius: 50%;
}

.vhl-poll-check .vhl-poll-check-icon {
	width: 10px;
	height: 8px;
	fill: transparent;
	transition: fill .2s ease-in-out;
}

.vhl-poll-option.is-selected .vhl-poll-check,
.vhl-poll-option.is-mine .vhl-poll-check {
	border-color: var(--color-primary, #23d2e2);
	background-color: var(--color-primary, #23d2e2);
}

.vhl-poll-option.is-selected .vhl-poll-check.is-round,
.vhl-poll-option.is-mine .vhl-poll-check.is-round {
	border-width: 6px;
	background-color: var(--color-box-background, #fff);
}

.vhl-poll-option.is-selected .vhl-poll-check-icon,
.vhl-poll-option.is-mine .vhl-poll-check-icon {
	fill: #fff;
}

.vhl-poll-option.is-interactive:hover .vhl-poll-check {
	border-color: var(--color-secondary, #615dfa);
}

.vhl-poll-option-text {
	flex: 1 1 auto;
	min-width: 0;
	color: var(--color-text, #3e3f5e);
	font-size: calc((14 / var(--vikinger-font-size-base, 16)) * 1rem);
	font-weight: 700;
	line-height: 1.4285714286em;
	word-break: break-word;
}

.vhl-poll-option-percent {
	flex: 0 0 auto;
	color: var(--color-text-alt, #8f91ac);
	font-size: calc((14 / var(--vikinger-font-size-base, 16)) * 1rem);
	font-weight: 700;
	line-height: 1em;
}

.vhl-poll-option.is-leading .vhl-poll-option-percent {
	color: var(--color-primary-dark, #00c7d9);
}

.vhl-poll-bar {
	height: 4px;
	margin-top: 12px;
	border-radius: 200px;
	background-color: var(--color-progressbar-underline, #e7e8ee);
	overflow: hidden;
}

.vhl-poll-bar-fill {
	display: block;
	height: 100%;
	border-radius: 200px;
	background: linear-gradient(90deg, var(--color-progressbar-line-gradient-start, #615dfa), var(--color-progressbar-line-gradient-end, #41efff));
	transition: width .6s cubic-bezier(.2, .8, .2, 1);
}

.vhl-poll-option:not(.is-leading) .vhl-poll-bar-fill {
	opacity: .55;
}

.vhl-poll.is-closed .vhl-poll-option:not(.is-leading) .vhl-poll-bar-fill {
	opacity: .35;
}

.vhl-poll-option-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 12px;
	margin-top: 8px;
	color: var(--color-text-alt, #8f91ac);
	font-size: calc((12 / var(--vikinger-font-size-base, 16)) * 1rem);
	font-weight: 700;
	line-height: 1.2em;
}

/* The theme gives every <button> width: 100% and a 12px radius: reset for text buttons. */
.vhl-poll-voters-link,
.vhl-poll-link {
	display: inline;
	width: auto;
	height: auto;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: transparent;
	box-shadow: none;
	text-align: left;
	color: var(--color-text-alt, #8f91ac);
	font: inherit;
	font-size: calc((12 / var(--vikinger-font-size-base, 16)) * 1rem);
	font-weight: 700;
	line-height: 1.2em;
	cursor: pointer;
	transition: color .2s ease-in-out;
}

.vhl-poll-voters-link {
	color: var(--color-primary-dark, #00c7d9);
}

.vhl-poll-voters-link:hover,
.vhl-poll-link:hover {
	color: var(--color-secondary, #615dfa);
}

.vhl-poll-link:disabled {
	opacity: .5;
	cursor: default;
}

.vhl-poll-mine {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	color: var(--color-primary-dark, #00c7d9);
}

.vhl-poll-mine .vhl-poll-mine-icon {
	width: 10px;
	height: 8px;
	fill: var(--color-primary-dark, #00c7d9);
}

/* 3. Footer -------------------------------------------------------------------------------- */
.vhl-poll-footer {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	margin-top: 16px;
}

.vhl-poll-summary {
	margin: 0;
	color: var(--color-text-alt, #8f91ac);
	font-size: calc((12 / var(--vikinger-font-size-base, 16)) * 1rem);
	font-weight: 700;
	line-height: 1.4em;
}

.vhl-poll-actions {
	display: flex;
	align-items: center;
	gap: 16px;
}

.vhl-poll-actions .button {
	width: auto;
	padding: 0 22px;
	white-space: nowrap;
}

.vhl-poll-actions .button[disabled] {
	cursor: default;
}

.vhl-poll-hint {
	margin: 10px 0 0;
	color: var(--color-text-alt, #8f91ac);
	font-size: calc((12 / var(--vikinger-font-size-base, 16)) * 1rem);
	font-weight: 500;
	line-height: 1.5em;
}

.vhl-poll-embed-link {
	margin: 14px 0 0;
	font-size: calc((12 / var(--vikinger-font-size-base, 16)) * 1rem);
	font-weight: 700;
}

.vhl-poll-embed-link a {
	color: var(--color-primary-dark, #00c7d9);
}

.vhl-poll-empty {
	padding: 14px 16px;
	border: 1px dashed var(--color-border, #dedeea);
	border-radius: 12px;
	color: var(--color-text-alt, #8f91ac);
	font-size: calc((13 / var(--vikinger-font-size-base, 16)) * 1rem);
	font-weight: 600;
	line-height: 1.5em;
}

.vhl-poll-empty.is-error {
	border-color: var(--color-tertiary, #fd4350);
}

.vhl-poll-empty .vhl-poll-retry {
	margin-left: 6px;
	color: var(--color-primary-dark, #00c7d9);
}

/* Loading skeleton. */
.vhl-poll-skeleton {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.vhl-poll-skeleton span {
	display: block;
	height: 48px;
	border-radius: 12px;
	background: linear-gradient(90deg, var(--color-box-highlight-background, #f7f7fb) 0%, var(--color-box-hover-background, #f2f2f9) 50%, var(--color-box-highlight-background, #f7f7fb) 100%);
	background-size: 200% 100%;
	animation: vhl-poll-shimmer 1.4s ease-in-out infinite;
}

.vhl-poll-skeleton span:nth-child(2) {
	width: 86%;
}

.vhl-poll-skeleton span:nth-child(3) {
	width: 64%;
}

@keyframes vhl-poll-shimmer {
	0% { background-position: 100% 0; }
	100% { background-position: -100% 0; }
}

@media (prefers-reduced-motion: reduce) {
	.vhl-poll-skeleton span {
		animation: none;
	}

	.vhl-poll-bar-fill,
	.vhl-poll-option,
	.vhl-poll-check {
		transition: none;
	}
}

/* 4. Activity form action ------------------------------------------------------------------- */
.quick-post .quick-post-footer .vhl-poll-create-action {
	display: flex;
	align-items: center;
	position: relative;
}

.quick-post .quick-post-footer .vhl-poll-create-action .quick-post-footer-action-icon {
	width: 20px;
	height: 20px;
	fill: var(--color-icon, #adafca);
}

.quick-post .quick-post-footer .vhl-poll-create-action:hover .quick-post-footer-action-icon {
	fill: var(--color-icon-highlighted, #3e3f5e);
}

/* 5. Create form ------------------------------------------------------------------------------ */
.vhl-poll-form .vhl-poll-form-row + .vhl-poll-form-row,
.vhl-poll-form .vhl-form-error + .vhl-poll-form-row {
	margin-top: 24px;
}

.vhl-poll-form .vhl-poll-form-row[hidden] {
	display: none;
}

.vhl-poll-form .vhl-poll-form-question textarea {
	height: 96px;
	min-height: 96px;
	padding-top: 22px;
	resize: vertical;
	line-height: 1.5em;
}

.vhl-poll-form .vhl-poll-form-counter {
	margin-top: 6px;
	color: var(--color-text-alt-2, #adafca);
	font-size: calc((12 / var(--vikinger-font-size-base, 16)) * 1rem);
	font-weight: 600;
	text-align: right;
}

.vhl-poll-form .vhl-poll-form-options {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.vhl-poll-form .vhl-poll-form-option {
	display: flex;
	align-items: center;
	gap: 10px;
}

.vhl-poll-form .vhl-poll-form-option .form-input {
	flex: 1 1 auto;
	min-width: 0;
}

.vhl-poll-form .vhl-poll-form-remove {
	display: flex;
	flex: 0 0 auto;
	justify-content: center;
	align-items: center;
	width: 36px;
	height: 36px;
	border: 0;
	border-radius: 10px;
	background-color: var(--color-box-highlight-background, #f7f7fb);
	cursor: pointer;
	transition: background-color .2s ease-in-out;
}

.vhl-poll-form .vhl-poll-form-remove svg {
	width: 10px;
	height: 10px;
	fill: var(--color-icon, #adafca);
	transition: fill .2s ease-in-out;
}

.vhl-poll-form .vhl-poll-form-remove:hover:not(:disabled) {
	background-color: var(--color-tertiary, #fd4350);
}

.vhl-poll-form .vhl-poll-form-remove:hover:not(:disabled) svg {
	fill: #fff;
}

.vhl-poll-form .vhl-poll-form-remove:disabled {
	opacity: .35;
	cursor: default;
}

.vhl-poll-form .vhl-poll-form-options-footer {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	margin-top: 14px;
}

.vhl-poll-form .vhl-poll-form-options-footer .vhl-field-help {
	margin: 0;
}

.vhl-poll-form .vhl-poll-form-add {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	width: auto;
	padding: 0 18px;
}

.vhl-poll-form .vhl-poll-form-add[hidden] {
	display: none;
}

.vhl-poll-form .vhl-poll-form-add svg {
	width: 8px;
	height: 8px;
	fill: currentColor;
}

.vhl-poll-form .vhl-has-error .form-input input,
.vhl-poll-form .vhl-has-error .form-input textarea,
.vhl-poll-form .vhl-has-error .form-select select {
	border-color: var(--color-tertiary, #fd4350);
}

.vhl-poll-form .vhl-poll-form-settings .vhl-choices .vhl-choice + .vhl-choice {
	margin-top: 14px;
}

.vhl-poll-form .vhl-poll-form-settings .vhl-field-help {
	margin-top: 14px;
}

.vhl-poll-form .vhl-poll-form-notice {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-top: 20px;
	padding: 12px 16px;
	border-radius: 12px;
	background-color: var(--color-box-highlight-background, #f7f7fb);
	color: var(--color-text-alt, #8f91ac);
	font-size: calc((13 / var(--vikinger-font-size-base, 16)) * 1rem);
	font-weight: 600;
	line-height: 1.4em;
}

.vhl-poll-form .vhl-poll-form-notice svg {
	flex: 0 0 auto;
	width: 16px;
	height: 16px;
	fill: var(--color-secondary, #615dfa);
}

.vhl-poll-form input[type="datetime-local"] {
	color-scheme: light dark;
}

@media screen and (max-width: 960px) {
	.vhl-poll-form .form-row.split {
		flex-direction: column;
		gap: 24px;
	}
}

/* 6. Voters modal ------------------------------------------------------------------------------ */
.vhl-poll-voters .vhl-poll-voters-list {
	display: flex;
	flex-direction: column;
	gap: 18px;
	min-height: 44px;
}

.vhl-poll-voters .vhl-poll-voters-list.is-loading:empty::before {
	content: "";
	display: block;
	height: 44px;
	border-radius: 12px;
	background-color: var(--color-box-highlight-background, #f7f7fb);
}

.vhl-poll-voters .vhl-poll-voters-empty {
	color: var(--color-text-alt, #8f91ac);
	font-size: calc((14 / var(--vikinger-font-size-base, 16)) * 1rem);
	font-weight: 600;
}

.vhl-poll-voters .vhl-poll-voters-footer {
	display: flex;
	justify-content: center;
}

.vhl-poll-voters .vhl-poll-voters-more {
	width: auto;
	padding: 0 22px;
}

.vhl-poll-voters .vhl-poll-voters-more[hidden] {
	display: none;
}

/* 7. Preview card, create box, embeds ---------------------------------------------------------- */
.vhl-poll-card .widget-box-status {
	margin-bottom: 24px;
}

.vhl-poll-card .user-status-title a {
	color: var(--color-text, #3e3f5e);
	font-weight: 700;
}

.vhl-poll-card .vhl-poll-card-footer {
	display: flex;
	justify-content: flex-end;
	padding: 0 28px 24px;
}

.vhl-poll-card .vhl-poll-card-link {
	width: auto;
	padding: 0 22px;
}

.vhl-poll-create-box {
	padding: 24px 28px;
}

.vhl-poll-create-inner {
	display: flex;
	align-items: center;
	gap: 16px;
}

.vhl-poll-create-icon {
	display: flex;
	flex: 0 0 auto;
	justify-content: center;
	align-items: center;
	width: 48px;
	height: 48px;
	border-radius: 12px;
	background-color: var(--color-secondary, #615dfa);
	box-shadow: var(--color-secondary-shadow, 4px 7px 12px 0 rgba(97, 93, 250, .2));
}

.vhl-poll-create-icon svg {
	width: 20px;
	height: 20px;
	fill: #fff;
}

.vhl-poll-create-text {
	flex: 1 1 auto;
	min-width: 0;
}

.vhl-poll-create-title {
	margin: 0;
	color: var(--color-text, #3e3f5e);
	font-size: calc((16 / var(--vikinger-font-size-base, 16)) * 1rem);
	font-weight: 700;
	line-height: 1.2em;
}

.vhl-poll-create-desc {
	margin: 6px 0 0;
	color: var(--color-text-alt, #8f91ac);
	font-size: calc((13 / var(--vikinger-font-size-base, 16)) * 1rem);
	font-weight: 500;
	line-height: 1.5em;
}

.vhl-poll-create-button,
.vhl-poll-create-login {
	flex: 0 0 auto;
	width: auto;
	padding: 0 24px;
}

.vhl-poll-create-result:not(:empty) {
	margin-top: 24px;
}

.vhl-poll-create-result .vhl-poll-card {
	box-shadow: none;
	border: 1px solid var(--color-divider, #eaeaf5);
}

.vhl-poll-embed-box {
	padding: 28px;
}

/* The theme keeps the 28px side padding of activity text on phones: the widget does too. */
@media screen and (max-width: 680px) {
	.vhl-poll-create-inner {
		flex-wrap: wrap;
	}

	.vhl-poll-create-button,
	.vhl-poll-create-login {
		width: 100%;
	}

	.vhl-poll-actions {
		width: 100%;
		justify-content: space-between;
	}
}

/* 8. Other themes ------------------------------------------------------------------------------- */
.vhl-no-vikinger .vhl-poll .button,
.vhl-no-vikinger .vhl-poll-create-box .button,
.vhl-no-vikinger .vhl-poll-card .button {
	display: inline-flex;
	justify-content: center;
	align-items: center;
	height: 40px;
	border: 1px solid var(--color-border, #dedeea);
	border-radius: 10px;
	background-color: var(--color-box-background, #fff);
	color: var(--color-text, #3e3f5e);
	font-weight: 700;
	cursor: pointer;
}

.vhl-no-vikinger .vhl-poll .button.secondary,
.vhl-no-vikinger .vhl-poll-create-box .button.secondary {
	border-color: var(--color-secondary, #615dfa);
	background-color: var(--color-secondary, #615dfa);
	color: #fff;
}

.vhl-no-vikinger .vhl-poll-create-box,
.vhl-no-vikinger .vhl-poll-embed-box {
	border-radius: 12px;
	background-color: var(--color-box-background, #fff);
	box-shadow: var(--color-box-shadow, 0 0 40px 0 rgba(94, 92, 154, .06));
}

.vhl-no-vikinger .vhl-poll-kicker-icon,
.vhl-no-vikinger .vhl-poll-check-icon,
.vhl-no-vikinger .vhl-poll-mine-icon {
	display: none;
}
