/* ──────────────────────────────────────────────────────────────────────────
   Survey (khảo sát) — theo ngôn ngữ thiết kế iOS-card của trang feed:
   thẻ trắng bo 16px, accent #007aff, dark mode qua class .dark trên <html>.
   Tự chứa (không phụ thuộc .ios-card) để dùng được ở bất kỳ trang nào.
   ────────────────────────────────────────────────────────────────────────── */

.survey-section {
    display: flex;
    flex-direction: column;
}

.survey-card {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.07), 0 0.5px 0 rgba(0, 0, 0, 0.04);
    margin-bottom: 12px;
    padding: 16px;
}

.dark .survey-card {
    background: #1c1c1e;
    box-shadow: none;
    border: none;
}

/* ── Header ── */

.survey-card__head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
}

.survey-card__icon {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, #5856d6, #af52de);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(88, 86, 214, 0.28);
}

.survey-card__heading {
    flex: 1;
    min-width: 0;
}

.survey-card__kicker {
    font-size: 11px;
    font-weight: 700;
    color: #5856d6;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 3px;
}

.dark .survey-card__kicker {
    color: #a5a3f5;
}

.survey-card__title {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.35;
    color: #1c1c1e;
    margin: 0;
}

.dark .survey-card__title {
    color: #f2f2f7;
}

.survey-card__hint {
    margin: 4px 0 0;
    font-size: 12px;
    color: rgba(60, 60, 67, 0.5);
}

.dark .survey-card__hint {
    color: rgba(235, 235, 245, 0.45);
}

/* ── Đáp án ── */

.survey-card__answers {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.survey-answer {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    /* <button> không kế thừa font và bị iOS Safari vẽ lại nếu không reset. */
    font: inherit;
    -webkit-appearance: none;
    appearance: none;
    overflow: hidden;
    border-radius: 14px;
    border: 1.5px solid rgba(0, 0, 0, 0.12);
    background: rgba(0, 0, 0, 0.04);
    cursor: pointer;
    text-align: left;
    -webkit-tap-highlight-color: rgba(0, 122, 255, 0.08);
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.dark .survey-answer {
    border-color: rgba(255, 255, 255, 0.13);
    background: rgba(255, 255, 255, 0.07);
}

.survey-answer:active {
    transform: scale(0.985);
}

@media (hover: hover) {
    .survey-answer:hover {
        border-color: #007aff;
        background: rgba(0, 122, 255, 0.08);
    }
}

.survey-answer__bar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    background: rgba(60, 60, 67, 0.07);
    border-radius: 10px 0 0 10px;
    transition: width 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.dark .survey-answer__bar {
    background: rgba(255, 255, 255, 0.07);
}

.survey-answer__body {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
}

.survey-answer__mark {
    display: none;
    flex-shrink: 0;
    color: #007aff;
}

.survey-answer__text {
    flex: 1;
    min-width: 0;
    font-size: 15px;
    font-weight: 500;
    color: #1c1c1e;
    /* Đáp án dài phải xuống dòng, không cắt chữ — khác poll (một dòng). */
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.dark .survey-answer__text {
    color: #f2f2f7;
}

.survey-answer__metrics {
    display: none;
    align-items: baseline;
    gap: 4px;
    flex-shrink: 0;
}

.survey-answer__percent {
    font-size: 14px;
    font-weight: 700;
    color: rgba(60, 60, 67, 0.5);
}

.dark .survey-answer__percent {
    color: rgba(235, 235, 245, 0.45);
}

.survey-answer__votes {
    font-size: 11px;
    color: rgba(60, 60, 67, 0.5);
}

.dark .survey-answer__votes {
    color: rgba(235, 235, 245, 0.45);
}

.survey-answer__chevron {
    flex-shrink: 0;
    color: rgba(60, 60, 67, 0.28);
}

.dark .survey-answer__chevron {
    color: rgba(235, 235, 245, 0.25);
}

/* ── Chưa bình chọn: nút pill gọn, chưa hé kết quả (giống Feed Poll) ── */

.survey-card[data-voted="false"] .survey-answer__bar,
.survey-card[data-voted="false"] .survey-answer__metrics,
.survey-card[data-voted="false"] .survey-answer__mark {
    display: none;
}

/* ── Đã bình chọn: hiện thanh %, ẩn mũi chevron ── */

.survey-card[data-voted="true"] .survey-answer {
    background: transparent;
    border-color: rgba(60, 60, 67, 0.13);
}

.dark .survey-card[data-voted="true"] .survey-answer {
    border-color: rgba(255, 255, 255, 0.1);
}

.survey-card[data-voted="true"] .survey-answer__bar,
.survey-card[data-voted="true"] .survey-answer__metrics {
    display: flex;
}

.survey-card[data-voted="true"] .survey-answer__chevron {
    display: none;
}

/* Giữ chỗ dấu check để chữ các dòng thẳng hàng nhau. */
.survey-card[data-voted="true"] .survey-answer__mark {
    display: block;
    visibility: hidden;
}

.survey-card[data-voted="true"] .survey-answer[data-selected="true"] {
    border-color: #007aff;
    background: rgba(0, 122, 255, 0.06);
}

.dark .survey-card[data-voted="true"] .survey-answer[data-selected="true"] {
    background: rgba(0, 122, 255, 0.13);
}

.survey-card[data-voted="true"] .survey-answer[data-selected="true"] .survey-answer__mark {
    visibility: visible;
}

.survey-card[data-voted="true"] .survey-answer[data-selected="true"] .survey-answer__bar {
    background: rgba(0, 122, 255, 0.22);
}

.survey-card[data-voted="true"] .survey-answer[data-selected="true"] .survey-answer__text {
    color: #007aff;
    font-weight: 600;
}

.survey-card[data-voted="true"] .survey-answer[data-selected="true"] .survey-answer__percent {
    color: #007aff;
}

/* ── Footer ── */

.survey-card__foot {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    font-size: 13px;
    color: rgba(60, 60, 67, 0.45);
}

.dark .survey-card__foot {
    color: rgba(235, 235, 245, 0.35);
}

.survey-card__change {
    margin-left: auto;
}

.survey-card[data-voted="false"] .survey-card__change {
    display: none;
}

/* ── Toast lỗi (cùng kiểu toast của Feed Poll) ── */

.survey-toast {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 9999;
    pointer-events: none;
}
