.selection-header {
    width: 100%;
    padding: 0; /* Supprime le padding */
    background-color: var(--primary-color); /* Changé de --light-bg à --primary-color */
    margin: 0;
    position: relative;
    height: 5vh; /* Garde 5% de la hauteur de l'écran */
    min-height: 0; /* Empêche une hauteur minimale */
    max-height: 5vh; /* Force la hauteur maximale */
}

/* Sélecteur de langue (dropdown custom avec drapeaux) */
.lang-selector {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    z-index: 100;
}

.lang-dropdown {
    position: relative;
    cursor: pointer;
    user-select: none;
}

.lang-current {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 4px;
    padding: 3px 8px;
    color: #ffffff;
    font-size: 13px;
    transition: background 0.15s, border-color 0.15s;
}

.lang-current:hover {
    background: rgba(255, 255, 255, 0.28);
    border-color: rgba(255, 255, 255, 0.75);
}

.lang-flag {
    width: 22px;
    height: 15px;
    object-fit: cover;
    border-radius: 2px;
    display: block;
    flex-shrink: 0;
}

.lang-name {
    font-size: 12px;
    color: #ffffff;
}

.lang-arrow {
    font-size: 9px;
    margin-left: 2px;
    opacity: 0.7;
    transition: transform 0.18s;
    color: #ffffff;
}

.lang-dropdown.open .lang-arrow {
    transform: rotate(180deg);
}

.lang-list {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: #1e3a5f;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    overflow: hidden;
    min-width: 130px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
    z-index: 200;
}

.lang-dropdown.open .lang-list {
    display: block;
}

.lang-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    color: #ffffff;
    text-decoration: none;
    font-size: 13px;
    transition: background 0.12s;
}

.lang-option:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    text-decoration: none;
}

.lang-option.active {
    background: rgba(255, 255, 255, 0.2);
    font-weight: 600;
}

/* Label devant le dropdown de phase (tableau) */
.phase-label {
    display: inline-block;
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    margin-right: 5px;
    opacity: 0.85;
    vertical-align: middle;
}


.header-content {
    display: flex;
    align-items: center; /* Centre verticalement */
    justify-content: center; /* Centre horizontalement */
    gap: 5px; /* Réduit l'espace entre le logo et le texte */
    max-width: 1200px;
    margin: 0 auto;
    height: 100%;
    padding: 2px 0; /* Réduit le padding vertical */
}

.header-logo {
    height: 5vh; /* Réduit la hauteur à 2% de la hauteur de l'écran */
    width: auto;
    filter: brightness(0) invert(1); /* Forcer le logo en blanc */
    margin-right: 3px; /* Ajoute un petit espace à droite du logo */
}

/* Style du titre de la page */
.page-title {
    font-size: min(5vw, 24px);
    font-weight: bold;
    color: #1e40af;
    text-align: center;
    padding: 8px 20px;
    white-space: normal;
    border-radius: 4px;
    background-color: rgba(219, 234, 254, 0.3);
    line-height: 1.3;
    word-wrap: break-word;
    margin: 0 auto;
    display: block;
    max-width: 80%;
    transition: all 0.3s ease;
}

/* Conteneur du titre de la page juste sous competition-info */
.page-title-container {
    width: 100%;
    padding: 5px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    margin-top: 5px;
    position: relative;
    z-index: 10;
    transition: all 0.3s ease;
}

@media (max-width: 768px) {
    .page-title-container {
        padding: 3px 0;
        margin-top: 0; /* Reduce top margin on mobile */
        margin-bottom: 0; /* Reduce bottom margin on mobile */
    }
    
    .page-title {
        font-size: min(4vw, 18px);
        padding: 6px 15px;
        max-width: 90%;
    }
    
    /* Reduce spacing between elements */
    .content-wrapper {
        padding-top: 0;
        margin-top: 0;
    }
}

/* Team competition status colors - only for clapou page */
.status-qualified {
    color: #008800;
    font-weight: bold;
}

.status-eliminated {
    color: #cc0000;
    font-weight: bold;
}

/* Team table styling with impairQL and pairQL system */
.teams-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.teams-table th {
    background-color: #1e40af;
    color: white;
    padding: 10px;
    text-align: left;
    font-weight: bold;
}

.teams-table .impairQL {
    background-color: #eef2ff; /* Light blue background */
}

