/* Polls (library/Polls.php, assets/js/polls.js): the composer's builder and
 * the poll card on posts. Colours come from sb_theme.css's tokens. */

:root { --sbp-accent: var(--sb-accent, #0073b7); }

/* ---- builder ---------------------------------------------------------------- */
.sbp-builder {
    margin: 0 14px 10px; padding: 12px; border: 1px solid var(--sb-border); border-radius: 14px;
    background: color-mix(in srgb, var(--sbp-accent) 4%, var(--sb-surface));
}
.sbp-builder[hidden] { display: none; }
.sbp-builder-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.sbp-builder-head .sbp-hint { flex: 1; }
.sbp-remove-poll { border: 0; background: rgba(127,127,127,.12); color: var(--sb-text); width: 28px; height: 28px; border-radius: 50%; font-size: 18px; line-height: 28px; cursor: pointer; }
.sbp-hint { font-size: 12px; color: var(--sb-text-muted); }
.sbp-opt { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.sbp-opt-label {
    flex: 1; min-width: 0; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--sb-border);
    background: var(--sb-surface); color: var(--sb-text); font-size: 14px;
}
.sbp-attach { position: relative; margin: 0; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--sb-border); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; overflow: hidden; }
.sbp-attach input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.sbp-thumb { position: relative; width: 36px; height: 36px; border-radius: 8px; overflow: hidden; flex: none; background: #000; }
.sbp-thumb[hidden] { display: none; }
.sbp-thumb img, .sbp-thumb video { width: 100%; height: 100%; object-fit: cover; }
.sbp-opt-remove { border: 0; background: none; color: var(--sb-text-muted); font-size: 20px; width: 28px; cursor: pointer; }
.sbp-opt-remove[hidden] { display: none; }
.sbp-add { border: 1px dashed var(--sb-border); background: none; color: var(--sbp-accent); border-radius: 10px; padding: 7px 12px; font-weight: 700; width: 100%; cursor: pointer; }
.sbp-add[hidden] { display: none; }
.sbp-settings { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-top: 10px; font-size: 13px; }
.sbp-check, .sbp-duration { margin: 0; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.sbp-duration select { border-radius: 8px; border: 1px solid var(--sb-border); padding: 4px 6px; background: var(--sb-surface); color: var(--sb-text); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---- card ------------------------------------------------------------------- */
/* Inset to line up with the post text and the Like/Share row: the card sits
 * straight in feed/thread.php's .box-body.no-padding. */
.sbp-card { margin: 12px 12px 10px; }
.sbp-card.is-busy { opacity: .6; pointer-events: none; }
.sbp-options-view { display: flex; flex-direction: column; gap: 8px; }
.sbp-options-view.is-grid { display: grid; grid-template-columns: repeat(2, 1fr); }
.sbp-row { display: flex; align-items: stretch; gap: 8px; }
.sbp-row.is-tile { flex-direction: column; gap: 6px; }
.sbp-choice {
    flex: 1; display: flex; align-items: center; gap: 10px; text-align: left; cursor: pointer;
    padding: 10px 12px; border-radius: 12px; border: 1.5px solid var(--sb-border);
    background: var(--sb-surface); color: var(--sb-text); font-size: 14px; font-weight: 600;
    transition: border-color .15s ease, background .15s ease, transform .1s ease;
}
.sbp-choice:hover:not([disabled]) { border-color: var(--sbp-accent); }
.sbp-choice:active:not([disabled]) { transform: scale(.98); }
.sbp-choice:focus-visible { outline: 3px solid color-mix(in srgb, var(--sbp-accent) 45%, transparent); outline-offset: 2px; }
.sbp-choice[disabled] { cursor: default; opacity: .8; }
.sbp-mark { width: 18px; height: 18px; flex: none; border-radius: 50%; border: 2px solid var(--sb-text-muted); position: relative; }
.sbp-choice[role=checkbox] .sbp-mark { border-radius: 5px; }
.sbp-row.is-picked .sbp-choice { border-color: var(--sbp-accent); background: color-mix(in srgb, var(--sbp-accent) 10%, var(--sb-surface)); }
.sbp-row.is-picked .sbp-mark { border-color: var(--sbp-accent); background: var(--sbp-accent); }
.sbp-row.is-picked .sbp-mark::after { content: '✓'; position: absolute; inset: 0; color: #fff; font-size: 12px; line-height: 14px; text-align: center; }
.sbp-label { word-break: break-word; }

.sbp-bar {
    position: relative; flex: 1; display: flex; align-items: center; gap: 8px; min-height: 42px;
    padding: 8px 12px; border-radius: 12px; overflow: hidden; background: rgba(127,127,127,.09);
    font-size: 14px; font-weight: 600; color: var(--sb-text);
}
.sbp-fill {
    position: absolute; left: 0; top: 0; bottom: 0; border-radius: 12px;
    background: color-mix(in srgb, var(--sbp-accent) 22%, transparent);
    transition: width .7s cubic-bezier(.2,.8,.2,1);
}
.sbp-row.is-lead .sbp-fill { background: color-mix(in srgb, var(--sbp-accent) 38%, transparent); }
.sbp-bar > :not(.sbp-fill) { position: relative; }
.sbp-bar .sbp-label { flex: 1; }
.sbp-mine { color: var(--sb-link, var(--sbp-accent)); font-weight: 800; }
.sbp-pct { margin-left: auto; font-weight: 800; }

.sbp-media { position: relative; display: block; flex: none; width: 56px; height: 56px; border-radius: 10px; overflow: hidden; background: #000; cursor: zoom-in; }
.sbp-media.is-big { width: 100%; height: auto; aspect-ratio: 1; }
.sbp-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sbp-video-blank { display: block; width: 100%; height: 100%; background: linear-gradient(135deg, #222, #444); }
.sbp-play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 30px; height: 30px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; font-size: 12px; line-height: 30px; text-align: center; }
.sbp-media:focus-visible { outline: 3px solid var(--sbp-accent); outline-offset: 2px; }

.sbp-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 10px; padding: 0 2px; font-size: 12.5px; color: var(--sb-text-muted); }
.sbp-actions { margin-left: auto; display: inline-flex; gap: 14px; align-items: center; }
.sbp-vote { border: 0; border-radius: 999px; padding: 6px 18px; background: var(--sbp-accent); color: #fff; font-weight: 800; cursor: pointer; }
.sbp-vote[disabled] { opacity: .5; cursor: default; }
.sbp-link { border: 0; background: none; padding: 0; color: var(--sb-link, var(--sbp-accent)); font-weight: 700; cursor: pointer; }

.sbp-lightbox { position: fixed; inset: 0; z-index: 10070; background: rgba(0,0,0,.88); display: flex; align-items: center; justify-content: center; padding: 16px; }
.sbp-lightbox img, .sbp-lightbox video { max-width: 100%; max-height: 100%; border-radius: 8px; }
.sbp-lightbox-close { position: absolute; top: 12px; right: 14px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255,255,255,.15); color: #fff; font-size: 24px; cursor: pointer; }

@media (prefers-reduced-motion: reduce) {
    .sbp-fill, .sbp-choice { transition: none; }
}
