/* Feuille volontairement courte : le site est un carnet de reservations, pas
   une vitrine. Aucun framework, aucune etape de build. */

:root {
  --terre-cuite: #c1440e;
  --terre-cuite-fonce: #8b2f00;
  --or: #ffd700;
  --texte: #333;
  --texte-clair: #666;
  --bordure: #e0e0e0;
  --fond: #f9f9f9;
  --libre: #e8f5e9;
  --occupe: #ffecec;
  --mien: #fff5e6;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--texte);
  background: var(--fond);
}

a { color: var(--terre-cuite); }
a:hover { color: var(--terre-cuite-fonce); }

.bandeau {
  background: linear-gradient(135deg, var(--terre-cuite) 0%, var(--terre-cuite-fonce) 100%);
  border-bottom: 3px solid var(--or);
  padding: 0 16px;
  display: flex; flex-wrap: wrap; gap: 12px;
  align-items: center; justify-content: space-between;
  min-height: 56px;
}
.bandeau .marque { color: #fff; font-weight: 700; text-decoration: none; letter-spacing: .3px; }
.bandeau nav { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.bandeau nav a { color: rgba(255,255,255,.92); text-decoration: none; }
.bandeau nav a:hover { color: #fff; text-decoration: underline; }
.bandeau form { margin: 0; }

main { max-width: 1100px; margin: 0 auto; padding: 20px 16px 40px; }
h1 { font-size: 1.6rem; margin: 0 0 4px; }
h2 { font-size: 1.2rem; margin: 28px 0 8px; }

.message { padding: 10px 14px; border-radius: 4px; margin: 0 0 16px; }
.succes { background: var(--libre); border-left: 4px solid #2f6b34; }
.alerte { background: var(--occupe); border-left: 4px solid var(--terre-cuite); }

.jour-nav { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 12px 0 18px; }
.jour-nav .date { font-size: 1.25rem; font-weight: 700; }

table.planning { width: 100%; border-collapse: collapse; background: #fff; }
table.planning th, table.planning td {
  border: 1px solid var(--bordure); padding: 0; text-align: center; vertical-align: middle;
}
table.planning thead th { background: #fff; border-bottom: 2px solid var(--texte); padding: 10px; }
table.planning th.heure { background: #f5f5f5; font-variant-numeric: tabular-nums; width: 72px; padding: 10px; }
table.planning td a, table.planning td span { display: block; min-height: 46px; padding: 12px 8px; }
td.libre   { background: var(--libre); }
td.libre a { color: #2f6b34; font-weight: 600; text-decoration: none; }
td.occupe  { background: var(--occupe); border-left: 4px solid var(--terre-cuite); text-align: left; }
td.mien    { background: var(--mien);   border-left: 4px solid var(--or); text-align: left; font-weight: 600; }
.marqueur { color: #b8860b; margin-right: 6px; }

.legende { display: flex; gap: 20px; flex-wrap: wrap; font-size: .9rem; color: var(--texte-clair); margin: 12px 0; }
.legende .pastille { display: inline-block; width: 24px; height: 16px; border-radius: 3px; vertical-align: -3px; margin-right: 6px; }

form .champ { margin-bottom: 14px; }
label { display: block; font-weight: 600; margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=date],
input[type=number], select, textarea {
  width: 100%; max-width: 420px; min-height: 44px;
  padding: 10px 12px; font-size: 1rem; line-height: 1.4;
  border: 1px solid var(--bordure); border-radius: 4px; background: #fff;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--terre-cuite);
  box-shadow: 0 0 0 3px rgba(193,68,14,.1);
}
button, .lien-bouton, input[type=submit] {
  min-height: 44px; padding: 10px 18px; font-size: 1rem; font-weight: 600;
  border: none; border-radius: 4px; cursor: pointer;
  background: linear-gradient(135deg, var(--terre-cuite) 0%, var(--terre-cuite-fonce) 100%);
  color: #fff;
}
.lien-bouton { background: none; color: rgba(255,255,255,.92); padding: 0; font-weight: 400; min-height: 0; }
.lien-bouton:hover { text-decoration: underline; }
.secondaire { background: #fff; color: var(--texte); border: 1px solid var(--bordure); }

table.liste { width: 100%; border-collapse: collapse; background: #fff; }
table.liste th, table.liste td { border: 1px solid var(--bordure); padding: 8px 10px; text-align: left; }
table.liste th { background: #f5f5f5; }
table.liste tr:nth-child(even) td { background: #fcfcfc; }

.erreurs { background: var(--occupe); border-left: 4px solid var(--terre-cuite); padding: 12px 16px; margin-bottom: 16px; }
.erreurs ul { margin: 6px 0 0; padding-left: 20px; }

.discret { color: var(--texte-clair); font-size: .9rem; }
.jauge { display: flex; gap: 4px; max-width: 200px; margin: 6px 0 14px; }
.jauge div { height: 6px; flex: 1; border-radius: 3px; background: var(--bordure); }
.jauge div.plein { background: var(--terre-cuite); }

.carte { background: #fff; border: 1px solid var(--bordure); border-left: 5px solid var(--terre-cuite); border-radius: 4px; padding: 16px 20px; margin-bottom: 16px; }

footer { border-top: 1px solid var(--bordure); margin-top: 40px; padding: 16px; text-align: center; font-size: .9rem; color: var(--texte-clair); }

@media (max-width: 700px) {
  table.planning th.heure { width: 52px; padding: 6px; }
  table.planning td a, table.planning td span { padding: 10px 4px; font-size: .85rem; }
}

/* --- bandeau graphique -------------------------------------------------
   Servi depuis WordPress en http:// jusqu'ici, donc bloque comme contenu
   mixte des que la page passe en https. Il est desormais dans le depot. */
.bandeau-image {
  display: block; width: 100%; overflow: hidden;
  background: #000; line-height: 0;
  transition: opacity .3s ease;
}
.bandeau-image:hover { opacity: .9; }
.bandeau-image img {
  display: block; width: 100%; height: auto;
  max-height: 200px; object-fit: cover;
}

/* Sous 768px l'ancien site masquait le bandeau : sur un telephone, 200px de
   hauteur repoussent le planning sous la ligne de flottaison. La barre de
   navigation joue seule ce role. */
@media (max-width: 768px) {
  .bandeau-image { display: none; }
}

/* --- barre d'administration -------------------------------------------- */
.barre-admin {
  background: #fff; border-bottom: 1px solid var(--bordure);
  padding: 8px 16px; font-size: .92rem;
  display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center;
}
.barre-admin a { text-decoration: none; color: var(--texte-clair); }
.barre-admin a:hover { color: var(--terre-cuite); text-decoration: underline; }
.barre-admin a.action { color: var(--terre-cuite); font-weight: 600; }

/* --- actions en tete de liste ------------------------------------------ */
.barre-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 14px 0 18px; }
.barre-actions form { margin: 0; }
.bouton-lien {
  display: inline-block; text-decoration: none; color: #fff !important;
  padding: 11px 18px; border-radius: 4px; font-weight: 600;
  background: linear-gradient(135deg, var(--terre-cuite) 0%, var(--terre-cuite-fonce) 100%);
}
.bouton-lien:hover { color: #fff !important; }
.bouton-lien.secondaire { background: #fff; color: var(--texte) !important; border: 1px solid var(--bordure); }
.actions-ligne { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.actions-ligne form { margin: 0; }
.actions-ligne button { min-height: 34px; padding: 5px 12px; font-size: .9rem; }

/* --- selection de membres ----------------------------------------------
   Remplace la double liste jQuery de 2011 : sur 959 fiches elle cachait la
   moitie des noms hors de l'ecran et ne tenait pas sur un telephone. */
.selection-membres { border: 1px solid var(--bordure); border-radius: 4px; background: #fff; margin-bottom: 16px; max-width: 700px; }
.selection-barre { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px; border-bottom: 1px solid var(--bordure); }
.selection-barre input[type=search] { flex: 1 1 180px; min-width: 0; max-width: none; }
.selection-barre button { min-height: 36px; padding: 6px 12px; font-size: .9rem; }
.selection-liste { max-height: 420px; overflow-y: auto; }
.ligne-membre { display: flex; gap: 10px; align-items: baseline; margin: 0; padding: 8px 12px; border-bottom: 1px solid #f0f0f0; font-weight: 400; }
.ligne-membre:nth-child(even) { background: #fcfcfc; }
.ligne-membre input[type=checkbox] { flex: 0 0 auto; width: 18px; height: 18px; min-height: 0; }
.ligne-membre span:first-of-type { flex: 1 1 auto; }

/* --- divers ------------------------------------------------------------ */
input[type=search], input[type=tel] {
  width: 100%; max-width: 420px; min-height: 44px;
  padding: 10px 12px; font-size: 1rem; line-height: 1.4;
  border: 1px solid var(--bordure); border-radius: 4px; background: #fff;
}
.carte.danger { border-left-color: #b00020; }
.champ.case { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.champ.case label { margin: 0; font-weight: 400; }
.champ.case input[type=checkbox] { width: 18px; height: 18px; min-height: 0; }
.champ.case p { flex-basis: 100%; margin: 2px 0 0; }
.bloc-copiable { width: 100%; max-width: 700px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; }
.choix-date { display: flex; gap: 6px; align-items: center; margin: 0; }
.choix-date input[type=date] { width: auto; min-width: 150px; min-height: 38px; padding: 4px 8px; }
.choix-date button { min-height: 38px; padding: 5px 12px; font-size: .9rem; }

/* --- reservation en masse ----------------------------------------------
   Le bleu de selection ne se confond avec aucune couleur du planning : vert
   libre, rouge pris, or pour ses propres parties. */
.barre-masse { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin: 0 0 12px; }
.barre-masse .bouton-lien.actif { background: #2b6cb0; border-color: #2b6cb0; color: #fff !important; }
table.planning.mode-masse td { cursor: crosshair; user-select: none; }
table.planning.mode-masse td a, table.planning.mode-masse td button { cursor: crosshair; }
td.masse-choisi, td.a-reserver { background: #dbeafe; box-shadow: inset 0 0 0 2px #2b6cb0; }
td.masse-choisi a { color: #1e4e8c; }
td.masse-conflit { background: repeating-linear-gradient(45deg, var(--occupe), var(--occupe) 6px, #f6c9bd 6px, #f6c9bd 12px); }
td.a-reserver span { color: #1e4e8c; font-weight: 600; }
.panneau-masse { margin-top: 16px; }
.panneau-masse [data-masse-resume] { font-weight: 600; }
.champs-horaire { display: flex; gap: 12px; flex-wrap: wrap; }
.champs-horaire .champ { flex: 0 1 140px; }
.cases-terrains { border: none; padding: 0; margin: 0 0 14px; }
.cases-terrains legend { font-weight: 600; margin-bottom: 4px; padding: 0; }
.cases-terrains label { display: inline-flex; align-items: center; gap: 6px; margin: 0 18px 6px 0; font-weight: 400; }
.cases-terrains input[type=checkbox] { width: 18px; height: 18px; min-height: 0; }

/* Calendrier : la case a cocher reste dans la page (clavier, lecteurs
   d'ecran) mais c'est le numero du jour qui se colore. */
.calendrier-jours { border: none; padding: 0; margin: 0 0 14px; }
.calendrier-jours legend { font-weight: 600; margin-bottom: 6px; padding: 0; }
.mois-liste { display: flex; flex-wrap: wrap; gap: 12px 20px; }
table.mois { border-collapse: collapse; background: #fff; font-size: .9rem; }
table.mois caption { font-weight: 600; text-align: left; padding: 0 0 4px; }
table.mois th { font-weight: 400; color: var(--texte-clair); width: 34px; padding: 2px 0; }
table.mois td { padding: 1px; text-align: center; }
table.mois label { display: block; margin: 0; font-weight: 400; cursor: pointer; position: relative; }
table.mois input[type=checkbox] { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; }
table.mois label span { display: block; width: 32px; line-height: 30px; border-radius: 4px; border: 1px solid transparent; }
table.mois td.weekend label span { background: #f3f3f3; }
table.mois td.aujourdhui label span { border-color: var(--terre-cuite); }
table.mois label:hover span { border-color: #2b6cb0; }
table.mois input:checked + span { background: #2b6cb0; color: #fff; font-weight: 600; }
table.mois input:focus-visible + span { box-shadow: 0 0 0 3px rgba(43,108,176,.35); }
table.mois input:disabled + span { color: #c8c8c8; background: none; cursor: default; }
table.mois label:has(input:disabled) { cursor: default; }
table.mois label:has(input:disabled):hover span { border-color: transparent; }
/* Deja pris pour les terrains et l'horaire choisis : une barre sous le
   numero, qui reste visible meme sur un jour coche. */
table.mois td.jour-partiel label span { background: #fff1dc; box-shadow: inset 0 -3px 0 #e08a00; }
table.mois td.jour-complet label span { background: #ffe0dc; box-shadow: inset 0 -3px 0 #c62828; color: #8e1c1c; }
table.mois td.jour-partiel input:checked + span { background: #2b6cb0; color: #fff; box-shadow: inset 0 -4px 0 #ffb74d; }
table.mois td.jour-complet input:checked + span { background: #2b6cb0; color: #fff; box-shadow: inset 0 -4px 0 #ff6b6b; }
.legende-calendrier { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 8px 0 0; }
.legende-calendrier .pastille { display: inline-block; width: 18px; height: 12px; border-radius: 2px; vertical-align: -1px; margin-right: 6px; }
.legende-calendrier .pastille.partiel { background: #fff1dc; box-shadow: inset 0 -3px 0 #e08a00; }
.legende-calendrier .pastille.complet { background: #ffe0dc; box-shadow: inset 0 -3px 0 #c62828; }
table.apercu-jours td.complet { background: #dbeafe; }
table.apercu-jours td.partiel { background: repeating-linear-gradient(45deg, #dbeafe, #dbeafe 6px, #eef4fd 6px, #eef4fd 12px); }
table.apercu-jours td.rien { color: var(--texte-clair); font-style: italic; }

/* --- rappel de la prochaine reservation --------------------------------- */
.rappel-reservation {
  background: var(--mien); border-bottom: 1px solid var(--bordure);
  border-left: 5px solid var(--or);
  padding: 9px 16px; font-size: .95rem;
  display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline;
}
.rappel-lien { text-decoration: none; color: var(--texte);
               display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; }
.rappel-lien:hover strong { text-decoration: underline; }
.rappel-reservation .etiquette { color: var(--texte-clair); text-transform: uppercase;
                                 font-size: .72rem; letter-spacing: .5px; }
.rappel-reservation .terrain { color: var(--texte-clair); }
.rappel-reservation .autres { margin-left: auto; font-size: .9rem; }

/* --- navigation par jour : trois boutons joints, comme l'ancien systeme --- */
.groupe-jours { display: inline-flex; }
.groupe-jours .bouton-jour {
  display: inline-block; text-decoration: none; white-space: nowrap;
  color: #fff; font-weight: 600; font-size: .95rem;
  padding: 10px 16px; line-height: 22px;
  background: linear-gradient(135deg, var(--terre-cuite) 0%, var(--terre-cuite-fonce) 100%);
  border: 1px solid var(--terre-cuite-fonce); border-right-width: 0;
}
.groupe-jours .bouton-jour:first-child { border-radius: 4px 0 0 4px; }
.groupe-jours .bouton-jour:last-child  { border-radius: 0 4px 4px 0; border-right-width: 1px; }
.groupe-jours .bouton-jour:hover { filter: brightness(1.1); color: #fff; }
.groupe-jours .bouton-jour.neutre {
  background: #fff; color: var(--texte); border-color: var(--bordure);
}
.groupe-jours .bouton-jour.neutre:hover { background: #f5f5f5; color: var(--texte); }
/* Deja sur aujourd'hui : le bouton reste en place mais n'appelle plus l'oeil. */
.groupe-jours .bouton-jour.actif { color: var(--texte-clair); cursor: default; }
/* Au bout de l'historique permis a un membre : « Veille » ne mene plus nulle part. */
.groupe-jours .bouton-jour.eteint,
.groupe-jours .bouton-jour.eteint:hover { opacity: .45; cursor: default; filter: none; }

@media (max-width: 520px) {
  .groupe-jours { width: 100%; }
  .groupe-jours .bouton-jour { flex: 1 1 0; text-align: center; padding: 10px 6px; }
}

/* --- choix d'un joueur : un seul champ ---------------------------------- */
.choix-joueur .combo { position: relative; max-width: 420px; }
.combo-champ { width: 100%; padding-right: 40px; }
.combo-effacer {
  position: absolute; top: 0; right: 0; width: 40px; height: 44px;
  background: none; border: none; color: var(--texte-clair);
  font-size: 1.4rem; line-height: 1; padding: 0; min-height: 44px;
}
.combo-effacer:hover { color: var(--terre-cuite); }
.combo-liste {
  position: absolute; z-index: 30; left: 0; right: 0; top: 100%;
  margin: 2px 0 0; padding: 0; list-style: none;
  background: #fff; border: 1px solid var(--bordure); border-radius: 4px;
  box-shadow: 0 6px 18px rgba(0,0,0,.14);
  max-height: 45vh; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
/* 44px de haut : la cible minimale confortable au pouce. */
.combo-liste li {
  padding: 12px 14px; min-height: 44px; cursor: pointer;
  border-bottom: 1px solid #f2f2f2;
}
.combo-liste li:last-child { border-bottom: none; }
.combo-liste li:hover, .combo-liste li.actif { background: var(--libre); }
.combo-liste li[aria-selected="true"] { font-weight: 600; }
.combo-vide { color: var(--texte-clair); cursor: default; }
.combo-vide:hover { background: none; }

/* --- ecrans etroits : ce qui casse a 360px ------------------------------
   Aucun de ces defauts ne se voit sur un ecran de bureau. */

@media (max-width: 700px) {
  /* Les tableaux de listes montent a cinq colonnes, boutons compris. Sans
     conteneur ils elargissent la page entiere : c'est le defilement
     horizontal parasite que l'on retrouve sur la moitie des sites. On les
     fait defiler dans leur propre boite. `display: block` est ce qui rend
     `overflow-x` operant sur un <table> ; l'alignement des colonnes est
     conserve. */
  table.liste {
    display: block; overflow-x: auto; -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }

  /* Neuf liens d'administration se replieraient sur cinq lignes et
     repousseraient le planning hors de l'ecran. Une seule ligne qui defile
     au doigt, comme une barre d'onglets. */
  .barre-admin {
    flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    gap: 14px; padding: 8px 12px;
  }
  .barre-admin a { white-space: nowrap; }

  /* Une adresse longue ne doit pas elargir sa colonne. */
  table.liste td a[href^="mailto:"] { word-break: break-all; white-space: normal; }

  .rappel-reservation .autres { margin-left: 0; }
}

/* Filet de securite pour le planning : trois terrains tiennent a 360px, un
   quatrieme emprunte au club voisin ne tiendrait plus. */
@media (max-width: 480px) {
  table.planning { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* Appareils tactiles : ramener les cibles trop petites a 44px. Le pointeur
   fin d'une souris s'accommode de 34px, pas un pouce. */
@media (hover: none) and (pointer: coarse) {
  .actions-ligne button,
  .selection-barre button,
  .choix-date button,
  .choix-date input[type=date] { min-height: 44px; }
  .ligne-membre { padding: 11px 12px; }
  .ligne-membre input[type=checkbox],
  .champ.case input[type=checkbox] { width: 22px; height: 22px; }
}
