
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }

:root {
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-color: #334155;
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --danger-color: #ef4444;
    --danger-hover: #dc2626;
    --border-color: #e2e8f0;
    --vert-claire:#E8F5E9;
    --vert-amende:#D1E7DD;
    --radius: 12px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    box-sizing: 0;
    /*margin: 0;*/
    padding: 0;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    
}

/* Barre de navigation */

.navbar {
    background-color: var(--vert-claire);
    padding: 1rem 2rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
    display: flex;
    flex:wrap;
    justify-content: space-between;
    align-items: center;
    color:var(--text-color);
}

.navbar h1 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    color: #1e293b;
}

/* Conteneur de la recherche dans la navbar */
.search-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-color);
    padding: 0.35rem 0.6rem;
    border-radius: 8px;
    backdrop-filter: blur(4px);
    margin-top:40px;
}

/* Style du champ de saisie (input) */
.search-container input {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    padding: 0.4rem 0.75rem;
    color: var(--text-color); /* Hérite de la couleur du texte de la navbar */
    font-size: 0.9rem;
    outline: none;
    transition: all 0.3s ease;
    width: 150px; /* Largeur par défaut sur bureau */
}

/* Effet focus sur l'input */
.search-container input:focus {
    border-color: #ffffff;
   /* background: rgba(255, 255, 255, 0.25);*/
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
}

/* Style du placeholder */
.search-container input::placeholder {
    color: var(--text-color);
}

/* Style du bouton de recherche */
.search-container button {
    background-color: var(--vert-amende); /* Bleu moderne */
    color: var(--text-color);
    border: none;
    border-radius: 6px;
    padding: 0.4rem 0.85rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

/* Effet survol et clic du bouton */
.search-container button:hover {
    background-color:var(--vert-claire);
}
.search-container button:active {
    transform: scale(0.97);
}

/* ==========================================
   GESTION DE LA RESPONSIVITÉ (Mobiles & Tablettes)
   ========================================== */
@media (max-width: 768px) {
    /* Si votre navbar utilise Flexbox, ceci permet de passer les éléments à la ligne si besoin */
    .navbar {
        justify-content: center;
        gap: 0.55rem;
        padding: 0.75rem 0.75rem;
    }

    /* Réduction de la largeur de l'input sur les petits écrans pour éviter les débordements */
    .search-container input {
        width: 140px;
        padding: 0.35rem 0.5rem;
        font-size: 0.85rem;
    }

    .search-container button {
        padding: 0.35rem 0.6rem;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    /* Sur très petits mobiles, on optimise l'espace au maximum */
    .search-container input {
        width: 90px;
    }
}

/* Conteneur principal */
.container {
    max-width: 1000px;
    margin: 2.5rem auto;
    padding: 0 1.5rem;
}

.action-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    background: var(--card-bg);
    padding: 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    align-items: center;
}

select {
    padding: 0.65rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    background-color: #fff;
    color: var(--text-color);
    outline: none;
    flex-grow: 1;
    max-width: 350px;
}

select:focus {
    border-color: var(--primary-color);
}

#btn-ouvrir-ajout,.btn{
    display: none;
}


/* Tableaux */

.table-container {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    width: 100%;
    height: 560px;
    overflow-y: auto;
    position: relative; /* Indispensable pour positionner le bouton à l'intérieur */
   /* Hauteur fixe ou maximale pour activer le scroll */
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom:30px,
}

@media ( max-width:1366px) {
    .table-container {
        height: 700px;
    }
}

.table-container::-webkit-scrollbar {
    width: 8px;  /* Largeur de la barre verticale */
    height: 8px; /* Hauteur de la barre horizontale */
  }
  
  .table-container::-webkit-scrollbar-track {
    background: #f1f5f9; /* Couleur de fond de la piste */
    border-radius: 4px;
  }
  
  .table-container::-webkit-scrollbar-thumb {
    background: var(--vert-amende); /* Couleur du curseur (la partie qu'on déplace) */
    border-radius: 4px;
  }
  
  .table-container::-webkit-scrollbar-thumb:hover {
    background:var(--vert-claire); /* Couleur du curseur au survol de la souris */
  }

