@font-face {
    font-family: 'EurostileExtended';
    src: url('/wp-content/themes/TON_THEME/fonts/EurostileExtendedBold.woff2') format('woff2'),
         url('/wp-content/themes/TON_THEME/fonts/EurostileExtendedBold.woff') format('woff');
    font-weight: bold;
    font-style: normal;
}

/* -------------------------------------------------------
   GLOBAL
------------------------------------------------------- */
canvas {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    padding: 1rem;
    margin: 1rem auto;
    display: block;
    max-width: 100%;
}

/* Empêche les décalages entre onglets */
.udt-tab-content {
    display: none;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

.udt-tab-content.active {
    display: block;
}

/* -------------------------------------------------------
   TITRES & SELECTEURS
------------------------------------------------------- */
.chart-title {
    font-size: 1.6rem;
    color: #004080;
    margin: 1.5rem 0 0.5rem;
    text-align: center;
}

#yearSelect, #raceSelect {
    padding: 0.6rem 1rem;
    font-size: 1rem;
    border-radius: 8px;
    border: 1px solid #ccc;
    margin: 0.5rem;
    background-color: #f0f4f8;
}

/* -------------------------------------------------------
   STATS BLOCKS
------------------------------------------------------- */
.stats-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    margin: 2rem 0;
}

.stat-block {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    padding: 1rem 1.5rem;
    text-align: center;
    min-width: 200px;
}

.stat-block h3 {
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
    color: #0077cc;
}

.stat-block p {
    font-size: 1.4rem;
    font-weight: bold;
    color: #333;
}

/* -------------------------------------------------------
   LEGENDES
------------------------------------------------------- */
.udt-legend {
    padding: 15px 20px;
    border-radius: 8px;
    background: transparent;
    border: 1px solid #e3e3e3;
    margin-bottom: 25px;
    width: 100%;
}

.udt-legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 15px 25px;
}

.udt-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
}

.udt-legend-color {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    display: inline-block;
}

/* Couleurs dynamiques */
.udt-legend-item.homme   { color: var(--ultraHomme); }
.udt-legend-item.homme .udt-legend-color { background-color: var(--ultraHomme); }

.udt-legend-item.femme   { color: var(--ultraFemme); }
.udt-legend-item.femme .udt-legend-color { background-color: var(--ultraFemme); }

.udt-legend-item.finisher { color: var(--ultraBlue); }
.udt-legend-item.finisher .udt-legend-color { background-color: var(--ultraBlue); }

.udt-legend-item.dnf     { color: var(--ultraRed); }
.udt-legend-item.dnf .udt-legend-color { background-color: var(--ultraRed); }

/* -------------------------------------------------------
   ONGLET SYSTEM
------------------------------------------------------- */
.udt-tabs {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 30px 0;
}

.udt-tab {
    padding: 10px 20px;
    border-radius: 8px;
    background: #e0ecf8;
    border: 1px solid #bcd4e6;
    cursor: pointer;
    font-weight: 600;
    color: #004080;
    transition: 0.2s;
}

.udt-tab.active {
    background: #0077cc;
    color: white;
    border-color: #005fa3;
}

.udt-tabs-container {
    width: 100%;
    position: relative;
}

.udt-format-temps {
    margin-left: 20px;
    font-style: italic;
    opacity: 0.8;
}

.ts-table tbody tr:hover {
    background-color: rgba(0, 119, 204, 0.10);
    border-left: 4px solid var(--ultraBlue);
    cursor: pointer;
}

#itraApply.udt-btn:hover {
    background-color: #0077cc;
    border-color: #005fa3;
    color: #fff;
}

#itraApply.udt-btn {
     background-color: #e0ecf8; 
     border-color: #e0ecf8; 
     color: #004080; 
      transform: translateY(-2px); 
      box-shadow: 0 4px 12px rgba(84,196,255,0.4);
}

/* Barre active (la partie colorée) */
.noUi-connect {
    background: #0077cc !important;
}

/* Barre inactive (fond du slider) */
.noUi-target {
    background: #d6e8f8 !important; /* bleu très clair */
    border: none !important;
    box-shadow: none !important;
}

/* Poignées */
.noUi-handle {
    background: #ffffff !important;
    border: 3px solid #0077cc !important;
    border-radius: 50% !important;
    width: 20px !important;
    height: 20px !important;
    top: -8px !important; /* recentre verticalement */
    box-shadow: none !important;
}

/*
SUPPLEMENT
*/
body, html {
    overflow-x: hidden;
}

.udt-tab-content,
.udt-graph,
.udt-time,
.stats-row,
.stat-block {
    max-width: 100% !important;
}


/* -------------------------------------------------------
   GRAPHIQUES
------------------------------------------------------- */
.udt-graph {
    width: 80%;
    max-width: 80%;
    margin: 0 auto;
}

.udt-graph-hommefemme canvas { max-height: 250px !important; 
    width: 80%;
    max-width: 80%;
    margin: 0 auto;}

.udt-time{
    width: 80%;
    max-width: 80%;
    margin: 0 auto; text-align: center;
}

.udt-graph canvas {
    width: 100% !important;
    display: block;
    min-height: 350px !important;
}

/* Responsive */
@media (max-width: 1024px) {
    .udt-graph canvas { min-height: 250px !important; }
}

@media (max-width: 600px) {
    .udt-graph canvas { min-height: 180px !important; }
}

/* -------------------------------------------------------
   TIME DISTRIBUTION
------------------------------------------------------- */
.time-dist {
    text-align: center;
    font-size: 20px;
    line-height: 1.8;
}

.time-dist div {
    margin: 6px 0;
}

