.ezpoll {
  background-color: rgb(228, 239, 249);
  background-color: var(--color-popular-comments-bg);
  margin: 1em 0;
}

.ezpoll .widget-title {
  margin-bottom: 0;
}

.ezpoll-content-wrap {
  padding: 10px 1em;
}

.ezpoll-form-ui {
  opacity: 1;
  max-height: 500px;
  overflow: hidden;
  transition: opacity 250ms ease, max-height 250ms ease;
}

.ezpoll-voted .ezpoll-form-ui {
  opacity: 0;
  max-height: 0;
}

/* Loading: hide form, show spinner, keep results hidden until ready */
.ezpoll-loading .ezpoll-form-ui {
  opacity: 0;
  max-height: 0;
}

.ezpoll-loading .ezpoll-results {
  opacity: 0;
  max-height: 0;
  margin-top: 0;
}

/* Spinner */
.ezpoll-spinner {
  display: none;
  align-items: center;
  justify-content: center;
  padding: 14px 0;
}

.ezpoll-loading .ezpoll-spinner {
  display: flex;
}

.ezpoll-spinner::after {
  content: "";
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid rgba(0,0,0,0.15);
  border-top-color: var(--ezpoll-accent); /* rgb(1,62,131) */
  animation: ezpoll-spin 0.9s linear infinite;
}

@keyframes ezpoll-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .ezpoll-spinner::after { animation: none; }
}


.ezpoll-choices {
  display: grid;
  gap: 8px;
}

.ezpoll-choice {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Accent color */
.ezpoll {
  --ezpoll-accent: rgb(1,62,131);
}

/* Make each choice look like a selectable card */
.ezpoll-choice {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

/* Hide native radio, keep it accessible */
.ezpoll-choice input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* Label text + custom radio indicator spacing */
.ezpoll-choice span {
  position: relative;
  display: block;
  padding-left: 30px;
  line-height: 1.25;
}

/* Custom radio outer circle */
.ezpoll-choice span::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);

  width: 18px;
  height: 18px;
  border-radius: 50%;

  border: 2px solid #8c8f94;
  background: #fff;

  box-sizing: border-box;
  transition: border-color 150ms ease;
}

/* Custom radio inner dot */
.ezpoll-choice span::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 50%;
  transform: translateY(-50%) scale(0);

  width: 8px;
  height: 8px;
  border-radius: 50%;

  background: var(--ezpoll-accent);

  transition: transform 150ms ease;
}

/* Hover/focus styling */
.ezpoll-choice:hover {
  border-color: #bdbfc4;
}

.ezpoll-choice:focus-within {
}

/* Selected state uses rgb(1,62,131) */
.ezpoll-choice input[type="radio"]:checked + span::before {
  border-color: var(--ezpoll-accent);
}

.ezpoll-choice input[type="radio"]:checked + span::after {
  transform: translateY(-50%) scale(1);
}

/* Optional: subtle selected background */
.ezpoll-choice input[type="radio"]:checked + span {
  /* keep text normal; indicator carries the accent */
}

.ezpoll-choice input[type="radio"]:checked {
  /* nothing needed; kept for clarity */
}

/* If you want the entire card to look selected */
.ezpoll-choice:has(input[type="radio"]:checked) {
}

.ezpoll-submit {
  margin-top: 12pt;
  margin-top: calc(1.2 * var(--base-font-size));
  margin-bottom: .5em;
}

.ezpoll-message {
	margin: 1em 0;
}

.ezpoll-message {
	display: none;
}

/* Results area appears where the form UI was */
.ezpoll-results {
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity 250ms ease, max-height 250ms ease;
  margin-top: 0;
}

.ezpoll-voted .ezpoll-results {
  opacity: 1;
  max-height: 2000px;
}

.ezpoll-results-title {
  font-weight: 600;
  margin-bottom: 1em;
}

.ezpoll-bars {
  display: grid;
  gap: 10px;
}

.ezpoll-bar-row {
  display: grid;
  grid-template-columns: 160px 1fr 50px;
  gap: 10px;
  align-items: center;
}

.ezpoll-bar-label,
.ezpoll-vote-count,
.ezpoll-bar-pct {
  font-size: .875em;
  font-weight: bold;
  line-height: 1.2;
}

.ezpoll-vote-count {
  margin-top: 1em;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.ezpoll-bar-pct {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.ezpoll-bar-track {
  background: rgba(1,62,131,.1);
  border-radius: 999px;
  height: 24px;
  overflow: hidden;
  position: relative;
}

.ezpoll-bar-fill {
  box-sizing: content-box;
  height: 100%;
  width: 0%;
  max-width: calc(100% - 10px);
  min-width: fit-content;
  padding: 0 10px;
  background: rgb(1,62,131);
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: flex-end;

  /* allow count text to remain readable even on small percentages */
  overflow: visible;
  white-space: nowrap;

  transition: width 900ms ease;
}

.ezpoll-bar-count {
  color: rgba(255,255,255,.75);
  font-weight: 600;
  font-size: 13px;
}

.is-winner .ezpoll-bar-count{
  color: #fff;
}

@media (prefers-reduced-motion: reduce) {
  .ezpoll-form-ui,
  .ezpoll-results,
  .ezpoll-bar-fill {
    transition: none;
  }
}

/* Mobile: label above bar (prevents squishing on narrow screens) */
@media (max-width: 959px) {
  .ezpoll-bar-row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "label pct"
      "track track";
    gap: 6px 10px;
    align-items: center;
  }

  .ezpoll-bar-label { grid-area: label; }
  .ezpoll-bar-pct   { grid-area: pct; text-align: right; }
  .ezpoll-bar-track { grid-area: track; }

  /* Slightly taller bar on mobile */
  .ezpoll-bar-track {
    height: 26px;
  }
}

/* Gewinner: dezenter "Sheen"-Sweep */
.ezpoll-bar-fill.is-winner {
  /* Keep your base winner color consistent with the UI */
  background-color: var(--ezpoll-accent);

  /* Subtle moving highlight */
  background-image: linear-gradient(
    120deg,
    rgba(255,255,255,0) 0%,
    rgba(255,255,255,0.22) 45%,
    rgba(255,255,255,0) 60%
  );
  background-repeat: no-repeat;
  background-size: 260% 100%;

  /* Soft emphasis */
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.18);

  /* The sweep animation (slow + subtle) */
  animation: ezpoll-winner-sheen 4.5s ease-in-out infinite;
}

/* Optional: slightly emphasize label of winner row */
.ezpoll-bar-row.ezpoll-winner .ezpoll-bar-label {
  font-weight: 600;
}

@keyframes ezpoll-winner-sheen {
  0%   { background-position: 220% 0; }
  55%  { background-position: -220% 0; }
  100% { background-position: -220% 0; }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .ezpoll-bar-fill.is-winner {
    animation: none;
  }
}
