/*
 * polls.css
 * Style dla modułu Ankiet/Uchwał
 * Wyodrębnione z app.css + inline z polls.php
 */

/* ============================================
   TOAST ANIMATIONS (z inline polls.php)
   ============================================ */
@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideOutDown {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(100%);
        opacity: 0;
    }
}

/* ============================================
   LISTA PLIKÓW W DROPZONE
   ============================================ */

.files-list-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--md-surface-container, #f5f5f5);
    border-radius: 6px;
    border: 1px solid var(--md-border, #e0e0e0);
    transition: background 0.2s ease;
}

.file-item:hover {
    background: var(--md-surface-container-high, #eeeeee);
}

.file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--md-text-primary, #1a1a1a);
    font-size: 14px;
}

.file-remove-btn {
    background: var(--md-danger, #f44336);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0;
    flex-shrink: 0;
    margin-left: 8px;
    transition: background 0.2s ease, transform 0.1s ease;
}

.file-remove-btn:hover {
    background: var(--md-danger-dark, #d32f2f);
    transform: scale(1.1);
}

.file-remove-btn:active {
    transform: scale(0.95);
}

/* ============================================
   STYLE ANKIET - PODSTAWOWE
   ============================================ */

.poll-description {
    color: var(--md-text-secondary, #666);
    margin: 12px 0;
    white-space: pre-wrap;
}

.poll-divider {
    border-top: 1px solid var(--md-border, #eee);
    margin: 20px 0;
}

.poll-section-label {
    margin-bottom: 12px;
}

.poll-vote-count {
    color: var(--md-text-secondary, #666);
    font-size: 0.9em;
    margin-top: 16px;
}

.poll-vote-message {
    color: var(--md-text-secondary, #666);
    font-size: 0.85em;
    margin-top: 4px;
    opacity: 0.9;
}

.poll-empty-state {
    color: var(--md-text-secondary, #666);
}

.poll-delete-form {
    display: inline;
}

.poll-delete-form .material-btn {
    margin-left: 12px;
}

.poll-vote-option {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.poll-vote-option input[type="radio"] {
    flex-shrink: 0;
}

.poll-vote-option .progress-bar {
    flex: 1;
    margin-bottom: 0;
}

.poll-vote-button {
    margin-top: 16px;
}

.poll-vote-details-item {
    padding: 4px 0;
}

/* ============================================
   POLL CARD - GŁÓWNY KONTENER
   ============================================ */

.poll-card {
    background: var(--md-surface, #fff);
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 20px;
    box-shadow: var(--md-shadow-md, 0 2px 8px rgba(25, 118, 210, 0.08));
    border: 1px solid var(--md-border, #e0e0e0);
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
}

.poll-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    gap: 16px;
    flex-wrap: wrap;
}

.poll-header h4 {
    margin: 0;
    color: var(--md-primary, #1976d2);
    font-size: 1.2em;
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: break-word;
    word-break: break-word;
}

.poll-header > div {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.poll-header-right {
    align-items: flex-end;
}

.poll-header-left {
    align-items: flex-start;
    flex: 1;
}

.poll-header > div .material-btn {
    white-space: nowrap;
}

.poll-dates {
    color: var(--md-text-secondary, #666);
    font-size: 0.9em;
    margin-bottom: 4px;
}

/* ============================================
   STATUS BANNERS
   ============================================ */

.status-banner {
    padding: 12px 16px;
    border-radius: 6px;
    margin: 5px 0;
    font-size: 0.95em;
}

.status-banner.success {
    background: #e8f5e9;
    color: #2e7d32;
    border-left: 4px solid #4caf50;
}

.status-banner.error {
    background: #ffebee;
    color: #c62828;
    border-left: 4px solid #f44336;
}

.status-banner.warn {
    background: #fff3cd;
    color: #856404;
    border-left: 4px solid #ffc107;
}

/* ============================================
   PROGRESS BAR
   ============================================ */

.progress-bar {
    background: var(--md-surface-container, #e3f2fd);
    border-radius: 6px;
    min-height: 32px;
    height: auto;
    margin-bottom: 12px;
    position: relative;
    overflow: visible;
    box-sizing: border-box;
    max-width: 100%;
}

.progress-fill {
    background: var(--md-primary, #1976d2);
    height: 100%;
    min-height: 32px;
    border-radius: 6px;
    transition: width 0.3s;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

.progress-label {
    position: relative;
    z-index: 2;
    padding: 6px 12px;
    color: var(--md-text-primary);
    font-size: 0.9em;
    font-weight: 500;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.3;
    display: block;
    width: 100%;
}

.progress-bar.green .progress-fill { background: #4caf50; }
.progress-bar.amber .progress-fill { background: #ff9800; }
.progress-bar.red .progress-fill { background: #f44336; }
.progress-bar.gray .progress-fill { background: #9e9e9e; }
.progress-bar.blue .progress-fill { background: #64b5f6; } /* Neutralny błękit dla WSTRZYMUJĘ SIĘ */

/* ============================================
   ATTACHMENTS GRID
/* ============================================
   ARCHIVAL POLL TABLE
   ============================================ */

.archival-poll-form {
    margin-top: 32px;
    padding: 24px;
    background: var(--md-surface-variant, #f5f5f5);
    border-radius: 6px;
    border: 1px solid var(--md-border, #e0e0e0);
}

.archival-poll-form-title {
    margin: 0 0 8px 0;
    color: var(--md-primary, #1976d2);
    font-size: 1.1em;
}

.archival-poll-form-description {
    color: var(--md-text-secondary, #666);
    font-size: 0.9em;
    margin: 0 0 20px 0;
}

.archival-poll-table-wrapper {
    overflow-x: auto;
    margin: 20px 0;
}

.archival-poll-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--md-surface, #fff);
    min-width: 400px;
    border: 1px solid var(--md-border, #e0e0e0);
    table-layout: fixed;
}

.archival-poll-table thead {
    background: var(--md-surface, #fff);
}

.archival-poll-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: var(--md-text-primary, #1a1a1a);
    border-bottom: 2px solid var(--md-border, #e0e0e0);
    border-right: 1px solid var(--md-border, #e0e0e0);
    white-space: normal;
    word-wrap: break-word;
    vertical-align: top;
    font-size: 0.9em;
}

.archival-poll-table th:last-child {
    border-right: none;
}

.archival-poll-table th:first-child {
    width: 55px;
    min-width: 55px;
    max-width: 55px;
}

.archival-poll-table th:not(:first-child) {
    width: auto;
    text-align: center;
}

.archival-poll-table td:first-child {
    width: 55px;
    min-width: 55px;
    max-width: 55px;
    font-weight: 500;
    color: var(--md-text-primary, #1a1a1a);
}

.archival-poll-table td {
    padding: 12px;
    border-bottom: 1px solid var(--md-border-light, #f0f0f0);
    border-right: 1px solid var(--md-border-light, #f0f0f0);
    vertical-align: middle;
}

.archival-poll-table td:last-child {
    border-right: none;
}

.archival-poll-table td:not(:first-child) {
    text-align: center;
}

.archival-poll-table tbody tr:hover {
    background: var(--md-surface-container, #f5f5f5);
}

.archival-poll-table input[type="radio"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.archival-poll-form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 20px;
}

/* ============================================
   ANKIETY ARCHIWALNE - ZWIJANIE/ROZWIJANIE
   ============================================ */

.poll-card-archival {
    position: relative;
}

.poll-header-collapsible {
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 0;
}

.poll-header-collapsible:hover {
    background: rgba(25, 118, 210, 0.04);
    border-radius: 6px;
    padding: 8px;
    margin: -8px;
}

.poll-header-left {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    max-width: 100%;
}

.poll-title-dates {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
    max-width: 100%;
}

.poll-title-dates h4 {
    margin: 0;
    color: var(--md-primary, #1976d2);
    font-size: 1.2em;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    line-height: 1.3;
}

.poll-title-dates .poll-dates {
    color: var(--md-text-secondary, #666);
    font-size: 0.85em;
}

.poll-header-right {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.poll-toggle-btn {
    background: transparent;
    color: var(--md-primary, #1976d2);
    border: none;
    border-radius: 0;
    width: auto;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    padding: 4px;
    font-size: 20px;
    box-shadow: none;
}

.poll-toggle-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2px 0;
    margin: 1px 0;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.poll-toggle-btn-centered {
    background: transparent;
    color: var(--md-primary, #1976d2);
    border: none;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 4px 8px;
    font-size: 24px;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.poll-toggle-btn-centered .expand-text {
    font-size: 14px;
    font-weight: 500;
}

.poll-toggle-btn-centered:hover {
    background: transparent;
    transform: scale(1.3);
    color: var(--md-primary-dark, #1565c0);
}

.poll-toggle-btn-centered:active {
    transform: scale(1.1);
}

.poll-toggle-btn-desktop,
.poll-toggle-btn-mobile {
    display: none !important;
}

.poll-toggle-btn .expand-icon {
    display: inline-block;
    transition: transform 0.3s ease;
    line-height: 1;
}

.poll-details-collapsible {
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
}

.poll-details-collapsible[style*="display: none"] {
    opacity: 0;
}

.poll-details-collapsible[style*="display: block"] {
    opacity: 1;
}

/* ============================================
   COLLAPSIBLE SECTION
   ============================================ */

.collapsible-section-header {
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    padding: 8px;
    margin: -8px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.collapsible-section-header:hover {
    background-color: rgba(25, 118, 210, 0.04);
}

.collapsible-toggle-btn {
    background: var(--md-primary, #1976d2);
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    padding: 0;
    font-size: 16px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.collapsible-toggle-btn:hover {
    background: var(--md-primary-dark, #1565c0);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    transform: scale(1.05);
}

.collapsible-toggle-btn:active {
    transform: scale(0.95);
}

.collapsible-toggle-btn .expand-icon {
    display: inline-block;
    transition: transform 0.3s ease;
    line-height: 1;
}

.collapsible-content {
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
}

/* ============================================
   POLL VOTE DETAILS TABLE
   ============================================ */

.poll-vote-details-wrapper {
    margin-top: 24px;
}

.poll-vote-details-title {
    margin: 0 0 16px 0;
    color: var(--md-text-primary);
    font-size: 1em;
    font-weight: 600;
}

.poll-vote-details-table-wrapper {
    overflow-x: auto;
}

.poll-vote-details-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--md-surface, #fff);
    min-width: 0;
    border: 1px solid var(--md-border, #e0e0e0);
    box-sizing: border-box;
    /* Równe kolumny - pusta kolumna (np. PRZECIW) nie jest już szersza niż ZA,
       a kolumna z głosami dostaje więcej szerokości, więc kafle układają się
       w rzędach obok siebie zamiast piętrzyć się w pionie. */
    table-layout: fixed;
}

.poll-vote-details-table thead {
    background: var(--md-surface, #fff);
}

.poll-vote-details-table th {
    padding: 12px;
    font-weight: 600;
    color: var(--md-text-primary, #1a1a1a);
    border-bottom: 2px solid var(--md-border, #e0e0e0);
    border-right: 1px solid var(--md-border, #e0e0e0);
    white-space: normal;
    word-wrap: break-word;
    text-align: left;
    vertical-align: top;
    font-size: 0.9em;
}

.poll-vote-details-table th:last-child {
    border-right: none;
}

.poll-vote-details-table td {
    padding: 12px;
    border-bottom: 1px solid var(--md-border-light, #f0f0f0);
    border-right: 1px solid var(--md-border-light, #f0f0f0);
    vertical-align: top;
}

.poll-vote-details-table td:last-child {
    border-right: none;
}

.poll-vote-details-label {
    display: none;
}

.poll-vote-details-content {
    width: 100%;
    box-sizing: border-box;
    /* Kafle obok siebie z odstępem, z zawijaniem do kolejnego rzędu */
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-content: flex-start;
}

/* Fix 2026-07-11 (zgłoszenie usera: "w darkmode nie widać kafelków domów"): poprzednio
   `background: var(--md-surface-container, #2a2a2a)` na ciemnym motywie różniło się od tła
   komórki (`--md-surface, #1e1e1e`) o zaledwie ~12/255 na kanał — technicznie inny kolor,
   ale wizualnie kafelek "zlewał się" z tłem (kontrast obramowania/tła kafla, nie tekstu).
   color-mix() względem --md-text-primary (jasny w dark mode, ciemny w light) daje kaflowi
   ZAWSZE wyraźnie jaśniejsze/ciemniejsze tło niż otoczenie, niezależnie od dokładnych
   wartości zmiennych motywu — ten sam sprawdzony wzorzec co .badge-neutral/.tint-neutral. */
.poll-vote-details-table td .poll-vote-details-item {
    padding: 4px 10px;
    background: color-mix(in srgb, var(--md-text-primary) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--md-text-primary) 25%, transparent);
    border-radius: 6px;
    font-size: 0.85em;
    line-height: 1.3;
    white-space: nowrap;
    position: relative;
    color: var(--md-text-primary);
}

.manual-vote-badge {
    display: inline-block;
    margin-left: 4px;
    font-size: 0.9em;
    cursor: help;
    vertical-align: middle;
}

.poll-vote-details-table td .no-votes {
    color: var(--md-text-disabled, #bdbdbd);
    font-style: italic;
    font-size: 0.85em;
}

/* ============================================
   RESPONSIVE - MOBILE
   ============================================ */

@media (max-width: 768px) {
    .material-form-grid,
    .material-form-grid-3col {
        grid-template-columns: 1fr !important;
    }
    
    .poll-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .poll-header h4 {
        font-size: 1.1em;
    }
    
    .poll-header > div {
        align-items: stretch;
    }
    
    .poll-header > div .material-btn {
        width: 100%;
        justify-content: center;
    }
    
    .poll-delete-form {
        width: 100%;
    }
    
    .poll-delete-form .material-btn {
        width: 100%;
        margin-left: 0;
    }
    
    .poll-card {
        padding: 10px;
    }
    
    .poll-toggle-btn-centered {
        font-size: 20px;
        padding: 6px 12px;
    }
    
    .poll-header-right {
        width: 100%;
        justify-content: flex-start;
    }
    
    .archival-poll-form {
        padding: 16px;
    }
    
    .archival-poll-table th,
    .archival-poll-table td {
        padding: 8px 4px;
        font-size: 0.85em;
    }
    
    .archival-poll-table th {
        font-size: 0.8em;
    }
    
    .archival-poll-table th:first-child {
        width: 60px;
        min-width: 50px;
    }
    
    /* Poll vote details - mobile cards */
    .poll-vote-details-wrapper {
        margin-top: 16px;
        width: 100%;
        max-width: 100%;
        overflow: visible;
    }
    
    .poll-vote-details-table-wrapper {
        border: none;
        overflow: visible;
        width: 100%;
        max-width: 100%;
    }
    
    .poll-vote-details-title {
        font-size: 0.95em;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        white-space: normal !important;
        line-height: 1.4;
        margin-bottom: 12px;
    }
    
    .poll-vote-details-table {
        border: 0;
        min-width: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        display: block;
        table-layout: auto;
        box-sizing: border-box !important;
    }
    
    .poll-vote-details-table thead {
        display: none;
    }
    
    .poll-vote-details-table tbody {
        display: block;
        width: 100%;
    }
    
    .poll-vote-details-table tr {
        display: block;
        width: 100%;
        margin: 0;
        padding: 0;
        background: transparent;
        border: none;
    }
    
    .poll-vote-details-table td {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 12px;
        margin-bottom: 12px;
        border: 1px solid var(--md-border, #e0e0e0);
        border-radius: 6px;
        background: var(--md-surface, #fff);
        text-align: left !important;
        box-sizing: border-box !important;
        overflow: visible !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
    }
    
    .poll-vote-details-label {
        font-weight: 600;
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        margin-bottom: 8px;
        padding-bottom: 8px;
        border-bottom: 1px solid var(--md-border-light, #f0f0f0);
        color: var(--md-primary, #1976d2);
        font-size: 0.9em;
        white-space: pre-wrap !important;
        word-wrap: break-word !important;
        overflow-wrap: anywhere !important;
        word-break: break-word !important;
        hyphens: auto !important;
        line-height: 1.3;
        box-sizing: border-box !important;
    }
    
    .poll-vote-details-content {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow: visible !important;
    }
    
    .poll-vote-details-table td::before,
    .poll-card .poll-vote-details-table td::before {
        content: none !important;
        display: none !important;
    }
    
    .poll-vote-details-table td .poll-vote-details-item,
    .poll-card .poll-vote-details-table td .poll-vote-details-item {
        display: inline-block !important;
        padding: 6px 10px;
        margin: 3px 4px 3px 0;
        border-radius: 6px;
        font-size: 0.85em;
        white-space: normal !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        hyphens: auto !important;
        max-width: calc(100% - 8px) !important;
        box-sizing: border-box !important;
        overflow: visible !important;
        text-overflow: clip !important;
    }
    
    .poll-vote-details-table td .no-votes {
        display: block;
        color: var(--md-text-disabled, #bdbdbd);
        font-style: italic;
        font-size: 0.85em;
    }
}

@media (max-width: 480px) {
    .poll-title-dates h4 {
        font-size: 1.1em;
    }
}

/* ============================================
   DARK MODE - POLLS
   ============================================ */

body.dark-mode .file-item {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .file-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

body.dark-mode .file-name {
    color: rgba(255, 255, 255, 0.9);
}

body.dark-mode .poll-card {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body.dark-mode .poll-header h4 {
    color: var(--md-primary, #90caf9);
}

body.dark-mode .poll-description,
body.dark-mode .poll-vote-count,
body.dark-mode .poll-vote-message,
body.dark-mode .poll-empty-state {
    color: rgba(255, 255, 255, 0.7);
}

body.dark-mode .poll-divider {
    border-top-color: rgba(255, 255, 255, 0.12);
}

body.dark-mode .poll-dates {
    color: rgba(255, 255, 255, 0.6);
}

body.dark-mode .status-banner.success {
    background: rgba(76, 175, 80, 0.15);
    color: #81c784;
}

body.dark-mode .status-banner.error {
    background: rgba(244, 67, 54, 0.15);
    color: #e57373;
}

body.dark-mode .status-banner.warn {
    background: rgba(255, 193, 7, 0.15);
    color: #ffd54f;
}

body.dark-mode .progress-bar {
    background: rgba(255, 255, 255, 0.08);
}

body.dark-mode .progress-label {
    color: var(--md-text-primary);
}

body.dark-mode .attachment-item {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

body.dark-mode .attachment-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

body.dark-mode .attachment-icon {
    background: rgba(255, 255, 255, 0.1);
}

body.dark-mode .collapsible-section-header:hover {
    background-color: rgba(25, 118, 210, 0.12);
}

body.dark-mode .collapsible-toggle-btn {
    background: var(--md-primary-light, #64b5f6);
}

body.dark-mode .collapsible-toggle-btn:hover {
    background: var(--md-primary, #1976d2);
}

body.dark-mode .poll-header-collapsible:hover {
    background: rgba(25, 118, 210, 0.12);
}

body.dark-mode .poll-header-left h4 {
    color: var(--md-primary-light, #64b5f6);
}

body.dark-mode .poll-header-left .poll-dates {
    color: var(--md-text-secondary, #b3b3b3);
}

body.dark-mode .poll-toggle-btn-centered {
    background: transparent;
    color: #ffffff;
}

body.dark-mode .poll-toggle-btn-centered:hover {
    background: transparent;
    color: #e0e0e0;
}

body.dark-mode .archival-poll-form {
    background: var(--md-surface-elevated, #2a2a2a);
    border-color: var(--md-border, #404040);
}

body.dark-mode .archival-poll-form-title {
    color: var(--md-text-primary);
}

body.dark-mode .archival-poll-form-description {
    color: var(--md-text-secondary, #b3b3b3);
}

body.dark-mode .archival-poll-table {
    background: var(--md-surface, #1e1e1e);
    border-color: var(--md-border, #404040);
}

body.dark-mode .archival-poll-table thead {
    background: var(--md-surface, #1e1e1e);
}

body.dark-mode .archival-poll-table th {
    color: var(--md-text-primary, #ffffff);
    border-bottom-color: var(--md-border, #404040);
    border-right-color: var(--md-border, #404040);
}

body.dark-mode .archival-poll-table td {
    border-bottom-color: var(--md-border-light, #333333);
    border-right-color: var(--md-border-light, #333333);
}

body.dark-mode .archival-poll-table td:first-child {
    color: var(--md-text-primary, #ffffff);
}

body.dark-mode .archival-poll-table tbody tr:hover {
    background: var(--md-surface-container, #2c2c2c);
}

body.dark-mode .poll-vote-details-title {
    color: var(--md-text-primary);
}

body.dark-mode .poll-vote-details-table {
    background: var(--md-surface, #1e1e1e);
    border-color: var(--md-border, #404040);
}

body.dark-mode .poll-vote-details-table thead {
    background: var(--md-surface, #1e1e1e);
}

body.dark-mode .poll-vote-details-table th {
    color: var(--md-text-primary, #ffffff);
    border-bottom-color: var(--md-border, #404040);
    border-right-color: var(--md-border, #404040);
}

body.dark-mode .poll-vote-details-table td {
    border-bottom-color: var(--md-border-light, #333333);
    border-right-color: var(--md-border-light, #333333);
    background: var(--md-surface, #1e1e1e);
}

/* Zbędne (2026-07-11): .poll-vote-details-item ma teraz kolory oparte o color-mix()
   względem --md-text-primary (patrz definicja bazowa wyżej) — samoczynnie dopasowane do
   motywu, bez potrzeby osobnego nadpisania dla body.dark-mode. */

body.dark-mode .poll-vote-details-table td .no-votes {
    color: var(--md-text-disabled, #666666);
}

body.dark-mode .poll-vote-details-label {
    color: var(--md-primary, #90caf9);
    border-bottom-color: var(--md-border, #404040);
}

/* ============================================
   TWO-COLUMN LAYOUT FOR ACTIVE/ARCHIVE
   ============================================ */

.material-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-top: 24px;
}

/* Fix width for cards inside columns - override .material-card { width: 100% } from app.css */
.material-columns > .material-card {
    width: auto;
    margin-bottom: 0;
}

@media (max-width: 1024px) {
    .material-columns {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* ============================================
   VOTING MODE SELECTION (CREATE FORM)
   ============================================ */

.voting-modes-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.voting-mode-option {
    display: flex;
    align-items: start;
    gap: 12px;
    cursor: pointer;
    padding: 12px;
    border-radius: 6px;
    transition: background 0.2s;
    border: 1px solid transparent;
}

.voting-mode-option:hover {
    background: rgba(0, 0, 0, 0.02);
}

.voting-mode-option input[type="radio"] {
    margin-top: 4px;
    cursor: pointer;
}

.voting-mode-option input[type="radio"]:checked {
    accent-color: var(--md-primary, #2196f3);
}

.voting-mode-desc {
    font-size: 0.9em;
    color: #666;
    margin-top: 4px;
    line-height: 1.6;
}

.voting-mode-example {
    font-size: 0.85em;
    margin-top: 8px;
    padding: 8px;
    border-radius: 6px;
}

.voting-mode-example.success {
    color: #2196f3;
    background: rgba(33, 150, 243, 0.1);
}

.voting-mode-example.error {
    color: #f44336;
    background: rgba(244, 67, 54, 0.1);
}

body.dark-mode .voting-mode-option:hover {
    background: rgba(255, 255, 255, 0.05);
}

body.dark-mode .voting-mode-desc {
    color: #aaa;
}

/* Responsywność dla voting mode selection */
@media (max-width: 768px) {
    .voting-mode-option {
        flex-direction: column;
        gap: 8px;
    }
    
    .voting-mode-option input[type="radio"] {
        margin-top: 0;
    }
    
    .voting-mode-example {
        font-size: 0.8em;
    }
}

@media (max-width: 480px) {
    .voting-mode-option {
        padding: 8px;
    }
    
    .voting-mode-desc {
        font-size: 0.85em;
    }
}

/* ============================================
   RADIO BUTTONY - TYP DOKUMENTU (dark mode fix)
   ============================================ */

.poll-type-radio {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 12px 16px;
    border: 2px solid var(--poll-type-border, #ddd);
    border-radius: 6px;
    background: var(--poll-type-bg-radio, #fff);
    transition: all 0.2s ease;
}

.poll-type-radio:hover {
    border-color: #9c27b0;
    background: var(--poll-type-bg-hover, rgba(156, 39, 176, 0.05));
}

.poll-type-radio input[type="radio"] {
    margin: 0;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #9c27b0;
}

.poll-type-radio input[type="radio"]:checked + .poll-type-label {
    color: #9c27b0;
    font-weight: 600;
}

.poll-type-radio:has(input[type="radio"]:checked) {
    border-color: #9c27b0;
    background: var(--poll-type-bg-checked, rgba(156, 39, 176, 0.08));
}

.poll-type-label {
    font-weight: 500;
    color: var(--text-primary, #333);
    transition: all 0.2s ease;
}

/* Dark mode - Typ dokumentu */
body.dark-mode .poll-type-radio {
    --poll-type-bg-radio: rgba(255, 255, 255, 0.05);
    --poll-type-border: rgba(255, 255, 255, 0.2);
    --poll-type-bg-hover: rgba(156, 39, 176, 0.15);
    --poll-type-bg-checked: rgba(156, 39, 176, 0.2);
}

body.dark-mode .poll-type-label {
    color: #e0e0e0;
}

body.dark-mode .poll-type-radio:has(input[type="radio"]:checked) .poll-type-label {
    color: #ce93d8;
}

/* Dark mode - Tryb głosowania */
body.dark-mode {
    --poll-type-bg: rgba(156, 39, 176, 0.1);
    --voting-mode-bg: rgba(33, 150, 243, 0.1);
}

/* ============================================
   RESPONSIVE - MOBILE
   ============================================ */

@media (max-width: 768px) {
    /* Tabela ręcznego zarządzania głosami - kompaktowy widok */
    .archival-poll-table {
        font-size: 0.8em;
        min-width: 100%;
    }
    
    .archival-poll-table th,
    .archival-poll-table td {
        padding: 6px 4px;
    }
    
    /* Dom - zawęź */
    .archival-poll-table th:first-child,
    .archival-poll-table td:first-child {
        width: 40px;
        min-width: 40px;
        max-width: 40px;
        font-size: 0.75em;
    }
    
    /* Checkbox "Ręczny głos" - zawęź */
    .archival-poll-table th:nth-child(2),
    .archival-poll-table td:nth-child(2) {
        width: 30px;
        min-width: 30px;
        padding: 4px 2px;
    }
    
    /* Nagłówki opcji głosowania - zawijaj tekst */
    .archival-poll-table th {
        white-space: normal;
        word-wrap: break-word;
        line-height: 1.2;
        font-size: 0.75em;
    }
    
    /* Kolumny ZA/PRZECIW/WSTRZYMUJĘ - węziej */
    .archival-poll-table th:not(:first-child):not(:nth-child(2)):not(:last-child),
    .archival-poll-table td:not(:first-child):not(:nth-child(2)):not(:last-child) {
        width: 50px;
        min-width: 50px;
        padding: 4px 2px;
    }
    
    /* Pole powodu - elastyczne, ale nie za szerokie */
    .archival-poll-table th:last-child {
        min-width: 120px;
        width: auto;
    }
    
    .archival-poll-table td:last-child {
        padding: 4px;
    }
    
    .archival-poll-table td:last-child input[type="text"] {
        font-size: 0.75em !important;
        padding: 4px !important;
    }
    
    /* Radio buttons - mniejsze */
    .archival-poll-table input[type="radio"] {
        width: 16px;
        height: 16px;
        margin: 0;
    }
    
    /* Checkbox - mniejszy */
    .archival-poll-table input[type="checkbox"] {
        width: 16px;
        height: 16px;
        margin: 0;
    }
}

/* Ultra małe ekrany (< 480px) - jeszcze bardziej kompaktowo */
@media (max-width: 480px) {
    .archival-poll-table {
        font-size: 0.7em;
    }
    
    .archival-poll-table th,
    .archival-poll-table td {
        padding: 4px 2px;
    }
    
    .archival-poll-table th:first-child,
    .archival-poll-table td:first-child {
        width: 35px;
        min-width: 35px;
        max-width: 35px;
    }
    
    .archival-poll-table th:nth-child(2),
    .archival-poll-table td:nth-child(2) {
        width: 25px;
        min-width: 25px;
    }
    
    .archival-poll-table th:not(:first-child):not(:nth-child(2)):not(:last-child),
    .archival-poll-table td:not(:first-child):not(:nth-child(2)):not(:last-child) {
        width: 45px;
        min-width: 45px;
    }
    
    .archival-poll-table th:last-child {
        min-width: 100px;
    }
}

/* ============================================
   MATERIAL MODAL STYLES (uzupełnienie)
   ============================================ */

.material-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(2px);
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.material-modal.open {
    display: flex;
    opacity: 1;
}

.material-modal-content {
    background-color: var(--md-surface, #fff);
    margin: auto;
    padding: 0;
    border-radius: var(--md-radius-lg, 6px);
    box-shadow: 0 24px 38px 3px rgba(0,0,0,0.14), 0 9px 46px 8px rgba(0,0,0,0.12), 0 11px 15px -7px rgba(0,0,0,0.2);
    width: 95%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    animation: slideInUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    border: 1px solid var(--md-border, rgba(0,0,0,0.1));
}

.material-modal-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--md-border, #e0e0e0);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--md-surface, #fff);
    border-radius: var(--md-radius-lg, 6px) var(--md-radius-lg, 6px) 0 0;
    flex-shrink: 0;
}

.material-modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--md-text-primary, #1a1a1a);
}

.material-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.material-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--md-border, #e0e0e0);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: var(--md-surface-container, #f5f5f5);
    border-radius: 0 0 var(--md-radius-lg, 6px) var(--md-radius-lg, 6px);
    flex-shrink: 0;
}

.material-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--md-border, #e0e0e0);
}

/* Close button style */
.material-modal-header .material-btn.small {
    min-width: 32px;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--md-text-secondary, #757575);
    box-shadow: none;
    font-size: 1.5rem;
    line-height: 1;
}

.material-modal-header .material-btn.small:hover {
    background-color: rgba(0,0,0,0.05);
    color: var(--md-text-primary, #000);
}

body.dark-mode .material-modal-content {
    background-color: var(--md-surface-elevated, #2a2a2a);
    border-color: var(--md-border, #404040);
}

/* ============================================
   MODAL FORM STYLES (kompaktowe)
   ============================================ */

.material-modal-body {
    padding: 16px 24px !important; /* Zmniejszony padding */
}

.material-form-group {
    margin-bottom: 16px; /* Zmniejszony margin */
}

.material-form-group:last-child {
    margin-bottom: 0;
}

.material-help-text {
    display: block;
    font-size: 0.8rem;
    color: var(--md-text-secondary, #666);
    margin-top: 4px;
    line-height: 1.4;
}

.material-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

/* Existing attachments list styles */
.existing-attachments-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.existing-attachment-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background-color: var(--md-surface, #fff);
    border: 1px solid var(--md-border, #e0e0e0);
    border-radius: 6px;
    font-size: 0.9em;
    transition: all 0.2s ease;
}

.existing-attachment-item:hover {
    background-color: var(--md-surface-container-high, #f5f5f5);
    border-color: var(--md-border-hover, #ccc);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.existing-attachment-item .attachment-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--md-text-primary, #1a1a1a);
    font-size: 0.875rem;
    margin-right: 12px;
}

body.dark-mode .existing-attachment-item {
    background-color: var(--md-surface, #1e1e1e);
    border-color: var(--md-border, #404040);
}

body.dark-mode .existing-attachment-item:hover {
    background-color: var(--md-surface-container, #2a2a2a);
    border-color: var(--md-border-hover, #555);
}

.existing-attachment-item .btn-text {
    padding: 6px 12px;
    font-size: 0.85rem;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 6px;
    font-weight: 500;
}

.btn-text-danger {
    color: var(--md-danger, #f44336);
}

.btn-text-danger:hover {
    background: rgba(244, 67, 54, 0.1);
    color: var(--md-danger-dark, #d32f2f);
}

.btn-text-danger:active {
    background: rgba(244, 67, 54, 0.2);
    transform: scale(0.95);
}

/* Compact modal width override */
#editPollModal .material-modal-content {
    max-width: 700px;
    width: 90%;
}

/* Poll options row styling */
.poll-option-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
}

.poll-option-row span {
    min-width: 30px;
    color: var(--md-text-secondary, #666);
    font-size: 0.9rem;
    font-weight: 500;
}

.poll-option-row .material-input,
.poll-option-row .option-label-input {
    flex: 1;
    margin-bottom: 0;
}

/* Delete option button */
.delete-option-btn {
    min-width: 40px !important;
    width: 40px !important;
    height: 40px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.delete-option-btn:hover {
    transform: scale(1.1);
}

/* Opcje container */
#editPollOptionsContainer {
    margin-top: 8px;
}

#editPollOptionsSection .material-label {
    font-weight: 600;
    color: var(--md-text-primary, #1a1a1a);
}

#editPollOptionsSection .material-help-text {
    color: var(--md-text-secondary, #666);
    font-size: 0.8rem;
    margin-bottom: 8px;
}

/* Mobile responsiveness for modal */
@media (max-width: 768px) {
    #editPollModal .material-modal-content {
        width: 95%;
        max-width: 95%;
        max-height: 95vh;
    }
    
    .material-form-grid {
        grid-template-columns: 1fr;
    }
    
    .material-modal-body {
        padding: 12px 16px !important;
    }
    
    .poll-option-row {
        flex-wrap: nowrap;
    }
    
    .delete-option-btn {
        min-width: 36px !important;
        width: 36px !important;
        height: 36px !important;
    }
}
