/* --- 1. CORE & FIX CADRAGE MOBILE --- */
* {
  box-sizing: border-box;
  /* Indispensable pour éviter que le padding fasse déborder */
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: Arial, sans-serif;
  background: #000;
  color: #fff;
  position: relative;
  max-width: 100%;
  /* Empêche le débordement horizontal */
  overflow-x: hidden;
  /* Coupe ce qui dépasse à droite */
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)),
    url("/app/assets/img/backgrounds/fond-archer.png");
  background-size: cover;
  background-position: 60% center;
  z-index: -1;
  pointer-events: none;
}

/* --- 2. TYPOGRAPHIE & ÉLÉMENTS COMMUNS --- */
h1 {
  margin: 0;
  color: orange;
  text-align: center;
  padding: 15px 0;
}

h2 {
  color: orange;
  margin-top: 0;
  border-left: 4px solid orange;
  padding-left: 10px;
  font-size: 1.2em;
}

h3 {
  color: #ffb347;
  margin-top: 20px;
  font-size: 1em;
}

section.card {
  background: rgba(17, 17, 17, 0.9);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

header {
  text-align: center;
  padding: 20px;
  background:
    linear-gradient(rgba(175, 0, 0, 0.45), rgba(150, 0, 0, 0.7)),
    url("/app/assets/img/backgrounds/fond-archer.png");
  background-repeat: no-repeat;
  background-position: 60% center;
  background-size: cover;
  border-bottom: 1px solid #222;
  width: 100%;
}

.logo {
  width: 150px;
  margin-bottom: 10px;
}

main {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding-bottom: 100px;
  padding-top: 80px;
  width: 100%;
}

/* --- 3. BOUTONS & NAVIGATION --- */
.btn {
  background: orange;
  color: #000;
  padding: 15px;
  text-align: center;
  text-decoration: none;
  font-size: 12px;
  border-radius: 8px;
  font-weight: bold;
}

.btn:hover {
  background: #ffb347;
}

.btn-reset {
  margin-top: auto;
  padding: 8px;
  background: orange;
  color: #111;
  border: none;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
}

.back {
  color: orange;
  text-decoration: none;
  display: inline-block;
  margin-bottom: 10px;
  font-size: 14px;
}

.info {
  font-size: 14px;
  opacity: 0.8;
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #111;
  display: flex;
  justify-content: space-around;
  padding: 10px 0;
  z-index: 10000;
  border-top: 1px solid #333;
}

.bottom-nav a {
  color: orange;
  font-size: 24px;
  text-decoration: none;
}

/* --- 4. SECTIONS PROJET (CONSERVÉES) --- */
.new-mandat {
  background-color: rgba(255, 165, 0, 0.15) !important;
  border-left: 5px solid orange;
}

.new-mandat td:last-child a {
  font-weight: bold;
  animation: pulse 1.5s infinite;
}

.mandat-nouveau {
  border-left: 5px solid #e63946;
  background-color: #fff4f4;
  animation: pulse 1.2s ease-in-out 2;
}

.mandat-nouveau::before {
  content: "NOUVEAU";
  font-size: 0.7rem;
  font-weight: bold;
  color: white;
  background: #e63946;
  padding: 2px 6px;
  margin-right: 6px;
  border-radius: 4px;
  display: inline-block;
}

.container {
  max-width: 1100px;
  margin: auto;
}


.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 30px;
}

.card {
  background: #222;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.stat-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 0.9em;
}

.podium-box {
  background: #1a1a1a;
  padding: 10px;
  border-radius: 8px;
  margin-top: 15px;
  border: 1px solid #333;
}

.podium-item {
  font-size: 0.85em;
  padding: 5px 0;
  border-bottom: 1px solid #222;
}

.medal {
  margin-right: 8px;
  font-size: 1.1em;
}

.global-section {
  margin-top: 50px;
  margin-bottom: 150px;
  background: #1a1a1a;
  padding: 30px;
  border-radius: 15px;
  border: 1px solid orange;
}

.award-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.award-card {
  padding: 20px;
  border-radius: 10px;
  text-align: center;
  color: white;
}

@keyframes pulse {
  0% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }

  100% {
    opacity: 1;
  }
}

.index-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 20px;
  padding: 20px;
}