/* -------------------------------------------------------
   ITRA RANGE
------------------------------------------------------- */
.itra-range-wrapper {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1rem;
    margin: 2rem 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.itra-range-values {
    display: flex;
    justify-content: center;
    gap: 1rem;
    font-size: 1.2rem;
    font-weight: bold;
    color: #004080;
}

/* -------------------------------------------------------
   TABLE CHECKPOINTS (optimisé + wrapper)
------------------------------------------------------- */
.ts-table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 20px;
}

.ts-table {
    width: 100%;
    min-width: 1200px;
    border-collapse: collapse;
    margin-top: 2rem;
    font-size: 0.9rem;
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.ts-table th,
.ts-table td {
    padding: 0.6rem;
    border: 1px solid #dee2e6;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ts-table th {
    background-color: #f0f4f8;
    color: #004080;
    font-weight: 600;
}

.ts-table tbody td {
    color: #333;
}

/* -------------------------------------------------------
   TOGGLES
------------------------------------------------------- */
#column-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 1rem 0;
    justify-content: center;
}

#column-toggles label {
    background: #e0ecf8;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
}

/* -------------------------------------------------------
   RESPONSIVE
------------------------------------------------------- */
@media (max-width: 768px) {
    .stats-row { flex-direction: column; }
    #yearSelect, #raceSelect { width: 100%; }
    .ts-table { font-size: 0.8rem; }
    .udt-chart-container, canvas { width: 100% !important; max-width: 100% !important; }
    .ts-chart, .ts-chart canvas { width: 100% !important; max-width: 100% !important; }
    canvas { min-height: 260px !important; }
    .site-logo img {
        max-width: 35vw;
    }
}

@media (max-width: 480px) and (orientation: portrait) {
    .header-container {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 8px;
    }
}

/* Le logo ne dépasse jamais une partie de l'écran */
.site-logo img {
    max-width: 45vw;
    height: auto;
}

/* En vertical, on réduit encore un peu */
@media (max-width: 480px) and (orientation: portrait) {
    .site-logo img {
        max-width: 35vw;
    }
}


/* -------------------------------------------------------
   GENDER TAB
------------------------------------------------------- */
.gender-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    text-align: center;
    align-items: start;
}

/* -------------------------------------------------------
   RESTAURATION GRILLE TRAIL PAR MOIS
------------------------------------------------------- */

.trail-month-grid {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 20px !important;
    justify-content: flex-start;
    align-items: stretch;
    margin-top: 30px;
}

.trail-month-card {
    flex: 1 1 calc(33.33% - 20px) !important;
    max-width: calc(33.33% - 20px) !important;
    min-width: 260px;
    background: #fff;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
}

.trail-month-title {
    margin: 0 0 10px 0;
    font-size: 1.3rem;
    color: #0077cc;
    text-align: center;
    font-family: 'EurostileExtended', sans-serif;
    font-weight: bold;
    text-transform: uppercase;
}

.trail-month-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.trail-month-list li {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 5px 0;
}


.trail-icon {
    font-size: 1.1rem;
}

.trail-unpublished {
    opacity: 0.7;
    cursor: help;
}

/* Responsive */
@media (max-width: 900px) {
    .trail-month-card {
        flex: 1 1 calc(50% - 20px) !important;
        max-width: calc(50% - 20px) !important;
    }
}

@media (max-width: 600px) {
    .trail-month-card {
        flex: 1 1 100% !important;
        max-width: 100% !important;
    }
}
/* --- GRID XXL --- */
.trail-month-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 35px;
    margin: 50px 0;
    padding: 10px;
}

/* --- CARTE DU MOIS XXL --- */
.trail-month-card.big {
    background: #3AABF1;
    border-radius: 18px;
    padding: 30px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.25);
    color: #fff;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    min-height: 350px;
}

.trail-month-card.big:hover {
    transform: none;
    box-shadow: 0 10px 25px rgba(0,0,0,0.25);
}

/* --- TITRE DU MOIS --- */
.trail-month-title {
    font-family: 'EurostileExtended', sans-serif;
    font-weight: bold;
    text-align: center;
    color: #000;
    font-size: 28px;
    margin-bottom: 25px;
    letter-spacing: 1px;
}

/* --- CONTENU --- */
.trail-month-content {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* --- ITEM TRAIL --- */
.trail-item {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255,255,255,0.15);
    padding: 12px 15px;
    border-radius: 12px;
    transition: background 0.2s ease;
}

.trail-item:hover {
    background: rgba(255,255,255,0.25);
}

/* --- LOGO --- */
.trail-logo img {
    width: 55px;
    height: 55px;
    object-fit: contain;
    border-radius: 8px;
    background: #fff;
    padding: 5px;
}

/* --- NOM DU TRAIL --- */
.trail-info a {
    color: #fff;
    font-weight: 700;
    font-size: 17px;
    text-decoration: none;
}

.trail-info a:hover {
    opacity: 0.8;
}

/* Non publié */
.trail-unpublished {
    opacity: 0.7;
    font-style: italic;
}

/* Le texte prend toute la largeur disponible */ 
.trail-info { 
    flex: 1; 
    text-align: center; /* centre le texte */ 
    color: #ffffff !important; 
    font-size: 17px; 
}

.trail-title {
    text-align: center;
}



.selectors-wrapper {
    display: flex;
    justify-content: center;
    gap: 15px; /* espace entre les selects */
    margin: 20px 0;
}

.selectors-wrapper select {
    padding: 6px 10px;
    font-size: 16px;
}


.itra-controls {
    display: flex;
    flex-direction: column;
    align-items: center; /* centre horizontalement */
    gap: 10px;
    margin-top: 15px;
}

#itraApply {
    display: inline-block;
    margin: 0 auto;
}
