/* ============================================================
   CJSM 2025 — Feuille de style principale
   ============================================================ */

:root {
  --red:       #b40000;
  --gray:      #262626;
  --red-dark:  #8a0000;
  --gold:      #d4a017;
  --silver:    #9e9e9e;
  --bronze:    #cd7f32;
  --bg:        #f4f5f7;
  --surface:   #ffffff;
  --border:    #e0e0e0;
  --text:      #1a1a2e;
  --muted:     #6b7280;
  --success:   #16a34a;
  --warn:      #d97706;
  --error:     #dc2626;
  --radius:    8px;
  --shadow:    0 2px 8px rgba(0,0,0,.10);
  --shadow-lg: 0 6px 24px rgba(0,0,0,.14);
  --font:      'Segoe UI', Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Navbar ---- */
.navbar {
  background: var(--gray);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.5rem;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.nav-brand a {
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: .5px;
}
.nav-links {
  display: flex;
  list-style: none;
  gap: .25rem;
  margin-left: auto;
}
.nav-links a {
  color: rgba(255,255,255,.85);
  padding: .35rem .75rem;
  border-radius: var(--radius);
  font-size: .9rem;
  transition: background .15s;
  text-decoration: none;
}
.nav-links a:hover, .nav-links a.active {
  background: rgba(255,255,255,.18);
  color: #fff;
}
.btn-nav-pdf {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.3);
  border-radius: var(--radius);
  padding: .3rem .75rem;
}
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  margin-left: auto;
}

/* ---- Page header ---- */
.page-header {
  background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%);
  color: #fff;
  padding: 2rem 0 1.5rem;
  margin-bottom: 2rem;
}
.page-header h1 { font-size: 1.6rem; font-weight: 700; }
.page-header p { opacity: .85; margin-top: .25rem; }

