/* =============================================================================
   style.css — Feuille de style de l'application « Classements Tir à l'Arc BFC ».
   Conçue pour être RESPONSIVE (ordinateur, tablette, téléphone) et lisible.
   Palette inspirée de l'interface FFTA fournie en référence (bleu-sarcelle).
   ============================================================================= */

/* ---- Variables de couleurs (faciles à modifier au même endroit) ---- */
:root {
    --bleu:        #4a86a5;   /* bleu-sarcelle des bandeaux */
    --bleu-fonce:  #3f7d9a;
    --navy:        #1f2a44;   /* titres */
    --fond:        #f4f5f7;   /* fond de page */
    --blanc:       #ffffff;
    --bordure:     #d9dde2;
    --gris-zebre:  #f0f2f4;   /* lignes alternées des tableaux */
    --texte:       #222831;
    --texte-doux:  #5c6672;
    --vert:        #4a8f3c;
    --rouge:       #b23b3b;
    --ombre:       0 1px 3px rgba(0,0,0,.08);
    --radius:      8px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--texte);
    background: var(--fond);
    line-height: 1.45;
}

a { color: var(--bleu-fonce); }

/* ---- En-tête du site (logo + titre + navigation) ---- */
.site-header {
    background: var(--blanc);
    border-bottom: 3px solid var(--bleu);
    box-shadow: var(--ombre);
}
.site-header .inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.site-header .logo img { height: 56px; width: auto; display: block; }
.site-header .titre { display: flex; flex-direction: column; }
.site-header .titre .t1 { font-weight: 800; font-size: 1.25rem; color: var(--navy); line-height: 1.1; }
.site-header .titre .t2 { color: var(--texte-doux); font-size: .85rem; }
.site-header nav { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.site-header nav a {
    text-decoration: none; color: var(--navy); font-weight: 600; font-size: .9rem;
    padding: 8px 12px; border-radius: 6px;
}
.site-header nav a:hover { background: var(--fond); }
.site-header nav a.admin { color: var(--bleu-fonce); }

/* ---- Conteneur principal ---- */
main { max-width: 1180px; margin: 22px auto; padding: 0 18px 60px; }

h1.page-title { color: var(--navy); font-size: 1.9rem; margin: 6px 0 18px; }

/* ---- Panneaux (cartes) ---- */
.panel { background: var(--blanc); border: 1px solid var(--bordure); border-radius: var(--radius); box-shadow: var(--ombre); margin-bottom: 20px; overflow: hidden; }
.panel > .panel-head { background: var(--bleu); color: #fff; padding: 10px 16px; font-weight: 700; font-size: .95rem; }
.panel > .panel-body { padding: 16px; }

/* ---- Formulaire de filtres ---- */
.filters { display: grid; grid-template-columns: repeat(2, minmax(260px, 1fr)); gap: 8px 28px; }
.filters .row { display: flex; align-items: center; gap: 10px; }
.filters label { min-width: 120px; text-align: right; font-weight: 600; color: var(--navy); font-size: .9rem; }
.filters select, .filters input[type=text] {
    flex: 1; padding: 7px 9px; border: 1px solid var(--bordure); border-radius: 6px; background: #fff;
    font-size: .92rem; font-weight: 600;
}
.filters .actions { grid-column: 1 / -1; display: flex; justify-content: center; gap: 10px; margin-top: 6px; }

/* ---- Boutons ---- */
.btn {
    display: inline-block; cursor: pointer; border: 1px solid var(--bordure);
    background: linear-gradient(#fdfdfd, #eef0f2); color: var(--navy); font-weight: 600;
    padding: 8px 16px; border-radius: 6px; text-decoration: none; font-size: .9rem;
}
.btn:hover { background: #e9ecef; }
.btn-primary { background: var(--bleu); border-color: var(--bleu-fonce); color: #fff; }
.btn-primary:hover { background: var(--bleu-fonce); }
.btn-danger { background: var(--rouge); border-color: #922; color: #fff; }
.btn-sm { padding: 4px 10px; font-size: .82rem; }

/* ---- Tableaux ---- */
.table-wrap { overflow-x: auto; }               /* défilement horizontal sur mobile */
table.grid { width: 100%; border-collapse: collapse; font-size: .9rem; background: #fff; }
table.grid thead th {
    background: var(--bleu); color: #fff; text-align: left; padding: 9px 10px; font-weight: 700;
    white-space: nowrap; position: sticky; top: 0;
}
table.grid tbody td { padding: 8px 10px; border-bottom: 1px solid #eceff2; }
table.grid tbody tr:nth-child(even) { background: var(--gris-zebre); }
table.grid tbody tr:hover { background: #e6eef3; }
table.grid td.num, table.grid th.num { text-align: center; }
table.grid td.rang { font-weight: 700; color: var(--bleu-fonce); text-align: center; }
table.grid td.moy { font-weight: 800; text-align: center; }
.clickable tbody tr { cursor: pointer; }

/* liste des classements : lignes cliquables */
.list-classements tbody tr { cursor: pointer; }
.list-classements .nom { font-weight: 700; color: var(--navy); }

/* ---- Bandeau d'info (date des données, nb de résultats) ---- */
.result-bar { background: #eef2f4; border: 1px solid var(--bordure); border-radius: 6px; padding: 8px 14px; margin-bottom: 12px; color: var(--texte-doux); font-size: .88rem; display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; }
.maj { background: #dbe6c4; color: #4a5a1e; border-radius: 6px; padding: 6px 12px; font-size: .85rem; font-weight: 600; display:inline-block; }

/* ---- Messages flash ---- */
.flash { padding: 11px 15px; border-radius: 6px; margin-bottom: 12px; font-weight: 600; }
.flash.success { background: #e5f3e0; color: #2f6a22; border: 1px solid #b9dcae; }
.flash.error   { background: #fbe6e6; color: #a12c2c; border: 1px solid #eeb9b9; }
.flash.info    { background: #e5eef5; color: #2b5872; border: 1px solid #b6d2e3; }

/* ---- Badges ---- */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.badge.inscrit { background: #e5f3e0; color: var(--vert); }
.badge.desinscrit { background: #fbe6e6; color: var(--rouge); }
.check-inscrit { color: var(--vert); font-weight: 800; }

/* Licence / nom d'archer cliquables → palmarès (couleur bleue explicite) */
.lien-palmares { color: #1668a8; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.lien-palmares:hover { color: #0d4a78; background: #eaf3fa; border-radius: 3px; }
.lien-palmares:focus { outline: 2px solid #1668a8; outline-offset: 1px; }
/* Reste bien visible même sur une ligne « non sélectionnée » (grisée) */
table.grid tbody tr.sel-out .lien-palmares { color: #1668a8; }

/* Quotas : lignes sélectionnées (dans le quota) / non sélectionnées */
table.grid tbody tr.sel-in { background: #eaf5e4; }
table.grid tbody tr.sel-in:nth-child(even) { background: #e1f0d8; }
table.grid tbody tr.sel-in td.rang { color: var(--vert); }
table.grid tbody tr.sel-out { color: #8a939c; }
table.grid tbody tr.sel-out td.rang { color: #9aa3ac; }

/* Bouton d'administration discret (petit logo subtil dans l'en-tête) */
.admin-link { opacity: .45; text-decoration: none; font-size: 1.05rem; padding: 4px 6px; border-radius: 6px; line-height: 1; }
.admin-link:hover { opacity: 1; background: var(--fond); }

/* ---- Pied de page + sponsors ---- */
.site-footer { border-top: 1px solid var(--bordure); background: #fff; margin-top: 40px; }
.sponsors { max-width: 1180px; margin: 0 auto; padding: 22px 18px; text-align: center; }
.sponsors h4 { color: var(--texte-doux); font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; margin: 0 0 16px; }
/* Répartition sur toute la largeur pour occuper l'espace disponible. */
.sponsors .logos { display: flex; flex-wrap: wrap; gap: 24px 40px; justify-content: space-evenly; align-items: center; }
.sponsors .logos > * { flex: 0 1 auto; }
.sponsors .logos img { max-height: 62px; max-width: 200px; object-fit: contain; filter: grayscale(15%); transition: filter .15s; }
.sponsors .logos a:hover img { filter: grayscale(0%); }
.footer-legal { text-align: center; color: var(--texte-doux); font-size: .8rem; padding: 12px; border-top: 1px solid #eee; }

/* ---- Fenêtre modale (palmarès de l'archer) ---- */
.modal-overlay { position: fixed; inset: 0; background: rgba(20,28,44,.55); display: none; align-items: flex-start; justify-content: center; padding: 30px 14px; z-index: 50; overflow-y: auto; }
.modal-overlay.open { display: flex; }
.modal { background: #fff; border-radius: var(--radius); max-width: 900px; width: 100%; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.modal .modal-head { background: var(--bleu); color: #fff; padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; border-radius: var(--radius) var(--radius) 0 0; }
.modal .modal-head .close { cursor: pointer; font-size: 1.4rem; line-height: 1; background: none; border: none; color: #fff; }
.modal .modal-body { padding: 16px; max-height: 70vh; overflow-y: auto; }
.modal .archer-id { font-size: 1.2rem; font-weight: 800; color: var(--navy); }

/* Cartes de synthèse du palmarès (moyennes / statistiques). */
.stat-cards { display: flex; flex-wrap: wrap; gap: 12px; margin: 14px 0; }
.stat-card { flex: 1 1 150px; background: #f6f8fa; border: 1px solid var(--bordure); border-radius: 8px; padding: 10px 14px; display: flex; flex-direction: column; }
.stat-card .stat-label { color: var(--texte-doux); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }
.stat-card .stat-val { font-size: 1.6rem; font-weight: 800; color: var(--bleu-fonce); line-height: 1.1; }
.stat-card .stat-sub { color: var(--texte-doux); font-size: .78rem; margin-top: 2px; }

/* Graphique d'évolution (SVG). */
.palmares-graph { margin: 8px 0 16px; }
.palmares-graph h4 { margin: 0 0 6px; font-size: .85rem; color: var(--navy); }
.palmares-graph .spark { width: 100%; height: auto; max-width: 620px; background: #fbfcfd; border: 1px solid var(--bordure); border-radius: 8px; }
.palmares-graph .spark .grid { stroke: #e5eaef; stroke-width: 1; }
.palmares-graph .spark .line { fill: none; stroke: var(--bleu); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.palmares-graph .spark .pt { fill: var(--bleu-fonce); }
.palmares-graph .spark .ax { fill: #8a939c; font-size: 10px; }

/* Mini graphique de fréquentation (barres). */
.visits-chart .visits-bars { width: 100%; height: auto; max-width: 760px; background: #fbfcfd; border: 1px solid var(--bordure); border-radius: 8px; }
.visits-chart .visits-bars rect { fill: var(--bleu); }
.visits-chart .visits-bars .ax { fill: #8a939c; font-size: 10px; }

/* ---- Divers ---- */
.help { color: var(--texte-doux); font-size: .85rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-weight: 600; margin-bottom: 4px; color: var(--navy); font-size: .9rem; }
.field input, .field select, .field textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--bordure); border-radius: 6px; font-size: .92rem; font-family: inherit; }
/* Navigation d'administration : lien direct + menus déroulants. */
.admin-nav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.admin-nav > a, .nav-group-btn {
    padding: 8px 14px; border-radius: 6px; text-decoration: none; background: #fff;
    border: 1px solid var(--bordure); color: var(--navy); font-weight: 600; font-size: .88rem;
    font-family: inherit; line-height: 1.2; cursor: pointer;
}
.admin-nav > a.active, .admin-nav > a:hover, .nav-group-btn:hover { background: var(--bleu); color: #fff; border-color: var(--bleu-fonce); }
.nav-group { position: relative; }
/* Le groupe contenant la page courante est mis en évidence. */
.nav-group.active > .nav-group-btn { background: var(--navy); color: #fff; border-color: var(--navy); }
.nav-group-btn .caret { font-size: .7em; margin-left: 2px; opacity: .85; }
.nav-group-menu {
    display: none; position: absolute; top: calc(100% + 6px); left: 0; z-index: 30;
    min-width: 210px; background: #fff; border: 1px solid var(--bordure); border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,.14); padding: 6px;
}
/* « Pont » transparent bouton → menu : garde le survol continu (sinon le petit vide
   referme le menu quand on descend la souris vers les sous-entrées). */
.nav-group-menu::before { content: ""; position: absolute; left: 0; right: 0; top: -10px; height: 10px; }
/* Ouverture : au survol (bureau) ou via la classe .open (clic / mobile). */
.nav-group:hover .nav-group-menu, .nav-group:focus-within .nav-group-menu, .nav-group.open .nav-group-menu { display: block; }
.nav-group-menu a {
    display: block; padding: 8px 12px; border-radius: 6px; text-decoration: none;
    color: var(--navy); font-weight: 600; font-size: .86rem; white-space: nowrap;
}
.nav-group-menu a:hover { background: var(--bleu); color: #fff; }
.nav-group-menu a.active { background: var(--bleu-fonce); color: #fff; }
.muted { color: var(--texte-doux); }
.text-center { text-align: center; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; }
.tag { display:inline-block; background:#eef2f4; border:1px solid var(--bordure); border-radius:4px; padding:1px 6px; font-size:.8rem; margin:1px; }

/* ---- Adaptation mobile ---- */
@media (max-width: 720px) {
    .filters { grid-template-columns: 1fr; }
    .filters label { min-width: 96px; }
    .form-grid { grid-template-columns: 1fr; }
    .site-header nav { width: 100%; margin-left: 0; }
    h1.page-title { font-size: 1.4rem; }
}

/* ---- Styles d'impression (repli si pas de PDF, et rendu propre) ---- */
@media print {
    .site-header nav, .filters, .actions, .btn, .admin-nav { display: none !important; }
    body { background: #fff; }
    .panel { box-shadow: none; border: none; }
}
