/**
 * Style dla wyświetlacza wyników zawodów
 */

/* Główny kontener */
.zawody-results-display-container {
    font-family: 'Roboto', sans-serif;
    max-width: 100%;
    margin: 0 auto;
    padding: 10px;
    background-color: #f5f5f5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Nagłówek wyników */
.zawody-results-header {
    background-color: #2c3e50;
    color: white;
    padding: 10px 15px;
    margin-bottom: 10px;
    position: relative;
}

.zawody-results-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.zawody-results-header .left-section {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 80px;
}

.zawody-results-header .center-section {
    flex: 2;
    text-align: center;
}

.zawody-results-header .right-section {
    flex: 1;
    text-align: right;
    min-width: 80px;
}

.zawody-results-title {
    margin: 0;
    font-size: 1.8em;
    flex: 1;
}

.zawody-results-competition-name {
    font-size: 1.5em;
    flex: 2;
    text-align: center;
    font-weight: bold;
}

.zawody-results-time {
    font-size: 1em;
    flex: 1;
    text-align: right;
}

/* Zawartość */
.zawody-results-content {
    flex: 1;
    background-color: white;
}

/* Style dla numeru licencji */
.zawody-license-number {
    font-size: 0.6em;
    color: #666;
    margin-left: 3px;
    font-style: italic;
    display: inline-block;
}

.zawody-results-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

    /* Spinner usunięty */

.zawody-results-error {
    color: #e74c3c;
    text-align: center;
    padding: 20px;
    font-size: 1.2em;
}

/* Tabela wyników */
.zawody-results-table-container {
    margin-top: 20px;
    overflow-x: visible; /* Usunięcie przewijania w bok */
    width: 100%;
    display: block !important; /* Zawsze pokazuj tabelę */
}

.zawody-results-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    font-size: 14px;
}

/* Responsywny design dla urządzeń mobilnych */
@media screen and (max-width: 768px) {
    /* Kompaktowy widok tabeli */
    .zawody-results-table {
        font-size: 12px;
        border: 1px solid #ddd;
        border-radius: 4px;
        width: 100%;
        table-layout: auto; /* Automatyczne dostosowanie szerokości kolumn */
    }
    
    .zawody-results-table th {
        font-size: 11px;
        padding: 5px 2px;
    }
    
    .zawody-results-table td {
        padding: 5px 2px;
    }
    
    /* Tylko kolumna z zawodnikiem może być ucinana */
    .zawody-results-table td:nth-child(3) { /* Zawodnik */
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 80px;
    }
    
    /* Kolumny z wynikami punktowymi muszą być zawsze widoczne */
    .zawody-results-table td:nth-child(5), /* Punkty/Czas */
    .zawody-results-table td:nth-child(7), /* Wynik */
    .zawody-results-table td.result-value {
        white-space: nowrap;
        overflow: visible;
        text-align: center;
        font-family: monospace; /* Czcionka stałej szerokości dla lepszego wyrównania cyfr */
        font-weight: bold; /* Pogrubienie dla lepszej czytelności */
        padding: 5px 3px; /* Zwiększone marginesy wewnętrzne */
        font-size: 14px; /* Większa czcionka dla wyników */
    }
    
    /* Ukrywanie kolumn na małych ekranach */
    .zawody-results-table th:nth-child(2), /* Nr startowy */
    .zawody-results-table td:nth-child(2),
    .zawody-results-table th:nth-child(4), /* Klub */
    .zawody-results-table td:nth-child(4) {
        display: none;
    }
}

/* Dodatkowy breakpoint dla bardzo małych ekranów */
@media screen and (max-width: 480px) {
    .zawody-results-table {
        font-size: 11px;
    }
    
    /* Ukrywamy kolumnę X/Karne na bardzo małych ekranach */
    .zawody-results-table th:nth-child(6), /* X/Karne */
    .zawody-results-table td:nth-child(6) {
        display: none;
    }
    
    /* Zwiększamy szerokość kolumn z wynikami na bardzo małych ekranach */
    .zawody-results-table td:nth-child(5), /* Punkty/Czas */
    .zawody-results-table td:nth-child(7), /* Wynik */
    .zawody-results-table td.result-value {
        min-width: 80px;
        font-size: 14px; /* Większa czcionka dla wyników */
    }
    
    /* Zmniejszamy szerokość kolumny z zawodnikiem */
    .zawody-results-table td:nth-child(3) { /* Zawodnik */
        max-width: 80px;
    }
    
    /* Zmniejszamy szerokość kolumny z miejscem */
    .zawody-results-table td:nth-child(1) { /* Miejsce */
        min-width: 30px;
        max-width: 30px;
    }
}

