/* ============================================================
   投票功能（前台）
   投票板块卡片 + 投票弹窗（填 QQ 号 + B 站 ID 才能投）+ 结果条
   与 admin/vote-api.php 配套
   ============================================================ */

/* ---------- 投票板块（与项目/帖子/文件卡片同款透明风格） ---------- */
.votes-card,
.votes-card:hover {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 28px 0 0;
    margin-bottom: 0;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    max-width: 900px;
}

.votes-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
    gap: 16px;
    margin-top: 14px;
}

.votes-empty {
    padding: 22px;
    text-align: center;
    font-size: 13.5px;
    color: rgba(255, 255, 255, 0.5);
    background: var(--card-bg);
    border: 1px dashed var(--card-border);
    border-radius: 16px;
}

/* ---------- 投票卡片 ---------- */
.vote-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 9px;
    width: 100%;
    padding: 17px 18px;
    text-align: left;
    font: inherit;
    color: var(--text);
    background: var(--card-bg);
    backdrop-filter: blur(var(--glass-blur)) saturate(120%);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(120%);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    cursor: pointer;
    transition: background 0.3s ease, border-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
}
.vote-card:hover {
    background: var(--card-bg-hover);
    border-color: var(--card-border-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25);
}
.vote-card:active { transform: translateY(0); }

.vote-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}
.vote-card-title {
    font-size: 15.5px;
    font-weight: 700;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.95);
    word-break: break-word;
}
.vote-card-desc {
    font-size: 12.5px;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.62);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}
.vote-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin-top: 2px;
    font-size: 11.5px;
    color: rgba(255, 255, 255, 0.5);
}
.vote-card-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.vote-card-meta svg { width: 12px; height: 12px; }
.vote-card-cta {
    margin-top: 4px;
    align-self: flex-start;
    padding: 7px 16px;
    border-radius: 9px;
    font-size: 12.5px;
    font-weight: 600;
    color: #12203f;
    background: linear-gradient(135deg, #9db8ff, #6d8cff);
    box-shadow: 0 4px 14px rgba(109, 140, 255, 0.28);
}
.vote-card.is-done .vote-card-cta {
    color: rgba(255, 255, 255, 0.82);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: none;
}

.vote-pill {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
}
.vote-pill.is-open    { color: #9be2a4; background: rgba(107, 203, 119, 0.16); border: 1px solid rgba(107, 203, 119, 0.35); }
.vote-pill.is-closed  { color: #ffb37a; background: rgba(255, 165, 90, 0.15); border: 1px solid rgba(255, 165, 90, 0.32); }
.vote-pill.is-ended   { color: rgba(255, 255, 255, 0.6); background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.16); }
.vote-pill.is-mine    { color: #a9c1ff; background: rgba(109, 140, 255, 0.16); border: 1px solid rgba(109, 140, 255, 0.38); }

/* ---------- 投票弹窗 ---------- */
.vt-modal {
    position: fixed;
    inset: 0;
    z-index: 10001; /* 必须高于帖子灯箱(9999)与图片预览 */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .2s ease, visibility .2s ease;
}
.vt-modal.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}
.vt-modal-card {
    width: min(470px, 100%);
    max-height: min(86vh, 720px);
    overflow-y: auto;
    padding: 20px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(20, 20, 24, 0.96);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
    transform: translateY(14px) scale(.98);
    opacity: 0;
    transition: transform .2s ease, opacity .2s ease;
}
.vt-modal.show .vt-modal-card {
    transform: translateY(0) scale(1);
    opacity: 1;
}
.vt-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}
.vt-modal-head h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.95);
    word-break: break-word;
}
.vt-modal-close {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: background .15s ease;
}
.vt-modal-close:hover { background: rgba(255, 255, 255, 0.13); }

.vt-desc {
    margin: 0 0 14px 0;
    font-size: 12.5px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.62);
    white-space: pre-wrap;
    word-break: break-word;
}
.vt-desc:empty { display: none; }

.vt-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    margin-bottom: 14px;
    font-size: 11.5px;
    color: rgba(255, 255, 255, 0.5);
}
.vt-meta .vt-meta-pill {
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

/* 选项列表 */
.vt-options {
    display: flex;
    flex-direction: column;
    gap: 9px;
    margin-bottom: 6px;
}
.vt-option {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(0, 0, 0, 0.28);
    cursor: pointer;
    transition: border-color .16s ease, background .16s ease;
}
.vt-option:hover { background: rgba(255, 255, 255, 0.05); }
.vt-option.is-checked {
    border-color: rgba(109, 140, 255, 0.65);
    background: rgba(109, 140, 255, 0.13);
}
.vt-option input {
    flex: 0 0 auto;
    width: 17px;
    height: 17px;
    accent-color: #6d8cff;
    cursor: pointer;
}
.vt-option-text {
    font-size: 14px;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.92);
    word-break: break-word;
}

