/* ===== Голосования: публичный список и страница голосования ===== */

/* Контентный максимум-ширина — как у статей/новостей. На широких экранах
   карточки голосований не растягиваются на всё пространство. */
.votes-page {
    display: flex;
    flex-direction: column;
    gap: 28px;
    padding: 24px 0px 30px;
    max-width: 1080px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}
@media (max-width: 700px) {
    .votes-page { padding: 18px 16px 24px; }
}
.votes-section h2 {
    margin: 0 0 14px;
    color: var(--text-bright);
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 9px;
}
.votes-section h2::before {
    content: "";
    width: 4px;
    height: 17px;
    border-radius: 2px;
    background: var(--link);
}
.votes-list { display: flex; flex-direction: column; gap: 14px; }
.vote-empty { color: var(--text-muted); font-style: italic; padding: 8px 0; }

/* Блок «Активные голосования» на главной — компактный список ссылок над
   серверами. Если активных нет, votes.js скрывает контейнер целиком. */
.home-active-vote {
    /* Боковых паддингов нет — выравнивание идёт по max-width.
       Только сверху/снизу воздух от шапки/серверов. */
    padding: 18px 20px;
    max-width: 1040px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}
.home-active-vote:empty { display: none; }
.home-vote-block {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--link);
    border-radius: 6px;
    padding: 10px 14px;
}
.home-vote-block-head {
    color: var(--text-muted);
    font-size: 14px;
    text-transform: none;
    letter-spacing: normal;
    font-weight: 600;
    margin-bottom: 6px;
}
.home-vote-list {
    display: flex;
    flex-direction: column;
}
.home-vote-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 6px 0;
    color: var(--text-bright);
    text-decoration: none;
    border-bottom: 1px dashed var(--border);
    font-size: 14px;
    transition: color 0.15s ease;
}
.home-vote-row:last-child { border-bottom: 0; }
.home-vote-row:hover { color: var(--link); }
.home-vote-row .home-vote-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-vote-row .home-vote-meta { color: var(--text-muted); font-size: 12px; flex-shrink: 0; }
/* Идущие ивенты по сбору на главной (pages/home.php): карточка-баннер как у
   розыгрышей - картинка ивента фоном, тёмный градиент слева под текстом. */
.home-active-event { padding-bottom: 0; display: grid; gap: 12px; }
.home-event-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    min-height: 150px;
    padding: 18px 22px;
    box-sizing: border-box;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    background-color: var(--bg-card);
    background-size: cover;
    background-position: center;
    color: #fff;
    text-decoration: none;
    transition: border-color 0.15s ease, transform 0.15s ease;
}
.home-event-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(20,24,31,0.92) 0%, rgba(20,24,31,0.70) 50%, rgba(20,24,31,0.20) 100%),
        linear-gradient(180deg, rgba(20,24,31,0) 50%, rgba(20,24,31,0.45) 100%);
    pointer-events: none;
}
.home-event-card > * { position: relative; }
.home-event-card:hover { border-color: var(--color-warning); transform: translateY(-1px); }
.home-event-badge {
    padding: 3px 10px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    background: rgba(109, 214, 164, 0.22);
    color: #9ff0c6;
    border: 1px solid rgba(109, 214, 164, 0.55);
    backdrop-filter: blur(4px);
}
.home-event-badge.is-counting { background: rgba(217, 169, 85, 0.22); color: #ffd28a; border-color: rgba(217, 169, 85, 0.55); }
.home-event-title {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.55);
    overflow-wrap: anywhere;
}
.home-event-meta { color: rgba(230, 233, 238, 0.9); font-size: 13px; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); }
.home-event-cta {
    margin-top: auto;
    padding-top: 8px;
    color: #ffd28a;
    font-size: 13px;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}
@media (max-width: 640px) {
    .home-event-card { padding: 16px; min-height: 140px; }
    .home-event-title { font-size: 20px; }
}

/* ===== Карточка голосования ===== */
.vote-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    transition: border-color .2s ease, box-shadow .2s ease;
}
.vote-card:hover { box-shadow: 0 4px 18px rgba(0, 0, 0, 0.28); }
.vote-card.vote-card-editable { border-left: 3px solid var(--link); }

