/* ==========================================================================
   Réglages → Événements (étape 5a) : liste des événements, un événement et ses
   tirs, import CSV. Complète app.css (mêmes règles : boutons ≥ 48 px, 56 px
   visés ; animations sur transform / opacity seulement).
   ========================================================================== */

/* Champs date, heure, fichier : mêmes dimensions que les autres champs. */
input[type="date"], input[type="time"], input[type="number"] {
  width: 100%; min-height: var(--bouton);
  padding: 12px 16px;
  font: inherit; font-size: 1.15rem;
  color: var(--texte); background: var(--surface);
  border: 2px solid var(--bordure); border-radius: var(--rayon);
  transition: border-color var(--rapide), box-shadow var(--rapide);
  -webkit-appearance: none; appearance: none;
}
input[type="time"] { font-family: var(--police-titre); font-weight: 800; font-size: 1.7rem; font-variant-numeric: tabular-nums; padding: 6px 16px; }
input:disabled, select:disabled { background: var(--surface-2); color: var(--texte-doux); cursor: not-allowed; }
.case:has(input:disabled) { color: var(--texte-doux); cursor: not-allowed; }
.grille-heure { display: grid; grid-template-columns: minmax(0, 150px) minmax(0, 1fr); gap: 0 12px; }
@media (max-width: 420px) { .grille-heure { grid-template-columns: 1fr; } }

