:root {
  --f1-red:    #e10600;
  --f1-black:  #1b1b1b;
  --f1-white:  #ffffff;
  --f1-grey:   #2e2e2e;
  --f1-shadow: rgba(0,0,0,0.5);
  --f1-font:   'Segoe UI', sans-serif;
}

/* ===== GLOBAL ===== */
body {
  background: #f3f3f3;
  font-family: var(--f1-font);
  color: var(--f1-white);
}

h4, h5 {
  font-weight: 600;
  text-transform: uppercase;
}

/* ===== F1 CARD ===== */
.f1-card {
  display: flex;
  flex-direction: column;
  background: var(--f1-grey);
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 1rem 2rem var(--f1-shadow);
}

.f1-card .f1-card-header {
  position: relative;
  background: var(--f1-red);
  padding: 1rem;
  text-align: center;
  font-size: 1rem;
}

.f1-card .f1-card-header::after {
  /* damier en bas du header */
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 6px;
  background:
    repeating-linear-gradient(
      90deg,
      var(--f1-white) 0 10px,
      var(--f1-black) 10px 20px
    );
}

.f1-card .f1-card-body {
  padding: 1.5rem;
  flex: 1;
}

/* ===== SIDEBAR LAYOUT ===== */
.container.my-5 > .row {
  display: flex;
  gap: 1rem;
}

aside.col-auto {
  flex: 0 0 auto;
}

section.col {
  flex: 1;
}

/* ===== PILOTE BLOCK ===== */
.f1-profile .f1-card {
  /* on masque tout ce qui dépasse, et on garde l’arrondi du parent */
  overflow: hidden;
}

.f1-profile .f1-card-header {
  /* force full width dans le flex container */
  width: 100%;
  /* enlève l’arrondi sur le header pour que la carte gère l’angle */
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

aside .avatar {
  display: block;
  width: 80px;
  height: 80px;
  margin: 0 auto .75rem;
  object-fit: cover;
  border: 3px solid var(--f1-white);
  border-radius: 50%;
  cursor: pointer;
}

aside h5 {
  text-align: center;
  margin-bottom: .5rem;
  color: var(--f1-red);
}

aside textarea.form-control {
  width: 100%;
  background: var(--f1-black);
  color: var(--f1-white);
  border: none;
  border-radius: .5rem;
  resize: none;
}

aside select.form-select,
aside input.form-control {
  width: 100%;
  font-size: .875rem;
  border-radius: .5rem;
}

aside button.btn {
  width: 100%;
  margin-top: .5rem;
}

/* centre le texte du Mot du Pilote */
#motPilote {
  text-align: center;
}
/* ==== Blocs ELO / TrueSkill ==== */
.stat-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--f1-grey);
  border-radius: 1rem;
  box-shadow: 0 1rem 2rem var(--f1-shadow);
  padding: 1.5rem;
  cursor: pointer;
}

.stat-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--f1-red);
  margin-bottom: .5rem;
}

.stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--f1-white);
}
.stat-block {
  cursor: pointer;
  /* ... reste de tes styles ... */
}
/* ==== Bloc Dernières Courses ==== */
#last-races-list .last-race-item {
  display: grid;
  grid-template-columns: auto 1fr auto auto auto;
  gap: 1rem;
  align-items: center;
  background: var(--f1-grey);
  border: none;
  border-radius: .5rem;
  margin-bottom: .5rem;
  padding: .75rem 1rem;
  box-shadow: 0 .3rem .6rem var(--f1-shadow);
}

#last-races-list .position {
  color: var(--f1-red);
  font-weight: 700;
  min-width: 2rem;
  text-align: center;
}

#last-races-list .circuit,
#last-races-list .date,
#last-races-list .essai,
#last-races-list .nb-pilotes {
  color: var(--f1-white);
  font-weight: 700;
  white-space: nowrap;
}

#last-races-list .circuit {
  overflow: hidden;
  text-overflow: ellipsis;
}

#last-races-list .nb-pilotes::after {
  content: ' pilotes';
  font-weight: 400;
}
/* ==== Bloc Garage / Galerie ==== */
.garage-block {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* conteneur des vignettes */
.garage-images {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* chaque slot s’ajuste à l’image */
.garage-images .img-slot {
  position: relative;
  width: 150px;
  /* on supprime height fixe pour laisser l’image définir la hauteur */
  background: var(--f1-grey);
  border-radius: .5rem;
  overflow: hidden;
  box-shadow: 0 .3rem .6rem var(--f1-shadow);
  cursor: pointer;
}

/* vignette : afficher l’image entière */
.garage-images .img-slot img {
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
}
/* ==== Bloc Garage largeur auto pour 3 vignettes ==== */
.garage-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  /* largeur auto pour col-auto */
}

.garage-images {
  display: inline-flex;    /* wrap des slots sur une ligne */
  gap: 1rem;
  flex-wrap: nowrap;
}

.garage-images .img-slot {
  width: 120px;            /* ou la taille que tu souhaites */
  /* plus de height fixe : auto selon l’image */
}
/* Bloc Championnats en cours */
#championship-card {
  display: block; /* s’assurer que l’ensemble est cliquable */
}