.vote-card-head { display: flex; flex-direction: column; gap: 6px; }
.vote-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.vote-title-status { flex-shrink: 0; }
.vote-title {
    margin: 0;
    color: var(--text-bright);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.2px;
    line-height: 1.25;
}
.vote-title a { color: inherit; text-decoration: none; }
.vote-title a:hover { color: var(--link); }
.vote-meta { color: var(--text-muted); font-size: 12px; }
.vote-meta .pill { margin-left: 2px; }
/* Счётчик «N голосов» — под опросом, обычно перед actions. */
.vote-total-row {
    padding-top: 4px;
    color: var(--text-secondary);
    font-size: 13px;
}
.vote-total { color: var(--text-secondary); }

.vote-image { display: flex; justify-content: center; }
.vote-image img { max-width: 100%; max-height: 320px; border-radius: 6px; display: block; }
/* description приходит как HTML из Quill (отсанитайзенный сервером). Базовые
   стили под заголовки/списки/ссылки/цитаты — тема Quill snow не подходит для
   read-view. */
.vote-desc { color: var(--text-secondary); font-size: 14px; line-height: 1.55; }
.vote-desc p { margin: 0 0 8px; }
.vote-desc p:last-child { margin-bottom: 0; }
.vote-desc h2, .vote-desc h3 { color: var(--text-bright); margin: 10px 0 6px; }
.vote-desc h2 { font-size: 18px; }
.vote-desc h3 { font-size: 16px; }
.vote-desc ul, .vote-desc ol { margin: 4px 0 8px; padding-left: 24px; }
.vote-desc a { color: var(--link); text-decoration: none; }
.vote-desc a:hover { text-decoration: underline; }
/* Блоки кода в описании: кнопка «блок кода» в редакторе голосований открывает
   то же окно, что в новостях и тикетах (quill_code_lang.js). Цвета токенов
   задаёт code_highlight.css, фон и отступы - раздел, то есть эти правила. */
.vote-desc pre {
    background: var(--bg-inner);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px;
    overflow-x: auto;
    font-size: 13px;
    text-wrap: wrap;
    line-height: 1.35;
    margin: 8px 0;
}
.vote-desc code {
    background: var(--bg-inner);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 13px;
}
.vote-desc pre code { background: none; padding: 0; }

.vote-desc blockquote {
    margin: 6px 0;
    padding: 6px 12px;
    border-left: 3px solid var(--border-hover);
    background: var(--bg-inner);
    color: var(--text-secondary);
    border-radius: 0 4px 4px 0;
}

.vote-options { display: flex; flex-direction: column; gap: 8px; }
.vote-opt {
    position: relative;
    overflow: hidden;               /* заливка результата не вылезает за скруглённые углы */
    display: flex;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-inner);
    cursor: default;
    align-items: flex-start;
    transition: border-color .18s ease, background .18s ease;
}
.vote-opt.editable { cursor: pointer; }
.vote-opt.editable:hover { border-color: var(--border-hover); background: var(--bg-card-hover); }
.vote-opt.is-mine {
    border-color: var(--link);
    background: var(--bg-card-hover);                                 /* fallback */
    background: color-mix(in srgb, var(--link) 8%, var(--bg-inner));
}
.vote-opt.is-leading {
    border-color: var(--border-hover);                               /* fallback */
    border-color: color-mix(in srgb, var(--link) 45%, var(--border));
}

.vote-opt input[type=radio],
.vote-opt input[type=checkbox] { margin-top: 3px; cursor: pointer; position: relative; z-index: 1; }

.vote-mine { color: var(--link); font-weight: bold; min-width: 14px; position: relative; z-index: 1; }
.vote-mine-empty { display: inline-block; min-width: 14px; }

