/* ===== Post Poll: frontend styles ===== */

/* Outer container — match both the legacy single-instance ID and the new
 * multi-instance class. Top margin 24px, bottom 30px for breathing room
 * before whatever follows in the post. */
.post-poll-instance,
div#post-poll[data-id] {
    width: 100%;
    max-width: 100%;
    margin: 24px auto 30px;
    float: none;
    height: auto !important;
}

.poll-box {
    background: #ffffff;
    padding: 24px 24px 20px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
    box-sizing: border-box;
}

/* Loading spinner — keep card from collapsing */
#poll-box-loading {
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.poll-question h3 {
    margin: 0 0 16px 0;
    /*font-size: 20px;*/
    font-weight: 600;
    line-height: 1.35;
    color: #1f2937;
}

.poll-total-votes {
    margin: -8px 0 18px 0;
    color: #6b7280;
    font-size: 13px;
}

/* ===== Options as clickable cards ===== */

.poll-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0 0 18px 0;
}

.poll-option {
    display: block;
    position: relative;
}

/* Hide the radio visually but keep it accessible to AT and keyboard */
.poll-option input[type="radio"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.poll-option label {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    margin: 0;
    border: 1.5px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.15s, background-color 0.15s;
    font-size: 16px;
    line-height: 1.3;
    color: #1f2937;
    box-sizing: border-box;
}

.poll-option label::before {
    content: "";
    width: 18px;
    height: 18px;
    border: 2px solid rgba(0, 0, 0, 0.25);
    border-radius: 50%;
    margin-right: 12px;
    flex-shrink: 0;
    background: #fff;
    transition: border-color 0.15s, background 0.15s;
    box-sizing: border-box;
}

.poll-option label:hover {
    border-color: rgba(218, 55, 45, 0.45);
    background: rgba(218, 55, 45, 0.03);
}

.poll-option input:checked + label {
    border-color: #da372d;
    background: rgba(218, 55, 45, 0.06);
}

.poll-option input:checked + label::before {
    border-color: #da372d;
    background: radial-gradient(circle at center, #da372d 0 5px, #fff 6px);
}

.poll-option input:focus-visible + label {
    outline: 3px solid rgba(218, 55, 45, 0.25);
    outline-offset: 2px;
}

/* ===== Email + submit ===== */

.poll-email {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0 0 14px 0;
}

.poll-email input[type="email"] {
    padding: 12px 14px;
    border: 1.5px solid rgba(0, 0, 0, 0.12);
    border-radius: 8px;
    font-size: 15px;
    width: 100%;
    box-sizing: border-box;
    background: #ffffff;
    color: #111;
    transition: border-color 0.15s, outline 0.15s;
}

.poll-email input[type="email"]:focus {
    border-color: #da372d;
    outline: 3px solid rgba(218, 55, 45, 0.2);
    outline-offset: 0;
}

.poll-email button#poll-submit,
.poll-email button {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    background-color: #da372d !important;
    color: #fff !important;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: background-color 0.15s;
}

/*
 * !important is unfortunately required here because some themes ship rules
 * like `button:hover { background-color: inherit !important; }` that would
 * otherwise wipe out the submit button's red on hover/focus.
 */
.poll-email button#poll-submit:hover,
.poll-email button#poll-submit:focus,
.poll-email button:hover,
.poll-email button:focus {
    background-color: #b82a22 !important;
    color: #fff !important;
}

.poll-email button#poll-submit:focus-visible,
.poll-email button:focus-visible {
    outline: 3px solid rgba(218, 55, 45, 0.3);
    outline-offset: 2px;
}

#post-poll-recaptcha {
    margin: 4px 0 0 0;
}

/* Email input + skip-link grouped together so the skip-link sits tight
   under the email field (rather than below the entire form), making it
   read as the "I don't want to give my email" escape hatch. The button
   stays a separate flex item with normal column-gap spacing below. */
.poll-email-field {
    display: block;
}
.poll-see-results {
    margin: 6px 0 0 16px;
    font-size: 13px;
    text-align: left;
}
.poll-see-results a {
    color: #777;
    cursor: pointer;
}
.poll-see-results a:hover,
.poll-see-results a:focus {
    color: #333;
}

/* Honeypot — visually hidden, still focusable by AT (but tabindex=-1 keeps it out of tab order). */
.pp-website-field {
    position: absolute !important;
    left: -9999px !important;
    top: auto !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
}

/* ===== Error message ===== */

.poll-error {
    background: #fde8e6;
    color: #a71f17;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    margin: 0 0 12px 0;
}

/* "Did you mean user@gmail.com?" — the address is a one-click fix (v2.6.65). */
.poll-error a.poll-suggestion {
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}

/* ===== Footer ===== */

.poll-footer {
    margin: 14px 0 0 0;
    padding: 12px 0 0 0;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.poll-footer p {
    margin: 0;
    font-size: 11px;
    color: #9ca3af;
    line-height: 1.5;
}

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

.poll-options.poll-options-results {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 0 0 4px 0;
}

.poll-options.poll-options-results .poll-option {
    display: block;
    margin: 0;
    font-weight: 400;
}

.result-answer-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 6px 0;
    font-size: 15px;
}

.result-answer-text {
    color: #1f2937;
    font-weight: 500;
}

.result-answer-pct {
    color: #1f2937;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.result-leader .result-answer-text,
.result-leader .result-answer-pct {
    color: #da372d;
    font-weight: 700;
}

.result-progress {
    position: relative;
    height: 9px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 999px;
    overflow: hidden;
}

.result-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0;
    background: rgba(218, 55, 45, 0.55);
    border-radius: 999px;
    transition: width 0.6s ease;
}

.result-leader .result-bar {
    background: #da372d;
}

.result-votes {
    margin: 6px 0 0 0;
    font-size: 12px;
    color: #6b7280;
    font-variant-numeric: tabular-nums;
}

/* ===== Mobile tweaks ===== */

@media (max-width: 480px) {
    .poll-box {
        padding: 20px 18px 16px;
        border-radius: 10px;
    }
    .poll-question h3 {
        /*font-size: 18px;*/
    }
    .poll-option label {
        font-size: 15px;
        padding: 11px 12px;
    }
}

/* ------------------------------------------------------------------
   "Hide all polls" reader opt-out link (question + results footers).
   Deliberately quiet: small, muted, bottom-right — findable by the
   reader who wants it, invisible to everyone else.
   ------------------------------------------------------------------ */
.poll-hide-all-wrap {
    text-align: right;
    margin: 10px 0 0;
}
.poll-hide-all {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.65rem;
    color: #ffffff !important;
    text-decoration: none;
    border: none !important;
    padding: 3px 8px;
    border-radius: 5px;
    background: #a5a5a5;
    font-weight: 400 !important;
    text-transform: uppercase;
    margin: 5px 0 0 0;
}
.poll-hide-all:hover {
    background: #8a8a8a;
    text-decoration: none;
}
.poll-hide-all svg {
    width: 13px;
    height: 13px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* "Your vote" badge in the results chart (added by postpoll.js next to the
   answer this browser voted for). Neutral gray so it doesn't compete with
   the red leader highlight. */
.result-your-vote {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #eef1f0;
    color: #374151;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    vertical-align: middle;
}