.zawody-results-table th {
    background-color: #3498db;
    color: white;
    padding: 8px 10px;
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 10;
    border: 1px solid #ddd;
    font-weight: bold;
}

.zawody-results-table td {
    padding: 6px 8px;
    border: 1px solid #ddd;
    text-align: center;
    vertical-align: middle;
}

/* Szerokości kolumn */
.zawody-results-table th:nth-child(1), /* Miejsce */
.zawody-results-table td:nth-child(1) {
    width: 3%;
    min-width: 3ch;
    max-width: 3ch;
    text-align: center;
}

.zawody-results-table th:nth-child(2), /* Nr */
.zawody-results-table td:nth-child(2) {
    width: 3%;
    min-width: 3ch;
    max-width: 3ch;
    text-align: center;
}

.zawody-results-table th:nth-child(3), /* Zawodnik (połączone imię i nazwisko) */
.zawody-results-table td:nth-child(3) {
    width: 35%;
    text-align: left;
    padding-left: 10px;
    font-size: 0.9em;
}

.zawody-results-table th:nth-child(4), /* Klub */
.zawody-results-table td:nth-child(4) {
    width: 29%;
    text-align: left;
    padding-left: 10px;
    font-size: 0.9em;
}

/* Style dla numeru licencji */
.zawody-license-number {
    font-size: 0.85em;
    color: #777;
    margin-left: 5px;
}

/* Pasiaste wiersze */
.zawody-results-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.zawody-results-table tr:hover {
    background-color: #f0f7ff;
}

/* Klasy dla podium */
.zawody-results-table tr.gold td {
    background-color: #fef9e7;
    font-weight: bold;
}

.zawody-results-table tr.silver td {
    background-color: #f8f9f9;
    font-weight: bold;
}

.zawody-results-table tr.bronze td {
    background-color: #fbeee6;
    font-weight: bold;
}

.zawody-results-table td {
    padding: 6px 8px;
    border: 1px solid #ddd;
    text-align: center;
    vertical-align: middle;
}

/* Szerokości kolumn */
.zawody-results-table th:nth-child(1), /* Miejsce */
.zawody-results-table td:nth-child(1) {
    width: 3%;
    min-width: 3ch;
    max-width: 3ch;
    text-align: center;
}

.zawody-results-table th:nth-child(2), /* Nr */
.zawody-results-table td:nth-child(2) {
    width: 3%;
    min-width: 3ch;
    max-width: 3ch;
    text-align: center;
}

.zawody-results-table th:nth-child(3), /* Zawodnik (połączone imię i nazwisko) */
.zawody-results-table td:nth-child(3) {
    width: 35%;
    text-align: left;
    padding-left: 10px;
    font-size: 0.9em;
}

.zawody-results-table th:nth-child(4), /* Klub */
.zawody-results-table td:nth-child(4) {
    width: 29%;
    text-align: left;
    padding-left: 10px;
    font-size: 0.9em;
}

/* Style dla numeru licencji */
.zawody-license-number {
    font-size: 0.85em;
    color: #666;
    margin-left: 5px;
}

@media screen and (max-width: 768px) {
    .zawody-license-number {
        display: inline;
        margin-left: 3px;
        font-size: 0.8em;
    }
    
    /* Podświetlenie dla miejsc na podium w widoku mobilnym */
    .zawody-results-table tr.gold {
        background-color: rgba(255, 215, 0, 0.1);
        border-left: 3px solid gold;
    }
    
    .zawody-results-table tr.silver {
        background-color: rgba(192, 192, 192, 0.1);
        border-left: 3px solid silver;
    }
    
    .zawody-results-table tr.bronze {
        background-color: rgba(205, 127, 50, 0.1);
        border-left: 3px solid #cd7f32;
    }
    
    /* Dostosowanie nagłówka na telefonach */
    .zawody-results-header {
        flex-direction: column;
        align-items: center;
        padding: 5px;
    }
    
    .zawody-results-header h2 {
        font-size: 16px;
        margin: 5px 0;
    }
}