.teams-table .pairQL {
    background-color: #ffffff; /* White background */
}

.teams-table .impairQL:hover,
.teams-table .pairQL:hover {
    background-color: #dbeafe; /* Lighter blue on hover */
}

.teams-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #e2e8f0;
}

.teams-table .team-name {
    font-weight: 500;
}

.teams-table .team-qualified {
    color: #008800;
    font-weight: bold;
}

.teams-table .team-eliminated {
    color: #cc0000;
    font-weight: bold;
}

.team-members-cell {
    font-size: 0.85em;
    color: #374151;
    white-space: normal;
    line-height: 1.6;
}

/* Specific smartphone adjustments */
@media (max-width: 480px) {
    .page-title-container {
        padding: 2px 0;
        margin-top: 0;
        margin-bottom: 0;
        height: auto; /* Ensure container takes height of its content */
        min-height: 30px; /* Minimum height to ensure visibility */
        display: block; /* Change to block display on mobile */
    }
    
    .page-title {
        font-size: min(3.5vw, 16px);
        padding: 4px 10px;
        line-height: 1.2;
        max-width: 95%;
        display: inline-block; /* Ensure the element is properly displayed */
    }
    
    /* Fix spacing between elements */
    .competition-info {
        margin-bottom: 0;
    }
    
    .content-wrapper {
        padding-top: 0;
        margin-top: 5px; /* Small gap between title and content */
    }
}

/* iOS specific fixes */
@supports (-webkit-touch-callout: none) {
    .page-title-container {
        display: flex !important; /* Force flex display on iOS */
        position: relative !important; /* Override any position issues */
        visibility: visible !important; /* Ensure visibility */
        opacity: 1 !important; /* Ensure opacity */
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        min-height: 35px !important; /* Slightly taller for iOS */
        z-index: 50 !important; /* Higher z-index to prevent layering issues */
    }
    
    .page-title {
        -webkit-transform: translateZ(0); /* Force hardware acceleration */
        transform: translateZ(0);
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }
    
    .content-wrapper {
        margin-top: 0 !important; /* Override any margin */
        padding-top: 5px !important; /* Small padding */
    }
}

/* Additional fixes for Android */
@supports not (-webkit-touch-callout: none) {
    @media (max-width: 480px) {
        .page-title-container {
            position: relative !important; /* Force relative positioning on Android */
            top: auto !important;
            margin: 0 !important;
        }
        
        /* Fix content spacing on Android */
        .content-wrapper {
            margin-top: 0 !important;
        }
    }
}

/* For very small screens */
@media (max-width: 320px) {
    .page-title-container {
        padding: 1px 0;
        margin-top: 1px;
    }
    
    .page-title {
        font-size: min(3vw, 14px);
        padding: 3px 8px;
        line-height: 1.1;
    }
}

/* Optimize for landscape mode on mobile */
@media (max-width: 896px) and (orientation: landscape) {
    .page-title-container {
        padding: 1px 0;
        margin-top: 0;
        margin-bottom: 0;
        min-height: 25px; /* Smaller height in landscape */
    }
    
    .page-title {
        font-size: min(2.5vw, 14px);
        padding: 2px 8px;
        max-width: 70%;
    }
    
    /* Reduce spacing in landscape mode */
    .content-wrapper {
        padding-top: 0;
        margin-top: 0;
    }
}

/* Specific adjustments for portrait mode */
@media screen and (max-width: 420px) and (orientation: portrait) {
    .competition-info {
        min-height: 30px;
        margin-bottom: 0; /* Remove bottom margin */
    }
    
    .page-title-container {
        position: relative; /* Change to relative from sticky */
        top: auto; /* Remove top positioning */
        z-index: 50;
        padding: 2px 0;
        margin: 0;
        min-height: 30px; /* Ensure minimum height */
        display: flex !important; /* Force flex display */
    }
    
    .page-title {
        font-size: min(3.5vw, 15px);
        padding: 3px 8px;
        max-width: 100%;
        display: inline-block !important; /* Ensure display */
    }
    
    /* Fix spacing for content */
    .content-wrapper {
        padding-top: 0;
        margin-top: 5px; /* Small margin instead of padding */
    }
}