.tile {
  background-color: #222;
  color: #fff;
  border-radius: 12px;
  padding: 25px 10px;
  text-align: center;
  transition: 0.2s;
}

.tile:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 15px rgba(255, 165, 0, 0.4);
}

/* --- 5. TABLES & FILTRES --- */
.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  padding: 12px;
  background: #111;
  position: sticky;
  top: 0;
  z-index: 9999;
  border-bottom: 1px solid #333;
  width: 100%;
}

.filter-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85em;
}

.filter-item select,
.filter-item input {
  padding: 6px;
  background: #222;
  color: orange;
  border: 1px solid #333;
  border-radius: 6px;
}

/* La table classique */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 80px;
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid #333;
}

th {
  background-color: #222;
  color: orange;
  cursor: pointer;
}

/* Styles .tg conservés */
.tg {
  border-collapse: collapse;
  border-spacing: 0;
  margin: 0px auto;
}

.tg td {
  background-color: #fff;
  color: #333;
  font-size: 14px;
  padding: 0px 35px;
  border: 1px solid #aaa;
}

.tg th {
  background-color: #f38630;
  color: #fff;
  font-size: 14px;
  padding: 0px 35px;
  border: 1px solid #aaa;
}

/* --- 6. AGENDA & COMPÉTITIONS OPTIMISÉES --- */
.tile-agenda {
  background: rgba(34, 34, 34, 0.9);
  border-radius: 12px;
  padding: 15px;
  margin-bottom: 12px;
  border-left: 5px solid #64748b;
  transition: 0.2s;
}

.tile-agenda.club {
  border-left-color: #FFD700 !important;
}

.tile-agenda.ecoles {
  border-left-color: #3498db !important;
}

/* Changé en bleu pour distinction */
.tile-agenda.prepa_compet {
  border-left-color: #ff9800 !important;
}

.date-separator {
  margin-top: 25px;
  margin-bottom: 10px;
  color: orange;
  font-weight: bold;
  border-bottom: 1px solid #333;
  padding-bottom: 5px;
}

.mandat-link {
  display: inline-block;
  background: orange;
  color: #000 !important;
  padding: 8px 12px;
  border-radius: 6px;
  font-weight: bold;
  text-decoration: none;
}

/* --- 7. RESPONSIVE MOBILE (PIXEL 9 PRO XL & CO) --- */
@media (max-width: 768px) {
  main {
    padding: 10px;
    padding-bottom: 100px;
  }

  /* On transforme la table de compétition en CARTES pour éviter le scroll droit */
  #competitions-table thead {
    display: none;
  }

  #competitions-table,
  #competitions-table tbody,
  #competitions-table tr,
  #competitions-table td {
    display: block;
    width: 100%;
  }

  #competitions-table tr {
    margin-bottom: 15px;
    border: 1px solid #333;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(20, 20, 20, 0.8);
  }

  #competitions-table td {
    text-align: left;
    padding: 10px 15px;
    border: none;
    border-bottom: 1px solid #222;
  }

  #competitions-table td::before {
    content: attr(data-label);
    color: orange;
    display: block;
    font-size: 0.7em;
    text-transform: uppercase;
    font-weight: bold;
  }

  #competitions-table td:last-child {
    background: #222;
    text-align: center;
    border-bottom: none;
    padding: 15px;
  }

  .tg {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    width: 100%;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 1.5em;
  }

  body {
    font-size: 16px;
  }

  /* Texte un peu plus grand pour lisibilité */
  .filters {
    grid-template-columns: 1fr 1fr;
  }

  .filter-item:first-child {
    grid-column: span 2;
  }

  /* Barre recherche pleine largeur */
}

/* Badge de catégorie orange */
.tile-agenda.prepa_compet .badge {
  background-color: #ff9800;
  color: #000;
  /* Texte noir sur fond orange pour le contraste */
  font-weight: bold;
}

/* Style pour les événements passés */
.event-past {
  opacity: 0.5;
  /* Plus transparent */
  filter: grayscale(0.8);
  /* Presque en noir et blanc */
  border-left-style: dashed;
  /* Bordure en pointillés pour différencier */
}

/* Optionnel : un petit badge "Terminé" */
.past-badge {
  font-size: 10px;
  color: #94a3b8;
  text-transform: uppercase;
  margin-right: 10px;
}