thead{
    max-width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th, td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
}

@media (max-width:850px) {
   th, td{
        font-size: 0.7rem;
    }
}

th {
    background-color: #f1f5f9;
    font-weight: 600;
    color: #475569;
    
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: #f8fafc;
}

@media screen and (max-width: 600px) {
    table, thead, tbody, th, td, tr {
      display: block; /* Transforme les éléments du tableau en blocs */
      width: 100%;
    }
    
    /* Masquer l'en-tête classique */
    thead tr {
      position: absolute;
      top: -9999px;
      left: -9999px;
    }
    
    tr {
      margin-bottom: 15px;
      border: 1px solid #ccc;
      text-align: left;
    }
    
    td {
      text-align: left;
      position: relative;
      /*padding-left: 50%; /* Laisse de la place pour le libellé *//*url(index.php)*/
    }
    
    /* Affiche le contenu de l'attribut data-label comme en-tête à gauche */
    td::before {
      content: attr(data-label);
      position: absolute;
      left: 10px;
      font-weight: bold;
      /*text-align: left;*/
    }
  }

/* Modale douce */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius);
    width: 100%;
    max-width: 500px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
#modal-palmares .modal-content {
    pointer-events: auto;
}

.modal-content::-webkit-scrollbar {
    width: 8px;  /* Largeur de la barre verticale */
    height: 8px; /* Hauteur de la barre horizontale */
  }
  
  .modal-content::-webkit-scrollbar-track {
    background: #f1f5f9; /* Couleur de fond de la piste */
    border-radius: 4px;
  }
  
  .modal-content::-webkit-scrollbar-thumb {
    background: var(--vert-amende); /* Couleur du curseur (la partie qu'on déplace) */
    border-radius: 4px;
  }
  
  .modal-content::-webkit-scrollbar-thumb:hover {
    background:var(--vert-claire); /* Couleur du curseur au survol de la souris */
  }


.modal-content h3 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    color: #1e293b;
}

.coureur-survol {
    cursor: pointer;
    color: var(--primary-color);
    font-weight: 600;
    transition: opacity 0.2s;
}
.coureur-survol:hover {
    opacity: 0.75;
    text-decoration: underline;
}

/* Styles pour les tableaux de la modale de palmarès */
.palmares-section {
    margin-bottom: 1.25rem;
}
.palmares-section h4 {
    font-size: 0.95rem;
    color: #475569;
    margin-bottom: 0.5rem;
    border-left: 3px solid var(--primary-color);
    padding-left: 0.5rem;
}
.palmares-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
   
}
.palmares-table th, .palmares-table td {
    padding: 0.4rem 0.75rem;
    border-bottom: 1px solid #f1f5f9;
}
.palmares-totaux {
    display: flex;
    gap: 1rem;
    background: #f8fafc;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: 1rem;
    justify-content: space-around;
}

/* Style de base pour les modales */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}



/* Paramétrage spécifique pour la modale de palmarès au survol */

#modal-palmares {
    display: none; /* Masquée par défaut */
    background-color: rgba(15, 23, 42, 0.2); /* Fond plus léger pour voir le tableau derrière */
    pointer-events: none; /* Empêche la modale de bloquer le curseur de la souris */
}

/* Permet de réactiver les interactions si besoin à l'intérieur de la boîte de dialogue */

/* bouton ancre */

.scroll-to-top-btn {
    position: sticky;
    bottom: 20px;
    float: right;
    margin-right: 20px;
    margin-bottom: 10px;
    z-index: 10;
    
    /* Dimensions et forme ronde */
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background-color:var(--vert-claire);
    color: #ffffff;
    border: none;
    cursor: pointer;
    
    /* Centrage de l'icône SVG */
    display: flex;
    align-items: center;
    justify-content: center;
    
    /* Style et animations */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.scroll-to-top-btn:hover {
    background-color:var(--vert-amende);
    transform: scale(1.05);
}

.scroll-to-top-btn:active {
    transform: scale(0.95);
}


footer {
    text-align: center;
    width: 100%;
    padding: 20px;
    background: var(--vert-claire);
    color:var(--text-color);
    margin-top: 20px;
    margin-bottom: 0%;
  }