:root {
    --bg: #f5f7fb;
	--bg-card: #ffffff;
    --surface: #ffffff;
    --ink: #0b1220;
    --muted: #5b6478;
    --line: #e3e7f0;
    --accent-a: #007F0E;
    --accent-b: #007F46;
    --accent-gradient: linear-gradient(135deg, #007F0E, #007F46);
    --gold: #b8860b;
    --radius: 14px;
}

* { box-sizing: border-box; }

body {
    background: var(--bg);
    background-image:
        radial-gradient(circle at 1px 1px, #dde2ee 1px, transparent 0);
    background-size: 28px 28px;
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    padding: 32px 0 80px;
}

/* --- Structure principale --- */
.wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Tous les Ã©lÃ©ments de contenu avec largeur uniforme */
.search-card,
.bib,
.index-hero,
.card,
.races-card,
.grid-2 > * {
    width: 100%;
    box-sizing: border-box;
}

h1.brand {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: -0.02em;
    margin: 0 0 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}


/* --- Pour supprimer le soulignage et la couleur bleue des liens --- */
a {
    color: inherit;
    text-decoration: none;
}

/* --- Pour les liens dans les cards et tableaux --- */
.card a,
.races-card a {
    color: inherit;
    text-decoration: none;
}

/* --- Formulaire de recherche --- */
.search-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 2px rgba(15,23,42,0.04);
}

.search-row {
    display: flex;
    gap: 10px;
}

input[type=text],
textarea {
    font: inherit;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 11px 14px;
    background: #fbfcfe;
    color: var(--ink);
    width: 100%;
}

input[type=text]:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-a);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

.btn {
    font: inherit;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    padding: 11px 22px;
    background: var(--accent-gradient);
    color: #fff;
    cursor: pointer;
    white-space: nowrap;
}

.btn:hover {
    filter: brightness(1.06);
}

.hint {
    color: var(--muted);
    font-size: 0.82rem;
    margin-top: 8px;
}

details.advanced {
    margin-top: 14px;
}

details.advanced summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--accent-a);
    letter-spacing: 0.01em;
}

.advanced-body {
    padding-top: 14px;
    display: grid;
    gap: 14px;
}

label.field-label {
    display: block;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 6px;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.error-box {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 0.92rem;
}

/* --- Bib plate (identitÃ©) --- */
.bib {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px 26px;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(15,23,42,0.04);
}

.bib::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--accent-gradient);
}

.bib-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
}

.bib-number {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 600;
    color: var(--muted);
    font-size: 0.85rem;
    letter-spacing: 0.03em;
}

.bib-name {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.9rem;
    letter-spacing: -0.01em;
    line-height: 1.1;
}

.bib-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.bib-tag {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.76rem;
    background: #f1f4fb;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 5px 12px;
    color: var(--ink);
}

/* --- Bandeau DUV-index (Ã©lÃ©ment signature) --- */
.index-hero {
    background: #0b1220;
    background-image: radial-gradient(circle at 20% -20%, #005B04, transparent 35%),
                       radial-gradient(circle at 100% 120%, #007F46, transparent 35%);
    border-radius: var(--radius);
    padding: 22px 28px;
    margin-bottom: 16px;
    display: flex;
    gap: 40px;
    flex-wrap: wrap;
    color: #ffffff;
}

.index-stat {
    flex: 1;
    min-width: 160px;
}

.index-value {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 600;
    font-size: 2.4rem;
    line-height: 1;
    background: linear-gradient(135deg, #93c5fd, #c4b5fd);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.index-label {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.76rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #cbd5e1;
    margin-top: 4px;
}

.index-label a {
    color: #93c5fd;
    text-decoration: none;
    margin-left: 6px;
}

.index-label a:hover {
    text-decoration: underline;
}

.info-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    border: 1px solid #64748b;
    color: #cbd5e1;
    font-size: 0.66rem;
    cursor: help;
    margin-left: 4px;
    position: relative;
}

.info-dot .bubble {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: 260px;
    background: #fff;
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 0.78rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.45;
    text-align: left;
    box-shadow: 0 8px 24px rgba(15,23,42,0.18);
    z-index: 10;
    cursor: auto;
}

.info-dot:hover .bubble,
.info-dot:focus .bubble,
.info-dot:focus-within .bubble {
    display: block;
}

/* --- Grille deux colonnes --- */
.grid-2 {
    display: grid;
    grid-template-columns: 0.8fr 1.2fr;
    gap: 20px;
    align-items: start;
}

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 2px rgba(15,23,42,0.04);
}

.card h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 12px;
}