/* Additional fixes for specific browsers/devices */
@media screen and (max-width: 420px) {
    /* Fix for Chrome on Android */
    body:not(.ios) .page-title-container {
        height: auto !important;
        min-height: 30px !important;
        display: block !important;
    }
    
    /* Fix for Safari on iOS */
    body.ios .page-title-container {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
}

/* Styles pour la page de sélection des compétitions */
:root {
    --primary-color: rgb(81, 152, 224);
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --text-color: #fdfbfb;
    --light-bg: rgb(42, 53, 70);
}

body.selection-page {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    background: var(--light-bg);
    padding-bottom: 4vh;
}

.competition-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.competition-card {
    background: rgb(216, 214, 214);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
    cursor: pointer;
    padding: 2rem;
}

.competition-card:hover {
    transform: translateY(-5px);
}

.competition-card h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.competition-card .competition-info {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.competition-card .competition-info i {
    margin-right: 0.5rem;
    color: var(--secondary-color);
}

/* Styles améliorés pour le sélecteur de taille de tableau */
.tableau-size-selector {
    margin: auto;
    text-align: center;
    width: 100%;
    position: relative; 
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0px;
}

#tableauSizeSelector {
    /* Augmentation de 40% de la taille */
    padding: 10px 18px;
    font-size: 25px;
    font-weight: bold;
    border: 2px solid #074f58;
    border-radius: 4px;
    background-color: #f8f9fa;
    color: #032c55;
    cursor: pointer;
    width: 308px; /* 220px * 1.4 */
    max-width: 100%;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    transition: all 0.3s ease;
}

#tableauSizeSelector {
    border: 2px solid #074f58;
    border-radius: 4px;
    background-color: #f8f9fa;
    color: #032c55;
    cursor: pointer;
    padding: 0px 15px;
    margin-right: 15px;
    font-size: 14px;
    font-weight: bold;
    width: 100px;
    max-width: 50%;
}

#tableauSizeSelector:hover {
    background-color: #e9ecef;
}

.tableau-button {
    padding: 8px 15px;
    font-size: 16px;
    font-weight: bold;
    border: 2px solid #074f58;
    border-radius: 4px;
    background-color: #074f58;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-left: 10px;
}

.tableau-button:hover {
    background-color: #032c55;
    border-color: #032c55;
}

/* Le sélecteur déroulant doit être au-dessus du slider */
.tableau-size-selector select {
    position: relative;
    z-index: 1001;
}

/* Cacher le slider quand le menu déroulant est ouvert */
.tableau-size-selector:focus-within + #autohide,
#tableauSizeSelector:focus + #autohide {
    visibility: hidden !important;
}

/* Style du formulaire */
#tableau-size-form {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0;
    padding: 0;
    width: 25%;
    max-width: 500px;
}

