/* =================== STYLES AFFICHAGE PUBLIC TOURNOI =================== */

.tournoi-public {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    line-height: 1.6;
}

.tournoi-public h1,
.tournoi-public h2,
.tournoi-public h3 {
    color: #1d2327;
    margin-bottom: 16px;
}

.tournoi-public h1 {
    text-align: center;
    border-bottom: 3px solid #0073aa;
    padding-bottom: 16px;
    margin-bottom: 32px;
}

/* =================== NAVIGATION ET ONGLETS =================== */

.tournoi-navigation {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 8px;
    margin-bottom: 32px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.nav-tabs {
    display: flex;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.nav-tab {
    flex: 1;
    text-align: center;
}

.nav-tab button {
    width: 100%;
    padding: 12px 20px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    color: #666;
    transition: all 0.3s ease;
}

.nav-tab button:hover {
    background: #e9ecef;
    color: #333;
}

.nav-tab button.active {
    background: #0073aa;
    color: white;
    box-shadow: 0 2px 6px rgba(0, 115, 170, 0.3);
}

/* =================== STATISTIQUES DU TOURNOI =================== */

.tournoi-stats {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 24px;
    border-radius: 16px;
    margin-bottom: 32px;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.2);
}

.tournoi-stats h3 {
    margin-top: 0;
    text-align: center;
    font-size: 20px;
    margin-bottom: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.15);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-number {
    display: block;
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.stat-label {
    font-size: 14px;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* =================== PHASE DE GROUPES =================== */

.phase-section {
    background: #ffffff;
    border-radius: 16px;
    padding: 32px;
    margin-bottom: 32px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
}

.phase-section h2 {
    text-align: center;
    color: #0073aa;
    margin-bottom: 32px;
    font-size: 28px;
    position: relative;
}

.phase-section h2::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: #0073aa;
    border-radius: 2px;
}

.groupes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.groupe-card {
    background: #f8f9fa;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
}

.groupe-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    border-color: #0073aa;
}

.groupe-header {
    background: linear-gradient(135deg, #0073aa, #005a87);
    color: white;
    padding: 16px 20px;
    text-align: center;
}

.groupe-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.groupe-content {
    padding: 20px;
}

/* =================== TABLEAUX DE CLASSEMENT =================== */

.classement-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.classement-table th {
    background: #f8f9fa;
    color: #495057;
    padding: 12px 8px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #dee2e6;
}

.classement-table td {
    padding: 12px 8px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.classement-table tr:hover {
    background: #f8f9fa;
}

.classement-table tr:last-child td {
    border-bottom: none;
}

.equipe-qualifiee {
    background: linear-gradient(90deg, #d4edda, #f8fff8) !important;
    border-left: 4px solid #28a745 !important;
}

.equipe-qualifiee td {
    font-weight: 600;
}

.badge-qualifie {
    background: #28a745;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 8px;
    font-weight: 600;
}

.equipe-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.equipe-nom {
    font-weight: 600;
    color: #1d2327;
}

.equipe-joueurs {
    font-size: 12px;
    color: #666;
}

.stats-cell {
    text-align: center;
    font-weight: 600;
    color: #0073aa;
}

/* =================== MATCHS =================== */

.matchs-section {
    margin-top: 24px;
}

.matchs-section h4 {
    color: #495057;
    margin-bottom: 16px;
    font-size: 16px;
}

.matchs-liste {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.match-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 16px;
    transition: all 0.3s ease;
}

.match-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #0073aa;
}

.match-teams {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.match-equipe {
    flex: 1;
    text-align: center;
}

.match-equipe-nom {
    font-weight: 600;
    color: #1d2327;
    margin-bottom: 4px;
}

.match-equipe-joueurs {
    font-size: 12px;
    color: #666;
}

.match-vs {
    margin: 0 16px;
    background: #0073aa;
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
}

.match-resultat {
    text-align: center;
    padding: 8px 0;
    border-top: 1px solid #f0f0f0;
    margin-top: 8px;
}

.match-score {
    font-family: monospace;
    font-size: 16px;
    font-weight: bold;
    color: #0073aa;
    background: #e8f4f8;
    padding: 4px 12px;
    border-radius: 16px;
    display: inline-block;
}

.match-statut {
    color: #6c757d;
    font-style: italic;
    font-size: 14px;
}

.match-gagnant {
    color: #28a745;
    font-weight: 600;
    margin-top: 4px;
}

/* =================== PHASE ÉLIMINATOIRE =================== */

.elimination-section {
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    border-radius: 16px;
    padding: 32px;
    margin-bottom: 32px;
    border: 2px solid #0073aa;
}

.elimination-title {
    text-align: center;
    color: #0073aa;
    font-size: 32px;
    margin-bottom: 32px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.bracket-container {
    overflow-x: auto;
    padding: 20px 0;
}

.bracket {
    display: flex;
    gap: 20px;
    min-width: 800px;
    justify-content: center;
}

.bracket-round {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    min-height: 400px;
}

.bracket-round-title {
    text-align: center;
    font-weight: 600;
    color: #495057;
    margin-bottom: 20px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bracket-match {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    min-width: 180px;
    margin: 10px 0;
    overflow: hidden;
    position: relative;
    transition: all 0.3s ease;
}

.bracket-match:hover {
    border-color: #0073aa;
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.2);
}

.bracket-match.completed {
    border-color: #28a745;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.2);
}

.bracket-team {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.3s ease;
}

.bracket-team:last-child {
    border-bottom: none;
}

.bracket-team.winner {
    background: #d4edda;
    font-weight: bold;
    color: #155724;
}

.bracket-team-nom {
    font-size: 13px;
    flex: 1;
}

.bracket-score {
    font-family: monospace;
    font-size: 12px;
    color: #495057;
    font-weight: 600;
}

/* Connecteurs entre les matchs */
.bracket-match::after {
    content: '';
    position: absolute;
    right: -30px;
    top: 50%;
    width: 30px;
    height: 2px;
    background: #0073aa;
    transform: translateY(-50%);
}

.bracket-round:last-child .bracket-match::after {
    display: none;
}

/* =================== PROCHAINS MATCHS =================== */

.prochains-matchs {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 32px;
}

.prochains-matchs h3 {
    color: #856404;
    margin-top: 0;
    margin-bottom: 16px;
}

.prochain-match {
    background: white;
    padding: 12px 16px;
    margin: 8px 0;
    border-radius: 6px;
    border-left: 4px solid #ffc107;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* =================== CHAMPION ET FINALE =================== */

.champion-section {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #333;
    text-align: center;
    padding: 40px;
    border-radius: 16px;
    margin: 32px 0;
    box-shadow: 0 8px 24px rgba(255, 215, 0, 0.3);
}

.champion-title {
    font-size: 36px;
    margin-bottom: 16px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.champion-equipe {
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 8px;
}

.champion-joueurs {
    font-size: 18px;
    opacity: 0.8;
}

.champion-trophee {
    font-size: 64px;
    margin: 20px 0;
    animation: bounce 2s infinite;
}

@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-10px);
    }

    60% {
        transform: translateY(-5px);
    }
}

/* =================== MODE PLEIN ÉCRAN =================== */

.fullscreen-mode {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: white;
    z-index: 99999;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
}

.fullscreen-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #0073aa;
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    z-index: 100000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.fullscreen-toggle:hover {
    background: #005a87;
}

/* =================== RESPONSIVE DESIGN =================== */

@media (max-width: 768px) {
    .tournoi-public {
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .stat-number {
        font-size: 24px;
    }

    .groupes-grid {
        grid-template-columns: 1fr;
    }

    .nav-tabs {
        flex-direction: column;
        gap: 4px;
    }

    .match-teams {
        flex-direction: column;
        gap: 8px;
    }

    .match-vs {
        transform: rotate(90deg);
        margin: 8px 0;
    }

    .bracket {
        flex-direction: column;
        gap: 30px;
        min-width: auto;
    }

    .bracket-round {
        min-height: auto;
    }

    .bracket-match::after {
        display: none;
    }

    .champion-title {
        font-size: 24px;
    }

    .champion-equipe {
        font-size: 20px;
    }

    .champion-trophee {
        font-size: 48px;
    }
}

@media (max-width: 480px) {

    .phase-section,
    .elimination-section {
        padding: 20px;
    }

    .groupe-header,
    .groupe-content {
        padding: 16px;
    }

    .classement-table th,
    .classement-table td {
        padding: 8px 4px;
        font-size: 12px;
    }

    .match-card {
        padding: 12px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* =================== ANIMATIONS =================== */

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

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in-left {
    animation: slideInLeft 0.6s ease-out;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.slide-in-right {
    animation: slideInRight 0.6s ease-out;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

/* =================== ÉTATS DE CHARGEMENT =================== */

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* =================== ACCESSIBILITÉ =================== */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.tournoi-public *:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* =================== THÈME SOMBRE (OPTIONNEL) =================== */

@media (prefers-color-scheme: dark) {
    .tournoi-public {
        background: #1a1a1a;
        color: #e0e0e0;
    }

    .phase-section {
        background: #2d2d2d;
        border-color: #404040;
    }

    .groupe-card {
        background: #333;
        border-color: #404040;
    }

    .classement-table {
        background: #2d2d2d;
    }

    .classement-table th {
        background: #404040;
        color: #e0e0e0;
    }

    .match-card {
        background: #2d2d2d;
        border-color: #404040;
    }

    .bracket-match {
        background: #2d2d2d;
        border-color: #404040;
    }
}

/* =================== IMPRESSION =================== */

@media print {

    .fullscreen-toggle,
    .nav-tabs,
    .prochains-matchs {
        display: none !important;
    }

    .tournoi-public {
        max-width: none;
        padding: 0;
    }

    .phase-section,
    .elimination-section {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .groupes-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .bracket {
        transform: scale(0.8);
        transform-origin: left top;
    }
}

.quick-actions {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.quick-actions h3 {
    margin: 0 0 15px 0;
    color: #495057;
}

.quick-buttons {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.quick-buttons .button {
    font-size: 14px;
    padding: 8px 16px;
    height: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.quick-actions .description {
    margin: 0;
    font-size: 13px;
    color: #6c757d;
    line-height: 1.4;
}

@media (max-width: 768px) {
    .quick-buttons {
        flex-direction: column;
    }

    .quick-buttons .button {
        width: 100%;
        justify-content: center;
    }
}

 .bracket-container {
                overflow-x: auto;
                padding: 20px 0;
            }

            .bracket {
                display: flex;
                gap: 60px;
                min-width: 1200px;
                justify-content: center;
            }

            .bracket-round {
                flex: 1;
            }

            .bracket-round h3 {
                text-align: center;
                color: #0073aa;
                border-bottom: 2px solid #0073aa;
                padding-bottom: 10px;
                margin-bottom: 30px;
            }

            .bracket-matches {
                display: flex;
                flex-direction: column;
                gap: 40px;
                align-items: center;
            }

            .bracket-match {
                border: 2px solid #ddd;
                border-radius: 8px;
                background: #fff;
                min-width: 220px;
                overflow: hidden;
                transition: all 0.3s ease;
            }

            .bracket-match:hover {
                box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
            }

            .bracket-match.completed {
                border-color: #00a32a;
                background: #f0f8f0;
            }

            .bracket-match.pending {
                border-color: #ccc;
                background: #f8f9fa;
                opacity: 0.7;
            }

            .bracket-team {
                padding: 12px 15px;
                border-bottom: 1px solid #eee;
                display: flex;
                justify-content: space-between;
                align-items: center;
            }

            .bracket-team:last-child {
                border-bottom: none;
            }

            .bracket-team.winner {
                background: #e8f5e8;
                font-weight: bold;
                color: #00a32a;
            }

            .bracket-team-info {
                flex: 1;
            }

            .bracket-team-name {
                font-weight: bold;
                color: #0073aa;
                margin-bottom: 2px;
            }

            .bracket-team-players {
                font-size: 11px;
                color: #666;
            }

            .bracket-score {
                font-weight: bold;
                font-size: 12px;
                color: #666;
            }

            .bracket-vs {
                text-align: center;
                padding: 8px;
                background: #f0f0f1;
                font-weight: bold;
                font-size: 12px;
                color: #666;
            }

            .match-form-elimination {
                padding: 15px;
                background: #f9f9f9;
                border-top: 1px solid #ddd;
            }

            .sets-simple-elimination {
                display: flex;
                gap: 10px;
                justify-content: center;
                align-items: end;
                margin-bottom: 15px;
                flex-wrap: wrap;
            }

            .set-simple-elimination {
                display: flex;
                flex-direction: column;
                align-items: center;
                gap: 3px;
            }

            .set-simple-elimination label {
                font-size: 11px;
                color: #0073aa;
                font-weight: bold;
            }

            .set-simple-elimination input {
                width: 60px;
                text-align: center;
                padding: 4px;
                border: 1px solid #ddd;
                border-radius: 3px;
                font-size: 12px;
            }

            .match-actions-elimination {
                text-align: center;
            }

            .match-actions-elimination .button {
                font-size: 12px;
                padding: 6px 12px;
                height: auto;
            }

            .champion-display,
            .champion-pending {
                text-align: center;
                padding: 30px 20px;
                border: 3px solid #ffd700;
                border-radius: 12px;
                background: linear-gradient(135deg, #ffd700, #ffed4e);
            }

            .champion-trophy {
                font-size: 48px;
                margin-bottom: 15px;
            }

            .champion-name {
                font-size: 20px;
                font-weight: bold;
                color: #333;
                margin-bottom: 8px;
            }

            .champion-players {
                font-size: 12px;
                color: #666;
            }

            .champion-pending {
                background: #f8f9fa;
                border-color: #ddd;
                color: #666;
            }

            .champion-text {
                font-size: 14px;
                font-style: italic;
            }

            .elimination-actions {
                text-align: center;
            }

            @media (max-width: 1200px) {
                .bracket {
                    min-width: 800px;
                    gap: 30px;
                }

                .bracket-round {
                    min-width: 180px;
                }

                .bracket-match {
                    min-width: 170px;
                }

                .bracket-team {
                    padding: 8px 10px;
                }

                .bracket-team-name {
                    font-size: 12px;
                }

                .bracket-team-players {
                    font-size: 10px;
                }
            }

            @media (max-width: 768px) {
                .bracket-container {
                    padding: 10px 0;
                }

                .bracket {
                    flex-direction: column;
                    gap: 30px;
                    min-width: auto;
                }

                .bracket-round {
                    min-width: auto;
                }

                .champion-trophy {
                    font-size: 36px;
                }

                .champion-name {
                    font-size: 16px;
                }
            }


              .tournoi-container {
                display: grid;
                gap: 20px;
                max-width: 1200px;
            }

            .tournoi-card {
                background: #fff;
                border: 1px solid #ccc;
                border-radius: 8px;
                padding: 20px;
                box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
            }

            .teams-grid {
                display: grid;
                grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
                gap: 15px;
                margin: 20px 0;
            }

            .team-card {
                border: 1px solid #ddd;
                border-radius: 6px;
                padding: 15px;
                background: #f9f9f9;
            }

            .team-header {
                display: flex;
                justify-content: space-between;
                align-items: center;
                margin-bottom: 10px;
            }

            .team-header h3 {
                margin: 0;
                color: #0073aa;
            }

            .delete-team {
                text-decoration: none;
                background: none;
                border: none;
                cursor: pointer;
            }

            .player {
                margin: 5px 0;
                font-size: 14px;
            }

            .team-group {
                margin-top: 10px;
                padding-top: 10px;
                border-top: 1px solid #ddd;
                font-size: 12px;
                color: #666;
            }

            .actions-bar {
                margin-top: 20px;
                padding: 15px;
                background: #f0f0f1;
                border-radius: 6px;
                text-align: center;
            }

            .empty-state {
                text-align: center;
                padding: 40px;
                color: #666;
            }

            .notice-info {
                background: #e7f3ff;
                border-left: 4px solid #0073aa;
                padding: 10px;
                margin: 15px 0;
            }

              .groups-display {
                display: grid;
                grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
                gap: 20px;
                margin: 20px 0;
            }

            .group-container {
                border: 1px solid #ddd;
                border-radius: 6px;
                padding: 15px;
                background: #f9f9f9;
            }

            .group-container h3 {
                margin: 0 0 15px 0;
                color: #0073aa;
                text-align: center;
                border-bottom: 2px solid #0073aa;
                padding-bottom: 8px;
            }

            .group-teams {
                display: flex;
                flex-direction: column;
                gap: 10px;
            }

            .group-team {
                padding: 10px;
                background: #fff;
                border-radius: 4px;
                border-left: 4px solid #0073aa;
            }

            .empty-group {
                text-align: center;
                color: #666;
                font-style: italic;
                padding: 20px;
            }

            .generation-controls {
                text-align: center;
                margin: 20px 0;
            }

            .generation-controls .button {
                margin: 0 10px;
            }

            