/* =========================================
   1. VARIABLES & CONFIGURATION
   ========================================= */
:root {
    /* --- COULEURS PRINCIPALES --- */
    --c-primary: #444;
    --c-primary-dark: #333; /* Hover state */
    --c-link: #2980b9;
    --c-link-hover: #3498db;
    --c-danger: #c0392b;
    --c-danger-hover: #e74c3c;
    
    /* --- COULEURS DE FOND & TEXTE --- */
    --c-bg: #fff;
    --c-text: #333;
    --c-white: #fff;
    
    /* --- COULEURS STATUTS (Utilisées par JS et CSS) --- */
    --c-purple: #9b59b6;
    --c-green: #2ecc71;
    --c-yellow: #f1c40f;
    --c-grey: #bdc3c7; /* "White" status visualisé en gris */
    
    /* --- VARIANTES TEXTE (Plus foncées pour lisibilité) --- */
    --t-purple: #8e44ad;
    --t-green: #27ae60;
    --t-yellow: #d35400;
    --t-grey: #7f8c8d;
}

/* =========================================
   2. GENERAL & RESET
   ========================================= */
* {
    box-sizing: border-box;
}

body {
    background-color: var(--c-bg);
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

body,
button,
input,
select,
textarea {
	color: var(--c-text);
	font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
	font-size: 16px;
	font-size: 1rem;
	line-height: 1.75;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: Montserrat, "Helvetica Neue", sans-serif;
	clear: both;
	font-weight: 700;
	margin: 0;
	text-rendering: optimizeLegibility;
    color: var(--c-primary);
}

p {
	margin: 0 0 1.75em;
}

a {
    text-decoration: none;
    color: var(--c-link);
    transition: color 0.2s;
}

a:hover {
    color: var(--c-link-hover);
}

/* =========================================
   3. LAYOUT (Navbar, Container, Cards)
   ========================================= */

/* Site Header */
.site-header-main {
    max-width: 1320px;
    position: relative;
    padding: 0 2em;
    margin: 0 auto;
}

.site-header-main {
    -webkit-align-items: center;
    -ms-flex-align: center;
    align-items: center;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-flex-wrap: wrap;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
}

.site-branding, .site-header-menu {
    margin-top: 1em;
    margin-bottom: 1em;
}

.site-branding {
    margin: 0.875em auto 0.875em 0;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}

.site-logo {
    height: 30px !important;
    vertical-align: middle;
}

.main-navigation {
    margin: 0 -0.875em;
}

.site-header-inner {
    background-color: #333;
}

.main-navigation li {
    position: relative;
    float: left;
}

.main-navigation ul {
    list-style: none;
    margin: 0;
}

.main-navigation a {
    display: block;
    line-height: 1.3125;
    text-decoration: none;
}

.main-navigation a {
    outline-offset: -8px;
    padding: 0.65625em 0.875em;
    white-space: nowrap;
	font-family: Montserrat, "Helvetica Neue", sans-serif;
    color: white;
}

.main-navigation a:hover, .main-navigation a:focus, .main-navigation a:active, .main-navigation a:focus-within {
    color: #1dadb2 !important;
}

.site-header-menu {
    display: block;
    -webkit-flex: 0 1 auto;
    -ms-flex: 0 1 auto;
    flex: 0 1 auto;
}

  /* language bar */
.language-bar {
    background-color: #0b1f24;
    border-bottom: dotted 2px #777;
    height: 35px;
}

.language-bar-links {
    max-width: 1320px;
    position: relative;
    padding: 0 2em;
    padding-top: 2px;
    margin: 0 auto;
    text-align: right;
}

.language-bar-links-span a{
    color: #999;
    font-size: small;
    font-family: 'Montserrat';
    text-decoration: none;
}
   /* Navbar */
.navbar {
    background-color: var(--c-primary);
    padding: 1rem 20px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.navbar .brand {
    font-size: 1.2rem;
    font-weight: bold;
    letter-spacing: 1px;
}

.navbar .links a {
    color: #ecf0f1;
    margin-left: 20px;
    font-weight: 500;
}

.navbar .links a:hover {
    color: var(--c-link-hover);
}

/* --- STATUS BAR STYLES --- */
.status-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Badge du Mode (Training/Racing) */
.mode-badge {
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: white;
    min-width: 80px;
    text-align: center;
    transition: background-color 0.3s;
}

.mode-training { background-color: #27ae60; } /* Vert */
.mode-racing { background-color: #e67e22; }   /* Orange */
.mode-disconnected { background-color: #7f8c8d; } /* Gris */

/* Indicateurs AMB / RCM */
.status-indicators {
    display: flex;
    gap: 15px;
    font-size: 0.8rem;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Le point lumineux */
.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #c0392b; /* Rouge par défaut */
    box-shadow: 0 0 2px rgba(0,0,0,0.5);
    transition: background-color 0.3s, box-shadow 0.3s;
}

.status-dot.connected {
    background-color: #2ecc71; /* Vert fluo */
    box-shadow: 0 0 8px #2ecc71; /* Effet Glow */
}

/* Container */
.container {
    padding: 20px;
    max-width: 1320px;
    margin: 0 auto;
}

/* Card générique */
.card {
    background: var(--c-white);
    border-radius: 8px;
    margin-bottom: 20px;
    overflow: hidden;
}

/* Classes utilitaires d'espacement */
.mb-20 { margin-bottom: 20px; }
.mt-20 { margin-top: 20px; }
.d-flex { display: grid; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.text-right { text-align: right; }
.w-100 { width: 100%; }

/* =========================================
   4. UI ELEMENTS (Buttons, Forms, Badges)
   ========================================= */
/* Boutons */
.btn {
    display: inline-block;
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    text-align: center;
    transition: background 0.2s;
    color: white;
}

.btn-primary { background-color: var(--c-primary); }
.btn-primary:hover { background-color: var(--c-primary-dark); }

.btn-danger { background-color: var(--c-danger); }
.btn-danger:hover { background-color: var(--c-danger-hover); }

.btn-small {
    padding: 4px 8px;
    font-size: 0.8rem;
}

.btn-save {
    height: 42px; /* Hauteur ajustée pour matcher les inputs */
    padding: 0 30px;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.9rem;
}

/* Formulaires */
input[type="text"], 
input[type="number"], 
select {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    box-sizing: border-box;
}

.config-card {
    background: white;
    border-radius: 8px;
    padding: 25px;
    border: 1px solid #ddd;
    margin-bottom: 30px;
}
.config-form-grid {
    display: grid;
    grid-template-columns: 2fr 1fr auto; /* Nom large, Catégorie moyenne, Bouton auto */
    gap: 20px;
    align-items: end; /* Aligner le bouton avec les inputs */
}
.input-group label {
    text-transform: uppercase;
    font-size: 0.75rem;
    color: #7f8c8d;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}
.input-modern {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1rem;
    background: #fcfcfc;
    transition: border-color 0.3s;
}
.input-modern:focus {
    border-color: var(--c-accent);
    outline: none;
    background: white;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: bold;
}

/* Badges de statut (utilisés dans Header Transpondeur) */
.badge-dark { background: var(--c-primary); color: white; }
.badge-yellow-stat { background: var(--c-yellow); color: #333; }

/* Badges de Catégorie (Dashboard & Listes) */
.badge-cat {
    background: #95a5a6;
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 5px;
    text-transform: uppercase;
    vertical-align: middle;
}

.badge-cat-small {
    font-size: 0.65rem;
    background: #ecf0f1;
    color: #7f8c8d;
    padding: 1px 4px;
    border-radius: 2px;
    margin-left: 5px;
    vertical-align: middle;
}

/* =========================================
   5. DASHBOARD & TABLES
   ========================================= */
.dashboard-grid {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 20px;
    align-items: start;
}

@media (max-width: 900px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}

.table-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    overflow: hidden;
}

.table-header {
    background: var(--c-primary);
    color: white;
    padding: 15px;
    font-size: 1.1rem;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-header .subtitle {
    font-size: 0.8rem;
    font-weight: normal;
    opacity: 0.8;
}

/* Tables Standards */
table { 
    width: 100%; 
    border-collapse: collapse; 
}

.session-table {
    border: solid 1px #e5e7eb !important;
}

.session-table thead tr {
    border-left: 4px solid var(--c-primary-dark) !important;
}

th { 
    background: var(--c-primary-dark); 
    color: #ecf0f1; 
    text-transform: uppercase; 
    font-size: 0.75rem; 
    letter-spacing: 1px; 
    padding: 12px 10px; 
    text-align: left; 
}

td { 
    padding: 10px; 
    border-bottom: 1px solid #eee; 
    vertical-align: middle;
}

#training-view td {
    height: 60px;
}

.empty-message {
    text-align: center; 
    padding: 30px; 
    color: #999;
    font-style: italic;
}

/* Typographie Spécifique Tableaux */
.font-mono { 
    font-family: 'Consolas', 'Monaco', monospace; 
    font-size: 1.1rem; 
    letter-spacing: -0.5px;
}

.font-bold { font-weight: bold; }

.pilot-name { 
    font-weight: 600; 
    font-size: 1.05rem; 
    color: var(--c-primary);
    display: inline-block;
}

.rank-pos {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--c-primary);
    text-align: center;
    width: 40px;
}

/* --- LIENS PILOTES --- */
.pilot-link {
    text-decoration: none;
    color: inherit; /* Garde la couleur noire/grise du texte parent */
    cursor: pointer;
    transition: color 0.2s;
}

.pilot-link:hover {
    color: #3498db; /* Bleu au survol */
    text-decoration: underline;
}

/* Classes texte couleur */
.text-purple { color: var(--t-purple);  }
.text-green  { color: var(--t-green);  }
.text-yellow { color: var(--t-yellow); }
.text-white  { color: var(--t-grey); }

.row-top3 {
    background-color: #fff9c4 !important; /* Fond jaune très pâle */
    border-left: 4px solid #f1c40f !important; /* Bordure Or à gauche */
}

.row-bestlap {
    background-color: #f3e5f5 !important; /* Fond violet très pâle */
    border-left: 4px solid var(--c-purple) !important; /* Bordure Violette */
}

/* Navigation Bar Styles */
.session-nav {
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    border: solid 1px #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.nav-group {
    display: flex;
    align-items: center;
    gap: 10px;
    width: -webkit-fill-available;
}

.nav-btn {
    text-decoration: none;
    background: #f8f9fa;
    border: 1px solid #ddd;
    color: #333;
    padding: 8px 15px;
    border-radius: 4px;
    transition: all 0.2s;
    font-weight: 500;
    display: flex; align-items: center; gap: 5px;
    height: 50px;
    width: 200px;
}
.nav-btn:hover { background: #e2e6ea; border-color: #adb5bd; }
.nav-btn.disabled { opacity: 0.5; pointer-events: none; }

select.nav-select {
    padding: 8px 30px 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    font-size: 0.95rem;
    cursor: pointer;
    height: 50px;
    margin-bottom: 0 !important;
}

/* Stats Cards Specific */
.stat-mini-label { font-size: 0.75rem; text-transform: uppercase; color: #999; margin-bottom: 3px; }
.stat-mini-value { font-size: 1.4rem; font-weight: bold; color: #333; font-family: 'Segoe UI', monospace;}

@keyframes slideInUp {
from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Classe générique pour animer un bloc entier (comme les cartes) */
.animate-enter {
    animation: slideInUp 1s ease-out forwards;
}

/* Configuration spécifique pour les lignes du tableau */
.session-table tbody tr {
    opacity: 0; /* Caché par défaut avant que l'animation ne se lance */
    animation: slideInUp 1s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}
/* =========================================
   6. ANIMATIONS (LIVE)
   ========================================= */
.live-row, .rank-row {
    transition: transform 0.5s ease, background-color 0.3s;
    background: white;
    position: relative; 
    z-index: 1;
    will-change: transform;
}

.col-center {
    text-align: center;
}

/* Keyframes Flash */
@keyframes flashPurple { 0% { background-color: #e1bee7; } 100% { background-color: white; } }
@keyframes flashGreen  { 0% { background-color: #a5d6a7; } 100% { background-color: white; } }
@keyframes flashYellow { 0% { background-color: #fff59d; } 100% { background-color: white; } }
@keyframes flashWhite  { 0% { background-color: #f5f5f5; } 100% { background-color: white; } }

/* Classes Flash appliquées via JS */
.flash-purple { animation: flashPurple 2s ease-out;}
.flash-green  { animation: flashGreen 2s ease-out;}
.flash-yellow { animation: flashYellow 2s ease-out;}
.flash-white  { animation: flashWhite 2s ease-out;}

/* --- COULEURS DE TEXTE (Pour les temps) --- */
.text-purple { color:var(--t-purple); } /* Violet */
.text-green { color:var(--t-green); }  /* Vert foncé */
.text-yellow { color:var(--t-yellow); } /* Orange (pour remplacer le jaune illisible sur blanc) */
.text-white { color:var(--t-white); }  /* Par défaut (Gris foncé/Noir), car blanc sur blanc est invisible */


/* =========================================
   7. SESSION DETAILS & CHARTS
   ========================================= */
.session-anchor { scroll-margin-top: 80px; }

.session-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    border-bottom: 1px solid #eee; 
    padding-bottom: 15px; 
    margin-bottom: 15px; 
}

.session-info {
    font-weight:normal;
    color:#666
}
.session-meta strong { margin-left: 15px; color: #333; }

/* Styles Barres Graphiques */
.chart-cell { 
    display: flex; 
    align-items: center; 
    width: 100%; 
    max-width: 250px;
    height: 20px; 
    position: relative; 
    background: #f0f0f0; 
    border-radius: 4px; 
    overflow: hidden; 
}

.center-line { 
    position: absolute; 
    left: 50%; 
    width: 1px; 
    height: 100%; 
    background: #999; 
    z-index: 2; 
}

.bar { 
    height: 100%; 
    position: absolute; 
    z-index: 1; 
    transition: width 0.3s; 
}

/* Couleurs de fond (background) */
.bg-purple { background-color: var(--c-purple); }
.bg-green  { background-color: var(--c-green); }
.bg-yellow { background-color: var(--c-yellow); }
.bg-white  { background-color: var(--c-grey); }

/* Tooltip Graphique ApexCharts */
.custom-tooltip {
    padding: 8px 12px;
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.graph_subtitle {
    font-size:0.8rem;
    color:#7f8c8d;
    text-align:center;
    margin-top:10px;
}

.session-chart, .day-boxplot {
    padding: 0 20px;
}

/* =========================================
   8. RANKING (PODIUMS)
   ========================================= */
.podium-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.podium-card {
    background: white;
    border-radius: 8px;
    border: solid 1px #e5e7eb;
    overflow: hidden;
}

.podium-header {
    background: var(--c-primary);
    color: white;
    padding: 10px 15px;
    text-align: center;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 1.1rem;
}

.podium-list { list-style: none; padding: 0; margin: 0; }
.podium-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
}
.podium-item:last-child { border-bottom: none; }

.rank-badge {
    width: 40px;
    height: 50px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    font-size: 5.8rem;
}

.rank-1 {
    background: linear-gradient(135deg, #facc15, #f59e0b);
    box-shadow: 0 2px 4px rgba(241, 196, 15, 0.4);
}

.rank-2 {
    background: linear-gradient(135deg, #e5e7eb, #d1d5db);
    box-shadow: 0 2px 4px rgba(241, 196, 15, 0.4);
}

.rank-3 {
    background: linear-gradient(135deg, #b54c07, #f59e0b99);
    box-shadow: 0 2px 4px rgba(241, 196, 15, 0.4);
}

.pilot-details { text-align: right; font-size: 0.85rem; color: #666; }

.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.profile-title h2 { margin: 0; font-size: 1.8rem; color: var(--c-primary); }
.profile-id { font-size: 1rem; color: #7f8c8d; font-weight: normal; background: #eee; padding: 2px 8px; border-radius: 4px; }

/* Grille de statistiques */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: solid 1px #e5e7eb !important;
    text-align: center;
    border-top: 4px solid transparent; /* Bordure colorée au top */
}

.stat-card.purple {
    border: solid 2px var(--c-purple) !important;
}

.stat-card.yellow {
    border: solid 2px var(--c-yellow) !important;
}

.stat-value {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--c-dark);
    margin: 10px 0;
    font-family: 'Segoe UI', monospace;
}
.stat-label {
    text-transform: uppercase;
    color: #95a5a6;
    font-size: 0.85rem;
    letter-spacing: 1px;
    font-weight: 600;
}
.stat-icon { font-size: 1.5rem; margin-bottom: 5px; display: block; }

/* =========================================
   9. ADMIN SECTION
   ========================================= */
.admin-grid { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 20px; 
    margin-bottom: 20px; 
}

.admin-config-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.admin-config-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

.add-cat-form { 
    background: #f4f4f4; 
    padding: 10px; 
    border-radius: 4px; 
    display: flex; 
    gap: 10px; 
}

/* Modale */
.modal { 
    display: none; 
    position: fixed; 
    z-index: 1000; 
    left: 0; 
    top: 0; 
    width: 100%; 
    height: 100%; 
    background-color: rgba(0,0,0,0.5); 
}

.modal-content { 
    background-color: white; 
    margin: 10% auto; 
    padding: 25px; 
    border-radius: 8px; 
    width: 90%; 
    max-width: 450px; 
    position: relative; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.close { 
    position: absolute; 
    right: 15px; 
    top: 10px; 
    font-size: 24px; 
    font-weight: bold;
    cursor: pointer; 
    color: #aaa;
}
.close:hover { color: #333; }

.modal-actions { margin-top: 20px; text-align: right; }

.login-message {
    background: #ffebee;
    color: #c0392b;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 20px;
    text-align: center;
}

.login-input {
    width: 100%;
    padding: 12px;
    font-size: 1.1rem;
}

.login-button {
    padding: 12px;
}

/* =========================================
   10. GRID.JS OVERRIDES
   ========================================= */
.gridjs-container {
    font-family: inherit;
    color: inherit;
}
.gridjs-wrapper {
    border-radius: 8px;
    box-shadow: none;
    border: 1px solid #eee;
    box-shadow: none !important;
}
.gridjs-table-wrapper table {
    table-layout: auto !important;
    width: 100%; /* optionnel, pour remplir le conteneur */
}
.gridjs-th, .gridjs-td {
    width: auto !important;
}
.gridjs-th {
    background: var(--c-primary-dark) !important;
    color: #ecf0f1 !important;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 1px;
    padding: 12px 10px !important;
    text-align: left;
    border: none !important;
}
.gridjs-tr:hover {
    background-color: #fafafa;
}
.gridjs-td{
    border: none !important;
}
.gridjs-footer {
    background-color: #fff;
    border-top: none;
    box-shadow: 0 0px 1px 0 rgba(0, 0, 0, .1), 0 0px 1px 0 rgba(0, 0, 0, .26);
}
.gridjs-pagination .gridjs-pages button {
    background-color: white;
    border: 1px solid #ddd;
    outline: none;
}
.gridjs-pagination .gridjs-pages button:hover {
    background-color: #eee;
}
.gridjs-pagination .gridjs-pages button.gridjs-currentPage {
    background-color: var(--c-primary) !important;
    color: white;
    border-color: var(--c-primary);
}
button.gridjs-sort-neutral, button.gridjs-sort-desc, button.gridjs-sort-asc {
    background-image: none!important;
}

/* 2. Style de base pour l'icône de tri (Pseudo-élément) */
button.gridjs-sort::after {
    font-family: Arial, sans-serif; /* Police standard pour symboles propres */
    font-size: 12px;
    font-weight: bold;
    content: '⇅'; /* Icône par défaut (neutre) */
    color:  var(--c-white);  /* Gris clair par défaut */
    transition: color 0.2s ease;
}

/* 3. État : Tri Ascendant (A-Z ou Croissant) */
button.gridjs-sort.gridjs-sort-asc::after {
    content: '▲'; /* Flèche haut */
    color: var( --c-white); /* Utilise la couleur principale du thème */
}

/* 4. État : Tri Descendant (Z-A ou Décroissant) */
button.gridjs-sort.gridjs-sort-desc::after {
    content: '▼'; /* Flèche bas */
    color: var( --c-white);
}

.gridjs-resizable {
    bottom: auto !important;
}

/* 5. Ajustement de l'entête pour aligner le texte et la flèche */
th.gridjs-th {
    position: relative;
}
.gridjs-th-content {
    display: inline-block;
    vertical-align: middle;
}
/* =========================================
   10.VUE RACING (RCM)
   ========================================= */
#racing-view {
    display: none; /* Masqué par défaut */
    padding: 0px;
    background: white;
    text-align: center;
}

#training-view {
    display: none; /* Masqué par défaut */
}

.rcm-header {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: solid 1px #e5e7eb !important;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rcm-info h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #2c3e50;
    text-transform: uppercase;
}
.rcm-category {
    color: #7f8c8d;
    font-weight: bold;
    margin-top: 5px;
}

.rcm-timer-box {
    text-align: right;
}

.main-timer {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 3rem;
    font-weight: bold;
    color: #333;
    line-height: 1;
}

/* Badges d'état de course */
.state-badge {
    display: inline-block;
    padding: 5px 15px;
    border-radius: 4px;
    color: white;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 5px;
}

/* 0: STANDBY (Gris) */
.state-0 { background: #95a5a6; } 

/* 1: RUNNING (Vert - C'est maintenant la course active) */
.state-1 { background: #27ae60; box-shadow: 0 0 10px #27ae60; animation: pulse 2s infinite; } 

/* 2: PREPARATION (Orange - Le décompte) */
.state-2 { background: #f39c12; } 

/* 3: INTERRUPTED (Rouge/Violet) */
.state-3 { background: #8e44ad; } 

/* 4: OVER (Drapeau à damier / Rouge) */
.state-4 { background: #c0392b; } 

/* 5: FINALIZED (Noir/Foncé) */
.state-5 { background: #2c3e50; } 

/* Petite animation pour le mode RUNNING */
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(39, 174, 96, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(39, 174, 96, 0); }
    100% { box-shadow: 0 0 0 0 rgba(39, 174, 96, 0); }
}
/* Table Racing */
.rcm-pos { font-size: 1.4rem; font-weight: bold; text-align: center; }
.rcm-num { 
    background: #2c3e50; color: white; 
    border-radius: 4px; padding: 2px 6px; 
    font-weight: bold; display: inline-block;
}

/* La cellule du pilote sert de cadre de référence */
.col-pilot-rcm {
    position: relative; /* Indispensable pour positionner le drapeau en absolu dedans */
    overflow: hidden;   /* Coupe ce qui dépasse */
    vertical-align: middle;
    z-index: 1; /* Crée un contexte d'empilement */
}

/* Le nom du pilote doit passer au-dessus du drapeau */
.pilot-name-text {
    position: relative;
    z-index: 2; /* Au premier plan */
    font-weight: bold;
    font-size: 1.1rem;
}

/* =========================================
   11.DIECONNECTED VIEW
   ========================================= */

/* --- DISCONNECTED STATE --- */
#disconnected-view {
    padding: 20px 0;
    text-align: center;
}

.empty-state {
    background: white;
    width: 100%;
    padding: 40px;
    border-radius: 8px;
    border: 1px solid #ddd;
    display: inline-block; /* Pour ne pas prendre toute la largeur */
    color: #7f8c8d;
}

.empty-state h2 {
    color: #2c3e50;
    margin-top: 0;
}

/* =========================================
   12.RESPONSIVE
   ========================================= */

@media (max-width: 900px) {
    [data-responsive="hidden"] {
        display: none !important;
    }
    
    .gridjs-th, .gridjs-td {
        width: auto !important; 
    }

    .rcm-info h2 {
        font-size: 1rem;
    }

    .main-timer {
        font-size: 2rem;
    }

}