/* Styles pour le conteneur de titre de tableau qui apparaît sous competition-info */
.tableau-title-container {
    width: 100%;
    padding: 12px 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    background-color: #f0f4f8;
    border-bottom: 1px solid #d0d8e8;
    margin-top: 15px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Conteneur du titre de la page juste sous competition-info */
.page-title-container {
    width: 100%;
    padding: 5px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    margin-top: 5px;
    position: relative;
    z-index: 10;
    transition: all 0.3s ease;
}

/* Style du titre de la page */
.page-title {
    font-size: min(5vw, 24px);
    font-weight: bold;
    color: #1e40af;
    text-align: center;
    padding: 8px 20px;
    white-space: normal;
    border-radius: 4px;
    background-color: rgba(219, 234, 254, 0.3);
    line-height: 1.3;
    word-wrap: break-word;
    margin: 0 auto; /* Center the banner */
    display: block; /* Make it a block element */
    max-width: 80%; /* Limit width for better readability */
    transition: all 0.3s ease;
}

/* Mobile device adjustments - General */
@media (max-width: 768px) {
    .page-title-container {
        padding: 3px 0;
        margin-top: 0; /* Reduce top margin on mobile */
        margin-bottom: 0; /* Reduce bottom margin on mobile */
    }
    
    .page-title {
        font-size: min(4vw, 18px);
        padding: 6px 15px;
        max-width: 90%;
    }
    
    /* Reduce spacing between elements */
    .content-wrapper {
        padding-top: 0;
        margin-top: 0;
    }
}

/* Specific smartphone adjustments */
@media (max-width: 480px) {
    .page-title-container {
        padding: 2px 0;
        margin-top: 0;
        margin-bottom: 0;
        height: auto; /* Ensure container takes height of its content */
        min-height: 30px; /* Minimum height to ensure visibility */
        display: block; /* Change to block display on mobile */
    }
    
    .page-title {
        font-size: min(3.5vw, 16px);
        padding: 4px 10px;
        line-height: 1.2;
        max-width: 95%;
        display: inline-block; /* Ensure the element is properly displayed */
    }
    
    /* Fix spacing between elements */
    .competition-info {
        margin-bottom: 0;
    }
    
    .content-wrapper {
        padding-top: 0;
        margin-top: 5px; /* Small gap between title and content */
    }
}

/* iOS specific fixes */
@supports (-webkit-touch-callout: none) {
    .page-title-container {
        display: flex !important; /* Force flex display on iOS */
        position: relative !important; /* Override any position issues */
        visibility: visible !important; /* Ensure visibility */
        opacity: 1 !important; /* Ensure opacity */
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        min-height: 35px !important; /* Slightly taller for iOS */
        z-index: 50 !important; /* Higher z-index to prevent layering issues */
    }
    
    .page-title {
        -webkit-transform: translateZ(0); /* Force hardware acceleration */
        transform: translateZ(0);
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }
    
    .content-wrapper {
        margin-top: 0 !important; /* Override any margin */
        padding-top: 5px !important; /* Small padding */
    }
}

/* Additional fixes for Android */
@supports not (-webkit-touch-callout: none) {
    @media (max-width: 480px) {
        .page-title-container {
            position: relative !important; /* Force relative positioning on Android */
            top: auto !important;
            margin: 0 !important;
        }
        
        /* Fix content spacing on Android */
        .content-wrapper {
            margin-top: 0 !important;
        }
    }
}

/* For very small screens */
@media (max-width: 320px) {
    .page-title-container {
        padding: 1px 0;
        margin-top: 1px;
    }
    
    .page-title {
        font-size: min(3vw, 14px);
        padding: 3px 8px;
        line-height: 1.1;
    }
}

/* Optimize for landscape mode on mobile */
@media (max-width: 896px) and (orientation: landscape) {
    .page-title-container {
        padding: 1px 0;
        margin-top: 0;
        margin-bottom: 0;
        min-height: 25px; /* Smaller height in landscape */
    }
    
    .page-title {
        font-size: min(2.5vw, 14px);
        padding: 2px 8px;
        max-width: 70%;
    }
    
    /* Reduce spacing in landscape mode */
    .content-wrapper {
        padding-top: 0;
        margin-top: 0;
    }
}

/* Specific adjustments for portrait mode */
@media screen and (max-width: 420px) and (orientation: portrait) {
    .competition-info {
        min-height: 30px;
        margin-bottom: 0; /* Remove bottom margin */
    }
    
    .page-title-container {
        position: relative; /* Change to relative from sticky */
        top: auto; /* Remove top positioning */
        z-index: 50;
        padding: 2px 0;
        margin: 0;
        min-height: 30px; /* Ensure minimum height */
        display: flex !important; /* Force flex display */
    }
    
    .page-title {
        font-size: min(3.5vw, 15px);
        padding: 3px 8px;
        max-width: 100%;
        display: inline-block !important; /* Ensure display */
    }
    
    /* Fix spacing for content */
    .content-wrapper {
        padding-top: 0;
        margin-top: 5px; /* Small margin instead of padding */
    }
}

/* Additional fixes for specific browsers/devices */
@media screen and (max-width: 420px) {
    /* Fix for Chrome on Android */
    body:not(.ios) .page-title-container {
        height: auto !important;
        min-height: 30px !important;
        display: block !important;
    }
    
    /* Fix for Safari on iOS */
    body.ios .page-title-container {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
}

/* Styles pour la page de sélection des compétitions */
:root {
    --primary-color: rgb(81, 152, 224);
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --text-color: #000000;
    --light-bg: rgb(42, 53, 70);
}

body.selection-page {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    text-align: left;
    background: var(--light-bg);
    padding-bottom: 4vh;
}

.competition-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.competition-card {
    background: rgb(216, 214, 214);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
    cursor: pointer;
    padding: 2rem;
}

.competition-card:hover {
    transform: translateY(-5px);
}

.competition-card h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.competition-card .competition-info {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.competition-card .competition-info i {
    margin-right: 0.5rem;
    color: var(--secondary-color);
}

/* Styles améliorés pour le sélecteur de taille de tableau */
.tableau-size-selector {
    margin: auto;
    text-align: center;
    width: 100%;
    position: relative; 
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0px;
}

#tableauSizeSelector {
    /* Augmentation de 40% de la taille */
    padding: 10px 18px;
    font-size: 25px;
    font-weight: bold;
    border: 2px solid #074f58;
    border-radius: 4px;
    background-color: #f8f9fa;
    color: #032c55;
    cursor: pointer;
    width: 308px; /* 220px * 1.4 */
    max-width: 100%;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    transition: all 0.3s ease;
}

#tableauSizeSelector {
    border: 2px solid #074f58;
    border-radius: 4px;
    background-color: #f8f9fa;
    color: #032c55;
    cursor: pointer;
    padding: 0px 15px;
    margin-right: 15px;
    font-size: 14px;
    font-weight: bold;
    width: 100px;
    max-width: 50%;
}

#tableauSizeSelector:hover {
    background-color: #e9ecef;
}