#championship-card .list-group-item {
  background: var(--f1-grey);
  border: none;
  border-radius: .5rem;
  margin-bottom: .5rem;
  padding: .75rem 1rem;
  box-shadow: 0 .3rem .6rem var(--f1-shadow);
  color: var(--f1-white);
  font-weight: 700;
}

#championship-card .list-group-item:hover {
  background: rgba(255,255,255,0.1);
}
/* le lien‐carte couvre tout le body */
#championship-link {
  display: block;
  cursor: pointer;
}

/* on reprend le style de tes autres list‐groups */
#championship-link .list-group-item {
  background: var(--f1-grey);
  border: none;
  border-radius: .5rem;
  margin: .5rem 1rem;
  padding: .75rem 1rem;
  box-shadow: 0 .3rem .6rem var(--f1-shadow);
  color: var(--f1-white);
  font-weight: 700;
}

#championship-link .list-group-item:hover {
  background: rgba(255,255,255,0.1);
}

#palmares-card .f1-card-body {
  min-height: 5rem;      /* fixe une hauteur si tu veux homogénéiser */
  display: flex;
  align-items: center;
  justify-content: center;
}
#palmares-card .avenir {
  color: var(--f1-white);
  font-weight: 700;
}

/* 1. Centre les vignettes du Garage */
.garage-block {
  align-items: center;    /* centre horizont. le conteneur .garage-images */
}

/* 2. Formulaire Profil en flex-col sur toute la hauteur */
aside.f1-profile .f1-card-body form {
  display: flex;
  flex-direction: column;
  height: 100%;           /* prend toute la hauteur du body */
}

/* 3. Centre ‘Mot du Pilote’ verticalement */
#motPilote {
  margin: auto 0;         /* espace égal au-dessus et en-dessous */
  text-align: center;
}

/* 4. Groupe bas de form — logo / nom / select / bouton poussé en bas */
aside.f1-profile .profile-footer {
  margin-top: auto;       /* pousse ce bloc en bas */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  width: 100%;
}
/* double taille avatar pilote et logo écurie */
aside .avatar {
  width: 160px;
  height: 160px;
  margin-bottom: 1rem;
}

/* label Mot du Pilote juste au-dessus de la textarea */
aside.f1-profile label[for="motPilote"] {
  margin-bottom: 0.25rem;
}

/* textarea centrée verticalement dans le form */
aside.f1-profile #motPilote {
  margin: auto 0;
  text-align: center;
}

/* le footer du profil reste en bas */
aside.f1-profile .profile-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}
/* Centre le libellé et supprime l’espace en dessous */
aside.f1-profile label[for="motPilote"] {
  display: block;       /* pour que text-align fonctionne */
  width: 100%;
  text-align: center;
  margin-bottom: 0;     /* plus de marge sous le label */
}



/* ==== Lecture seule du profil only ==== */
body.readonly aside.f1-profile button,
body.readonly aside.f1-profile input,
body.readonly aside.f1-profile select,
body.readonly aside.f1-profile textarea {
  pointer-events: none;
  user-select: none;
  opacity: 0.6;
}

/* Masquer seulement les submit/file du profil */
body.readonly aside.f1-profile button[type="submit"],
body.readonly aside.f1-profile input[type="file"] {
  display: none;
}

#championship-card .list-group-item {
  background: var(--f1-grey);
  border: none;
  border-radius: .5rem;
  margin: .5rem 1rem;
  padding: .75rem 1rem;
  box-shadow: 0 .3rem .6rem var(--f1-shadow);
  color: var(--f1-white);
  font-weight: 700;
}

/* Modal Recherche Pilote uniquement */
#searchModal .modal-content {
  background: var(--f1-dark);
  color: var(--f1-white);
}

#searchModal .modal-body {
  color: var(--f1-white);
}
/* Remettre un style normal pour le modal de login */
#loginModal .modal-content {
  background: #fff !important;
  color: #000 !important;
}

#loginModal .modal-body {
  color: #000 !important;
}
#loginModal .form-label,
#loginModal .form-control,
#loginModal .btn {
  color: inherit !important;
}
/* Style pour les lignes de courses à venir */
.champ-next-race {
  margin-left: 1rem;
  font-size: 0.875rem;   /* un peu plus petit */
  color: var(--f1-gray); /* ou une nuance discrète */
  line-height: 1.3;
}
/* Pour le textarea (saisie) */
textarea {
  white-space: pre-wrap;        /* respecte les retours à la ligne */
  overflow-wrap: break-word;    /* coupe les mots si besoin */
  word-break: break-all;        /* pour garantir le retour, même au milieu d’un mot */
}

/* Pour l’affichage en lecture seule */
.citation-display {
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: break-all;
}
.js-champ-schedule:hover {
  background-color: var(--f1-red-light);
}
.champ-next-race {
  margin-left: 1rem;
  font-size: 0.875rem;
  color: var(--f1-gray);
  line-height: 1.3;
}
/* ============================
   THEMES GRID (remplace existant)
   ============================ */

