/* Channel Polls Styles */
.chat-polls-container {
    margin: 0.3rem 0 0.2rem;
    padding: 0;
    width: 100%;
    box-sizing: border-box;
}

.chat-poll {
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.45rem;
    padding: 0.6rem;
    margin-bottom: 0.5rem;
    box-shadow: none;
    width: 100%;
    box-sizing: border-box;
}

.chat-polls-container .chat-poll:last-child {
    margin-bottom: 0.2rem;
}

.chat-poll-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.35rem;
}

.chat-poll-question {
    font-weight: 600;
    font-size: 16px;
    line-height: 1.5;
    margin: 0;
    flex: 1;
}

.chat-poll-status {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.chat-poll-description {
    color: var(--bs-secondary-color);
    font-size: 12px;
    line-height: 1.4;
    margin-bottom: 0.4rem;
}

.chat-poll-options {
    margin: 0.4rem 0;
}

.chat-poll-option {
    margin-bottom: 0.3rem;
}

.chat-poll-option-button {
    width: 100%;
    text-align: left;
    padding: 0.45rem;
    background: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
    line-height: 1.5;
}

.chat-poll-option-button:hover:not(:disabled) {
    background: var(--bs-tertiary-bg);
    border-color: var(--bs-primary);
}

.chat-poll-option-button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.chat-poll-option-button.voted {
    border-color: rgba(var(--bs-primary-rgb), 0.6);
    background: rgba(var(--bs-primary-rgb), 0.16);
}

.chat-poll-option.poll-vote-changed .chat-poll-option-button,
.chat-poll-option.poll-vote-changed .chat-poll-result-info {
    animation: pollVoteFlash 1.1s ease;
}

@keyframes pollVoteFlash {
    0% {
        background: rgba(var(--bs-primary-rgb), 0.18);
        border-color: rgba(var(--bs-primary-rgb), 0.4);
    }
    70% {
        background: rgba(var(--bs-primary-rgb), 0.08);
        border-color: rgba(var(--bs-primary-rgb), 0.2);
    }
    100% {
        background: transparent;
        border-color: inherit;
    }
}

.chat-poll-option-text {
    flex: 1;
}

.chat-poll-option-votes {
    font-size: 12px;
    color: var(--bs-secondary-color);
    margin-left: 0.5rem;
}

.chat-poll-result-bar {
    margin-top: 0.5rem;
}

.chat-poll-result-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.2rem;
    font-size: 12px;
}

.chat-poll-progress {
    height: 0.45rem;
    background: var(--bs-secondary-bg);
    border-radius: 0.25rem;
    overflow: hidden;
}

.chat-poll-progress-bar {
    height: 100%;
    background: var(--bs-primary);
    transition: width 0.3s ease;
}

.chat-poll-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.35rem;
    padding-top: 0.35rem;
    border-top: 1px solid var(--bs-border-color);
    font-size: 12px;
    color: var(--bs-secondary-color);
}

.chat-poll-meta {
    display: flex;
    gap: 0.6rem;
    align-items: center;
}

.chat-poll-meta-muted {
    font-style: italic;
    color: var(--bs-secondary-color);
}

.chat-poll-voters-button {
    padding: 0;
    border: 0;
    background: none;
    color: #2563eb;
    font-size: inherit;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.chat-poll-voters-button:hover {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.poll-voters-open {
    overflow: hidden;
}

.poll-voters-modal {
    position: fixed;
    inset: 0;
    z-index: 1080;
    display: none;
}

.poll-voters-modal.is-open {
    display: block;
}

.poll-voters-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
}

.poll-voters-modal-dialog {
    position: relative;
    margin: 10vh auto 0;
    background: var(--bs-body-bg);
    border-radius: 12px;
    max-width: 520px;
    width: calc(100% - 32px);
    padding: 16px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.2);
}

.poll-voters-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.poll-voters-modal-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
}

.poll-voters-modal-subtitle {
    font-size: 12px;
    color: var(--bs-secondary-color);
    margin-top: 4px;
}

.poll-voters-modal-close {
    border: 0;
    background: none;
    font-size: 1.1rem;
    line-height: 1;
    color: var(--bs-secondary-color);
    cursor: pointer;
}

.poll-voters-modal-body {
    max-height: 50vh;
    overflow: auto;
}

.poll-voters-group {
    margin-bottom: 12px;
}

.poll-voters-group:last-child {
    margin-bottom: 0;
}

.poll-voters-group-title {
    font-size: 12px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 6px;
}