.tableau-button {
    padding: 8px 15px;
    font-size: 16px;
    font-weight: bold;
    border: 2px solid #074f58;
    border-radius: 4px;
    background-color: #074f58;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-left: 10px;
}

.tableau-button:hover {
    background-color: #032c55;
    border-color: #032c55;
}

/* Le sélecteur déroulant doit être au-dessus du slider */
.tableau-size-selector select {
    position: relative;
    z-index: 1001;
}

/* Cacher le slider quand le menu déroulant est ouvert */
.tableau-size-selector:focus-within + #autohide,
#tableauSizeSelector:focus + #autohide {
    visibility: hidden !important;
}

/* Style du formulaire */
#tableau-size-form {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0;
    padding: 0;
    width: 25%;
    max-width: 500px;
}

/* Styles pour le conteneur de titre de tableau qui apparaît sous competition-info */
.tableau-title-container {
    width: 100%;
    padding: 12px 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    background-color: #f0f4f8;
    border-bottom: 1px solid #d0d8e8;
    margin-top: 15px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Conteneur du titre de la page juste sous competition-info */
.page-title-container {
    width: 100%;
    padding: 5px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    margin-top: 5px;
    position: relative;
    z-index: 10;
    transition: all 0.3s ease;
}

/* Style du titre de la page */
.page-title {
    font-size: min(5vw, 24px);
    font-weight: bold;
    color: #1e40af;
    text-align: left;
    padding: 8px 20px;
    white-space: normal;
    border-radius: 4px;
    background-color: rgba(219, 234, 254, 0.3);
    line-height: 1.3;
    word-wrap: break-word;
    margin: 0 auto; /* Center the banner */
    display: block; /* Make it a block element */
    max-width: 80%; /* Limit width for better readability */
    transition: all 0.3s ease;
}

/* Mobile device adjustments - General */
@media (max-width: 768px) {
    .page-title-container {
        padding: 3px 0;
        margin-top: 0; /* Reduce top margin on mobile */
        margin-bottom: 0; /* Reduce bottom margin on mobile */
    }
    
    .page-title {
        font-size: min(4vw, 18px);
        padding: 6px 15px;
        max-width: 90%;
    }
    
    /* Reduce spacing between elements */
    .content-wrapper {
        padding-top: 0;
        margin-top: 0;
    }
}

/* Specific smartphone adjustments */
@media (max-width: 480px) {
    .page-title-container {
        padding: 2px 0;
        margin-top: 0;
        margin-bottom: 0;
        height: auto; /* Ensure container takes height of its content */
        min-height: 30px; /* Minimum height to ensure visibility */
        display: block; /* Change to block display on mobile */
    }
    
    .page-title {
        font-size: min(3.5vw, 16px);
        padding: 4px 10px;
        line-height: 1.2;
        max-width: 95%;
        display: inline-block; /* Ensure the element is properly displayed */
    }
    
    /* Fix spacing between elements */
    .competition-info {
        margin-bottom: 0;
    }
    
    .content-wrapper {
        padding-top: 0;
        margin-top: 5px; /* Small gap between title and content */
    }
}

/* iOS specific fixes */
@supports (-webkit-touch-callout: none) {
    .page-title-container {
        display: flex !important; /* Force flex display on iOS */
        position: relative !important; /* Override any position issues */
        visibility: visible !important; /* Ensure visibility */
        opacity: 1 !important; /* Ensure opacity */
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        min-height: 35px !important; /* Slightly taller for iOS */
        z-index: 50 !important; /* Higher z-index to prevent layering issues */
    }
    
    .page-title {
        -webkit-transform: translateZ(0); /* Force hardware acceleration */
        transform: translateZ(0);
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }
    
    .content-wrapper {
        margin-top: 0 !important; /* Override any margin */
        padding-top: 5px !important; /* Small padding */
    }
}

/* Additional fixes for Android */
@supports not (-webkit-touch-callout: none) {
    @media (max-width: 480px) {
        .page-title-container {
            position: relative !important; /* Force relative positioning on Android */
            top: auto !important;
            margin: 0 !important;
        }
        
        /* Fix content spacing on Android */
        .content-wrapper {
            margin-top: 0 !important;
        }
    }
}

/* For very small screens */
@media (max-width: 320px) {
    .page-title-container {
        padding: 1px 0;
        margin-top: 1px;
    }
    
    .page-title {
        font-size: min(3vw, 14px);
        padding: 3px 8px;
        line-height: 1.1;
    }
}

/* Optimize for landscape mode on mobile */
@media (max-width: 896px) and (orientation: landscape) {
    .page-title-container {
        padding: 1px 0;
        margin-top: 0;
        margin-bottom: 0;
        min-height: 25px; /* Smaller height in landscape */
    }
    
    .page-title {
        font-size: min(2.5vw, 14px);
        padding: 2px 8px;
        max-width: 70%;
    }
    
    /* Reduce spacing in landscape mode */
    .content-wrapper {
        padding-top: 0;
        margin-top: 0;
    }
}

/* Specific adjustments for portrait mode */
@media screen and (max-width: 420px) and (orientation: portrait) {
    .competition-info {
        min-height: 30px;
        margin-bottom: 0; /* Remove bottom margin */
    }
    
    .page-title-container {
        position: relative; /* Change to relative from sticky */
        top: auto; /* Remove top positioning */
        z-index: 50;
        padding: 2px 0;
        margin: 0;
        min-height: 30px; /* Ensure minimum height */
        display: flex !important; /* Force flex display */
    }
    
    .page-title {
        font-size: min(3.5vw, 15px);
        padding: 3px 8px;
        max-width: 100%;
        display: inline-block !important; /* Ensure display */
    }
    
    /* Fix spacing for content */
    .content-wrapper {
        padding-top: 0;
        margin-top: 5px; /* Small margin instead of padding */
    }
}

/* Additional fixes for specific browsers/devices */
@media screen and (max-width: 420px) {
    /* Fix for Chrome on Android */
    body:not(.ios) .page-title-container {
        height: auto !important;
        min-height: 30px !important;
        display: block !important;
    }
    
    /* Fix for Safari on iOS */
    body.ios .page-title-container {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
}

/* Styles pour la barre d'onglets de tableaux avec le sélecteur intégré */
.tableaux-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px;
    background-color: #f5f5f5;
    border-bottom: 1px solid #e0e0e0;
    align-items: center;
}

.tableaux-tabs {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

/* Le sélecteur de taille à gauche */
.tableaux-tabs .tableau-size-selector {
    margin: 0;
    margin-right: auto; /* Pousse tout le reste vers la droite */
    padding: 0;
    flex-grow: 0;
    flex-shrink: 0;
}

/* Style des onglets */
.tableau-tab {
    padding: 8px 15px;
    background-color: #e0e0e0;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    font-weight: bold;
    transition: all 0.3s ease;
}

.tableau-tab:hover {
    background-color: #d0d0d0;
}

.tableau-tab.active {
    background-color: #074f58;
    color: white;
}

/* Améliorer le style du sélecteur pour qu'il s'intègre mieux dans la barre d'onglets */
#tableauSizeSelector {
    padding: 8px 15px;
    font-size: 16px;
    font-weight: bold;
    border: 2px solid #074f58;
    border-radius: 4px;
    background-color: #f8f9fa;
    color: #032c55;
    cursor: pointer;
    width: 308px; /* 220px * 1.4 */
    max-width: 100%;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="6"><path d="M0,0 L12,0 L6,6 Z" fill="%23074f58"/></svg>');
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 16px;
    transition: all 0.3s ease;
}

/* Style du formulaire dans la barre d'onglets */
.tableaux-tabs #tableau-size-form {
    margin: 0;
    padding: 0;
    display: flex;
}

