/* Опросы — форма создания (/polls/create) + карточка в студии.
   Виджет голосования (страница опроса/лента) — секция ниже, Фаза 3. */

.poll-muted { color: #94a3b8; font-weight: 400; font-size: 13px; }

.poll-textarea { resize: vertical; min-height: 64px; font-family: inherit; }

/* ── Варианты ответа ───────────────────────────────────────────────── */
.poll-options { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }

.poll-option-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.poll-option-row__grip {
    color: #cbd5e1;
    cursor: grab;
    flex: 0 0 auto;
    display: inline-flex;
}
.poll-option-row__grip:active { cursor: grabbing; }
.poll-option-row.is-dragging {
    opacity: .55;
    background: #f8fafc;
    border-radius: 8px;
}
.poll-option-input { flex: 1 1 auto; }
.poll-option-row__remove {
    flex: 0 0 auto;
    width: 34px; height: 34px;
    border: none;
    background: #f1f5f9;
    color: #64748b;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .15s ease, color .15s ease;
}
.poll-option-row__remove:hover { background: #fee2e2; color: #dc2626; }
.poll-option-row__remove:disabled { opacity: .4; cursor: not-allowed; }

.poll-add-option {
    border: 1px dashed #cbd5e1;
    background: #f8fafc;
    color: #475569;
    border-radius: 10px;
    padding: 9px 16px;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: border-color .15s ease, color .15s ease;
}
.poll-add-option:hover { border-color: #0040ff; color: #0040ff; }

.poll-frozen-note {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #9a3412;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    margin-bottom: 10px;
}

/* ── Настройки голосования ─────────────────────────────────────────── */
.poll-settings {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
}
.poll-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 0;
}
.poll-setting-row.poll-conditional[hidden] { display: none; }
.poll-setting-label { font-size: 14px; color: #334155; }
.poll-setting-label strong { display: block; font-size: 14px; color: #1e293b; }

.poll-radio {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 18px;
    cursor: pointer;
    font-size: 14px;
}
.poll-num { max-width: 90px; text-align: center; }
.poll-select { max-width: 230px; }
.poll-datetime { max-width: 230px; }

.poll-switch-row { align-items: flex-start; }

/* ── Карточка опроса в студии ──────────────────────────────────────── */
.poll-card .post-body { padding: 16px; }
.poll-card__head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

@media (max-width: 640px) {
    .poll-select, .poll-datetime { max-width: 100%; }
    .poll-setting-row { flex-direction: column; align-items: stretch; }
}

/* ── Виджет голосования (страница опроса / лента) ───────────────────── */
.poll-widget {
    margin: 18px 0;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 16px;
    background: #fff;
}
.poll-widget--loading { opacity: .6; }
.poll-widget__error { color: #94a3b8; font-size: 14px; text-align: center; padding: 8px; }

/* Голосование */
.poll-widget__form { display: flex; flex-direction: column; gap: 8px; }
.poll-widget__option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    text-align: left;
    border: 1.5px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 15px;
    color: #1e293b;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}
.poll-widget__option:hover { border-color: #c7d2fe; background: #f5f7ff; }
.poll-widget__option.is-selected { border-color: #0040ff; background: #eef2ff; }
.poll-widget__mark {
    flex: 0 0 auto;
    width: 20px; height: 20px;
    border: 2px solid #cbd5e1;
    border-radius: 50%;
    transition: border-color .15s ease, background .15s ease;
    position: relative;
}
.poll-widget__mark--box { border-radius: 6px; }
.poll-widget__option.is-selected .poll-widget__mark {
    border-color: #0040ff;
    background: #0040ff;
}
.poll-widget__option.is-selected .poll-widget__mark::after {
    content: '';
    position: absolute;
    inset: 0;
    margin: auto;
    width: 8px; height: 8px;
    background: #fff;
    border-radius: inherit;
}
.poll-widget__option-label { flex: 1 1 auto; }

.poll-widget__submit {
    margin-top: 6px;
    align-self: flex-start;
    border: none;
    background: #0040ff;
    color: #fff;
    border-radius: 999px;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .15s ease;
}
.poll-widget__submit:disabled { opacity: .45; cursor: not-allowed; }
.poll-widget__hint { font-size: 12px; color: #94a3b8; }

/* Результаты */
.poll-widget__results { display: flex; flex-direction: column; gap: 12px; }
.poll-widget__result-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    font-size: 14px;
}
.poll-widget__result-label { color: #334155; display: inline-flex; align-items: center; gap: 6px; }
.poll-widget__your-mark { color: #0040ff; font-size: 12px; }
.poll-widget__result.is-yours .poll-widget__result-label { font-weight: 600; color: #1e293b; }
.poll-widget__result-pct { color: #64748b; font-variant-numeric: tabular-nums; }
.poll-widget__bar {
    height: 8px;
    border-radius: 999px;
    background: #f1f5f9;
    overflow: hidden;
}
.poll-widget__bar-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #0040ff, #4f6bff);
    transition: width .4s ease;
    min-width: 2px;
}
.poll-widget__result.is-yours .poll-widget__bar-fill { background: linear-gradient(90deg, #0040ff, #0040ff); }

/* Футер + ожидание */
.poll-widget__foot {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #f1f5f9;
    font-size: 13px;
    color: #94a3b8;
}
.poll-widget__closed { color: #64748b; }
.poll-widget__anon::before { content: '\f070'; font-family: 'Font Awesome 6 Free'; font-weight: 900; margin-right: 4px; font-size: 11px; }
.poll-widget__waiting { text-align: center; padding: 12px; }
.poll-widget__waiting-text { color: #64748b; font-size: 14px; margin-bottom: 10px; }
.poll-widget__login-btn {
    display: inline-block;
    background: #0040ff;
    color: #fff;
    border-radius: 999px;
    padding: 8px 22px;
    font-size: 14px;
    text-decoration: none;
}

/* Вариант в режиме голосования — неактивен, пока летит запрос. */
.poll-widget__option:disabled { opacity: .55; cursor: default; }

/* «Изменить голос» / «Отмена» */
.poll-widget__change,
.poll-widget__cancel {
    align-self: flex-start;
    margin-top: 4px;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #475569;
    border-radius: 999px;
    padding: 7px 18px;
    font-size: 13px;
    cursor: pointer;
    transition: border-color .15s ease, color .15s ease;
}
.poll-widget__change:hover { border-color: #0040ff; color: #0040ff; }
.poll-widget__cancel:hover { border-color: #94a3b8; }

/* Кто проголосовал (автору не-анонимного опроса) */
.poll-widget__voters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
    padding-left: 2px;
}
.poll-widget__voter {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #f1f5f9;
    border-radius: 999px;
    padding: 2px 9px 2px 2px;
    font-size: 12px;
    color: #475569;
    text-decoration: none;
    max-width: 180px;
}
a.poll-widget__voter:hover { background: #e0e7ff; color: #0040ff; }
.poll-widget__voter-ava {
    width: 20px; height: 20px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.poll-widget__voter-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.poll-widget__voter-more {
    display: inline-flex;
    align-items: center;
    background: #e0e7ff;
    color: #0040ff;
    border-radius: 999px;
    padding: 3px 11px;
    font-size: 12px;
    font-weight: 600;
}