.stat-line {
    display: flex;
    justify-content: space-between;
    padding: 7px 0;
    border-bottom: 1px dashed var(--line);
    font-size: 0.92rem;
}

.stat-line:last-child {
    border-bottom: none;
}

.stat-line .v {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 600;
}

/* --- Tableau des records --- */
table.records {
    width: 100%;
    border-collapse: collapse;
}

table.records td {
    padding: 7px 0;
    border-bottom: 1px dashed var(--line);
    font-size: 0.92rem;
}

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

table.records td:last-child {
    text-align: right;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 600;
}

/* Effet de survol sur les lignes du tableau des records */
.card table.records tbody tr:hover,
.card table.records tr:hover {
    background-color: #e8f5e9;
    cursor: pointer;
}

.recent-item {
    font-size: 0.86rem;
    padding: 7px 0;
    border-bottom: 1px dashed var(--line);
}

.recent-item:last-child {
    border-bottom: none;
}

.recent-item .d {
    color: var(--muted);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.78rem;
}

.recent-item .p {
    float: right;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 600;
}

/* --- Tableau complet des courses --- */
.races-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
}

.races-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    flex-wrap: wrap;
    gap: 10px;
}

table.races-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.87rem;
}

table.races-table th {
    text-align: left;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 8px 10px;
    border-bottom: 1px solid var(--line);
}

table.races-table td {
    padding: 7px 10px;
    border-bottom: 1px solid #f0f2f7;
}

table.races-table tr[data-stage="1"] td {
    color: var(--muted);
    font-size: 0.83rem;
}

table.races-table .date,
table.races-table .perf {
    font-family: 'IBM Plex Mono', monospace;
    white-space: nowrap;
}

table.races-table .medal {
    font-size: 1rem;
    white-space: nowrap;
}

/* Effet de survol sur les lignes du tableau principal */
#racesTable tbody tr:hover {
    background-color: #e8f5e9;
    cursor: pointer;
}

/* Pour que le lien occupe toute la cellule dans le tableau principal */
#racesTable tbody td .row-link {
    display: block;
    padding: 7px 10px;
    margin: -7px -10px;
    color: inherit;
    text-decoration: none;
}

/* SÃ©parateur d'annÃ©es - pas de survol */
#racesTable tbody tr.year-separator:hover {
    background-color: transparent;
    cursor: default;
}

/* ============================================================
   MEDIA QUERIES - RESPONSIVE
   ============================================================ */