/* 身份输入 */
.vt-label {
    display: block;
    margin: 14px 0 7px;
    font-size: 12.5px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.78);
}
.vt-input {
    width: 100%;
    box-sizing: border-box;
    padding: 11px 13px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(0, 0, 0, 0.35);
    color: rgba(255, 255, 255, 0.95);
    font-size: 15px;
    font-family: inherit;
    letter-spacing: 1px;
    outline: none;
    transition: border-color .18s ease, box-shadow .18s ease;
}
.vt-input::placeholder { color: rgba(255, 255, 255, 0.32); letter-spacing: 0; }
.vt-input:focus {
    border-color: rgba(109, 140, 255, 0.6);
    box-shadow: 0 0 0 3px rgba(109, 140, 255, 0.16);
}
.vt-hint {
    margin: 8px 0 0 0;
    font-size: 11.5px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.45);
}
.vt-msg {
    margin: 12px 0 0 0;
    font-size: 12.5px;
    line-height: 1.5;
}
.vt-msg:empty { display: none; }
.vt-msg.is-ok  { color: #9be2a4; }
.vt-msg.is-err { color: #ff8f8f; }

.vt-actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
}
.vt-submit,
.vt-cancel {
    flex: 1;
    padding: 11px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: transform .15s ease, filter .15s ease, background .15s ease;
}
.vt-submit {
    border: none;
    color: #12203f;
    background: linear-gradient(135deg, #9db8ff, #6d8cff);
}
.vt-submit:hover:not(:disabled) { filter: brightness(1.07); }
.vt-submit:disabled { opacity: .6; cursor: not-allowed; }
.vt-cancel {
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.07);
    color: rgba(255, 255, 255, 0.82);
}
.vt-cancel:hover { background: rgba(255, 255, 255, 0.12); }
.vt-submit:active,
.vt-cancel:active { transform: scale(.98); }

/* ---------- 结果条 ---------- */
.vt-results {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 4px;
}
.vt-result-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}
.vt-result-name {
    font-size: 13.5px;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.9);
    word-break: break-word;
}
.vt-result-mine {
    display: inline-block;
    margin-left: 7px;
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 600;
    color: #a9c1ff;
    background: rgba(109, 140, 255, 0.16);
    border: 1px solid rgba(109, 140, 255, 0.38);
    vertical-align: middle;
}
.vt-result-num {
    flex: 0 0 auto;
    font-size: 12.5px;
    color: rgba(255, 255, 255, 0.6);
    white-space: nowrap;
}
.vt-result-num b { color: rgba(255, 255, 255, 0.92); font-weight: 700; }
.vt-bar {
    height: 9px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}
.vt-bar-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #6d8cff, #9db8ff);
    transition: width .45s ease;
}
.vt-result.is-mine .vt-bar-fill {
    background: linear-gradient(90deg, #5ec26d, #9be2a4);
}
.vt-total {
    margin-top: 14px;
    font-size: 12.5px;
    color: rgba(255, 255, 255, 0.55);
}
.vt-total b { color: rgba(255, 255, 255, 0.92); }

/* ---------- 投票密钥 ---------- */
.vote-card-meta .vote-card-key {
    color: #ffd97a;
}

.vt-meta-pill.vt-meta-key {
    color: #ffd97a;
    background: rgba(255, 217, 122, 0.12);
    border-color: rgba(255, 217, 122, 0.32);
}

.vt-label.vt-label-key {
    color: #ffd97a;
}
.vt-label .vt-req {
    color: #ff8f8f;
    font-weight: 700;
}

.vt-input.vt-input-key {
    letter-spacing: 1.5px;
    border-color: rgba(255, 217, 122, 0.32);
    background: rgba(255, 217, 122, 0.06);
}
.vt-input.vt-input-key::placeholder { letter-spacing: 0; }
.vt-input.vt-input-key:focus {
    border-color: rgba(255, 217, 122, 0.65);
    box-shadow: 0 0 0 3px rgba(255, 217, 122, 0.14);
}

@media (max-width: 480px) {
    .votes-list { grid-template-columns: 1fr; }
    .vt-modal-card { padding: 17px; }
}

@media (prefers-reduced-motion: reduce) {
    .vt-modal, .vt-modal-card, .vt-submit, .vt-cancel, .vt-bar-fill, .vote-card {
        transition: none !important;
    }
}
