/* ── Sidebar Poll Widget (abad-sidebar-poll) ── */

.abad-sidebar-poll {
    --sp-accent: #6366f1;
    --sp-accent-soft: rgba(99, 102, 241, 0.12);
    --sp-border: #e8edf3;
    --sp-text: #0f172a;
    --sp-muted: #64748b;
    position: relative;
    margin-bottom: 1.25rem;
    padding: 0;
    border: 1px solid var(--sp-border) !important;
    border-radius: 14px !important;
    background: #fff !important;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.06) !important;
    overflow: hidden;
}

/* ── Theme isolation (style.css global radio ~ label::before) ── */
.abad-sidebar-poll input[type="radio"],
.abad-sidebar-poll .abad-sidebar-poll__radio {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none;
}

.abad-sidebar-poll input[type="radio"] ~ label,
.abad-sidebar-poll label.abad-sidebar-poll__option-label {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 0 !important;
    margin: 0 !important;
    line-height: 1.35 !important;
    font-weight: inherit !important;
    color: inherit !important;
}

.abad-sidebar-poll input[type="radio"] ~ label::before,
.abad-sidebar-poll input[type="radio"] ~ label::after,
.abad-sidebar-poll .abad-sidebar-poll__option-label::before,
.abad-sidebar-poll .abad-sidebar-poll__option-label::after {
    display: none !important;
    content: none !important;
}

.abad-sidebar-poll.widget input:not([type="hidden"]) {
    height: auto !important;
    min-height: 0 !important;
}

.abad-sidebar-poll__glow {
    height: 3px;
    background: linear-gradient(90deg, #6366f1, #818cf8, #6366f1);
    background-size: 200% 100%;
    animation: spShimmer 4s linear infinite;
}

@keyframes spShimmer {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

.abad-sidebar-poll__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 0.9rem 0;
    gap: 0.5rem;
}

.abad-sidebar-poll__brand {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--sp-accent);
}

.abad-sidebar-poll__brand i {
    font-size: 0.85rem;
}

.abad-sidebar-poll__status {
    font-size: 0.6rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    flex-shrink: 0;
}

.abad-sidebar-poll__status--live {
    color: #15803d;
    background: rgba(34, 197, 94, 0.12);
}

.abad-sidebar-poll__status--ended {
    color: #b91c1c;
    background: rgba(239, 68, 68, 0.1);
}

.abad-sidebar-poll__question {
    margin: 0;
    padding: 0.5rem 0.9rem 0.7rem;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.45;
    color: var(--sp-text);
}

.abad-sidebar-poll__body {
    padding: 0 0.9rem 0.75rem;
}

.abad-sidebar-poll__form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.abad-sidebar-poll__options {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    width: 100%;
}

.abad-sidebar-poll__option {
    position: relative;
    width: 100%;
    animation: spOptIn 0.3s ease backwards;
    animation-delay: var(--opt-delay, 0ms);
}

@keyframes spOptIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.abad-sidebar-poll__option-label {
    gap: 0.55rem;
    padding: 0.62rem 0.7rem;
    border-radius: 10px;
    border: 1.5px solid var(--sp-border);
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
    box-sizing: border-box;
}

.abad-sidebar-poll__option-label:hover {
    border-color: rgba(99, 102, 241, 0.45);
    background: #fafbff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.08);
}

.abad-sidebar-poll__option-label:active {
    transform: scale(0.99);
}

.abad-sidebar-poll__radio:checked + .abad-sidebar-poll__option-label {
    border-color: var(--sp-accent);
    background: var(--sp-accent-soft);
    box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.15);
}

.abad-sidebar-poll__option.is-voting .abad-sidebar-poll__option-label {
    pointer-events: none;
    opacity: 0.7;
}

.abad-sidebar-poll__letter {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: 800;
    background: #f1f5f9;
    color: var(--sp-muted);
    border: 1px solid var(--sp-border);
    transition: all 0.2s ease;
}

.abad-sidebar-poll__radio:checked + .abad-sidebar-poll__option-label .abad-sidebar-poll__letter {
    background: var(--sp-accent);
    border-color: var(--sp-accent);
    color: #fff;
}

.abad-sidebar-poll__option-text {
    flex: 1;
    min-width: 0;
    font-size: 0.82rem;
    font-weight: 600;
    color: #334155;
    line-height: 1.4;
    word-break: break-word;
}

