/* Variables de couleurs */
:root {
    --bg: #0f172a;
    --panel: #111827;
    --text: #e5e7eb;
    --muted: #94a3b8;
    --accent: #38bdf8; /* Bleu vif pour l'action et l'accent */
    --line: #22d3ee; /* Cyan/aqua pour les lignes ou le survol */
    --red: #ef4444; /* Pour les erreurs */
}

/* Réinitialisation de base */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, 'Helvetica Neue', Arial, 'Noto Sans', 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
    color: var(--text);
    /* Dégradé du fond */
    background: linear-gradient(180deg, #0b1022, var(--bg) 40%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.6;
}

/* HEADER & NAVBAR */
.site-header {
    background: rgba(17, 24, 39, 0.85);
    backdrop-filter: blur(6px);
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.navbar {
    max-width: 1100px;
    margin: 0 auto;
    display: flex; 
    gap: 1.5rem;
    align-items: center;
    padding: 0 1rem;
    height: 56px;
    position: relative; 
}

.nav-link {
    color: var(--muted);
    text-decoration: none;
    padding: 0.5rem 0.75rem; 
    position: relative;
    transition: color .2s ease, border-bottom .2s ease; 
    font-weight: 600;
    white-space: nowrap;
    border-bottom: 2px solid transparent; /* Bordure transparente par défaut */
}
.nav-link:hover { 
    color: var(--text); 
    border-bottom: 2px solid var(--accent); /* Bordure bleue au survol */
}
.nav-link.active { 
    color: var(--text); 
    border-bottom: 2px solid var(--accent); /* Bordure bleue pour le lien actif */
}

/* Contenu principal et mise en page */
.container {
    max-width: 1100px;
    margin: 2rem auto;
    padding: 0 1rem 4rem;
    width: 100%;
}

h1, h2 { margin: 0 0 1rem; }
h1 { font-size: 2.5rem; }
h2 { margin-top: 2rem; font-size: 1.75rem; color: var(--accent); }
p { color: var(--text); line-height: 1.6; }

/* Champ de recherche */
.search {
    width: 100%;
    max-width: 400px; /* Limite la largeur du champ de recherche */
    padding: .65rem .8rem;
    border-radius: 8px;
    border: 1px solid rgba(148,163,184,.25);
    background: rgba(2,6,23,.4);
    color: var(--text);
    outline: none;
    margin: 1rem 0;
    transition: border-color .2s;
}
.search:focus {
    border-color: var(--accent);
}

/* --- Styles Spécifiques aux Tableaux Dynamiques --- */
.data-table-container {
    background: var(--panel);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 16px;
    padding: 1.5rem;
}

/* Compteur de résultats (nouvel ajout) */
.result-count {
    font-size: 0.9rem;
    color: var(--muted);
    margin-bottom: 1rem;
    padding-left: 0.5rem;
}

.table-wrapper {
    width: 100%;
    overflow-x: auto; /* Permet le scroll horizontal sur mobile */
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: separate; 
    border-spacing: 0;
    min-width: 800px; /* Assure que le tableau ne soit pas trop étroit sur mobile */
}

.data-table th {
    color: var(--accent);
    text-align: left;
    padding: 0.75rem 1rem;
    background: rgba(56, 189, 248, 0.05); /* Fond légèrement bleu pour l'entête */
    font-size: 0.9rem;
    font-weight: 700;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    white-space: nowrap;
}

.data-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    transition: background-color 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.data-table tbody tr:hover {
    background-color: rgba(56, 189, 248, 0.1); /* Surlignement de survol */
}

/* Style des liens de téléchargement SGF */
.data-table td .download-link {
    color: var(--accent);
    transition: color 0.2s;
}
.data-table td .download-link:hover {
    color: var(--line);
}

/* Style de la colonne Résultat pour indiquer le vainqueur */
.data-table td.result {
    font-weight: 700;
}
.data-table td.result-black {
    color: #34d399; /* Vert (couleur vive pour Noir) */
}
.data-table td.result-white {
    color: #fcd34d; /* Jaune/Ambre (couleur vive pour Blanc) */
}

/* --- Pagination (Nouvel ajout) --- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 1.5rem;
    gap: 0.5rem;
}

.pagination-link {
    text-decoration: none;
    color: var(--muted);
    background-color: var(--panel);
    padding: 0.5rem 0.8rem;
    border-radius: 6px;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
    font-size: 0.9rem;
    font-weight: 500;
    min-width: 35px;
    text-align: center;
    border: 1px solid rgba(148, 163, 184, 0.15);
    white-space: nowrap;
}

.pagination-link:hover {
    background-color: rgba(56, 189, 248, 0.15);
    color: var(--accent);
    border-color: var(--accent);
}

.pagination-link.active {
    background-color: var(--accent);
    color: var(--panel); /* Texte sombre sur fond bleu vif */
    border-color: var(--accent);
    font-weight: 700;
    pointer-events: none; /* Désactive le clic sur la page active */
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.4); /* Effet néon */
}

.pagination-link.disabled {
    opacity: 0.3;
    pointer-events: none;
    background-color: var(--panel);
}

.page-ellipsis {
    color: var(--muted);
    padding: 0.5rem 0.2rem;
}

/* Footer */
.site-footer {
    margin-top: auto;
    border-top: 1px solid rgba(148, 163, 184, 0.15);
    padding: 1rem;
    text-align: center;
    color: var(--muted);
    background: rgba(17, 24, 39, 0.6);
}

/* Responsive pour les petits écrans (Tableau - Vue carte) */
@media (max-width: 768px) {
    .data-table thead {
        display: none; /* Cache les en-têtes sur mobile */
    }
    .data-table tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid rgba(148, 163, 184, 0.15);
        border-radius: 8px;
        background: var(--panel);
        padding: 0.5rem;
    }
    .data-table td {
        display: block;
        text-align: right;
        padding: 0.5rem 1rem;
        border-bottom: none;
    }
    .data-table td::before {
        content: attr(data-label); /* Utilise l'attribut data-label pour afficher le nom de la colonne */
        float: left;
        font-weight: 700;
        color: var(--muted);
    }
    /* Correction pour la colonne SGF */
    .data-table td:last-child {
        text-align: center;
        margin-top: 0.5rem;
        border-top: 1px solid rgba(148, 163, 184, 0.1);
    }

    .pagination {
        flex-wrap: wrap;
        padding: 0 1rem;
    }
}