/* Adaptation responsive */
@media (max-width: 768px) {
    .tableaux-tabs {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .tableaux-tabs .tableau-size-selector {
        margin-bottom: 10px;
        width: 100%;
    }
    
    #tableauSizeSelector {
        width: 100%;
    }
}

/* Amélioration des styles pour la page tableau */
.tableau-container {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    margin-top: 10px;
}

.myTableau {
    border-collapse: collapse;
    margin-top: 15px;
    table-layout: auto;
}

/* Style spécifique pour l'en-tête du tableau */
.tblhd_tab {
    margin-top: 10px;
    clear: both;
}

/* Améliorer la visibilité du sélecteur de taille */
#tableauSizeSelector {
    min-width: 60x;
    height: auto;
    padding: 5px;
    border: 2px solid #074f58;
    border-radius: 4px;
    background-color: #f8f9fa;
    color: #032c55;
    font-weight: bold;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    min-width: 200px;
}

.suite-selector:hover {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    border-color: #60a5fa;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    transform: translateY(-1px);
}

.suite-selector:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

.suite-selector option {
    background: #ffffff00;
    color: #022e5a;
    font-weight: 600;
    text-align: left;
    padding: 15px;
    border-bottom: 2px solid #34495e;
    white-space: nowrap;
}

.final-ranking td {
    padding: 12px 15px;
    border-bottom: 1px solid #ecf0f1;
    vertical-align: middle;
}

