/* Speciální styly pro stránku výsledků poháru */

/* Základní nastavení sekce výsledků */
.cup-results-section {
    padding: var(--space-9) 0 var(--space-8);
    background-color: var(--secondary);
    position: relative;
}

/* Kontejner pro výsledkové tabulky */
.cup-results-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-6);
    margin-bottom: var(--space-8);
}

@media (min-width: 992px) {
    .cup-results-container {
        grid-template-columns: minmax(320px, 1fr) minmax(500px, 2fr);
    }
}

/* Box s výsledky */
.results-box {
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    height: 100%;
}

/* Nadpis boxu */
.box-title {
    background-color: rgba(255, 255, 255, 0.1);
    padding: var(--space-4);
    margin: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: var(--fs-5);
    text-align: center;
    color: var(--white);
    position: relative;
}

.box-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background-color: var(--primary);
    border-radius: 2px;
}

/* Responzivní tabulka */
.table-responsive {
    overflow-x: auto;
    padding: var(--space-4);
}

/* Tabulka výsledků */
.results-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: var(--fs-3);
}

.results-table th,
.results-table td {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.results-table th {
    font-weight: 600;
    color: var(--gray-300);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: var(--fs-2);
    background-color: rgba(255, 255, 255, 0.05);
}

.results-table tr:last-child td {
    border-bottom: none;
}

.results-table tr:hover td {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Specifické nastavení pro sloupec pohybu v celkové tabulce */
.overall-results .results-table th:nth-child(3),
.overall-results .results-table td:nth-child(3) {
    text-align: center;
    width: 40px;
    min-width: 40px;
    padding: 0 5px;
}

.overall-results .results-table td:nth-child(3) {
    font-size: 16px;
    font-weight: bold;
}

/* Zachování normálních šířek pro tabulku soutěží */
.competitions-results .results-table th,
.competitions-results .results-table td {
    min-width: auto; /* Reset min-width pro tabulku soutěží */
}

/* Responzivní tabulka - lépe definované šířky */
.overall-results .results-table th:nth-child(1),
.overall-results .results-table td:nth-child(1) {
    width: 80px;
    min-width: 80px;
}

.overall-results .results-table th:nth-child(2),
.overall-results .results-table td:nth-child(2) {
    width: auto; /* Název týmu - dynamická šířka */
    min-width: 150px;
}

.overall-results .results-table th:nth-child(4),
.overall-results .results-table td:nth-child(4) {
    width: 80px;
    min-width: 80px;
    text-align: center;
}

.overall-results .results-table th:nth-child(5),
.overall-results .results-table td:nth-child(5) {
    width: 120px;
    min-width: 120px;
    text-align: center;
}

/* Jednotné buňky pro tabulku soutěží */
.competitions-results .results-table td {
    width: 120px;
    min-width: 120px;
    max-width: 120px;
    padding: var(--space-2);
    vertical-align: middle;
}

.competitions-results .results-table th {
    width: 120px;
    min-width: 120px;
    max-width: 120px;
}

/* Speciální nastavení pro první sloupec (název týmu) v tabulce soutěží */
.competitions-results .results-table td:first-child,
.competitions-results .results-table th:first-child {
    width: 150px;
    min-width: 150px;
    max-width: 150px;
}

/* Highlight pro první tři místa */
.position-1 td {
    background-color: rgba(255, 215, 0, 0.15) !important; /* Gold */
}

.position-2 td {
    background-color: rgba(192, 192, 192, 0.15) !important; /* Silver */
}

.position-3 td {
    background-color: rgba(205, 127, 50, 0.15) !important; /* Bronze */
}

/* Zvýraznění a velikost pozice v tabulce */
.position-number {
    font-weight: 700;
    font-size: var(--fs-4);
    color: var(--white);
    display: flex;
    align-items: center;
}

/* Speciální ikony pro první tři místa */
.position-1 .position-number::before {
    content: '🏆';
    margin-right: var(--space-2);
}

.position-2 .position-number::before {
    content: '🥈';
    margin-right: var(--space-2);
}

.position-3 .position-number::before {
    content: '🥉';
    margin-right: var(--space-2);
}

/* Styly pro indikátory pohybu týmů */
.movement-up {
    color: #28a745 !important;
    font-weight: bold;
    font-size: var(--fs-4);
}

.movement-down {
    color: #dc3545 !important;
    font-weight: bold;
    font-size: var(--fs-4);
}

.movement-same {
    color: #6c757d !important;
    font-size: var(--fs-4);
}

.movement-new {
    color: #0088cc !important;
    font-weight: bold;
    font-size: var(--fs-2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Styly pro zobrazení výsledků v soutěžích */
.competition-result {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: var(--radius-sm);
    background-color: rgba(255, 255, 255, 0.03);
    transition: all var(--trans-normal);
    height: 76px; /* Pevná výška pro všechny buňky */
    width: 112px; /* Pevná šířka minus padding */
    box-sizing: border-box;
}

.competition-result:hover {
    background-color: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
}

.competition-position {
    font-weight: 700;
    font-size: var(--fs-5);
    line-height: 1.2;
    margin-bottom: 2px;
}

.competition-time {
    font-size: var(--fs-2);
    color: var(--gray-300);
    font-family: 'Roboto Mono', monospace;
    margin-bottom: 2px;
    line-height: 1.2;
}

.competition-points {
    font-size: var(--fs-2);
    color: var(--primary);
    font-weight: 600;
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    line-height: 1.2;
}

/* Styly pro pozadí hlaviček soutěží */
.competition-header {
    text-align: center;
    font-weight: 600;
    background-color: rgba(255, 255, 255, 0.08);
    padding-top: var(--space-3);
    padding-bottom: var(--space-3);
    width: 120px; /* Pevná šířka pro jednotnost */
    min-width: 120px;
    max-width: 120px;
}

/* Styl pro prázdné výsledky */
.competition-result-empty {
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    color: var(--gray-500);
    font-style: italic;
    height: 76px; /* Stejná výška jako ostatní buňky */
    width: 112px; /* Stejná šířka jako ostatní buňky */
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: var(--fs-4);
    position: relative;
    box-sizing: border-box;
}

/* Styly pro pozadí hlaviček soutěží */
.competition-header {
    text-align: center;
    font-weight: 600;
    background-color: rgba(255, 255, 255, 0.08);
    padding-top: var(--space-3);
    padding-bottom: var(--space-3);
    min-width: 120px;
    width: 120px; /* Pevná šířka pro jednotnost */
}

/* Styl pro prázdné výsledky */
.competition-result-empty {
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    color: var(--gray-500);
    font-style: italic;
    height: 80px; /* Stejná výška jako ostatní buňky */
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: var(--fs-4);
    position: relative;
}

/* Responzivní úpravy pro tabulku soutěží */
@media (max-width: 768px) {
    .competition-result {
        height: 66px;
        width: 92px;
        padding: 3px;
    }
    
    .competition-result-empty {
        height: 66px;
        width: 92px;
    }
    
    .competition-header {
        width: 100px;
        min-width: 100px;
        max-width: 100px;
    }
    
    .competitions-results .results-table td {
        width: 100px;
        min-width: 100px;
        max-width: 100px;
    }
    
    .competitions-results .results-table th {
        width: 100px;
        min-width: 100px;
        max-width: 100px;
    }
    
    .competitions-results .results-table td:first-child,
    .competitions-results .results-table th:first-child {
        width: 120px;
        min-width: 120px;
        max-width: 120px;
    }
    
    .competition-position {
        font-size: var(--fs-4);
    }
    
    .competition-points {
        font-size: var(--fs-1);
        padding: 1px 4px;
    }
}

/* První tři místa v soutěžích */
.position-result-1 .competition-position {
    color: var(--gold);
}

.position-result-2 .competition-position {
    color: var(--silver);
}

.position-result-3 .competition-position {
    color: var(--bronze);
}

/* Styl pro NP (neplatný pokus) */
.position-result-np {
    background-color: rgba(255, 0, 0, 0.1);
}

.position-result-np .competition-position {
    color: var(--red);
}

.position-result-np .competition-points {
    background: rgba(255, 0, 0, 0.2);
    color: var(--red);
}

/* Zvýraznění počtu bodů */
.team-points {
    font-weight: 700;
    font-size: var(--fs-4);
    color: var(--primary);
}

/* Nejlepší čas */
.best-time {
    font-family: 'Roboto Mono', monospace;
    font-weight: 500;
    color: var(--accent);
}

/* Styly pro pozadí hlaviček soutěží */
.competition-header {
    text-align: center;
    font-weight: 600;
    background-color: rgba(255, 255, 255, 0.08);
    padding-top: var(--space-3);
    padding-bottom: var(--space-3);
    min-width: 120px;
}

/* Zápatí tabulky */
.results-table tfoot td {
    background-color: rgba(255, 255, 255, 0.08);
    font-weight: 600;
    color: var(--primary);
}

/* Nadpis sekce */
.section-heading {
    margin-bottom: var(--space-4);
}

.section-description {
    color: var(--gray-400);
    max-width: 600px;
    margin-top: var(--space-2);
}

/* Vysvětlení bodování */
.scoring-explanation {
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    margin-bottom: var(--space-8);
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.scoring-explanation h3 {
    color: var(--white);
    margin-bottom: var(--space-4);
    position: relative;
    padding-bottom: var(--space-3);
    display: inline-block;
}

.scoring-explanation h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 3px;
    background-color: var(--primary);
    border-radius: 2px;
}

.scoring-explanation p {
    color: var(--gray-300);
    margin-bottom: var(--space-3);
    line-height: 1.6;
}

/* Tabulka s bodovým ohodnocením */
.points-table-container {
    margin-top: var(--space-5);
}

.points-table-container h4 {
    margin-bottom: var(--space-4);
    color: var(--white);
}

.points-table {
    width: 100%;
    max-width: 500px;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: var(--space-4);
}

.points-table th,
.points-table td {
    padding: var(--space-3);
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.points-table th {
    color: var(--gray-300);
    font-weight: 600;
    background-color: rgba(255, 255, 255, 0.05);
}

.points-table tr:last-child td {
    border-bottom: none;
}

/* Overlay pro načítání */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 31, 63, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.error-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 31, 63, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-content,
.error-content {
    text-align: center;
    background-color: var(--secondary-dark);
    padding: var(--space-7);
    border-radius: var(--radius-lg);
    max-width: 90%;
    width: 450px;
    box-shadow: var(--shadow-xl);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: fadeIn 0.5s ease;
}

.loading-spinner-large {
    margin: 0 auto var(--space-5);
}

.spinner-large {
    width: 80px;
    height: 80px;
    border: 8px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite;
}

.loading-text {
    color: var(--white);
    font-size: var(--fs-4);
    margin: var(--space-4) 0 0;
}

.error-icon {
    font-size: 64px;
    color: var(--red);
    margin-bottom: var(--space-4);
    animation: pulse 2s infinite;
}

.error-title {
    color: var(--white);
    margin-bottom: var(--space-4);
    font-size: var(--fs-6);
}

.error-message {
    color: var(--gray-300);
    margin-bottom: var(--space-6);
    font-size: var(--fs-4);
    line-height: 1.5;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responzivní úpravy */
@media (max-width: 768px) {
    .cup-results-container {
        grid-template-columns: 1fr;
    }
    
    .results-table th,
    .results-table td {
        padding: var(--space-2) var(--space-3);
        font-size: var(--fs-2);
    }
    
    /* Úprava pro menší obrazovky - sloupec pohybu pouze v celkové tabulce */
    .overall-results .results-table th:nth-child(3),
    .overall-results .results-table td:nth-child(3) {
        width: 35px;
        min-width: 35px;
        padding: 0 3px;
    }
    
    .overall-results .results-table td:nth-child(3) {
        font-size: 14px;
    }
    
    .position-number {
        font-size: var(--fs-3);
    }
}

/* Styl pro prázdné výsledky */
.competition-result-empty {
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    color: var(--gray-500);
    font-style: italic;
    min-height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: var(--fs-4);
    position: relative;
}

/* Efekt při najetí myší na prázdné výsledky */
.competition-result-empty:hover {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

/* Responzivní úpravy */
@media (max-width: 768px) {
    .header-actions {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-3);
    }
    
    .header-actions .btn {
        margin-top: var(--space-2);
    }
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

@media (max-width: 768px) {
    .header-actions {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-3);
    }
    
    .header-actions .btn {
        margin-top: var(--space-2);
    }
}

/* Stylování tlačítka, aby bylo konzistentní s designem */
#export-pdf {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    background-color: var(--primary);
    color: var(--white);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: var(--fs-3);
}

#export-pdf:hover {
    background-color: var(--primary-light);
    transform: translateY(-2px);
}

#export-pdf:active {
    transform: translateY(0);
}

/* Styly pro tlačítko exportu - přidat do cup_results.css */

/* Export container pod tabulkami */
.export-container {
    margin-top: var(--space-6);
    text-align: right;
    padding-bottom: var(--space-4);
}

/* Tlačítko pro export ve stejném stylu jako ostatní tlačítka */
.export-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    background-color: var(--primary);
    color: var(--white);
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: var(--fs-3);
    box-shadow: var(--shadow-sm);
}

.export-btn:hover {
    background-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.export-btn:active {
    transform: translateY(0);
}

.export-btn i {
    font-size: var(--fs-4);
}

/* Animace při načítání */
.export-btn.loading {
    pointer-events: none;
    opacity: 0.8;
}

.export-btn.loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.no-bar:after, .no-bar:before {
  display: none !important;
  background: none !important;
  border: none !important;
  content: none !important;
  height: 0 !important;
}
.no-bar {
  border: none !important;
  background: none !important;
  box-shadow: none !important;
}

/* Přidat do cup_results.css - styly pro penalizace */

/* Styl pro výsledky s penalizací */
.penalty-applied {
    background-color: rgba(255, 0, 0, 0.1) !important;
    border: 1px solid rgba(255, 0, 0, 0.3) !important;
}

.penalty-applied .competition-points {
    background: rgba(255, 0, 0, 0.2) !important;
    color: var(--red) !important;
    font-weight: bold;
}

/* Styl pro týmy s penalizacemi v seznamu */
.team-with-penalty {
    position: relative;
}

.team-with-penalty::after {
    content: "⚠";
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--red);
    font-weight: bold;
}

/* Nové styly pro statistiky - přidejte na konec cup_results.css */

.category-stats {
    margin-top: var(--space-8);
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stats-header {
    text-align: center;
    margin-bottom: var(--space-6);
}

.stats-title {
    color: var(--white);
    margin-bottom: var(--space-3);
    position: relative;
    display: inline-block;
    padding-bottom: var(--space-3);
}

.stats-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background-color: var(--primary);
    border-radius: 2px;
}

.stats-subtitle {
    color: var(--gray-300);
    font-size: var(--fs-4);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-4);
}

.stat-card {
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    padding: var(--space-5);
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
}

.stat-card:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-3px);
    box-shadow: var(--shadow-xl);
}

