/* Polls CSS */

/* Poll Card (detail page) */
.poll-detail {
    /* Full width to match post-detail */
}

.poll-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

.poll-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.poll-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: var(--primary);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.poll-status {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 12px;
}

.poll-status.active {
    background: rgba(34, 197, 94, 0.1);
    color: #16a34a;
}

.poll-status.ended {
    background: var(--border-light);
    color: var(--text-muted);
}

.poll-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 12px 0;
    color: var(--text);
    line-height: 1.3;
}

.poll-description {
    margin-bottom: 16px;
    color: var(--text-muted);
}

.poll-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.poll-meta a {
    color: var(--text-muted);
}

.poll-meta a:hover {
    color: var(--primary);
}

.system-author {
    font-style: italic;
}

/* Poll Body */
.poll-body {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}

/* Voting Form */
.poll-voting-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.voting-instructions {
    font-size: 14px;
    color: var(--text-muted);
    margin: 0 0 8px 0;
}

.poll-option-label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s ease;
}

.poll-option-label:hover {
    border-color: var(--primary);
    background: var(--border-light);
}

.poll-option-label input[type="radio"],
.poll-option-label input[type="checkbox"] {
    display: none;
}

.poll-option-label .option-radio,
.poll-option-label .option-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    background: var(--bg-card);
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.poll-option-label .option-radio {
    border-radius: 50%;
}

.poll-option-label .option-checkbox {
    border-radius: 4px;
}

.poll-option-label input:checked + .option-radio,
.poll-option-label input:checked + .option-checkbox {
    border-color: var(--primary);
    background: var(--primary);
}

.poll-option-label input:checked + .option-radio::after,
.poll-option-label input:checked + .option-checkbox::after {
    content: '';
    display: block;
    width: 8px;
    height: 8px;
    margin: 4px;
    background: #fff;
    border-radius: 50%;
}

.poll-option-label input:checked + .option-checkbox::after {
    width: 12px;
    height: 12px;
    margin: 2px;
    border-radius: 2px;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E") center/contain no-repeat;
}

.poll-option-label .option-text {
    flex: 1;
    font-size: 15px;
    color: var(--text);
}

.poll-submit-area {
    margin-top: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.vote-warning {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
}

/* Vote Disabled */
.vote-disabled {
    padding: 20px;
    background: var(--border-light);
    border-radius: var(--radius);
    text-align: center;
}

.vote-error {
    color: var(--text-muted);
    margin: 0 0 12px 0;
}

/* Voting form disabled state */
.poll-voting-form.disabled {
    opacity: 1;
}

.poll-voting-form.disabled .poll-option-label {
    cursor: not-allowed;
    opacity: 0.6;
}

.poll-voting-form.disabled .poll-option-label:hover {
    border-color: var(--border);
    background: var(--bg);
}

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

.poll-option-label.disabled:hover {
    border-color: var(--border);
    background: var(--bg);
}

/* Vote restriction notice */
.vote-restriction-notice {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
    color: #b45309;
}

.vote-restriction-notice svg {
    flex-shrink: 0;
    color: #d97706;
}

[data-theme="dark"] .vote-restriction-notice {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}

[data-theme="dark"] .vote-restriction-notice svg {
    color: #fbbf24;
}

/* Poll Results */
.poll-results {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.poll-result-option {
    position: relative;
}

.poll-result-option .option-bar {
    position: relative;
    display: flex;
    align-items: center;
    padding: 14px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.poll-result-option.user-voted .option-bar {
    border-color: var(--primary);
    border-width: 2px;
}

.poll-result-option .option-fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    background: var(--primary);
    opacity: 0.15;
    transition: width 0.5s ease;
}

.poll-result-option.user-voted .option-fill {
    opacity: 0.25;
}

.poll-result-option .option-text {
    position: relative;
    z-index: 1;
    flex: 1;
    font-size: 15px;
    color: var(--text);
}

.poll-result-option .option-stats {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.poll-result-option .option-percentage {
    font-weight: 600;
    font-size: 15px;
    color: var(--text);
}

.poll-result-option .option-votes {
    font-size: 13px;
    color: var(--text-muted);
}

.your-vote-badge {
    position: absolute;
    right: 16px;
    top: -8px;
    padding: 2px 8px;
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 10px;
}

.vote-confirmation {
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
}

/* Poll Actions (uses same styles as posts) */
.poll-card .post-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
    flex-wrap: wrap;
}

.poll-card .post-actions-vote {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--border-light);
    border-radius: 20px;
    padding: 4px 8px;
}

.poll-card .action-vote-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    border-radius: 50%;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.poll-card .action-vote-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--primary);
}

