/* =============================================================================
   polls-tab.css - Community Polls tab styles
   Scoped to .rp-polls-section and .poll-* classes.
   ============================================================================= */

/* ── Section wrapper ─────────────────────────────────────────────────────── */

.rp-polls-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

/* ── Poll card ───────────────────────────────────────────────────────────── */

.rp-polls-section .rdm07-card-list .poll-card {
    margin-bottom: 1rem;
}

.rp-polls-section .rdm07-card-list .poll-card:last-child {
    margin-bottom: 0;
}

.poll-card-header {
    cursor: pointer;
}

.poll-card-header .rdm07-chevron {
    user-select: none;
}

.rp-polls-section .rdm07-title,
.rp-polls-section .poll-card-question,
.rp-polls-section .poll-detail-desc,
.rp-polls-section .poll-option-label {
    user-select: text;
}

.poll-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-2);
}

.poll-card-question {
    font-size: var(--fs-sm);
    color: var(--text-muted);
    margin: var(--space-1) 0 var(--space-3);
    line-height: 1.5;
}

.poll-card-footer {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--fs-xs);
}

/* ── Footer text ─────────────────────────────────────────────────────────── */

.poll-footer-cta {
    color: var(--accent);
    font-weight: 600;
    font-size: var(--fs-xs);
}

.poll-footer-status {
    color: var(--text-muted);
    font-size: var(--fs-xs);
}

/* ── Expanded detail ─────────────────────────────────────────────────────── */

.rp-polls-section .poll-card .rdm07-detail {
    padding-top: var(--space-md);
}

.poll-detail-desc {
    font-size: var(--fs-sm);
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: var(--space-4);
}

.poll-detail-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 0;
}

.poll-detail-options--vote {
    gap: 10px;
}

.poll-detail-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    margin-top: var(--space-3);
}

.poll-detail-footer--vote {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(197, 160, 89, 0.14);
}

/* ── Vote panel (expanded open poll, pre-vote) ───────────────────────────── */

.poll-vote-panel {
    margin-top: 12px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(197, 160, 89, 0.16);
    border-radius: 4px;
}

.poll-vote-lede {
    margin: 0 0 12px;
    font-family: var(--font-heading);
    font-size: var(--font-size-xs);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(197, 160, 89, 0.6);
}

.poll-vote-submit {
    width: 100%;
    min-height: 42px;
}

.poll-vote-submit:disabled {
    opacity: 0.45;
}

.poll-closed-note {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    margin-bottom: var(--space-2);
}

/* ── Option rows ─────────────────────────────────────────────────────────── */

.poll-option {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.03);
    transition:
        border-color 0.15s,
        background 0.15s;
}

.poll-option--pick {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin: 0;
    text-align: left;
    cursor: pointer;
    font: inherit;
    color: inherit;
    appearance: none;
    -webkit-appearance: none;
    box-sizing: border-box;
}

.poll-option-indicator {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    border: 1.5px solid rgba(197, 160, 89, 0.4);
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.3);
    transition:
        border-color 0.15s,
        background 0.15s;
}

.poll-option--selected .poll-option-indicator {
    border-color: var(--gold);
    background: radial-gradient(circle, var(--gold) 0 36%, transparent 38%);
}

.poll-option--pick:hover {
    border-color: rgba(197, 160, 89, 0.35);
    background: rgba(197, 160, 89, 0.05);
}

.poll-option--pick:hover .poll-option-indicator {
    border-color: rgba(197, 160, 89, 0.65);
}

.poll-option--selected {
    border-color: rgba(197, 160, 89, 0.55);
    background: rgba(197, 160, 89, 0.08);
}

.poll-option-label {
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    flex: 1;
    line-height: 1.5;
    letter-spacing: 0.01em;
    padding-right: var(--space-2);
}

/* ── Result bars ─────────────────────────────────────────────────────────── */

.poll-option--result {
    gap: var(--space-2);
    padding: 16px 18px;
}

.poll-option-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.poll-option-pct {
    font-size: var(--fs-sm);
    font-weight: 700;
    color: var(--text-primary);
    min-width: 36px;
    text-align: right;
}

.poll-bar-track {
    height: 6px;
    border-radius: 3px;
    background: var(--surface-3);
    overflow: hidden;
    padding: 0.5rem 0;
}

.poll-bar-fill {
    height: 100%;
    border-radius: 3px;
    background: var(--gold);
    transition: width 0.3s ease;
}

.poll-option--selected .poll-bar-fill {
    background: var(--gold);
}

.poll-option-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.poll-option-count {
    font-size: var(--fs-xs);
    color: var(--text-muted);
}

/* ── Admin controls ──────────────────────────────────────────────────────── */

.poll-admin-actions,
.poll-card-admin-strip {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: var(--space-2);
}

.poll-admin-actions {
    padding-top: var(--space-3);
    border-top: 1px solid var(--border-subtle);
    margin-top: var(--space-3);
}

.poll-admin-actions .btn,
.poll-card-admin-strip .btn {
    flex: 0 0 auto;
    width: auto;
}

.poll-card-admin-strip {
    margin-top: var(--space-3);
}

.poll-draft-note {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    margin: 0 0 10px;
    line-height: 1.5;
}

.poll-option--preview {
    cursor: default;
    pointer-events: none;
}

/* ── Admin modal shell override ─────────────────────────────────────────────── */
/* Handled via inline style on the element since CSS specificity can't reliably
   beat the cascade order of ms-shell in modal-system.css. See pollsTab.js. */

/* ── Admin modal form (pm-* prefix, sits inside the ms-* modal shell) ───────── */

.pm-body {
    display: block;
    padding: 20px 24px;
    box-sizing: border-box;
}

.pm-field {
    display: block;
    margin-bottom: 16px;
    box-sizing: border-box;
}

.pm-field:last-child {
    margin-bottom: 0;
}

.pm-label {
    font-size: var(--font-size-xs);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(197, 160, 89, 0.6);
    font-family: var(--font-heading);
}

.pm-hint {
    font-size: var(--font-size-xs);
    color: rgba(255, 255, 255, 0.28);
    text-transform: none;
    letter-spacing: 0;
    font-family: var(--font-body);
    font-weight: 400;
}

.pm-input {
    display: block;
    padding: 9px 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.35);
    color: rgba(255, 255, 255, 0.88);
    font-size: var(--font-size-base);
    font-family: var(--font-body);
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    transition: border-color 0.15s;
}

.pm-input:focus {
    outline: none;
    border-color: rgba(197, 160, 89, 0.55);
}

.pm-textarea {
    min-height: 72px;
    resize: vertical;
    line-height: 1.5;
}

.pm-select {
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='rgba(197,160,89,0.5)'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
}

.pm-section-label {
    font-size: var(--font-size-xs);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.28);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: -4px;
}

.pm-section-label::before,
.pm-section-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.07);
}

.pm-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

.pm-opt-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    width: 100%;
}

.pm-opt-row .pm-input {
    width: 100%;
    min-width: 0;
}

.pm-opt-remove {
    flex-shrink: 0;
}

.pm-add-opt {
    margin-top: 8px;
}