.vote-opt-body { flex: 1; min-width: 0; }
.vote-opt-head {
    position: relative; z-index: 1;
    display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.vote-opt-label { color: var(--text-primary); font-size: 14px; font-weight: 500; }
.vote-opt.is-mine .vote-opt-label { color: var(--text-bright); }

.vote-opt-count {
    display: inline-flex; align-items: baseline; gap: 6px; flex-shrink: 0;
    color: var(--text-muted); font-size: 12px; font-variant-numeric: tabular-nums;
}
.vote-opt-count .vote-opt-pct { color: var(--text-bright); font-size: 14px; font-weight: 700; }
.vote-opt.is-leading .vote-opt-count .vote-opt-pct { color: var(--link); }
.vote-opt-count .vote-opt-num { opacity: .8; }

/* Заливка результата — на всю высоту строки, под контентом (бар-чарт внутри строки). */
.vote-opt-bar {
    position: absolute;
    inset: 0;
    height: auto;
    margin: 0;
    background: transparent;
    border-radius: inherit;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}
.vote-opt-bar-fill {
    height: 100%;
    background: var(--link);
    opacity: 0.14;
    transition: width 0.35s ease;
}
.vote-opt.is-leading .vote-opt-bar-fill { opacity: 0.24; }
.vote-opt.is-mine .vote-opt-bar-fill { opacity: 0.20; }

/* Миниатюры — над заливкой. */
.vote-opt-thumbs { position: relative; z-index: 1; }

/* Лента миниатюр картинок варианта (до 10). Клик — открывает лайтбокс с
   возможностью перелистывать ТОЛЬКО внутри этого варианта. */
.vote-opt-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0 4px;
}
.vote-opt-thumb {
    display: block;
    max-height: 90px;
    max-width: 140px;
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: zoom-in;
    background: var(--bg-page);
    transition: border-color 0.15s ease, transform 0.15s ease;
}
.vote-opt-thumb:hover { border-color: var(--link); transform: scale(1.02); }

/* Лайтбокс — полупрозрачный фон, картинка по центру. */
.vote-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 20000;
    align-items: center;
    justify-content: center;
    padding: 24px;
    cursor: zoom-out;
}
.vote-lightbox img {
    max-width: 95vw;
    max-height: 95vh;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.7);
    cursor: default;
}
.vote-lightbox-close {
    position: absolute;
    top: 16px;
    right: 20px;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255,255,255,0.3);
    background: rgba(0,0,0,0.4);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
}
.vote-lightbox-close:hover {
    background: rgba(0,0,0,0.7);
    border-color: rgba(255,255,255,0.6);
}

/* Стрелки навигации в лайтбоксе — видимы только если в группе >1 картинки
   (JS прячет их display: none при единственной картинке). */
.vote-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 64px;
    border: 1px solid rgba(255,255,255,0.25);
    background: rgba(0,0,0,0.4);
    color: #fff;
    font-size: 36px;
    line-height: 1;
    cursor: pointer;
    border-radius: 4px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}
.vote-lightbox-nav:hover {
    background: rgba(0,0,0,0.7);
    border-color: rgba(255,255,255,0.6);
}
.vote-lightbox-nav.prev { left: 16px; }
.vote-lightbox-nav.next { right: 16px; }

/* Счётчик "3 / 10" внизу. Пустая строка для одиночных картинок —
   JS оставляет textContent='', поэтому ничего не рисуется. */
.vote-lightbox-counter {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.85);
    font-size: 13px;
    background: rgba(0,0,0,0.4);
    padding: 4px 10px;
    border-radius: 12px;
    pointer-events: none;
}
.vote-lightbox-counter:empty { display: none; }

@media (max-width: 600px) {
    .vote-lightbox-nav { width: 40px; height: 52px; font-size: 28px; }
    .vote-lightbox-nav.prev { left: 6px; }
    .vote-lightbox-nav.next { right: 6px; }
}

.vote-actions { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 6px; }
.vote-locked-note {
    padding-top: 6px;
    color: var(--text-muted);
    font-size: 13px;
    font-style: italic;
}

/* Явный блок «требуется авторизация» + кнопка входа. */
.vote-auth-required {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 14px;
    background: var(--bg-inner);                                   /* fallback */
    background: color-mix(in srgb, var(--link) 7%, var(--bg-inner));
    border: 1px solid var(--border);
    border-left: 3px solid var(--link);
    border-radius: 8px;
}
.vote-auth-text { color: var(--text-secondary); font-size: 13.5px; line-height: 1.4; }
.vote-auth-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--btn-primary-bg);
    color: var(--text-bright);
    border: 1px solid var(--btn-primary-hover);
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: background-color 0.2s ease;
}
.vote-auth-btn:hover { background: var(--btn-primary-hover); }
.vote-open-link {
    margin-top: 4px;
    text-align: right;
    font-size: 12px;
}
.vote-open-link a { color: var(--link); text-decoration: none; }
.vote-open-link a:hover { text-decoration: underline; }