.poll-card .action-vote-btn.active.upvote {
    color: var(--accent);
}

.poll-card .action-score {
    font-weight: 700;
    font-size: 14px;
    color: var(--text);
    min-width: 24px;
    text-align: center;
}

.poll-card .post-action-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

.poll-card .post-action-link:hover {
    background: var(--border-light);
    color: var(--text);
}

.poll-card .post-action-link.text-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* Poll Create Form */
.poll-options-builder {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.poll-option-input {
    display: flex;
    align-items: center;
    gap: 8px;
}

.poll-option-input .option-number {
    width: 24px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    text-align: right;
}

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

.poll-option-input .remove-option {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    border-radius: var(--radius);
    transition: all 0.15s ease;
}

.poll-option-input .remove-option:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

#add-poll-option {
    align-self: flex-start;
    margin-top: 8px;
}

#add-poll-option svg {
    margin-right: 4px;
}

/* Poll Settings Row */
.poll-settings-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.poll-settings-row .form-group {
    flex: 1;
    min-width: 140px;
}

/* Voting Requirements */
.voting-requirements {
    margin-top: 16px;
    padding: 12px 16px;
    background: var(--border-light);
    border-radius: var(--radius);
}

.voting-requirements summary {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.voting-requirements summary::-webkit-details-marker {
    display: none;
}

.voting-requirements summary::before {
    content: '▸';
    transition: transform 0.2s ease;
}

.voting-requirements[open] summary::before {
    transform: rotate(90deg);
}

.voting-requirements .requirements-content {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* Poll Removed */
.poll-removed {
    text-align: center;
    padding: 48px 24px;
}

.removed-notice svg {
    color: var(--text-muted);
    margin-bottom: 16px;
}

.removed-notice h2 {
    margin: 0 0 12px 0;
    color: var(--text);
}

.removed-notice .removed-reason {
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* Poll Card in Feed */
.poll-feed-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
    border: 1px solid var(--border-light);
    transition: border-color 0.15s ease;
}

.poll-feed-card:hover {
    border-color: var(--border);
}

.poll-feed-card .poll-badge {
    font-size: 10px;
    padding: 2px 6px;
}

.poll-feed-card .poll-title {
    font-size: 18px;
    margin: 8px 0;
}

.poll-feed-card .poll-title a {
    color: var(--text);
    text-decoration: none;
}

.poll-feed-card .poll-title a:hover {
    color: var(--primary);
}

.poll-feed-card .poll-preview {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 12px;
}

.poll-feed-card .poll-option-preview {
    padding: 8px 12px;
    background: var(--bg);
    border-radius: 4px;
    font-size: 13px;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 640px) {
    .poll-card {
        padding: 16px;
    }

    .poll-title {
        font-size: 20px;
    }

    .poll-settings-row {
        flex-direction: column;
    }

    .poll-submit-area {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Poll items in feed list */

.poll-type-icon {
    color: var(--primary);
}

.poll-badge-sm {
    display: inline-block;
    padding: 2px 6px;
    background: var(--primary);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-right: 6px;
    vertical-align: middle;
}

.poll-status-sm {
    display: inline-block;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 500;
    border-radius: 8px;
    margin-left: 6px;
    vertical-align: middle;
}

.poll-status-sm.ended {
    background: var(--border-light);
    color: var(--text-muted);
}

.poll-options-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.poll-option-preview-item {
    display: inline-block;
    padding: 4px 10px;
    background: var(--border-light);
    border-radius: 12px;
    font-size: 12px;
    color: var(--text-muted);
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.poll-option-more {
    display: inline-block;
    padding: 4px 10px;
    font-size: 12px;
    color: var(--text-muted);
}

.poll-voters,
.poll-time-left {
    color: var(--text-muted);
}

.system-author {
    font-style: italic;
    color: var(--text-muted);
}
