/*
 * ngager poll tab and charts (unified platform R9, R28; task 2.4).
 * Service names stay lowercase: no text-transform. Chart colors come from pollChart.js.
 */

.poll-student {
    max-width: 960px;
    margin: 0 auto;
}

/* Teacher: same two-panel layout and width as the questions tab (.ngager-screen in
   desktop.css, #main-content is max 1400px with 24px padding). */
.poll-teacher {
    max-width: 1352px;
    margin: 0 auto;
}

.poll-teacher .poll-form {
    margin-top: 16px;
    padding: 16px;
    border: 1px solid #dde3ec;
    border-radius: 8px;
    box-shadow: none;
}

.poll-teacher .active-question-area {
    flex-direction: column;
}

.poll-teacher .poll-item {
    background: #f8f9fa;
}

.poll-teacher .poll-item-controls {
    margin-top: 8px;
}

.poll-teacher .poll-visibility {
    flex: 1 1 100%;
}

.poll-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.poll-title {
    margin: 0;
    text-transform: none;
}

.poll-header-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.poll-error {
    color: #9b1c1c;
    background: #fdecec;
    border-radius: 6px;
    padding: 8px 12px;
}

.poll-form {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}

/* `display` above would override the hidden attribute; keep hidden elements hidden. */
.poll-teacher [hidden],
.poll-student [hidden] {
    display: none !important;
}

.poll-form h3 {
    margin: 0 0 4px;
}

.poll-options {
    border: 0;
    padding: 0;
    margin: 0;
}

.poll-option-row {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
}

.poll-check {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
}

.poll-check input {
    width: 20px;
    height: 20px;
}

.poll-form-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.poll-active {
    margin-bottom: 16px;
}

.poll-active-label {
    margin: 0;
    font-weight: 700;
    color: #1f6f3b;
}

.poll-active-text,
.poll-question {
    margin: 6px 0;
    font-size: 1.25em;
}

.poll-active-meta,
.poll-item-meta,
.poll-note {
    margin: 0 0 8px;
    color: #4b5563;
}

.poll-countdown {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.poll-empty {
    color: #4b5563;
}

.poll-list-title {
    margin-top: 24px;
}

.poll-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 10px;
}

.poll-item {
    border: 1px solid #dde3ec;
    border-radius: 8px;
    padding: 12px;
    background: #fff;
}

.poll-item-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: baseline;
}

.poll-item-text {
    font-weight: 600;
}

.poll-state {
    font-size: 0.85em;
    padding: 2px 8px;
    border-radius: 10px;
    background: #eef2f7;
    color: #1f2937;
    white-space: nowrap;
}

.poll-state--open {
    background: #e3f4e8;
    color: #14532d;
}

.poll-state--closed {
    background: #f1f1f1;
    color: #374151;
}

.poll-item-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.poll-visibility {
    width: auto;
    min-height: 36px;
}

/* student */
.poll-choices {
    display: grid;
    gap: 10px;
    margin: 12px 0;
}

.poll-choice {
    min-height: 52px;
    font-size: 1.1em;
    border: 2px solid #c7d2e3;
    background: #fff;
    color: #1f2937;
    text-align: left;
    padding: 10px 16px;
}

.poll-choice--selected,
.poll-choice[aria-pressed="true"] {
    border-color: #1f3b73;
    background: #eaf0fb;
    font-weight: 700;
}

.poll-choice--selected::after,
.poll-choice[aria-pressed="true"]::after {
    content: "\00a0\2713";
}

.poll-short {
    display: grid;
    gap: 8px;
    margin: 12px 0;
}

.poll-status {
    min-height: 1.4em;
    color: #1f2937;
}

/* charts */
.poll-chart {
    margin: 12px 0 0;
}

.poll-chart-graphic {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.poll-legend {
    list-style: none;
    padding: 0;
    margin: 0;
}

.poll-legend li {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0;
}

.poll-swatch {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    display: inline-block;
}

.poll-bars {
    width: 100%;
    display: grid;
    gap: 8px;
}

.poll-bar-row {
    display: grid;
    grid-template-columns: minmax(80px, 30%) 1fr auto;
    gap: 10px;
    align-items: center;
}

.poll-bar-label {
    overflow-wrap: anywhere;
}

.poll-bar-track {
    height: 18px;
    background: #eef2f7;
    border-radius: 9px;
    overflow: hidden;
}

.poll-bar-fill {
    display: block;
    height: 100%;
}

.poll-bar-value {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.poll-chart-caption {
    margin: 8px 0;
    color: #4b5563;
}

.poll-table {
    border-collapse: collapse;
    font-size: 0.95em;
}

.poll-table th,
.poll-table td {
    border: 1px solid #dde3ec;
    padding: 4px 10px;
    text-align: left;
}

/* presentation */
.present-service-title--small {
    font-size: 1.6em;
}

.present-poll-question {
    font-size: 1.6em;
    font-weight: 600;
    max-width: 30em;
    margin: 0;
}

.present-poll-options {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.4em;
    font-size: 1.2em;
}

.present-poll-results {
    width: min(80vw, 1200px);
}

.present-poll-results .poll-chart-graphic {
    justify-content: center;
}

.present-poll-results .poll-table {
    margin: 0 auto;
}

.present-poll-results .poll-pie {
    width: min(40vh, 420px);
    height: auto;
}

.present-poll-results .poll-table {
    font-size: 0.8em;
}