/* Bouton retour en haut stylisé comme tes .btn */
#backToTop {
  position: fixed;
  bottom: 85px;
  /* Pour être au dessus de ta .bottom-nav */
  right: 20px;
  background: orange;
  color: #000;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  opacity: 0;
  visibility: hidden;
  transition: 0.3s;
  z-index: 1100;
}

#backToTop.show {
  opacity: 1;
  visibility: visible;
}

/* Badge "EN COURS" avec ton rouge notification */
.live-badge {
  background: #e63946;
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: bold;
  margin-right: 10px;
  animation: pulse 1.5s infinite;
  /* Utilise ton animation pulse existante */
}

.date-separator {
  margin-top: 25px;
  margin-bottom: 10px;
  color: orange;
  font-weight: bold;
  border-bottom: 1px solid #333;
  padding-bottom: 5px;
  text-transform: capitalize;
}

.badge-new {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 6px;
  font-size: 0.7em;
  font-weight: bold;
  color: #111;
  background-color: orange;
  border-radius: 8px;
  vertical-align: middle;
  margin-right: 6px;
}

/* Bouton individuel dans la tuile */
.add-single-btn {
  background: rgba(255, 165, 0, 0.2);
  border: 1px solid orange;
  color: orange;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: bold;
  font-size: 1.2em;
  transition: 0.2s;
  margin-left: 10px;
}

.add-single-btn:hover {
  background: orange;
  color: black;
}

/* On s'assure que le bouton "Tout télécharger" ressemble à tes autres boutons */
.btncal {
  background: orange;
  color: black;
  border: none;
  padding: 12px 20px;
  border-radius: 12px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

/* Petit bouton d'ajout individuel */
.add-single-btn {
  background: rgba(255, 165, 0, 0.15);
  border: 1px solid orange;
  color: orange;
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 0.9em;
  transition: 0.2s;
}

.add-single-btn:hover {
  background: orange;
  color: black;
}

/* Petit bouton à côté du compteur de résultats */
.btn-mini {
  background: orange;
  border: none;
  padding: 4px 10px;
  border-radius: 4px;
  color: black;
  font-size: 0.8em;
  font-weight: bold;
  cursor: pointer;
}

/* Ajustement pour le lien mandat */
.mandat-link {
  display: inline-block;
  background: orange;
  color: black !important;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 0.85em;
  font-weight: bold;
  text-decoration: none;
}

.badge-discipline {
  background: rgba(255, 165, 0, 0.1);
  color: #ffb347;
  border: 1px solid rgba(255, 165, 0, 0.3);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75em;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Optionnel : assombrir un peu les tuiles de résultats pour faire ressortir l'orange */
.tile-agenda {
  background: rgba(25, 25, 25, 0.9) !important;
  border-bottom: 1px solid #333;
}

.tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  justify-content: center;
}

.tab-btn {
  background: #222;
  color: orange;
  border: 1px solid orange;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
}

.tab-btn.active {
  background: orange;
  color: #000;
  font-weight: bold;
}

.stat-card {
  background: rgba(34, 34, 34, 0.9);
  border-radius: 12px;
  margin-bottom: 10px;
  border-left: 5px solid orange;
}

.grid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 15px;
}

.medal-icon {
  font-size: 1.2em;
  margin-right: 5px;
}

.badge-discipline {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.8em;
  font-weight: bold;
}

.accordion-item {
  margin-bottom: 10px;
  border: 1px solid #333;
  border-radius: 8px;
  overflow: hidden;
}

.accordion-header {
  background: #222;
  padding: 15px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}


.equipe-card {
  background: #222;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  border-left: 8px solid orange;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.rank-badge {
  background: orange;
  color: black;
  padding: 10px;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.2em;
}

.quota-in {
  color: #2ecc71;
  font-weight: bold;
}

/* Vert si qualifié */
.moyenne-label {
  font-size: 1.5em;
  color: white;
  font-weight: bold;
}

.discipline-header {
  color: orange;
  border-bottom: 2px solid orange;
  margin: 40px 0 20px;
  padding-bottom: 5px;
}

.info-update {
    text-align: center;
    margin-top: 40px;
    padding: 15px;
    font-size: 0.8em;
    color: #666;
    border-top: 1px solid #222;
    font-style: italic;
}