/* Forcer container en grille 3 colonnes (prioritaire) */
#themesContainer {
  box-sizing: border-box !important;
}
#themesContainer.grid-3 {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 0.5rem !important;
  align-items: stretch !important;
  grid-auto-rows: 1fr !important;
  width: 100% !important;
}

/* Neutraliser les classes Bootstrap flex-column si présentes */
#themesContainer.d-flex,
#themesContainer.flex-column,
#themesContainer.d-flex.flex-column {
  display: grid !important;
}

/* Tuile : flex pour centrage — laisser le contenu grandir en multi‑lignes */
#themesContainer.grid-3 .theme-tile {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 1rem !important;
  min-height: 72px !important;
  height: auto !important;
  box-sizing: border-box !important;
  border-radius: 8px !important;
  border: 1px solid rgba(255,255,255,0.08) !important;
  background: rgba(255,255,255,0.02) !important;
  color: #fff !important;
  font-size: 0.98rem !important;
  line-height: 1.2 !important;
  cursor: pointer !important;
  width: 100% !important;
  text-align: center !important;
}

/* Wrapper interne pour le texte — cible prioritaire pour supprimer clamp/ellipsis */
#themesContainer.grid-3 .theme-tile > .theme-text {
  display: inline-block !important;
  width: 100% !important;
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  -webkit-line-clamp: unset !important;
  -webkit-box-orient: unset !important;
  display: block !important;
  max-height: none !important;
  height: auto !important;
  word-break: break-word !important;
  overflow-wrap: anywhere !important;
  text-align: center !important;
  padding: 0 !important;
}

/* Si tuiles contiennent boutons/anchors, forcer multi‑lignes */
#themesContainer.grid-3 .theme-tile button,
#themesContainer.grid-3 .theme-tile .btn,
#themesContainer.grid-3 .theme-tile a {
  display: block !important;
  width: 100% !important;
  white-space: normal !important;
  overflow: visible !important;
  height: auto !important;
  max-height: none !important;
  text-overflow: clip !important;
}

/* Override ciblé pour annuler règles inline clamp */
#themesContainer.grid-3 .theme-tile *[style*="-webkit-line-clamp"],
#themesContainer.grid-3 .theme-tile *[style*="-webkit-box"] {
  -webkit-line-clamp: unset !important;
  display: block !important;
}

/* Hover / focus */
#themesContainer.grid-3 .theme-tile:hover,
#themesContainer.grid-3 .theme-tile:focus {
  background: rgba(255,255,255,0.06) !important;
  transform: translateY(-2px);
}

/* Responsive : 1 colonne sur petit écran */
@media (max-width: 576px) {
  #themesContainer.grid-3 {
    grid-template-columns: repeat(1, 1fr) !important;
  }
  #themesContainer.grid-3 .theme-tile {
    padding: 0.6rem !important;
    min-height: 56px !important;
    font-size: 0.92rem !important;
  }
}

/* Large screens slight increase */
@media (min-width: 1200px) {
  #themesContainer.grid-3 .theme-tile {
    min-height: 84px !important;
    padding: 1.1rem !important;
  }
}
/* Catalogue voitures */
#carsCatalogContainer.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  align-items: start;
}
.car-tile {
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:flex-start;
  padding:0.8rem;
  background: rgba(255,255,255,0.02);
  border:1px solid rgba(255,255,255,0.06);
  border-radius:8px;
  cursor:pointer;
  box-sizing:border-box;
  height:100%;
}
.car-tile img {
  width:100%;
  height:96px;
  object-fit:cover;
  border-radius:6px;
  margin-bottom:0.5rem;
}
.car-tile .car-name {
  font-weight:600;
  font-size:0.95rem;
  text-align:center;
  word-break:break-word;
}
.car-tile .car-meta {
  font-size:0.85rem;
  color: rgba(255,255,255,0.65);
  margin-top:0.25rem;
}
.car-tile:focus, .car-tile:hover {
  transform:translateY(-3px);
  background: rgba(255,255,255,0.035);
}
.car-tile img, .img-slot img {
  width: 100%;
  height: 96px;
  object-fit: cover; /* change en contain si tu préfères voir l'intégralité de l'image */
  display: block;
  border-radius: 6px;
  background: #0b0b0b;
}


@media (max-width:576px) {
  #carsCatalogContainer.grid-3 { grid-template-columns: repeat(1, 1fr); }
  .car-tile img { height:72px; }
}
/* conservation de la transparence des GIF/PNG */
#garage-images .img-slot img,
.cars-grid .car-tile img,
.car-tile img {
  background: transparent !important;
  background-color: transparent !important;
  display: block;
  margin: 0 auto;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

/* optionnel : léger padding autour des vignettes */
.car-tile, #garage-images .img-slot {
  background-color: transparent;
  padding: 6px;
  border-radius: 6px;
}