/* Пилл-статусы: самодостаточные классы, ни от каких других файлов не зависят.
   Финансовый CSS на публичные страницы не подключаем. */
.votes-page .pill,
.vote-card .pill,
.home-active-vote .pill {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 11px;
    border: 1px solid var(--border);
}
.votes-page .pill-ok, .vote-card .pill-ok, .home-active-vote .pill-ok {
    color: var(--color-success); background: rgba(109, 214, 164, 0.10); border-color: rgba(109, 214, 164, 0.40);
}
.votes-page .pill-gray, .vote-card .pill-gray, .home-active-vote .pill-gray {
    color: var(--text-muted);
}
.votes-page .pill-soon, .vote-card .pill-soon, .home-active-vote .pill-soon {
    color: var(--color-warning); background: rgba(217, 169, 85, 0.10); border-color: rgba(217, 169, 85, 0.40);
}

/* Кнопка «Проголосовавшие» — список открывается в модалке. */
/* Подтверждение голоса при скрытых результатах. */
.vote-voted-note {
    display: flex; align-items: center; gap: 6px;
    color: var(--color-success); font-size: 13px; font-weight: 500;
}

/* Баннер «голосование ещё не началось» — заметный, с отсчётом до старта. */
.vote-notstarted {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px;
    background: rgba(217, 169, 85, 0.08);
    border: 1px solid rgba(217, 169, 85, 0.35);
    border-left: 3px solid var(--color-warning);
    border-radius: 8px;
}
.vote-notstarted-icon { font-size: 22px; line-height: 1; flex-shrink: 0; }
.vote-notstarted-title { color: var(--text-bright); font-size: 15px; font-weight: 600; }
.vote-notstarted-sub { color: var(--color-warning); font-size: 13px; margin-top: 2px; }

.vote-voters-row { padding-top: 2px; }
.vote-voters-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px;
    background: var(--btn-secondary-bg); color: var(--text-secondary);
    border: 1px solid var(--border); border-radius: 6px;
    font-size: 13px; cursor: pointer;
    transition: background .18s ease, color .18s ease, border-color .18s ease;
}
.vote-voters-btn:hover {
    background: var(--btn-secondary-hover); color: var(--text-bright); border-color: var(--border-hover);
}

/* Модалка со списками проголосовавших по вариантам. */
.voters-modal {
    position: fixed; inset: 0; z-index: 20000;
    display: flex; align-items: center; justify-content: center;
    padding: 24px; background: rgba(0, 0, 0, 0.85);
}
.voters-modal-box {
    width: 100%; max-width: 460px; max-height: 82vh;
    display: flex; flex-direction: column;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 10px; box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
}
.voters-modal-head {
    flex: 0 0 auto;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.voters-modal-title { margin: 0; font-size: 16px; font-weight: 600; color: var(--text-bright); }
.voters-modal-close {
    background: none; border: none; color: var(--text-muted);
    font-size: 24px; line-height: 1; cursor: pointer; transition: color .2s ease;
}
.voters-modal-close:hover { color: var(--text-bright); }
.voters-modal-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 6px 18px 16px; }
.voters-group { padding: 12px 0; border-bottom: 1px solid var(--border); }
.voters-group:last-child { border-bottom: 0; }
.voters-group-head {
    display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 5px;
}
.voters-group-label { color: var(--text-bright); font-size: 14px; font-weight: 500; }
.voters-group-count {
    flex-shrink: 0; color: var(--text-secondary); font-size: 12px;
    background: var(--bg-inner); border: 1px solid var(--border);
    border-radius: 10px; padding: 1px 9px; font-variant-numeric: tabular-nums;
}
.voters-group-list { color: var(--text-primary); font-size: 13px; line-height: 1.6; }
.voters-group-empty { color: var(--text-muted); font-size: 12px; font-style: italic; }
body.votes-modal-open { overflow: hidden; }