.zawody-results-table th:nth-child(5), /* Punkty/Czas */
.zawody-results-table td:nth-child(5) {
    width: 5%;
    min-width: 6ch;
    max-width: 6ch;
    text-align: center;
    font-family: monospace;
}

.zawody-results-table th:nth-child(6), /* X/Karne */
.zawody-results-table td:nth-child(6) {
    width: 5%;
    min-width: 6ch;
    max-width: 6ch;
    text-align: center;
    font-family: monospace;
}

.zawody-results-table th:nth-child(7), /* Wynik (tylko dla dynamicznej) */
.zawody-results-table td:nth-child(7) {
    width: 5%;
    min-width: 6ch;
    max-width: 6ch;
    text-align: center;
    font-family: monospace;
}

.zawody-results-table tr:nth-child(even) {
    background-color: #f2f2f2;
}

/* Style dla koła postępu */
#progress-circle-container {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 1000;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    padding: 3px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zawody-results-table tr:hover {
    background-color: #e3f2fd;
}

/* Maksymalna wysokość tabeli z przewijaniem */
.zawody-results-table-container {
    max-height: 75vh;
    overflow-y: auto;
}

/* Stopka */
.zawody-results-footer {
    background-color: #2c3e50;
    color: white;
    padding: 8px 15px;
    border-radius: 0 0 5px 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.zawody-results-info {
    font-size: 0.9em;
}

.zawody-results-logo img {
    height: 30px;
    width: auto;
}

/* Kontrolki paginacji */
.zawody-results-pagination {
    display: flex;
    justify-content: center;
    margin: 10px 0;
}

.zawody-results-pagination-info {
    margin: 0 15px;
    font-size: 0.9em;
    line-height: 30px;
}

.zawody-results-pagination-button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 5px 10px;
    margin: 0 5px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.9em;
}

.zawody-results-pagination-button:hover {
    background-color: #2980b9;
}

.zawody-results-pagination-button:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

/* Podświetlenie najlepszych wyników */
.zawody-results-table tr.gold {
    background-color: rgba(255, 215, 0, 0.2);
}

.zawody-results-table tr.silver {
    background-color: rgba(192, 192, 192, 0.2);
}

.zawody-results-table tr.bronze {
    background-color: rgba(205, 127, 50, 0.2);
}

.zawody-results-table tr.gold td:first-child,
.zawody-results-table tr.silver td:first-child,
.zawody-results-table tr.bronze td:first-child {
    font-weight: bold;
}

/* Animacja przejścia między konkurencjami */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fadeIn 1s ease-in-out;
}

/* Style dla koła postępu */
#progress-circle-container {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    z-index: 100;
}

#progress-circle {
    transition: stroke-dashoffset 0.1s linear;
}

/* Style dla elementu ładowania */
.zawody-results-loading {
    text-align: center;
    padding: 20px;
}

.zawody-results-spinner {
    display: inline-block;
    width: 50px;
    height: 50px;
    border: 5px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: #3498db;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}


/* Tryb pełnoekranowy */
body.zawody-fullscreen-mode .zawody-results-display-container {
    padding: 0;
    margin: 0;
    width: 100vw;
    height: 100vh;
    max-width: 100%;
    overflow: hidden;
}

body.zawody-fullscreen-mode .zawody-results-header {
    border-radius: 0;
}

body.zawody-fullscreen-mode .zawody-results-footer {
    border-radius: 0;
}

/* Responsywność */
@media (max-width: 768px) {
    .zawody-results-header {
        flex-direction: column;
        text-align: center;
    }
    
    .zawody-results-title,
    .zawody-results-competition-name,
    .zawody-results-time {
        flex: none;
        width: 100%;
        text-align: center;
        margin-bottom: 10px;
    }
    
    .zawody-results-table th,
    .zawody-results-table td {
        padding: 8px;
    }
}
