/* École de tennis : habillage par-dessus Bootstrap 5.3 */
:root {
  --bs-primary: #1f5f3f;
  --bs-primary-rgb: 31, 95, 63;
  --bs-link-color: #1f5f3f;
  --bs-link-color-rgb: 31, 95, 63;
  --balle: #d7e84a;
  --present: #198754;
  --absent: #dc3545;
  --neutre: #adb5bd;
  --fond-app: #f3f5f2;
}
[data-bs-theme="dark"] {
  --bs-primary: #4fb57f;
  --bs-primary-rgb: 79, 181, 127;
  --bs-link-color: #6cc795;
  --bs-link-color-rgb: 108, 199, 149;
  --fond-app: #15181a;
}
.btn-primary {
  --bs-btn-bg: var(--bs-primary); --bs-btn-border-color: var(--bs-primary);
  --bs-btn-hover-bg: #174a31; --bs-btn-hover-border-color: #174a31;
  --bs-btn-active-bg: #123b27; --bs-btn-active-border-color: #123b27;
}
[data-bs-theme="dark"] .btn-primary { --bs-btn-color: #0d1f16; --bs-btn-hover-bg: #3f9a6a; --bs-btn-active-bg: #34865b; }

body { background: var(--fond-app); -webkit-tap-highlight-color: transparent; }
.container-app { max-width: 720px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }

/* barre du haut */
.barre { background: #1f5f3f; color: #fff; padding-top: env(safe-area-inset-top); box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.barre .titre { font-weight: 600; font-size: 1.05rem; line-height: 1.2; }
.barre .sous-titre { font-size: .8rem; opacity: .8; }
.btn-icone { color: #fff; font-size: 1.4rem; padding: .25rem .5rem; border: 0; }
.btn-icone:hover, .btn-icone:focus { color: var(--balle); }

/* connexion */
.page-connexion { background: linear-gradient(160deg, #1f5f3f 0 35%, var(--fond-app) 35%); }
.page-connexion h1, .page-connexion .text-body-secondary { color: #fff !important; }
.logo-balle { width: 64px; height: 64px; border-radius: 50%; background: var(--balle);
  box-shadow: inset -6px -6px 0 rgba(0,0,0,.08); position: relative; }
.logo-balle::before, .logo-balle::after { content: ""; position: absolute; top: 8px; width: 40px; height: 48px;
  border: 3px solid #fff; border-radius: 50%; }
.logo-balle::before { left: -22px; border-left-color: transparent; border-top-color: transparent; border-bottom-color: transparent; }
.logo-balle::after { right: -22px; border-right-color: transparent; border-top-color: transparent; border-bottom-color: transparent; }

/* cartes d'accueil */
.tuile { display: flex; align-items: center; gap: 1rem; padding: 1.1rem 1.25rem; border-radius: .9rem;
  background: var(--bs-body-bg); text-decoration: none; color: inherit; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.tuile:hover { color: inherit; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.tuile .bi { font-size: 1.8rem; color: var(--bs-primary); }
.tuile.inactive { opacity: .5; pointer-events: none; }

/* listes */
.liste { border-radius: .9rem; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.liste .list-group-item { border-left: 0; border-right: 0; padding: .85rem 1rem; }
.liste .list-group-item:first-child { border-top: 0; }
.liste .list-group-item:last-child { border-bottom: 0; }
.liste .list-group-item-action:active { background: rgba(var(--bs-primary-rgb), .08); }
.section-titre { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 600;
  color: var(--bs-secondary-color); margin: 1.25rem .25rem .5rem; }
.heure { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.1rem; min-width: 3.4rem; }
.aujourdhui { box-shadow: inset 4px 0 0 var(--bs-primary); }
.annulee .heure, .annulee .nom-groupe { text-decoration: line-through; color: var(--bs-secondary-color); }
.pastille { min-width: 1.6rem; }

/* navigation de semaine */
.nav-semaine { display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  background: var(--bs-body-bg); border-radius: .9rem; padding: .35rem; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.nav-semaine .btn { min-width: 44px; min-height: 44px; }

/* appel */
.compteurs { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.compteur { background: var(--bs-body-bg); border-radius: .75rem; padding: .5rem; text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.compteur strong { display: block; font-size: 1.4rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.compteur span { font-size: .75rem; color: var(--bs-secondary-color); }
.compteur.present strong { color: var(--present); }
.compteur.absent strong { color: var(--absent); }

.joueur { display: flex; align-items: center; gap: .75rem; min-height: 64px; cursor: pointer; user-select: none; }
.joueur.verrou { cursor: default; }
.joueur .identite { flex: 1; min-width: 0; }
.joueur .nom { font-weight: 600; }
.joueur .infos { font-size: .8rem; color: var(--bs-secondary-color); display: flex; flex-wrap: wrap; gap: .25rem .4rem; align-items: center; }
.etat { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; flex: none;
  border: 2px solid var(--neutre); color: var(--neutre); font-size: 1.3rem; transition: all .12s; }
.etat.present { background: var(--present); border-color: var(--present); color: #fff; }
.etat.absent { background: var(--absent); border-color: var(--absent); color: #fff; }
.joueur.en-cours .etat { opacity: .5; }
.btn-retard { font-size: .8rem; padding: .15rem .5rem; border-radius: 1rem; }
.niveau { font-size: .7rem; padding: .15rem .45rem; border-radius: .4rem; font-weight: 600; border: 1px solid transparent; }
.niveau-blanc { background: #fff; color: #333; border-color: #ccc; }
.niveau-violet { background: #7b4fbf; color: #fff; }
.niveau-rouge { background: #d63c3c; color: #fff; }
.niveau-orange { background: #f08c2e; color: #fff; }
.niveau-vert { background: #2e9e57; color: #fff; }
.niveau-adulte { background: var(--bs-secondary-bg); color: var(--bs-body-color); }

.chargement { display: grid; place-items: center; min-height: 40vh; }
.toast.ok { background: var(--present); color: #fff; }
.toast.erreur { background: var(--absent); color: #fff; }
.toast.info { background: #343a40; color: #fff; }

/* lignes avec bouton d'action à droite */
.liste .ligne { display: flex; align-items: stretch; padding: 0; }
.liste .ligne .lien { flex: 1; min-width: 0; display: flex; align-items: center; gap: 1rem; padding: .85rem 1rem;
  color: inherit; text-decoration: none; }
.liste .ligne .lien:active { background: rgba(var(--bs-primary-rgb), .08); }
.btn-action { border: 0; border-left: 1px solid var(--bs-border-color); border-radius: 0; min-width: 52px;
  color: var(--bs-secondary-color); font-size: 1.15rem; display: grid; place-items: center; }
.btn-action:hover { color: var(--bs-primary); background: rgba(var(--bs-primary-rgb), .06); }
.min-w-0 { min-width: 0; }

.carte { background: var(--bs-body-bg); border-radius: .9rem; padding: 1rem; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.onglets { flex-wrap: nowrap; overflow-x: auto; gap: .25rem; scrollbar-width: none; }
.onglets .nav-link { white-space: nowrap; padding: .4rem .75rem; }
.onglets .nav-link:not(.active) { background: var(--bs-body-bg); color: var(--bs-body-color); }
.nav-pills { --bs-nav-pills-link-active-bg: var(--bs-primary); }
.choix-joueurs { max-height: 50vh; overflow-y: auto; }
.choix-joueurs .list-group-item { cursor: pointer; }
.barre-bas { position: sticky; bottom: 0; padding: .75rem 0 calc(.75rem + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--fond-app) 30%); }
.modal-content { border-radius: 1rem; }

/* calendrier de saison */
.container-app.large { max-width: 1140px; }
.puce { font-weight: 600; padding: .45em .8em; }
.type-entr { --c: #2e7d4f; --f: #e3f1e9; }
.type-vac  { --c: #b7791f; --f: #fff1d6; }
.type-fer  { --c: #5f6470; --f: #e9e9ee; }
.type-nd   { --c: #9aa0a6; --f: transparent; }
[data-bs-theme="dark"] .type-entr { --f: #1d3528; }
[data-bs-theme="dark"] .type-vac  { --f: #3a2f17; }
[data-bs-theme="dark"] .type-fer  { --f: #2b2d33; }
.puce.type-entr, .puce.type-vac, .puce.type-fer { background: var(--f); color: var(--c); }
.puce.type-nd { background: transparent; color: var(--bs-body-color); border: 1px dashed var(--c); }
[data-bs-theme="dark"] .puce { color: var(--bs-body-color); }
.mois-titre { font-weight: 700; padding: .6rem .9rem; border-bottom: 1px solid var(--bs-border-color); }
.semaine-cal { display: flex; align-items: center; gap: .6rem; width: 100%; border: 0; text-align: left;
  padding: .5rem .9rem .5rem .75rem; background: var(--f); border-left: 5px solid var(--c);
  border-bottom: 1px solid var(--bs-border-color); color: var(--bs-body-color); min-height: 56px; }
.semaine-cal:last-child { border-bottom: 0; }
.semaine-cal.type-nd { border-left-style: dashed; }
.semaine-cal:hover, .semaine-cal:focus-visible { filter: brightness(.96); outline: none; }
.semaine-cal.passee { opacity: .7; }
.semaine-cal.courante { box-shadow: inset 0 0 0 2px var(--bs-primary); opacity: 1; }
.semaine-cal .iso { font-size: .7rem; color: var(--bs-secondary-color); font-variant-numeric: tabular-nums; min-width: 2rem; }
.semaine-cal .libelle-type { font-size: .85rem; color: var(--c); }
[data-bs-theme="dark"] .semaine-cal .libelle-type { filter: brightness(1.6); }
.pastille-evt { display: inline-grid; place-items: center; min-width: 1.4rem; height: 1.4rem; padding: 0 .3rem;
  border-radius: .7rem; font-size: .72rem; font-weight: 700; color: #fff; }
.evt-a { background: #b3261e; }
.evt-r { background: #1f5fbf; }
.evt-s { background: #6b3fa0; }

/* administration */
.ligne-droit { cursor: pointer; }
.ligne-droit:last-child { border-bottom: 0 !important; }
.ligne-droit:hover { background: rgba(var(--bs-primary-rgb), .04); }
.form-switch .form-check-input:checked { background-color: var(--bs-primary); border-color: var(--bs-primary); }
.form-check-input:checked { background-color: var(--bs-primary); border-color: var(--bs-primary); }

/* Galaxie */
.btn-galaxie { color: #7b4fbf; font-size: 1.15rem; padding: .25rem .4rem; border: 0; }
.btn-galaxie:hover { color: #5b2f9f; }
.competence { display: flex; align-items: center; gap: .75rem; cursor: pointer; user-select: none; min-height: 60px; }
.competence.verrou { cursor: default; }
.competence.en-cours .etat-comp { opacity: .4; }
.etat-comp { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none;
  border: 2px solid var(--neutre); color: var(--neutre); font-size: 1.1rem; transition: all .12s; }
.etat-comp.etat-1 { border-color: #f08c2e; color: #f08c2e; }
.etat-comp.etat-2 { background: var(--present); border-color: var(--present); color: #fff; }
.chrono { list-style: none; padding: 1rem 1rem 1rem 2.2rem; margin: 0; position: relative; }
.chrono::before { content: ""; position: absolute; left: 1.15rem; top: 1.2rem; bottom: 1.2rem; width: 2px; background: var(--bs-border-color); }
.chrono li { position: relative; padding: .35rem 0; }
.puce-chrono { position: absolute; left: -1.45rem; top: .6rem; width: .8rem; height: .8rem; border-radius: 50%;
  background: var(--bs-secondary-bg); border: 2px solid var(--bs-border-color); }
.chrono-niveau .puce-chrono { width: 1rem; height: 1rem; left: -1.55rem; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--bs-border-color); }
.impression-seule { display: none; }
@media print {
  .barre, .sans-impression, .toast-container { display: none !important; }
  .impression-seule { display: block; }
  body { background: #fff; }
  .carte, .compteur, .liste { box-shadow: none !important; border: 1px solid #ddd; }
  .container-app { max-width: none; }
  .progress, .progress-bar, .niveau, .puce-chrono { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* comptabilité */
.tuiles-compta { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; }
@media (min-width: 576px) { .tuiles-compta { grid-template-columns: repeat(4, 1fr); } }
.tuiles-compta .compteur { text-align: left; padding: .6rem .75rem; }
.tuiles-compta .compteur strong { font-size: 1.15rem; margin: .1rem 0; }
.resume-compta { display: grid; grid-template-columns: repeat(2, 1fr); gap: .35rem 1rem; font-size: .9rem; }
.resume-compta > div { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px dashed var(--bs-border-color); padding: .2rem 0; }
.resume-compta span { color: var(--bs-secondary-color); }
.ligne-echeance:last-child { border-bottom: 0 !important; }

/* notifications : en haut sous la barre, sans bloquer les appuis */
.zone-toast { top: calc(env(safe-area-inset-top) + 60px); pointer-events: none; width: min(100%, 480px); z-index: 1090; }
.zone-toast .toast { pointer-events: auto; width: 100%; box-shadow: 0 4px 14px rgba(0,0,0,.18); }

/* imports Excel */
details.carte { padding: 0; overflow: hidden; }
details.carte > summary { cursor: pointer; list-style: none; }
details.carte > summary::-webkit-details-marker { display: none; }
details.carte > summary::after { content: '\F282'; font-family: bootstrap-icons; margin-left: auto; transition: transform .15s; }
details.carte[open] > summary::after { transform: rotate(180deg); }
details.carte table td:first-child, details.carte table th:first-child { padding-left: 1rem; }

/* cahier de présence */
table.cahier { font-size: .78rem; min-width: 60rem; table-layout: fixed; }
table.cahier th { background: #2F5496; color: #fff; text-align: center; font-weight: 600; }
table.cahier td { text-align: center; padding: .15rem .3rem; height: 1.45rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.cahier td.cahier-entete { font-weight: 700; }
table.cahier td.cahier-vide { background: #BFBFBF; }
.cahier-pastille { display: inline-block; width: .9rem; height: .7rem; border: 1px solid #999; margin-right: .3rem; vertical-align: -1px; }

/* statistiques de présence */
.st-table { font-size: .82rem; }
.st-table th, .st-table td { vertical-align: middle; text-align: center; padding: .25rem .2rem; }
.st-table .st-nom { text-align: left; position: sticky; left: 0; background: var(--bs-body-bg); z-index: 1; min-width: 10rem; max-width: 13rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-table th.st-date { font-weight: 500; font-size: .72rem; line-height: 1.1; min-width: 1.9rem; }
.st-table th.st-date a { color: inherit; text-decoration: none; }
.st-table tr.st-hors td { background: var(--bs-tertiary-bg); }
.st-carre { display: inline-block; width: 1.25rem; height: 1.25rem; border-radius: .2rem; vertical-align: middle; font-size: .62rem; line-height: 1.25rem; color: #fff; font-weight: 700; text-align: center; }
.st-p { background: #2e8b3d; }
.st-r { background: #e0a100; }
.st-a { background: #d63c3c; }
.st-n { background: #d3d3d3; }
.st-annulee, .st-annulee-leg { background: repeating-linear-gradient(45deg, #e9e9e9 0 4px, #c9c9c9 4px 8px) !important; }
.st-annulee-leg { display: inline-block; width: 1.25rem; height: 1.25rem; border-radius: .2rem; vertical-align: middle; }
.badge.st-p, .badge.st-r, .badge.st-a, .badge.st-n { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.badge.st-r { color: #000; }