/* Conteneur pour mettre les boutons côte à côte */
.nav-buttons-row {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
    width: 100%;
}

/* Style spécifique pour les boutons bleus */
.btn-blue {
    background-color: #3498db !important; /* Bleu identique à ta discipline 'Salle' */
    color: #fff !important;
    flex: 1; /* Permet aux boutons d'avoir la même largeur */
    display: flex;
    flex-direction: column; /* Icône au dessus du texte */
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 10px 5px !important;
    font-size: 11px !important;
    border: 1px solid rgba(255, 255, 255, 0.2);
    min-height: 60px;
}

.btn-blue span {
    font-size: 1.4em;
}

.btn-blue:hover {
    background-color: #2980b9 !important;
    transform: translateY(-2px);
    transition: 0.2s;
}

/* Ajustement mobile : si l'écran est trop petit, on peut les passer sur deux lignes ou réduire le texte */
@media (max-width: 480px) {
    .btn-blue {
        font-size: 10px !important;
        padding: 8px 2px !important;
    }
}

/* Container pour gérer l'alignement du header */
.header-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center; /* Centre le titre */
    min-height: 60px;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
}

/* Style du bouton retour "flottant" à gauche */
.back-button {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 165, 0, 0.2); /* Fond orange très léger */
    color: orange !important;
    text-decoration: none;
    padding: 8px 15px;
    border-radius: 8px;
    border: 1px solid orange;
    font-weight: bold;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    z-index: 10;
}

.back-button:hover {
    background: orange;
    color: #000 !important;
}

.back-button .icon {
    font-size: 1.2em;
}

/* Ajustement pour mobile pour éviter que le titre et le bouton se chevauchent */
@media (max-width: 600px) {
    .header-container {
        flex-direction: column;
        padding-top: 10px;
    }
    
    .back-button {
        position: static; /* Redevient un élément normal sur petit mobile */
        transform: none;
        margin-bottom: 10px;
        align-self: flex-start;
    }
    
    header h1 {
        font-size: 1.2em;
    }
}

.filter-container {
    background: rgba(20, 20, 20, 0.8);
    padding: 15px;
    border-radius: 12px;
    margin: 10px 20px 20px 20px;
    border: 1px solid #333;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.9em;
    color: #ccc;
    background: #222;
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid #444;
    transition: 0.3s;
}

.filter-checkbox input {
    margin-right: 8px;
    accent-color: orange;
}

.filter-checkbox:hover {
    border-color: orange;
}

/* Style quand la case est cochée (optionnel via JS ou sélecteur adjacent) */
.filter-checkbox.active {
    border-color: orange;
    background: rgba(255, 165, 0, 0.1);
}

/* Conteneur principal des actus */
.news-container {
    width: 100%;
    grid-column: 1 / -1; /* Permet de prendre toute la largeur si vous utilisez un CSS Grid pour les tuiles */
    margin-bottom: 20px;
    padding: 0 10px;
}

.news-container h2 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: orangered;
}

/* Liste défilante horizontale pour ne pas prendre trop de place verticale */
.news-list {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding-bottom: 10px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

/* Masquer la barre de défilement sur les navigateurs modernes */
.news-list::-webkit-scrollbar {
    display: none;
}

/* Carte d'un article */
.news-card {
    flex: 0 0 75%; /* Largeur de la carte (75% de l'écran pour deviner la suivante) */
    scroll-snap-align: start;
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: transform 0.2s;
}

.news-card:active {
    transform: scale(0.98);
}

/* Image miniature */
.news-thumb {
    width: 100%;
    height: 120px;
    background-size: cover;
    background-position: center;
}

/* Contenu textuel */
.news-content {
    padding: 12px;
}

.news-date {
    font-size: 0.8rem;
    color: #888;
    text-transform: uppercase;
    font-weight: bold;
}

.news-title {
    font-size: 0.95rem;
    margin: 5px 0 0 0;
    color: #222;
    display: -webkit-box;
    /* Standard property for compatibility */
    line-clamp: 2;
    -webkit-line-clamp: 2; /* Coupe le texte après 2 lignes */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Séparateur */
.separator {
    grid-column: 1 / -1;
    border: 0;
    border-top: 1px solid #eee;
    margin: 10px 10px 25px 10px;
}