/**
 * America Visualized — Custom Poll Styles
 *
 * Visual language matches vision cards and the vision submission form.
 * Font: Poppins (inherited from Impreza theme).
 * Brand: purple #752776 / pink #dc4797 / pink-hover #b02aac / orange #f7941d
 */

/* ==========================================================================
   Wrapper
   ========================================================================== */

.vision-poll {
    font-family: "Poppins", sans-serif;
    max-width: 560px;
    margin: 0 auto;
    padding: 1.75rem 2rem;
    background: #fff;
    border-radius: 1.25rem;
    box-shadow: 0 2px 16px rgba(117, 39, 118, 0.08);
}

/* ==========================================================================
   Question
   ========================================================================== */

.vision-poll__question {
    font-family: "Poppins", sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: #752776;
    margin: 0 0 1.25rem;
    line-height: 1.4;
}

/* ==========================================================================
   Notice (not started, login required)
   ========================================================================== */

.vision-poll__notice {
    font-size: 0.9rem;
    color: #555;
    margin: 0;
}

.vision-poll__notice a {
    color: #dc4797;
    font-weight: 600;
}

/* ==========================================================================
   Hint text ("Select all that apply")
   ========================================================================== */

.vision-poll__hint {
    font-size: 0.78rem;
    color: #999;
    margin: -0.5rem 0 0.75rem;
    font-style: italic;
}

/* ==========================================================================
   Option Pills (voting form)
   ========================================================================== */

.vision-poll__options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.vision-poll__option {
    display: flex;
    align-items: center;
    padding: 0.6rem 1rem;
    background: #fff;
    border: 1.5px solid #ddd;
    border-radius: 2rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: #333;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease,
                box-shadow 0.15s ease;
    user-select: none;
    line-height: 1.4;
    position: relative; /* anchors the ::after checkmark */
}

.vision-poll__option:hover {
    border-color: #dc4797;
    background: #fef0f7;
    color: #752776;
}

.vision-poll__option:focus {
    outline: 2px solid #dc4797;
    outline-offset: 2px;
}

.vision-poll__option.is-selected {
    border-color: #dc4797;
    background: #dc4797;
    color: #fff;
    box-shadow: 0 2px 8px rgba(220, 71, 151, 0.25);
}

.vision-poll__option.is-selected:hover {
    background: #b02aac;
    border-color: #b02aac;
}

.vision-poll__option-text {
    flex: 1;
}

/* Selection indicator — circle matching vision form style */
.vision-poll__option::before {
    content: "";
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #ccc;
    margin-right: 0.65rem;
    flex-shrink: 0;
    background: #fff;
    position: relative;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.vision-poll__option:hover::before {
    border-color: #dc4797;
}

/* Pink fill when selected */
.vision-poll__option.is-selected::before {
    background: #dc4797;
    border-color: #dc4797;
}

/* White checkmark via CSS border trick — matches vision form exactly */
.vision-poll__option.is-selected::after {
    content: "";
    position: absolute;
    left: calc(1rem + 9px);      /* center within the 18px circle */
    top: 50%;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: translate(-50%, -60%) rotate(45deg);
    background: transparent;
    pointer-events: none;
}

/* ==========================================================================
   Actions (Vote button + See results link)
   ========================================================================== */

.vision-poll__actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.vision-poll__submit {
    padding: 0.65rem 2rem;
    background: #dc4797;
    color: #fff;
    border: none;
    border-radius: 2rem;
    font-family: "Poppins", sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
    position: relative;
}

.vision-poll__submit:hover:not(:disabled) {
    background: #b02aac;
}

.vision-poll__submit:active:not(:disabled) {
    transform: scale(0.97);
}

.vision-poll__submit:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Spinner while loading */
.vision-poll__submit.is-loading {
    color: transparent;
    pointer-events: none;
}

.vision-poll__submit.is-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: vision-poll-spin 0.6s linear infinite;
}

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

.vision-poll__skip {
    background: none;
    border: none;
    padding: 0;
    font-family: "Poppins", sans-serif;
    font-size: 0.8rem;
    color: #999;
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.15s ease;
}

.vision-poll__skip:hover {
    color: #752776;
}

/* Error message */
.vision-poll__error {
    margin: 0.75rem 0 0;
    font-size: 0.82rem;
    color: #c62828;
}

/* ==========================================================================
   Results Bars
   ========================================================================== */

.vision-poll__results {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.vision-poll__result-row {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 0.25rem 0.75rem;
    align-items: center;
}

.vision-poll__result-label {
    grid-column: 1;
    grid-row: 1;
    font-size: 0.88rem;
    color: #333;
    font-weight: 500;
    line-height: 1.3;
}

.vision-poll__result-row--voted .vision-poll__result-label {
    color: #752776;
    font-weight: 700;
}

.vision-poll__voted-marker {
    display: inline-block;
    width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    background: #dc4797;
    color: #fff;
    border-radius: 50%;
    font-size: 10px;
    margin-right: 4px;
    vertical-align: middle;
    flex-shrink: 0;
}

.vision-poll__bar-wrap {
    grid-column: 1;
    grid-row: 2;
    height: 10px;
    background: #e8e8e8;
    border-radius: 5px;
    overflow: hidden;
}

.vision-poll__bar {
    height: 100%;
    width: 0;
    background: #dc4797;
    border-radius: 5px;
    transition: width 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Alternate bar colors: odd rows pink, even rows slightly muted */
.vision-poll__result-row:nth-child(even) .vision-poll__bar {
    background: #b02aac;
}

/* Animate to final width when .is-animated is added by JS */
.vision-poll__bar.is-animated {
    width: var(--pct, 0%);
}

.vision-poll__result-meta {
    grid-column: 2;
    grid-row: 1 / 3;
    text-align: right;
    white-space: nowrap;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1px;
}

.vision-poll__pct {
    font-size: 1rem;
    font-weight: 700;
    color: #333;
    line-height: 1.2;
}

.vision-poll__count {
    font-size: 0.72rem;
    color: #888;
    line-height: 1.2;
}

.vision-poll__total {
    font-size: 0.78rem;
    color: #aaa;
    margin: 0.25rem 0 0;
    text-align: right;
}

/* ==========================================================================
   Transitions (form → results)
   ========================================================================== */

@keyframes vision-poll-fade-out {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(-6px); }
}

@keyframes vision-poll-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.vision-poll__form.is-fading-out {
    animation: vision-poll-fade-out 0.25s ease forwards;
    pointer-events: none;
}

.vision-poll__results.is-fading-in {
    animation: vision-poll-fade-in 0.3s ease forwards;
}

/* ==========================================================================
   Ended state
   ========================================================================== */

.vision-poll--ended .vision-poll__question::after {
    content: " · Closed";
    font-size: 0.7em;
    font-weight: 400;
    color: #aaa;
    vertical-align: middle;
    margin-left: 0.4em;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 480px) {
    .vision-poll {
        padding: 1.25rem 1.25rem;
        border-radius: 1rem;
    }

    .vision-poll__question {
        font-size: 1rem;
    }

    .vision-poll__option {
        font-size: 0.85rem;
        padding: 0.55rem 0.85rem;
    }

    .vision-poll__option.is-selected::after {
        left: calc(0.85rem + 9px);
    }

    .vision-poll__pct {
        font-size: 0.9rem;
    }
}