.stat-icon {
    font-size: 2.5rem;
    margin-bottom: var(--space-3);
    color: var(--primary);
    opacity: 0.8;
}

.stat-label {
    color: var(--gray-300);
    font-size: var(--fs-3);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: var(--space-2);
}

.stat-team {
    color: var(--white);
    font-size: var(--fs-5);
    font-weight: 700;
    margin-bottom: var(--space-2);
    line-height: 1.2;
    min-height: 2.4em; /* Rezerva místa pro více řádků */
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.stat-value {
    color: var(--accent);
    font-size: var(--fs-4);
    font-weight: 600;
    font-family: 'Roboto Mono', monospace;
}

.stat-card.fastest-time::before {
    background: linear-gradient(90deg, #FF6B6B, #FF8E53);
}

.stat-card.most-wins::before {
    background: linear-gradient(90deg, #4ECDC4, #44A08D);
}

.stat-card.best-avg-time::before {
    background: linear-gradient(90deg, #845EC2, #B39CD0);
}

.stat-card.best-avg-position::before {
    background: linear-gradient(90deg, #FFC75F, #FF9671);
}

.no-data {
    color: var(--gray-500);
    font-style: italic;
    font-size: var(--fs-3);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: var(--space-3);
    }
    
    .stat-card {
        padding: var(--space-4);
    }
    
    .stat-icon {
        font-size: 2rem;
    }
    
    .stat-team {
        font-size: var(--fs-4);
    }
}

@media (max-width: 480px) {
    .category-stats {
        padding: var(--space-4);
    }
    
    .stats-grid {
        gap: var(--space-2);
    }
}

/* Loading animation for stats */
.stats-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    grid-column: 1 / -1;
}

.stats-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}