.abad-sidebar-poll__radio:checked + .abad-sidebar-poll__option-label .abad-sidebar-poll__option-text {
    color: #1e293b;
}

.abad-sidebar-poll__option-check {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--sp-accent);
    font-size: 0.85rem;
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.abad-sidebar-poll__radio:checked + .abad-sidebar-poll__option-label .abad-sidebar-poll__option-check {
    opacity: 1;
    transform: scale(1);
}

.abad-sidebar-poll__hint {
    margin: 0.15rem 0 0;
    padding: 0.35rem 0.5rem;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--sp-muted);
    text-align: center;
    background: #f8fafc;
    border-radius: 8px;
}

.abad-sidebar-poll__auth-note,
.abad-sidebar-poll__ended {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--sp-muted);
    text-align: center;
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px dashed var(--sp-border);
}

.abad-sidebar-poll__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.55rem 0.9rem;
    border-top: 1px solid var(--sp-border);
    background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
}

.abad-sidebar-poll__total {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--sp-muted);
}

.abad-sidebar-poll__total strong {
    color: var(--sp-accent);
    font-size: 0.82rem;
}

.abad-sidebar-poll__countdown-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 0.68rem;
    color: var(--sp-muted);
    margin-left: auto;
}

.abad-sidebar-poll__countdown-wrap i {
    color: var(--sp-accent);
    font-size: 0.75rem;
}

.abad-sidebar-poll__countdown {
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--sp-accent);
    font-size: 0.72rem;
}

.abad-sidebar-poll__body > .abad-sidebar-poll__countdown-wrap,
.abad-sidebar-poll__body > .abad-sidebar-poll__ended {
    margin-top: 0.55rem;
    padding-top: 0.55rem;
    border-top: 1px dashed var(--sp-border);
    width: 100%;
    justify-content: center;
}

/* ── Results ── */
.abad-sidebar-poll__stack-bar {
    display: flex;
    height: 6px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(99, 102, 241, 0.08);
    margin-bottom: 0.7rem;
}

.abad-sidebar-poll__stack-segment {
    height: 100%;
}

.abad-sidebar-poll__result-row {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--sp-border);
}

.abad-sidebar-poll__result-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.abad-sidebar-poll__result-row.is-yours .abad-sidebar-poll__result-text {
    color: var(--sp-accent);
}

.abad-sidebar-poll__result-row.is-winner {
    background: rgba(34, 197, 94, 0.05);
    border-radius: 8px;
    padding: 0.5rem 0.4rem;
}

.abad-sidebar-poll__result-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
}

.abad-sidebar-poll__result-text {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #334155;
    line-height: 1.35;
    min-width: 0;
}

.abad-sidebar-poll__result-text .abad-sidebar-poll__letter {
    width: 24px;
    height: 24px;
    font-size: 0.65rem;
}

.abad-sidebar-poll__result-pct {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--sp-accent);
    flex-shrink: 0;
}

.abad-sidebar-poll__result-track {
    height: 5px;
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.1);
    overflow: hidden;
}

.abad-sidebar-poll__result-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #818cf8);
    border-radius: 999px;
    transition: width 0.9s cubic-bezier(0.4, 0, 0.2, 1);
}

.abad-sidebar-poll__result-row.is-winner .abad-sidebar-poll__result-fill {
    background: linear-gradient(90deg, #22c55e, #4ade80);
}

.abad-sidebar-poll__result-meta {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.25rem;
    flex-wrap: wrap;
}

.abad-sidebar-poll__vote-count {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--sp-muted);
    margin-left: auto;
}

.abad-sidebar-poll__badge {
    font-size: 0.55rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.12rem 0.4rem;
    border-radius: 999px;
}

.abad-sidebar-poll__badge--yours {
    color: #4338ca;
    background: rgba(99, 102, 241, 0.15);
}

.abad-sidebar-poll__badge--winner {
    color: #15803d;
    background: rgba(34, 197, 94, 0.12);
}

.abad-sidebar-poll__badge--lead {
    color: var(--sp-accent);
    background: var(--sp-accent-soft);
}

.abad-sidebar-poll.is-submitting {
    opacity: 0.85;
    pointer-events: none;
}

@media (max-width: 575px) {
    .abad-sidebar-poll__footer {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .abad-sidebar-poll__countdown-wrap {
        margin-left: 0;
        justify-content: center;
    }
}