.final-ranking tr.pair {
    background-color: #f8f9fa;
}

.final-ranking tr.impair {
    background-color: #ffffff;
}

.final-ranking tr:hover {
    background-color: #f1f4f6;
}

/* Styles spécifiques pour les colonnes */
.final-ranking .place {
    width: 80px;
    text-align: center;
    font-weight: 600;
    position: relative;
}

.final-ranking .nation {
    width: 60px;
    text-align: center;
}

.final-ranking .name {
    font-weight: 500;
}

/* Styles pour le sélecteur de suites */

.suite-selector {
    background: linear-gradient(135deg, #1e50df, #2563eb);
    border: 2px solid #1e40af;
    border-radius: 6px;
    color: #3b2ff0;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer !important; 
    position: center;
    z-index: 1001; /* Higher than container to ensure clicks register */
    outline: none;
    transition: all 0.3s ease;
    box-shadow: 0 3px 8px rgba(0,0,0,0.2);
    min-width: 180px;
    max-width: 300px;
    text-align: center;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'><path fill='%23ffffff' d='m0 1 2 2 2-2z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 35px;
}

/* Responsive design pour les sélecteurs de suites */
@media (max-width: 768px) {
    .tableau-title-container {
        flex-direction: column;
        padding: 10px 0;
    }
    
    .phase-dropdown {
        margin-top: 10px;
        margin-left: 0;
    }
    
    .suite-selector {
        width: 100%;
        max-width: 280px;
        font-size: 14px;
        padding: 8px 12px;
        padding-right: 30px;
        min-width: unset;
    }
    
   
}

@media (max-width: 480px) {
    .suite-selector {
        width: 100%;
        max-width: 250px;
        font-size: 13px;
        padding: 7px 10px;
        padding-right: 28px;
        background-size: 10px;
        background-position: right 8px center;
    }
    
    .suite-selector option {
        font-size: 13px;
        padding: 8px;
    }
    
  
}

/* ====================================================================
   BOOTSTRAP 5 INTEGRATION — Reset des styles Bootstrap pour la page
   de sélection des compétitions (selcotpage.php).
   Bootstrap est chargé avant ce fichier.
   ==================================================================== */

/* Éviter que Bootstrap modifie le style des liens dans les cartes */
.competition-card,
.competition-card:hover,
.competition-card h3 {
    text-decoration: none;
}

/* ====================================================================
   COMPETITION GRID — Responsive amélioré pour iPhone et petits écrans
   ==================================================================== */

/* Réduire le minmax et le padding sur petits écrans */
@media (max-width: 600px) {
    .competition-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 1rem;
    }

    .competition-card {
        padding: 1.25rem;
        /* Touch target : s'assurer que la zone cliquable est suffisante */
        min-height: 80px;
    }
}

@media (min-width: 601px) and (max-width: 900px) {
    .competition-grid {
        grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
        gap: 1.25rem;
        padding: 1.25rem;
    }
}

