/* ==========================================================================
   poll-results.css — ظاهرِ کامپوننتِ «Poll Results» (21st.dev) برایِ ویجتِ نظرسنجی
   منبع: https://21st.dev/@ddoemonn/components/poll-results  (id 23544، نویسنده: ddoemonn)
   عناصرِ وفادار به کامپوننت: ردیف‌هایِ گردِ ۳۶–۴۰px با سایه‌یِ درونیِ لبه‌دار، پرشدنِ نوار با
   clip-path، readoutِ درصد با اعدادِ هم‌عرض، تیکِ گزینه‌یِ پیشرو با «pop»، رینگِ فوکوسِ درونی،
   حالتِ «revealed» با کفِ فرورفته. رنگ‌ها: پالتِ خودِ سایت (جنگلی/کاغذی)، نه آبیِ کامپوننت.
   تبدیل: React/Tailwind → CSS ساده، راست‌به‌چپ (پرشدن از راست). منطقِ رأی‌دادنِ سمتِ سرور دست‌نخورده.
   بازگشت: نسخه‌یِ قبلیِ قالب در /opt/ai-skills/backups/_poll_widget.html.before-21st
   ========================================================================== */

.poll-options { display: flex; flex-direction: column; gap: 8px; }
.poll-submit { align-self: flex-start; margin-top: 6px; }

/* ---------- حالتِ رأی‌نداده: ردیف‌هایِ انتخاب (رادیو واقعی، فقط پنهانِ بصری) ---------- */
.poll-option {
    position: relative; display: flex; align-items: center; gap: 10px;
    min-height: 42px; padding: 8px 14px; overflow: hidden; cursor: pointer;
    border: 1px solid var(--line); border-radius: 10px; background: #fff;
    box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, .95), inset 0 -1px 0 rgba(28, 25, 23, .06), 0 1px 2px rgba(28, 25, 23, .08);
    transition: border-color .2s ease, background-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.poll-option:hover { background: #FAF8F2; }
.poll-option:active { transform: translateY(1px); box-shadow: inset 0 1px 2px rgba(28, 25, 23, .06); }
.poll-option input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.poll-option-label { flex: 1; min-width: 0; font-size: 13.5px; line-height: 1.7; color: #3F4A42; transition: color .2s ease, font-weight .2s ease; }
.poll-option:hover .poll-option-label { color: var(--ink); }
.poll-option-mark {
    display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0;
    border: 1.5px solid #B9B4A3; color: #fff; background: transparent;
    transition: background-color .2s ease, border-color .2s ease;
}
.poll-option-mark svg { opacity: 0; transform: scale(.4); transition: opacity .15s ease, transform .22s cubic-bezier(.34, 1.56, .64, 1); }
.poll-option input:checked ~ .poll-option-mark { background: var(--forest-700); border-color: var(--forest-700); }
.poll-option input:checked ~ .poll-option-mark svg { opacity: 1; transform: scale(1); }
.poll-option input:checked ~ .poll-option-label { font-weight: 700; color: var(--forest-900); }
.poll-option:has(input:checked) { border-color: var(--forest-700); background: rgba(31, 77, 58, .07); }
.poll-option-ring { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; }
.poll-option input:focus-visible ~ .poll-option-ring { background: rgba(31, 77, 58, .06); box-shadow: inset 0 0 0 2px var(--forest-700); }

/* تراز بصریِ متنِ فارسی (Vazirmatn ascender بلند دارد) */
.poll-option-label, .poll-row-label, .poll-row-count, .poll-row-pct { padding-top: 3px; }

/* ---------- حالتِ نتایج: ردیف‌هایِ «revealed» با نوارِ clip-path ---------- */
.poll-results { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.poll-row {
    position: relative; display: flex; align-items: center; min-height: 40px; overflow: hidden;
    border: 1px solid var(--line); border-radius: 10px; background: rgba(246, 243, 234, .75);
    box-shadow: inset 0 1px 2px rgba(28, 25, 23, .07); cursor: default;
}
.poll-fill {
    position: absolute; inset: 3px; border-radius: 7px; pointer-events: none;
    background: rgba(31, 77, 58, .10);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), inset 0 -1px 0 rgba(28, 25, 23, .10);
    /* از لبه‌یِ راست (RTL) تا share٪؛ --p را JS هنگامِ انیمیشن می‌نویسد */
    clip-path: inset(0 0 0 calc(100% - (var(--p, var(--share, 0)) * 1%)) round 7px);
}
.poll-row.is-winner .poll-fill {
    background: rgba(31, 77, 58, .22);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), inset 0 -1px 0 rgba(31, 77, 58, .30);
}
.poll-row-body { position: relative; display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 14px; }
.poll-row-label { flex: 1; min-width: 0; font-size: 13.5px; line-height: 1.7; color: #3F4A42; }
.poll-row.is-winner .poll-row-label { font-weight: 700; color: var(--forest-900); }
.poll-row-count { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.poll-row-pct {
    min-width: 3.4em; text-align: left; direction: ltr; font-size: 12px; color: var(--muted);
    font-variant-numeric: tabular-nums; white-space: nowrap;
}
.poll-row.is-winner .poll-row-pct { color: var(--forest-900); font-weight: 700; }
.poll-row-win { display: grid; place-items: center; width: 16px; height: 16px; color: var(--forest-900); flex-shrink: 0; }
.poll-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* با JS: تیک بعد از فرود «pop» می‌کند */
.poll-row.is-armed .poll-row-win { opacity: 0; transform: scale(.4); }
.poll-row.is-armed.is-landed .poll-row-win { opacity: 1; transform: scale(1); transition: transform .22s cubic-bezier(.34, 1.56, .64, 1), opacity .15s ease; }

/* ---------- حالت‌هایِ دسترس‌پذیریِ سایت ---------- */
html.a11y-dark .poll-option, html.a11y-dark .poll-row { background: #252522; border-color: rgba(255, 255, 255, .16); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 1px 2px rgba(0, 0, 0, .4); }
html.a11y-dark .poll-option:hover { background: #2A2A27; }
html.a11y-dark .poll-option-label, html.a11y-dark .poll-row-label { color: #d9d9d3; }
html.a11y-dark .poll-option input:checked ~ .poll-option-label, html.a11y-dark .poll-row.is-winner .poll-row-label,
html.a11y-dark .poll-row.is-winner .poll-row-pct, html.a11y-dark .poll-row-win { color: #f2f2ee; }
html.a11y-dark .poll-fill { background: rgba(255, 255, 255, .12); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), inset 0 -1px 0 rgba(0, 0, 0, .3); }
html.a11y-dark .poll-row.is-winner .poll-fill { background: rgba(255, 255, 255, .26); }
html.a11y-dark .poll-option:has(input:checked) { background: rgba(255, 255, 255, .10); border-color: #9bd0b0; }
html.a11y-dark .poll-option input:checked ~ .poll-option-mark { background: #9bd0b0; border-color: #9bd0b0; color: #12291E; }
html.a11y-dark .poll-option input:focus-visible ~ .poll-option-ring { box-shadow: inset 0 0 0 2px #9bd0b0; }
html.a11y-contrast .poll-option, html.a11y-contrast .poll-row { border-width: 2px; box-shadow: none; }

html.a11y-motion-off .poll-option, html.a11y-motion-off .poll-option *,
html.a11y-motion-off .poll-row-win { transition: none !important; }
@media (prefers-reduced-motion: reduce) {
    .poll-option, .poll-option *, .poll-row-win { transition: none !important; }
}
