/* ============================================================
   Опрос на главной.

   Два состояния одного и того же списка: до голосования это кнопки,
   после — полосы с долями. Отдельной вёрстки для результатов нет,
   меняется только заливка и доступность кнопок.
   ============================================================ */

.poll {
    margin-bottom: 28px;
    padding: 18px 20px 16px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, .07);
    background: var(--card-color);
}

.poll__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 14px;
}

.poll__label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .38);
}

.poll__label i { font-size: 16px; color: var(--a-href-color); }

.poll__question {
    margin: 0;
    font-family: Oswald, sans-serif;
    font-size: 22px;
    font-weight: 600;
    line-height: 1.15;
    color: #fff;
    text-transform: uppercase;
}

.poll__note {
    margin-top: 6px;
    font-size: 12.5px;
    color: rgba(255, 255, 255, .38);
}

.poll__meta {
    flex: 0 0 auto;
    text-align: right;
}

.poll__total {
    font-size: 12.5px;
    color: rgba(255, 255, 255, .38);
    white-space: nowrap;
}

.poll__total span { color: #fff; font-weight: 700; }

/* Срок виден, пока опрос идёт, — чтобы он не закрывался неожиданно */
.poll__deadline {
    margin-top: 3px;
    font-size: 12px;
    color: rgba(255, 255, 255, .3);
    white-space: nowrap;
}

/* Завершённый опрос остаётся на главной ради итогов, но не зовёт
   голосовать: подпись гасим, заголовок делаем спокойнее */
.poll--closed .poll__label { color: rgba(255, 255, 255, .28); }
.poll--closed .poll__label i { color: rgba(255, 255, 255, .28); }
.poll--closed .poll__question { color: rgba(255, 255, 255, .72); }

/* ---------- варианты ---------- */
.poll__body { display: flex; flex-direction: column; gap: 8px; }

/* Кнопка и значок списка стоят рядом: внутрь кнопки значок класть
   нельзя — после голосования она disabled и события не отдаёт */
.poll__row { display: flex; align-items: center; gap: 8px; }
.poll__row .poll__option { flex: 1 1 auto; }

.poll__option {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 11px 14px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 10px;
    background: rgba(255, 255, 255, .03);
    color: rgba(255, 255, 255, .85);
    font-size: 13.5px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: background 140ms ease, border-color 140ms ease;
}

.poll__option:not(:disabled):hover {
    background: rgba(255, 255, 255, .07);
    border-color: rgba(255, 255, 255, .14);
}

.poll__option:disabled { cursor: default; }

/* Заливка доли лежит под текстом и не мешает кликам */
.poll__fill {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 0;
    pointer-events: none;
    background: rgba(95, 101, 220, .18);
    transition: width 420ms cubic-bezier(.4, 0, .2, 1);
}

.poll__text { position: relative; flex: 1 1 auto; }

/* Процент виден только в режиме результатов: до голосования цифры нет */
.poll__pct {
    position: relative;
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
    color: rgba(255, 255, 255, .45);
    opacity: 0;
    transition: opacity 200ms ease;
}

.poll__body.is-results .poll__pct { opacity: 1; }
.poll__body:not(.is-results) .poll__fill { width: 0 !important; }

/* Свой выбор выделен рамкой и заливкой поярче */
.poll__option.is-mine {
    border-color: rgba(95, 101, 220, .5);
    color: #fff;
}

.poll__option.is-mine .poll__fill { background: rgba(95, 101, 220, .3); }
.poll__option.is-mine .poll__pct { color: #a3a7fd; }

.poll__hint {
    margin-top: 12px;
    font-size: 12.5px;
    color: rgba(255, 255, 255, .35);
}

/* Передумать можно, пока опрос идёт. Кнопка неброская: это запасной
   выход, а не то, чем предлагают воспользоваться */
.poll__change {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 12px;
    padding: 0;
    border: 0;
    background: transparent;
    font-size: 12.5px;
    font-weight: 600;
    color: rgba(255, 255, 255, .38);
    cursor: pointer;
    transition: color .15s;
}

.poll__change[hidden] { display: none; }
.poll__change:hover { color: var(--a-href-color); }
.poll__change i { font-size: 16px; }

/* ---------- кто голосовал ----------
   Значок у варианта открывает список. Список открыт всем: итоги и так
   видны, а знать, кто поддержал твой вариант, интереснее самой доли. */
.poll__who {
    position: relative;
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: rgba(255, 255, 255, .35);
    font-size: 16px;
    cursor: pointer;
    transition: background 140ms ease, color 140ms ease;
}

.poll__who:hover { background: rgba(255, 255, 255, .08); color: #fff; }

/* До голосования значок не показываем: списка ещё нет, а место занимает */
.poll__body:not(.is-results) .poll__who { display: none; }

.poll__who { width: 30px; height: 30px; }

.poll-voters {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 320px;
    overflow-y: auto;
    margin-top: 6px;
}

.poll-voter {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 8px;
    border-radius: 9px;
    color: rgba(255, 255, 255, .85);
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none;
    transition: background 140ms ease;
}

.poll-voter:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }

.poll-voter img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    background: #0f0f14;
}

.poll-voters__empty {
    padding: 20px 8px;
    text-align: center;
    font-size: 13px;
    color: rgba(255, 255, 255, .35);
}

/* Два опроса встают в ряд, один занимает всю ширину. Больше двух не
   выводим: третий превращает главную в анкету. */
.polls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 14px;
    margin-bottom: 28px;
}

/* Отступ снизу теперь у сетки, у самих карточек его быть не должно */
.polls .poll { margin-bottom: 0; }

/* ---------- выбор и отправка ----------
   Клик по варианту только отмечает его, голос уходит кнопкой: карточка
   в ряду узкая, промахнуться легко, а голос один. */
.poll__option.is-picked {
    border-color: var(--a-href-color);
    background: rgba(95, 101, 220, .12);
    color: #fff;
}

.poll__submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: 100%;
    height: 38px;
    margin-top: 10px;
    padding: 0 16px;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 10px;
    background: rgba(255, 255, 255, .04);
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, .5);
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}

.poll__submit[hidden] { display: none; }

/* Пока вариант не выбран, кнопка неактивна — но остаётся на месте,
   иначе карточка подпрыгивает при первом же клике */
.poll__submit:disabled { cursor: default; }

.poll__submit:not(:disabled) {
    border-color: transparent;
    background: var(--accent);
    color: #fff;
}

.poll__submit:not(:disabled):hover { background: var(--btn-wallet-color-hover); }
.poll__submit i { font-size: 18px; }