/* ---------- Liste des événements ---------- */
.liste-evenements { gap: 12px; }
.liste-evenements .vide { background: var(--surface); border-radius: var(--rayon); }
a.ligne-evenement {
  text-decoration: none; color: inherit; min-height: 88px; border: 2px solid transparent;
  transition: transform var(--rapide) ease-out, border-color var(--rapide), box-shadow var(--rapide);
}
a.ligne-evenement:hover { border-color: var(--jaune); box-shadow: var(--ombre-forte); }
a.ligne-evenement:active { transform: scale(.985); }
.ligne-evenement .ligne-principal { display: flex; flex-direction: column; gap: 1px; }
.ligne-evenement .ligne-titre { font-family: var(--police-titre); font-weight: 800; font-size: 1.45rem; line-height: 1.1; text-transform: uppercase; overflow-wrap: anywhere; }
.ligne-etiquettes { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 4px; }
.sans-tir { color: #8a1c12; font-weight: 600; }
.fleche { width: 28px; height: 28px; flex: none; color: var(--texte-doux); }
.archives { margin-top: 28px; }
.archives > summary {
  min-height: var(--bouton); display: flex; align-items: center; cursor: pointer;
  font-family: var(--police-titre); font-weight: 800; font-size: 1.3rem; text-transform: uppercase;
}
.archives .ligne-evenement { opacity: .8; }

/* ---------- Un événement ---------- */
.fiche-evenement-tete { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.fiche-evenement-texte { min-width: 0; }
.fiche-evenement h1 { font-size: clamp(1.7rem, 6vw, 2.4rem); margin: 0; overflow-wrap: anywhere; }
.fiche-evenement .sous-titre { margin-top: 2px; overflow-wrap: anywhere; }
[data-fil] { overflow-wrap: anywhere; min-width: 0; }
.fiche-evenement .sous-titre:first-letter { text-transform: uppercase; }
.actions-tirs { margin-bottom: 14px; }
@media (max-width: 520px) {
  .actions-tirs .btn, .fiche-evenement .groupe-boutons .btn, .zone-evenement .groupe-boutons .btn { flex: 1 1 100%; }
}

/* Tirs : chaque ligne est un gros bouton (on touche la ligne pour la modifier). */
.liste-tirs { display: flex; flex-direction: column; gap: 8px; }
.tir-bouton {
  width: 100%; min-height: 72px; text-align: left; font: inherit; color: inherit; cursor: pointer;
  border: 2px solid transparent; border-left: 6px solid transparent; box-shadow: var(--ombre);
  grid-template-columns: auto 1fr auto; touch-action: manipulation;
  transition: transform var(--rapide) ease-out, border-color var(--rapide);
}
.tir-bouton + .tir-bouton { margin-top: 0; }
.tir-bouton .tir-heure { min-width: 2.7em; }
.tir-bouton:hover { border-color: var(--jaune); }
.tir-bouton:active { transform: scale(.985); }
.tir-bouton.est-marque { border-left-color: var(--vert-fonce); }
.tir-corps { display: flex; flex-direction: column; gap: 2px; min-width: 0; align-items: flex-start; }
.tir-bouton .tir-nom { overflow-wrap: anywhere; }
.tir-commentaire { color: var(--texte-doux); font-size: .95rem; font-style: italic; overflow-wrap: anywhere; }
.a-choisir { color: #8a1c12; font-style: normal; font-weight: 600; }
.crayon { width: 24px; height: 24px; flex: none; color: var(--texte-doux); }
.liste-tirs .vide.carte { box-shadow: none; border: 2px dashed var(--bordure); }

/* Choix de la charge dans la fenêtre d'un tir. */
/* Le rond de la case est caché (il reste utilisable au clavier) : le niveau choisi est encadré en noir. */
.choix-charges { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.choix-charge { position: relative; min-height: 56px; padding: 6px 12px; line-height: 1.15; overflow-wrap: anywhere; border: 2px solid transparent; }
.choix-charge input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.choix-charge:has(input:checked) { background: var(--jaune); box-shadow: 0 0 0 3px var(--noir); }
.choix-charge:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 4px; }
.choix-charge .verre { --fond-verre: transparent; }

/* Archiver / supprimer : confirmation sur place. */
.zone-evenement .zone-ligne { padding: 12px 0; border-top: 1px solid var(--bordure); }
.zone-evenement .zone-ligne:first-of-type { border-top: 0; padding-top: 0; }
.zone-evenement .zone-ligne p { margin-bottom: 10px; }
.confirmation { background: #fffbe0; border-left: 6px solid var(--jaune); border-radius: var(--rayon); padding: 12px 14px; }
.confirmation p { font-weight: 600; }
.btn-danger { color: var(--rouge); }
.btn-danger:disabled { color: var(--texte-doux); }

/* ---------- Import CSV ---------- */
dialog.dialog-large { width: min(760px, calc(100vw - 24px)); }
#form-import [data-import-saisie] > .groupe-boutons:first-of-type { margin-bottom: 16px; }
.bouton-fichier { position: relative; cursor: pointer; }
.bouton-fichier:focus-within { outline: 3px solid var(--focus); outline-offset: 3px; }
textarea.texte-csv {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1rem; line-height: 1.4;
  white-space: pre; overflow: auto; min-height: 170px;
}
.liste-messages { margin: 0 0 14px; padding: 0; list-style: none; display: grid; gap: 6px; }
.liste-messages li { padding: 8px 12px; border-radius: 10px; overflow-wrap: anywhere; }
.liste-messages.erreurs li { background: #fbe9e6; border-left: 5px solid var(--rouge); }
.liste-messages.avertissements li { background: #fffbe0; border-left: 5px solid var(--jaune); }
.colonnes-lues { font-size: .95rem; margin-bottom: 10px; }
.apercu-table { max-height: 46vh; overflow: auto; border: 1px solid var(--bordure); border-radius: var(--rayon); margin-bottom: 16px; }
.apercu-table:empty { display: none; }
.apercu-table table { width: 100%; border-collapse: collapse; font-size: 1rem; }
.apercu-table th {
  position: sticky; top: 0; background: var(--noir); color: var(--jaune); text-align: left;
  font-family: var(--police-titre); font-weight: 700; text-transform: uppercase; padding: 8px 10px; white-space: nowrap;
}
.apercu-table td { padding: 8px 10px; border-top: 1px solid var(--bordure); vertical-align: top; overflow-wrap: break-word; }
.apercu-table td.court { white-space: nowrap; }
.apercu-table td.num { color: var(--texte-doux); font-variant-numeric: tabular-nums; width: 1%; }
.apercu-table td.heure { font-family: var(--police-titre); font-weight: 800; font-size: 1.2rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.apercu-table td.heure .jour { font-family: var(--police); font-weight: 600; font-size: .85rem; color: var(--texte-doux); display: block; }
.apercu-table .commentaire { display: block; color: var(--texte-doux); font-size: .9rem; font-style: italic; }
@media (max-width: 520px) {
  .apercu-table table { font-size: .92rem; }
  .apercu-table th, .apercu-table td { padding: 8px 4px; }
  .apercu-table th:first-child, .apercu-table td.num { padding-left: 8px; }
  .apercu-table td.heure { font-size: 1.1rem; }
  .apercu-table td.court { font-size: .86rem; }
}
[data-import-mode] .choix + .choix { margin-top: 8px; }
[data-import-mode] .choix input { flex: none; accent-color: var(--noir); }
.archives > summary::after { content: '▾'; margin-left: 10px; font-size: 1.2rem; }
.archives[open] > summary::after { content: '▴'; }
.archives > summary::-webkit-details-marker { display: none; }

/* Aperçu : un titre par jour (événement de plusieurs jours) et ce que l'import fera de chaque ligne. */
.apercu-table tr.jour td {
  background: var(--jaune); font-family: var(--police-titre); font-weight: 800; text-transform: uppercase; letter-spacing: .02em;
}
.apercu-table tr.ignoree td { color: var(--texte-doux); background: var(--surface-2); }
.apercu-table .effet {
  display: inline-block; margin-top: 2px; padding: 0 8px; border-radius: 999px; font-size: .85rem; font-weight: 700;
  background: #fff1c2; color: #6b5300;
}
.apercu-table .effet-mis_a_jour { background: #e8f3e3; color: var(--vert-fonce); }
.apercu-jours { margin: 0 0 12px; font-weight: 600; }
#form-tir [data-ajoute], #form-tir [data-tir-ailleurs] { scroll-margin-top: 12px; }
#form-tir .confirmation { margin-bottom: 14px; }

/* Aperçu de l'import : les tirs qui seront supprimés, nommés, en orange, juste avant le bouton. */
.alerte-orange { border-color: #d9730d; background: #fdebd8; }
.alerte-orange ul { margin: 6px 0 10px; padding-left: 1.2em; }
.alerte-orange li { margin: 3px 0; overflow-wrap: anywhere; }
#form-import [data-abandon] { margin-bottom: 14px; scroll-margin-top: 12px; }