/* Tablettes et petits Ã©crans */
@media (max-width: 992px) {
    .grid-2 {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* Mobiles */
@media (max-width: 768px) {
    body {
        padding: 16px 0 60px;
    }

    .wrap {
        padding: 0 10px;
    }

    /* RÃ©duire les paddings sur mobile */
    .search-card,
    .bib,
    .index-hero,
    .card,
    .races-card {
        padding: 16px;
    }

    .bib {
        padding: 18px 20px;
    }

    .index-hero {
        padding: 18px 20px;
        gap: 20px;
    }

    .search-card {
        padding: 16px;
    }

    .search-row {
        flex-direction: column;
        gap: 8px;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .bib-name {
        font-size: 1.5rem;
    }

    .index-value {
        font-size: 2rem;
    }

    .index-hero {
        flex-direction: column;
        gap: 16px;
    }

    .index-stat {
        min-width: auto;
        width: 100%;
    }

    /* --- TABLEAU DES RÃ‰SULTATS MOBILE --- */
    .races-card {
        padding: 10px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table.races-table {
        font-size: 0.7rem;
        min-width: 100%;
    }

    table.races-table th {
        font-size: 0.6rem;
        padding: 5px 6px;
        white-space: nowrap;
    }

    table.races-table td {
        padding: 4px 6px;
        font-size: 0.65rem;
    }

    table.races-table .date,
    table.races-table .perf {
        font-size: 0.6rem;
        white-space: nowrap;
    }

    table.races-table .medal {
        font-size: 0.8rem;
        white-space: nowrap;
    }

    table.races-table tr[data-stage="1"] td {
        font-size: 0.6rem;
    }

    /* Largeurs des colonnes */
    table.races-table th:nth-child(1),
    table.races-table td:nth-child(1) {
        min-width: 70px;
        max-width: 70px;
    }

    table.races-table th:nth-child(2),
    table.races-table td:nth-child(2) {
        min-width: 50px;
        max-width: 60px;
    }

    table.races-table th:nth-child(3),
    table.races-table td:nth-child(3) {
        min-width: 100px;
    }

    table.races-table th:nth-child(4),
    table.races-table td:nth-child(4) {
        min-width: 60px;
        max-width: 70px;
    }

    table.races-table th:nth-child(5),
    table.races-table td:nth-child(5) {
        min-width: 40px;
        max-width: 50px;
    }

    /* Cards en colonne */
    .grid-2 {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .card {
        padding: 14px 16px;
    }

    /* Records table */
    table.records td {
        padding: 5px 0;
        font-size: 0.85rem;
    }

    .stat-line {
        font-size: 0.85rem;
        padding: 5px 0;
    }

    .bib-tags {
        gap: 6px;
    }

    .bib-tag {
        font-size: 0.7rem;
        padding: 4px 10px;
    }


}

/* TrÃ¨s petits mobiles (moins de 480px) */
@media (max-width: 480px) {
    .wrap {
        padding: 0 6px;
    }

    .search-card,
    .bib,
    .index-hero,
    .card,
    .races-card {
        padding: 10px;
        border-radius: 10px;
    }

    .races-card {
        padding: 8px;
    }

    table.races-table {
        font-size: 0.6rem;
    }

    table.races-table th {
        font-size: 0.55rem;
        padding: 3px 4px;
    }

    table.races-table td {
        padding: 3px 4px;
        font-size: 0.55rem;
    }

    table.races-table .date,
    table.races-table .perf {
        font-size: 0.5rem;
    }

    table.races-table .medal {
        font-size: 0.7rem;
        white-space: nowrap;
    }

    table.races-table tr[data-stage="1"] td {
        font-size: 0.5rem;
    }

    /* Colonnes encore plus serrÃ©es */
    table.races-table th:nth-child(1),
    table.races-table td:nth-child(1) {
        min-width: 60px;
        max-width: 60px;
    }

    table.races-table th:nth-child(2),
    table.races-table td:nth-child(2) {
        min-width: 40px;
        max-width: 50px;
    }

    table.races-table th:nth-child(3),
    table.races-table td:nth-child(3) {
        min-width: 80px;
    }

    table.races-table th:nth-child(4),
    table.races-table td:nth-child(4) {
        min-width: 50px;
        max-width: 60px;
    }

    table.races-table th:nth-child(5),
    table.races-table td:nth-child(5) {
        min-width: 35px;
        max-width: 40px;
    }

    .bib {
        padding: 12px 14px;
    }

    .index-hero {
        padding: 12px 14px;
        border-radius: 10px;
    }

    .bib-name {
        font-size: 1.2rem;
    }

    .index-value {
        font-size: 1.6rem;
    }

    h1.brand {
        font-size: 1.1rem;
        gap: 6px;
    }

    .card h3 {
        font-size: 0.65rem;
    }

    .stat-line {
        font-size: 0.75rem;
        padding: 3px 0;
    }

    .bib-tag {
        font-size: 0.6rem;
        padding: 2px 6px;
    }

    .btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    input[type=text],
    textarea {
        padding: 8px 10px;
        font-size: 0.85rem;
    }

/* Style de base pour toutes les bulles */


/* Ajustement pour la bulle des pays - plus Ã©troite */
.info-dot .country-bubble {
    width: 180px;
    text-align: center;
    font-size: 0.85rem;
    padding: 12px 16px;
}

/* Bulles DUV-index / DUV-index+ : ouvrent a droite du « ? » (pas au-dessus),
   pour ne jamais deborder en haut de l'ecran quel que soit l'endroit
   ou la bande index-hero se trouve sur la page. */
.index-stat:first-child .info-dot .bubble,
.index-stat:nth-child(2) .info-dot .bubble {
    width: 340px;
    left: calc(100% + 12px);
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
}

@media (max-width:768px) {

    .info-dot .bubble {
        width: 260px;
        left: 10px; /* ChangÃ© de 0 Ã  10px */
        transform: none;
    }

    .info-dot .bubble::after {
        left: 32px; /* ChangÃ© de 22px Ã  32px (22+10) */
        transform: none;
    }

    .info-dot .country-bubble {
        width: 170px;
    }

    .index-stat:first-child .info-dot .bubble,
    .index-stat:nth-child(2) .info-dot .bubble {
        width: 220px;
        left: calc(100% + 12px);
        top: 50%;
        bottom: auto;
        transform: translateY(-50%);
    }
}

@media (max-width:480px) {

    .info-dot .bubble {
        width: 210px;
    }

    .info-dot .country-bubble {
        width: 150px;
    }

    .index-stat:first-child .info-dot .bubble,
    .index-stat:nth-child(2) .info-dot .bubble {
        width: 170px;
        left: calc(100% + 10px);
        top: 50%;
        bottom: auto;
        transform: translateY(-50%);
    }
}

/* Effet de survol */
.info-dot:hover .bubble,
.info-dot:focus .bubble {
    visibility: visible;
    opacity: 1;
}

.info-dot {
    position: relative;
    display: inline-block;
    cursor: help;
    margin-left: 4px;
}



.index-stat:first-child .info-dot .bubble::after,
.index-stat:nth-child(2) .info-dot .bubble::after {
    content: '';
    position: absolute;
    left: -9px;
    top: 50%;
    transform: translateY(-50%);
    border: 9px solid transparent;
    border-right-color: var(--line);
    z-index: -1;
}

    table.records td {
        font-size: 0.75rem;
        padding: 3px 0;
    }
}

/* Pour les trÃ¨s grands Ã©crans */
@media (min-width: 1400px) {
    .wrap {
        padding: 0 40px;
    }
}

/* ============================================================
   STYLES POUR EVENT.PHP
   ============================================================ */

/* Tableau des rÃ©sultats event.php */
#resultsTable {
    width: 100%;
    border-collapse: collapse;
}

#resultsTable th,
#resultsTable td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid var(--line);
}

#resultsTable tbody tr:hover {
    background-color: #e8f5e9;
    cursor: pointer;
}

#resultsTable tbody td .row-link {
    display: block;
    padding: 8px 12px;
    margin: -8px -12px;
    color: inherit;
    text-decoration: none;
}

/* Mobile pour event.php */
@media (max-width: 768px) {
    .results-card {
        padding: 10px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    #resultsTable {
        font-size: 0.7rem;
        min-width: 100%;
    }

    #resultsTable th,
    #resultsTable td {
        padding: 4px 6px;
        font-size: 0.6rem;
        white-space: nowrap;
    }

    #resultsTable tbody td .row-link {
        padding: 4px 6px;
        margin: -4px -6px;
    }
}

@media (max-width: 480px) {
    .results-card {
        padding: 6px;
    }

    #resultsTable {
        font-size: 0.55rem;
    }

    #resultsTable th,
    #resultsTable td {
        padding: 3px 4px;
        font-size: 0.5rem;
    }

    #resultsTable tbody td .row-link {
        padding: 3px 4px;
        margin: -3px -4px;
    }
}