body { 
    font-family: 'Montserrat', Arial, sans-serif; 
    margin: 0; 
    padding: 0; 
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333; 
    min-height: 100vh;
}

.dashboard-container { 
    max-width: 1600px; 
    margin: 0 auto; 
    padding: 40px 20px 20px 20px; 
    background: rgba(255,255,255,0.95);
    border-radius: 20px;
    margin-top: 50px;
    margin-bottom: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

.main-title { 
    text-align: center; 
    margin-bottom: 40px; 
    font-weight: 700; 
    color: #2c3e50; 
    font-size: 2.5em; 
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.subtitle {
    text-align: center;
    margin-bottom: 30px;
    font-weight: 400;
    color: #7f8c8d;
    font-size: 1.2em;
}

.results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

.card {
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    padding: 25px;
    border: 1px solid #e8ecf0;
}

.card-title {
    font-size: 1.4em;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 20px;
    text-align: center;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

.chart-container {
    position: relative;
    height: 400px;
    margin-bottom: 20px;
}

.flow-section {
    margin: 40px 0;
}

.flow-title {
    font-size: 2em;
    font-weight: 700;
    color: #2c3e50;
    text-align: center;
    margin-bottom: 30px;
    background: linear-gradient(45deg, #3498db, #9b59b6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.flow-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.candidate-flow {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.08);
    border-left: 5px solid #3498db;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.candidate-flow:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
}

.candidate-name {
    font-weight: 600;
    font-size: 1.1em;
    color: #2c3e50;
    margin-bottom: 10px;
}

.candidate-votes {
    font-size: 0.9em;
    color: #7f8c8d;
    margin-bottom: 15px;
}

.flow-bars {
    margin: 15px 0;
}

.flow-bar {
    display: flex;
    align-items: center;
    margin: 8px 0;
    font-size: 0.85em;
}

.flow-label {
    width: 120px;
    font-weight: 500;
}

.flow-visual {
    flex: 1;
    height: 20px;
    border-radius: 10px;
    margin: 0 10px;
    position: relative;
    overflow: hidden;
}

.flow-trzaskowski { background: linear-gradient(90deg, #3498db, #2980b9); }
.flow-nawrocki { background: linear-gradient(90deg, #e54b3b, #c83d2e); }
.flow-abstain { background: linear-gradient(90deg, #95a5a6, #7f8c8d); }

.flow-percentage {
    width: 60px;
    text-align: right;
    font-weight: 600;
}

.prediction-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px;
    padding: 30px;
    margin: 40px 0;
    text-align: center;
}

.prediction-title {
    font-size: 2.2em;
    font-weight: 700;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.prediction-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 30px;
}

.prediction-card {
    background: rgba(255,255,255,0.15);
    border-radius: 15px;
    padding: 25px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
}

.candidate-photo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 15px;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    font-weight: 700;
}

.prediction-name {
    font-size: 1.3em;
    font-weight: 600;
    margin-bottom: 10px;
}

.prediction-range {
    font-size: 1.8em;
    font-weight: 700;
    margin: 15px 0;
}

.prediction-votes {
    font-size: 1em;
    opacity: 0.9;
}

.methodology {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    margin: 30px 0;
    border-left: 5px solid #3498db;
}

.methodology-title {
    font-size: 1.3em;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 15px;
}

.methodology-text {
    color: #5a6c7d;
    line-height: 1.6;
}

.source-info {
    text-align: center;
    margin-top: 30px;
    padding: 20px;
    background: #ecf0f1;
    border-radius: 10px;
    color: #7f8c8d;
    font-size: 0.9em;
}

.source-info a {
    color: #3498db;
    text-decoration: none;
    font-weight: 500;
}

.source-info a:hover {
    text-decoration: underline;
}





/* Styles for mobilization slider */
.mobilization-control {
    margin-top: 15px;
    padding: 10px;
    background: rgba(0,0,0,0.02);
    border-radius: 8px;
    border: 1px solid #e8ecf0;
}

.mobilization-label {
    font-size: 0.8em;
    color: #7f8c8d;
    margin-bottom: 8px;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mobilization-value {
    color: #2c3e50;
    font-weight: 600;
}

.mobilization-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e8ecf0;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.mobilization-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #3498db;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
}

.mobilization-slider::-webkit-slider-thumb:hover {
    background: #2980b9;
    transform: scale(1.1);
}

.mobilization-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #3498db;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
}

.mobilization-slider::-moz-range-thumb:hover {
    background: #2980b9;
    transform: scale(1.1);
}

/* Styles for source info in candidate cards */
.candidate-source {
    margin-top: 15px;
    padding: 8px 12px;
    background: rgba(0,0,0,0.02);
    border-radius: 6px;
    border: 1px solid #e8ecf0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.source-date {
    font-size: 0.65em;
    color: #95a5a6;
    font-weight: 400;
    font-style: italic;
}

.source-link {
    display: inline-block;
    padding: 4px 8px;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    text-decoration: none;
    border-radius: 12px;
    font-size: 0.7em;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(52, 152, 219, 0.2);
}

.source-link:hover {
    background: linear-gradient(135deg, #2980b9, #1f5f8b);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.3);
    color: white;
    text-decoration: none;
}

/* Nowy styl dla linków szacunkowych */
.source-link.estimate {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    box-shadow: 0 2px 4px rgba(243, 156, 18, 0.2);
}

.source-link.estimate:hover {
    background: linear-gradient(135deg, #e67e22, #d35400);
    box-shadow: 0 4px 8px rgba(243, 156, 18, 0.3);
}

.source-text {
    font-size: 0.7em;
    color: #7f8c8d;
    font-style: italic;
    font-weight: 400;
}

.source-text-only {
    text-align: center;
    width: 100%;
}

/* Styles for transfer table section */
.transfer-section {
    margin: 40px 0;
    background: #fff;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.transfer-title {
    font-size: 2em;
    font-weight: 700;
    color: #2c3e50;
    text-align: center;
    margin-bottom: 10px;
    background: linear-gradient(45deg, #3498db, #9b59b6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}



.transfer-table-container {
    overflow-x: auto;
    margin-bottom: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.transfer-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
}

.transfer-table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 10px;
    text-align: center;
    font-weight: 600;
    font-size: 0.85em;
    border: none;
}

.transfer-table td {
    padding: 12px 10px;
    text-align: center;
    border-bottom: 1px solid #e8ecf0;
    transition: background-color 0.3s ease;
}

.transfer-table tbody tr:hover {
    background-color: #f8f9fa;
}

.transfer-table tbody tr:nth-child(even) {
    background-color: #fdfdfd;
}

.transfer-summary {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%) !important;
    color: white !important;
}

.transfer-summary td {
    padding: 15px 10px !important;
    font-weight: 600 !important;
    border: none !important;
}

.candidate-name-cell {
    text-align: left !important;
    font-weight: 600;
    color: #2c3e50;
}

.votes-cell {
    font-weight: 500;
    color: #34495e;
}

.percentage-cell {
    font-weight: 600;
    color: #7f8c8d;
}

.transfer-trzaskowski {
    background: linear-gradient(90deg, rgba(52, 152, 219, 0.1), rgba(52, 152, 219, 0.2));
    color: #2980b9;
    font-weight: 600;
}

.transfer-nawrocki {
    background: linear-gradient(90deg, rgba(229, 75, 59, 0.1), rgba(200, 61, 46, 0.2));
    color: #c83d2e;
    font-weight: 600;
}

.transfer-abstain {
    background: linear-gradient(90deg, rgba(149, 165, 166, 0.1), rgba(149, 165, 166, 0.2));
    color: #7f8c8d;
    font-weight: 600;
}

/* Final calculation styles */
.final-calculation {
    margin-top: 30px;
}

.calc-title {
    font-size: 1.6em;
    font-weight: 600;
    color: #2c3e50;
    text-align: center;
    margin-bottom: 25px;
}

.calc-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.calc-card {
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.calc-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
}

.calc-trzaskowski {
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.05), rgba(52, 152, 219, 0.1));
    border-color: #3498db;
}

.calc-nawrocki {
    background: linear-gradient(135deg, rgba(229, 75, 59, 0.05), rgba(200, 61, 46, 0.1));
    border-color: #e54b3b;
}

.calc-header {
    font-size: 1.3em;
    font-weight: 700;
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid;
}

.calc-trzaskowski .calc-header {
    color: #2980b9;
    border-color: #3498db;
}

.calc-nawrocki .calc-header {
    color: #c83d2e;
    border-color: #e54b3b;
}

.calc-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 12px 0;
    font-size: 1em;
}

.calc-row span:first-child {
    color: #5a6c7d;
    font-weight: 500;
}

.calc-row span:last-child {
    font-weight: 600;
    color: #2c3e50;
}

.calc-divider {
    height: 2px;
    background: linear-gradient(90deg, transparent, #bdc3c7, transparent);
    margin: 15px 0;
}

.calc-total {
    font-size: 1.1em;
    font-weight: 700 !important;
    padding: 10px 0;
    border-radius: 8px;
    background: rgba(255,255,255,0.5);
}

.calc-total span {
    font-weight: 700 !important;
    color: #2c3e50 !important;
}

.calc-percentage {
    text-align: center;
    font-size: 1.4em;
    font-weight: 700;
    margin-top: 15px;
    padding: 10px;
    border-radius: 8px;
    background: rgba(255,255,255,0.7);
}

.calc-trzaskowski .calc-percentage {
    color: #2980b9;
}

.calc-nawrocki .calc-percentage {
    color: #c83d2e;
}

/* Fixed prediction bar styles */
.fixed-prediction-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    border-bottom: 3px solid #1a252f;
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    font-family: 'Montserrat', sans-serif;
}

.prediction-bar-header {
    background: linear-gradient(135deg, #1a252f 0%, #2c3e50 100%);
    color: white;
    padding: 8px 15px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.prediction-bar-table {
    display: table;
    width: 100%;
    table-layout: fixed;
}

.prediction-bar-cell {
    display: table-cell;
    text-align: center;
    vertical-align: middle;
    padding: 12px 8px;
    border-right: 2px solid #1a252f;
    transition: all 0.3s ease;
}

.prediction-bar-cell:last-child {
    border-right: none;
}

.candidate-cell {
    width: 40%;
    font-weight: 600;
    color: white;
}

/* Domyślne tła dla kandydatów przez klasy */
.candidate-cell.trzaskowski {
    background: linear-gradient(135deg, #3498db, #2980b9);
}

.candidate-cell.nawrocki {
    background: linear-gradient(135deg, #e54b3b, #c83d2e);
}

/* Style dla wygranego - teraz tylko dodają cień, bo tło jest z klas .trzaskowski/.nawrocki */
.candidate-cell.winner {
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Style dla przegranego - nadpisuje tło na szare */
.candidate-cell.loser {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
    opacity: 0.8;
    box-shadow: 0 2px 8px rgba(149, 165, 166, 0.2);
}

.difference-cell {
    width: 20%;
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(44, 62, 80, 0.3);
    padding: 12px 15px;
}

.candidate-status-icon {
    font-size: 1.1em;
    margin-left: 6px;
    font-weight: bold;
}

.candidate-cell.winner .candidate-status-icon {
    color: #27ae60;
}

.candidate-cell.loser .candidate-status-icon {
    color: #e74c3c;
}

.candidate-cell .candidate-status-icon {
    color: #7f8c8d;
}

.candidate-bar-name {
    font-weight: 700;
    font-size: 0.85em;
    margin-bottom: 4px;
}

.candidate-bar-percentage {
    font-weight: 700;
    font-size: 1.1em;
    margin-bottom: 2px;
}

.candidate-bar-votes {
    font-size: 0.75em;
    opacity: 0.9;
}

.prediction-bar-simulation-info {
    color: white;
    font-size: 0.75em;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.difference-text {
    font-size: 0.75em;
    font-weight: 600;
    margin-bottom: 2px;
    line-height: 1.1;
}

.difference-votes {
    font-size: 0.85em;
    font-weight: 700;
}

/* Mobile responsiveness for prediction bar */
@media (max-width: 768px) {
    .prediction-bar-header {
        padding: 4px 10px;
    }
    
    .prediction-bar-cell {
        padding: 8px 4px;
        font-size: 0.85em;
    }
    
    .candidate-bar-name {
        font-size: 0.75em;
    }
    
    .candidate-bar-percentage {
        font-size: 1em;
    }
    
    .candidate-bar-votes {
        font-size: 0.7em;
    }
    
    .difference-text {
        font-size: 0.65em;
    }
    
    .difference-votes {
        font-size: 0.8em;
    }
    
    .prediction-bar-simulation-info {
        font-size: 0.7em;
    }
}

@media (max-width: 480px) {
    .prediction-bar-cell {
        padding: 6px 2px;
        font-size: 0.8em;
    }
    
    .candidate-bar-name {
        font-size: 0.7em;
    }
    
    .candidate-bar-percentage {
        font-size: 0.9em;
    }
    
    .candidate-bar-votes {
        font-size: 0.65em;
    }
    
    .difference-text {
        font-size: 0.6em;
        line-height: 0.9;
    }
    
    .difference-votes {
        font-size: 0.75em;
    }
    
    .prediction-bar-simulation-info {
        font-size: 0.65em;
    }
}

/* Add top margin to body to compensate for fixed bar */
body.with-fixed-bar {
    padding-top: 80px;
}

@media (max-width: 480px) {
    body.with-fixed-bar {
        padding-top: 110px;
    }
}

/* Additional mobile optimizations */
@media (max-width: 768px) {
    .dashboard-container {
        margin-top: 20px;
        padding: 15px;
        border-radius: 15px;
    }
    
    .main-title {
        font-size: 2em;
        margin-bottom: 20px;
    }
    
    .subtitle {
        font-size: 1em;
        margin-bottom: 20px;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .prediction-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .calc-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .flow-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .transfer-table {
        font-size: 0.75em;
    }
    
    .transfer-table th,
    .transfer-table td {
        padding: 8px 5px;
    }
}

@media (max-width: 480px) {
    .dashboard-container {
        padding: 10px;
        margin-top: 10px;
    }
    
    .main-title {
        font-size: 1.6em;
    }
    
    .subtitle {
        font-size: 0.9em;
    }
    
    .card {
        padding: 15px;
    }
    
    .card-title {
        font-size: 1.1em;
    }
    
    .flow-title {
        font-size: 1.5em;
    }
    
    .transfer-title {
        font-size: 1.5em;
    }
    
    .prediction-title {
        font-size: 1.8em;
    }
    
    .transfer-table {
        font-size: 0.7em;
    }
    
    .transfer-table th,
    .transfer-table td {
        padding: 6px 3px;
    }
}