/* ====================================================================
   PAGE DE SÉLECTION — Header responsive
   ==================================================================== */

/* Header adaptatif : réduire la hauteur fixe sur petits écrans */
@media (max-width: 600px) {
    .selection-header {
        height: auto;
        min-height: 44px;
        max-height: none;
        padding: 8px 0;
    }

    .header-logo {
        height: 32px;
        max-height: 32px;
    }

    .selection-header .page-title {
        font-size: clamp(14px, 4vw, 20px);
        padding: 4px 12px;
    }
}

/* Footer — ne pas le laisser coller au bas du dernier contenu */
.footer {
    padding: 1rem;
    text-align: center;
    font-size: 12px;
    color: #aaa;
}

/* ====================================================================
   ARCHIVES
   ==================================================================== */

/* Mode archives : arrière-plan sépia */
body.archive-mode {
    background-color: #f5f0e8;
}
body.archive-mode .selection-header {
    background: linear-gradient(135deg, #5c3d2e 0%, #8b5e3c 100%);
}

/* Carte en mode archives */
body.archive-mode .competition-card {
    background: #fdf8f2;
    border-left: 4px solid #8b5e3c;
}
body.archive-mode .competition-card:hover {
    border-left-color: #5c3d2e;
    background: #faf3e8;
}

/* Bandeau archive */
.archive-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #5c3d2e;
    color: #fff;
    padding: 0.6rem 1.5rem;
    font-size: 0.95rem;
}
.archive-banner .archive-mode-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    font-size: 1.25rem;
    color: #b30000;
    letter-spacing: 0.03em;
}

/* Bouton retour au live (dans le bandeau) — style Bootstrap btn-light */
.btn-back-live {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #212529;
    text-decoration: none;
    background-color: #f8f9fa;
    border: 1px solid #f8f9fa;
    border-radius: 0.375rem;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
}
.btn-back-live:hover {
    background-color: #e2e6ea;
    border-color: #dae0e5;
    color: #212529;
}

/* Bouton Archives dans le footer — style Bootstrap btn-secondary */
.btn-archive {
    display: inline-block;
    margin-bottom: 0.5rem;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    border: 1px solid #6c757d;
    background-color: #6c757d;
    color: #fff;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
}
.btn-archive:hover {
    background-color: #5a6268;
    border-color: #545b62;
    color: #fff;
}

/* Bouton Archives désactivé (ARCHIVE_DIR vide) — style Bootstrap btn disabled */
.btn-archive-disabled {
    display: inline-block;
    margin-bottom: 0.5rem;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    border: 1px solid #6c757d;
    background-color: #6c757d;
    color: #fff;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    opacity: 0.65;
    cursor: not-allowed;
}

/* Filtre par année */
.year-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0.75rem 1.5rem;
    background: #f5f0e8;
    border-bottom: 1px solid #d9cfc2;
}
.year-filter-btn {
    padding: 4px 16px;
    border-radius: 20px;
    border: 1px solid #8b5e3c;
    background: transparent;
    color: #8b5e3c;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.year-filter-btn:hover,
.year-filter-btn.active {
    background: #8b5e3c;
    color: #fff;
}
/* Bouton année — plus en évidence */
.year-filter-year {
    font-weight: 700;
    border-width: 2px;
}
/* Bouton mois — plus compact, légèrement indenté */
.year-filter-month {
    font-size: 0.78rem;
    padding: 3px 10px;
    margin-left: 4px;
    border-style: dashed;
}

/* ====================================================================
   BOOTSTRAP REBOOT OVERRIDES — Bootstrap 5 réinitialise certaines
   propriétés qui peuvent casser nos layouts de compétition.
   ==================================================================== */

/* Bootstrap ajoute margin-bottom sur les h* — annuler pour les titres dans les barres */
.toolbar h1, .toolbar h2, .toolbar h3,
.competition-info h1, .competition-info h2, .competition-info h3 {
    margin-bottom: 0;
}

/* Bootstrap normalize — s'assurer que nos SVG restent à leur taille */
svg.header-logo,
img.header-logo {
    display: inline-block;
    vertical-align: middle;
}

/* Bootstrap met box-sizing border-box sur * — déjà fait dans notre reset, OK */

/* Bootstrap aligne le texte des boutons — neutraliser pour nos toolbar-button */
.toolbar-button {
    text-align: center;
}