/* ---- Hero ---- */
.hero {
  background: linear-gradient(160deg, #1a1a2e 0%, var(--red-dark) 60%, var(--red) 100%);
  color: #fff;
  text-align: center;
  padding: 5rem 1rem 4rem;
}
.hero-logo { font-size: 4rem; margin-bottom: 1rem; }
.hero h1 { font-size: 2.2rem; font-weight: 800; line-height: 1.2; }
.hero h1 span { color: var(--gold); }
.hero-subtitle { margin-top: .75rem; font-size: 1.1rem; opacity: .8; }
.hero-btns { display: flex; gap: 1rem; justify-content: center; margin-top: 2rem; flex-wrap: wrap; }

/* ---- Container ---- */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1rem;
  flex: 1;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1.1rem;
  border-radius: var(--radius);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: filter .15s, transform .1s;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn-primary  { background: var(--red);     color: #fff; }
.btn-secondary{ background: var(--border);  color: var(--text); }
.btn-pdf      { background: #1a56db;        color: #fff; }
.btn-danger   { background: var(--error);   color: #fff; }
.btn-sm       { padding: .3rem .65rem; font-size: .82rem; }

/* ---- Stats grid ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2.5rem;
}
@media (max-width: 600px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  text-align: center;
}
.stat-icon  { font-size: 2rem; margin-bottom: .5rem; }
.stat-value { font-size: 2.2rem; font-weight: 800; color: var(--red); }
.stat-label { font-size: .85rem; color: var(--muted); margin-top: .2rem; }

/* ---- Leaders ---- */
.leaders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}
.leader-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
  border-top: 3px solid var(--red);
}
.leader-cat    { font-size: .82rem; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.leader-name   { font-size: 1.05rem; font-weight: 700; }
.leader-points { font-size: 1.4rem; font-weight: 800; color: var(--red); }
.leader-courses{ font-size: .82rem; color: var(--muted); }
.leader-empty  { color: var(--muted); font-style: italic; }

/* ---- Quick links ---- */
.quick-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: .75rem;
  margin-bottom: 2rem;
}
.quick-link {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
  font-weight: 600;
  font-size: .95rem;
  color: var(--text);
  transition: box-shadow .15s, border-color .15s;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
}
.quick-link:hover { box-shadow: var(--shadow); border-color: var(--red); text-decoration: none; }
.quick-link span  { font-size: 1.6rem; }

/* ---- Section title ---- */
.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
  padding-bottom: .4rem;
  border-bottom: 2px solid var(--border);
}

/* ---- Tabs ---- */
.tabs {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.tab {
  padding: .55rem 1.2rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 600;
  font-size: .9rem;
  text-decoration: none;
  transition: all .15s;
}
.tab:hover    { border-color: var(--red); color: var(--red); text-decoration: none; }
.tab-active   { background: var(--red); color: #fff; border-color: var(--red); }

/* ---- Actions bar ---- */
.actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
  margin-bottom: 1rem;
}
.actions-left, .actions-right { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }

/* ---- Badges ---- */
.badge {
  display: inline-block;
  padding: .2rem .65rem;
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 600;
  text-decoration: none;
}
.badge-info   { background: #dbeafe; color: #1d4ed8; }
.badge-ok     { background: #dcfce7; color: #15803d; }
.badge-warn   { background: #fef3c7; color: #92400e; }
.badge-error  { background: #fee2e2; color: #991b1b; }
.badge-light  { background: var(--border); color: var(--text); }
.badge-active { background: var(--red); color: #fff; }
.badge-tiny   { padding: .1rem .4rem; font-size: .7rem; }

.badge-cat-auto       { background: #dbeafe; color: #1e40af; }
.badge-cat-autocross  { background: #ede9fe; color: #5b21b6; }
.badge-cat-karting    { background: #d1fae5; color: #065f46; }
.badge-cat-navigateur { background: #fef3c7; color: #78350f; }

/* ---- Podium ---- */
.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: .5rem;
  margin: 2rem 0;
}
.podium-step {
  min-width: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: .75rem;
  border-radius: var(--radius) var(--radius) 0 0;
  text-align: center;
}
.podium-gold   { background: linear-gradient(160deg, #ffd700, #f59e0b); }
.podium-silver { background: linear-gradient(160deg, #e5e7eb, #9ca3af); }
.podium-bronze { background: linear-gradient(160deg, #d97706, #92400e); color: #fff; }
.podium-name   { font-weight: 700; font-size: .95rem; padding: 0 .5rem; }
.podium-pts    { font-size: 1.1rem; font-weight: 800; color: var(--red-dark); }
.podium-pos    { font-size: 2rem; font-weight: 900; opacity: .3; margin-top: .25rem; }

/* ---- Tables ---- */
.table-wrapper {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
  margin-bottom: 1.5rem;
}
table { width: 100%; border-collapse: collapse; }
th {
  background: #1a1a2e;
  color: #fff;
  padding: .75rem .9rem;
  font-size: .82rem;
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
}
td { padding: .65rem .9rem; border-bottom: 1px solid var(--border); font-size: .88rem; }
tr:last-child td { border-bottom: none; }
tr:hover > td { background: #f9fafb; }

.classement-table tr.podium-row.pos-1 td { background: rgba(255,215,0,.15); }
.classement-table tr.podium-row.pos-2 td { background: rgba(200,200,200,.15); }
.classement-table tr.podium-row.pos-3 td { background: rgba(205,127,50,.12); }

.col-pos     { width: 52px; text-align: center; font-weight: 700; font-size: 1.05rem; }
.col-pts     { width: 90px; text-align: center; }
.col-courses { width: 70px; text-align: center; }
.col-stars   { width: 55px; text-align: center; }
.col-action  { width: 40px; text-align: center; }
.expand-icon { color: var(--muted); transition: transform .2s; display: inline-block; }

/* ---- Détail dépliable ---- */
.detail-row td { padding: 0; background: #f8f9ff !important; }
.detail-content { padding: 1rem 1.5rem; }
.detail-table   { font-size: .83rem; }
.detail-res.biffe td { color: var(--muted); font-style: italic; text-decoration: line-through; }
.biffes-header  { background: #fef9c3 !important; font-weight: 600; font-size: .8rem; color: var(--warn); }

/* ---- Légende ---- */
.legend {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  font-size: .85rem;
  color: var(--muted);
}
.legend h4   { color: var(--text); margin-bottom: .5rem; }
.legend ul   { padding-left: 1.25rem; }
.legend li   { margin-bottom: .25rem; }

/* ---- Cards ---- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 1.5rem; }
.card-header { background: #1a1a2e; color: #fff; padding: 1rem 1.5rem; }
.card-header h2 { font-size: 1.1rem; }

/* ---- Formulaires ---- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  padding: 1.5rem;
}
.form-group { display: flex; flex-direction: column; gap: .35rem; }
.form-col-2 { grid-column: span 2; }
label { font-size: .85rem; font-weight: 600; color: var(--text); }
input[type="text"], input[type="email"], input[type="date"], input[type="number"],
select, textarea {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .55rem .75rem;
  font-size: .9rem;
  font-family: var(--font);
  width: 100%;
  background: var(--bg);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(180,0,0,.12);
  background: #fff;
}
textarea { resize: vertical; min-height: 60px; }
.checkbox-group { display: flex; flex-wrap: wrap; gap: .75rem; }
.checkbox-label { display: flex; align-items: center; gap: .4rem; font-size: .88rem; font-weight: 400; cursor: pointer; }
.checkbox-label input { width: auto; }
.form-actions { padding: 1rem 1.5rem; border-top: 1px solid var(--border); display: flex; gap: .75rem; }

/* ---- Data table ---- */
.data-table .actions-col { width: 100px; white-space: nowrap; }
.opts-cell span { font-size: 1.1rem; margin-right: .15rem; cursor: help; }
.demo-badge { background: #fee2e2; color: var(--error); padding: .1rem .4rem; border-radius: 4px; font-size: .72rem; font-weight: 700; }
.row-demo td { background: #fff8f8 !important; color: var(--muted); }
.cats-badge { font-size: .82rem; color: var(--muted); }
.empty-cell { text-align: center; padding: 2rem; color: var(--muted); font-style: italic; }

/* ---- Empty state ---- */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state h3 { font-size: 1.3rem; margin-bottom: .5rem; }
.empty-state p  { color: var(--muted); margin-bottom: 1.5rem; }

/* ---- Alerts ---- */
.alert {
  padding: .85rem 1.25rem;
  border-radius: var(--radius);
  margin: .75rem 0;
  font-weight: 600;
  font-size: .9rem;
}
.alert-success { background: #dcfce7; color: #15803d; border-left: 4px solid #22c55e; }
.alert-error   { background: #fee2e2; color: #991b1b; border-left: 4px solid #ef4444; }

/* ---- Info box ---- */
.info-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: .75rem 1rem;
  font-size: .85rem;
  color: #1e40af;
  margin: 0 1.5rem 1rem;
}

/* ---- Footer ---- */
.footer {
  background: #1a1a2e;
  color: rgba(255,255,255,.7);
  padding: 1.5rem 0;
  text-align: center;
  font-size: .85rem;
  margin-top: auto;
}
.footer a { color: rgba(255,255,255,.8); }
.footer-small { margin-top: .35rem; font-size: .78rem; opacity: .6; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .nav-links { display: none; flex-direction: column; position: absolute; top: 56px; left: 0; right: 0; background: var(--red); padding: .75rem; }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; }
  .hero h1 { font-size: 1.5rem; }
  .podium { gap: .25rem; }
  .podium-step { min-width: 100px; }
  .form-col-2 { grid-column: span 1; }
  .page-header { padding: 1.25rem 0 1rem; }
}

/* ---- Nav user (login info + logout) ---- */
.nav-user {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-left: .5rem;
  padding-left: .75rem;
  border-left: 1px solid rgba(255,255,255,.25);
  white-space: nowrap;
}
.nav-username {
  color: rgba(255,255,255,.9);
  font-size: .82rem;
  font-weight: 600;
}
.btn-logout {
  color: rgba(255,255,255,.8);
  font-size: .8rem;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: var(--radius);
  padding: .25rem .6rem;
  text-decoration: none;
  transition: background .15s;
}
.btn-logout:hover {
  background: rgba(255,255,255,.25);
  color: #fff;
  text-decoration: none;
}