.poll-voters-group-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.poll-voters-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.poll-voters-name {
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.08);
    font-size: 12px;
    color: #111827;
}

.poll-voters-empty {
    font-size: 12px;
    color: var(--bs-secondary-color);
}

.chat-poll-actions {
    display: flex;
    gap: 0.4rem;
}

.chat-poll-hide-btn {
    padding: 0.2rem 0.4rem;
    font-size: 12px;
    border: none;
    background: transparent;
    color: var(--bs-secondary-color);
    cursor: pointer;
    border-radius: 0.25rem;
    transition: all 0.2s;
}

.chat-poll-hide-btn:hover {
    background: var(--bs-secondary-bg);
    color: var(--bs-body-color);
}

.polls-page {
    background: var(--bs-body-bg);
    min-height: 100vh;
}

.polls-page-shell {
    padding: 0.75rem 0 1.5rem;
}

.polls-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 0.55rem;
}

.polls-page-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.polls-page-channel {
    display: flex;
    align-items: center;
    gap: 8px;
}

.polls-page-logo {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.06);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #111827;
    overflow: hidden;
}

.polls-page-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.polls-page-title {
    font-size: 16px;
    font-weight: 700;
    color: #111827;
}

.polls-page-subtitle {
    font-size: 12px;
    color: var(--bs-secondary-color);
}

.polls-page-description {
    display: flex;
    gap: 6px;
    align-items: flex-start;
    font-size: 12px;
    color: var(--bs-secondary-color);
    margin-bottom: 0.75rem;
}

.polls-page-empty {
    font-size: 12px;
    color: var(--bs-secondary-color);
    padding: 0.25rem 0;
}

.polls-page-list {
    display: grid;
    gap: 8px;
}

.polls-page .chat-poll {
    margin-bottom: 0;
}

.polls-hidden-badge {
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.08);
    color: #475569;
    font-size: 12px;
}

.polls-page .chat-poll-actions {
    gap: 8px;
}

.polls-page .chat-poll-toggle-btn {
    border: 1px solid rgba(15, 23, 42, 0.18);
    background: transparent;
    color: #1f2937;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
}

.polls-page .chat-poll-toggle-btn:hover {
    background: rgba(15, 23, 42, 0.06);
}

@media (max-width: 576px) {
    .polls-page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .polls-page-actions {
        width: 100%;
    }

    .polls-page-actions .btn {
        width: 100%;
    }
}

.chat-poll-status .badge {
    font-size: 12px;
    padding: 0.16rem 0.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1;
}

.badge.poll-status-active {
    background-color: #198754 !important;
    border-color: #198754 !important;
    color: #ffffff !important;
}

.badge.poll-status-stopped {
    background-color: #ffc107 !important;
    border-color: #ffc107 !important;
    color: #111827 !important;
}

.badge.poll-status-expired {
    background-color: #6c757d !important;
    border-color: #6c757d !important;
    color: #ffffff !important;
}

.chat-polls-hidden {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 5px 7px;
    margin-bottom: 0.35rem;
    border-radius: 8px;
    border: 1px dashed rgba(15, 23, 42, 0.2);
    background: rgba(15, 23, 42, 0.04);
    font-size: 12px;
    color: var(--bs-secondary-color);
}

.chat-polls-hidden-link {
    font-weight: 600;
    font-size: 12px;
    color: #1d4ed8;
    text-decoration: none;
}

.chat-polls-hidden-link:hover {
    text-decoration: underline;
}

@media (min-width: 768px) {
    .chat-poll-question {
        font-size: 15px;
        line-height: 1.45;
    }

    .chat-poll-option-button {
        font-size: 15px;
        line-height: 1.45;
    }

    .chat-poll-description,
    .chat-poll-option-votes,
    .chat-poll-result-info,
    .chat-poll-footer,
    .poll-voters-modal-subtitle,
    .poll-voters-group-title,
    .poll-voters-name,
    .poll-voters-empty,
    .chat-poll-hide-btn,
    .polls-page-subtitle,
    .polls-page-description,
    .polls-page-empty,
    .polls-hidden-badge,
    .polls-page .chat-poll-toggle-btn,
    .chat-polls-hidden,
    .chat-polls-hidden-link,
    .chat-poll-status .badge {
        font-size: 11px;
    }

    .poll-voters-modal-title,
    .polls-page-title {
        font-size: 15px;
    }
}

@media (max-width: 576px) {
    .chat-poll {
        padding: 0.6rem;
    }

    .chat-poll-question {
        font-size: 16px;
    }

    .chat-poll-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .chat-poll-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
}
