/* ── Variables ── */
:root {
  --c-primary:   #1a56db;
  --c-primary-d: #1142a6;
  --c-yes:       #0e9f6e;
  --c-yes-bg:    #f0fdf4;
  --c-no:        #e02424;
  --c-no-bg:     #fef2f2;
  --c-warn:      #d97706;
  --c-warn-bg:   #fffbeb;
  --c-bg:        #f9fafb;
  --c-card:      #ffffff;
  --c-border:    #e5e7eb;
  --c-text:      #111827;
  --c-muted:     #6b7280;
  --radius:      12px;
  --shadow:      0 1px 4px rgba(0,0,0,.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--c-primary); }

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: 16px; /* base mobile */
}

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

/* ── Navbar ── */
.navbar {
  background: var(--c-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  padding-top: calc(1rem + env(safe-area-inset-top, 0px));
  gap: .75rem;
  position: sticky;
  top: 0;
  z-index: 100;
}
.navbar-brand {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: 1.2rem;
  font-weight: 700;
  flex-shrink: 0;
}
.navbar-brand a { color: #fff; }
.brand-icon { font-size: 1.5rem; }
.season-badge {
  background: rgba(255,255,255,.2);
  border-radius: 999px;
  padding: .15rem .6rem;
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
}
.nav-toggle { display: none; }
.navbar-links {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}
.navbar-links a { color: rgba(255,255,255,.9); font-size: 1rem; white-space: nowrap; }
.navbar-links a:hover { color: #fff; text-decoration: none; }
.admin-link { font-weight: 600; }
.user-pill {
  background: rgba(255,255,255,.15);
  border-radius: 999px;
  padding: .25rem .75rem;
  font-size: .9rem;
  white-space: nowrap;
}
.btn-logout {
  background: rgba(255,255,255,.2);
  border-radius: 8px;
  padding: .4rem .9rem;
  font-size: .9rem;
  white-space: nowrap;
}
.btn-logout:hover { background: rgba(255,255,255,.35); }

/* ── Layout ── */
.container { max-width: 960px; margin: 0 auto; padding: 1.5rem 1.25rem; flex: 1; }

/* ── Alerts ── */
.alert {
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  font-size: 1rem;
  line-height: 1.4;
}
.alert-success  { background: var(--c-yes-bg);  color: var(--c-yes);  border: 1px solid #6ee7b7; }
.alert-danger   { background: var(--c-no-bg);   color: var(--c-no);   border: 1px solid #fca5a5; }
.alert-warning  { background: var(--c-warn-bg); color: var(--c-warn); border: 1px solid #fde68a; }
.alert-info     { background: #eff6ff;           color: var(--c-primary); border: 1px solid #bfdbfe; }

/* ── Auth Card ── */
.auth-card {
  max-width: 440px;
  margin: 2rem auto;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow);
  text-align: center;
}
.auth-logo { font-size: 3.5rem; margin-bottom: .75rem; }
.auth-logo-img { width: 5.25rem; height: 5.25rem; object-fit: contain; }
.auth-card h1 { font-size: 1.75rem; margin-bottom: .25rem; }
.auth-subtitle { color: var(--c-muted); font-size: 1rem; margin-bottom: 1.75rem; }
.auth-card form { text-align: left; }
.auth-footer { margin-top: 1.25rem; font-size: 1rem; color: var(--c-muted); }

/* ── Forms ── */
.form-group { margin-bottom: 1.1rem; }
.form-group label {
  display: block;
  font-size: .95rem;
  font-weight: 600;
  margin-bottom: .4rem;
}
.form-group input:not([type="checkbox"]),
.form-group textarea,
.form-group select {
  width: 100%;
  padding: .75rem 1rem;
  border: 1.5px solid var(--c-border);
  border-radius: 8px;
  font-size: 1rem; /* 16px = pas de zoom auto iOS */
  background: #fff;
  transition: border-color .15s;
  -webkit-appearance: none;
}
.form-group input:not([type="checkbox"]):focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,.15);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-check {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: 1.1rem;
  font-size: 1rem;
}
.form-check input { width: auto; width: 20px; height: 20px; }
.form-actions { display: flex; gap: .75rem; margin-top: 1.75rem; flex-wrap: wrap; }
.req { color: var(--c-no); }
.form-card {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.75rem;
  max-width: 640px;
  box-shadow: var(--shadow);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .7rem 1.25rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background .15s, opacity .15s;
  white-space: nowrap;
  min-height: 48px; /* tap target confortable */
}
.btn:hover { text-decoration: none; opacity: .88; }
.btn-primary   { background: var(--c-primary); color: #fff; }
.btn-secondary { background: var(--c-border);  color: var(--c-text); }
.btn-danger    { background: var(--c-no);       color: #fff; }
.btn-success   { background: var(--c-yes);      color: #fff; }
.btn-warning   { background: var(--c-warn);     color: #fff; }
.btn-full      { width: 100%; padding: .85rem; font-size: 1.05rem; }
.btn-sm {
  padding: .45rem .85rem;
  font-size: .9rem;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  min-height: 38px;
  font-weight: 500;
}
.actions-cell { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

/* ── Page header ── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.page-header h1 { font-size: 1.5rem; margin-bottom: .25rem; }
.page-sub { color: var(--c-muted); font-size: .95rem; }
.section-title {
  font-weight: 700;
  margin: 1.75rem 0 .9rem;
  color: var(--c-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: .8rem;
}

/* ── Training cards ── */
.training-grid { display: grid; gap: .85rem; }
.training-card {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow);
  transition: border-color .15s;
  position: relative;
  cursor: pointer;
}
.training-card:hover { border-color: var(--c-primary); }
.training-card.past { opacity: .65; }
.training-card.my-status-yes { border-left: 5px solid var(--c-yes); }
.training-card.my-status-no  { border-left: 5px solid var(--c-no); }

.tc-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 54px;
  background: var(--c-bg);
  border-radius: 10px;
  padding: .5rem .6rem;
  flex-shrink: 0;
}
.tc-day   { font-size: 1.6rem; font-weight: 800; line-height: 1; }
.tc-month { font-size: .75rem; text-transform: uppercase; color: var(--c-muted); font-weight: 600; margin-top: .1rem; }
.tc-body  { flex: 1; min-width: 0; }
.tc-title { font-weight: 700; font-size: 1.05rem; display: block; }
.tc-meta  { font-size: .85rem; color: var(--c-muted); margin: .25rem 0; }
.tc-creator { font-size: .8rem; color: var(--c-muted); }
.tc-presence-bar { display: flex; gap: .6rem; margin-top: .4rem; }
.tc-actions { display: flex; flex-direction: column; gap: .4rem; align-items: flex-end; flex-shrink: 0; }

/* ── Presence buttons (liste) ── */
.presence-form { display: flex; gap: .4rem; }
.btn-presence {
  width: 50px; height: 50px;
  border-radius: 10px;
  border: 2px solid var(--c-border);
  background: #fff;
  cursor: pointer;
  font-size: 1.3rem;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .15s, background .15s;
}
.btn-presence.active { border-color: var(--c-primary); background: #eff6ff; }

/* ── Presence buttons (détail) ── */
.presence-buttons { display: flex; gap: .85rem; margin: 1.25rem 0; }
.btn-pres-big {
  flex: 1;
  padding: 1rem .5rem;
  border-radius: 10px;
  border: 2px solid var(--c-border);
  background: #fff;
  cursor: pointer;
  font-size: 1.05rem;
  font-weight: 600;
  transition: all .15s;
  min-height: 56px;
}
.btn-pres-big:hover { border-color: var(--c-primary); background: #eff6ff; }
.btn-pres-big.active-yes { border-color: var(--c-yes); background: var(--c-yes-bg); color: var(--c-yes); }
.btn-pres-big.active-no  { border-color: var(--c-no);  background: var(--c-no-bg);  color: var(--c-no); }
.presence-hint { font-size: .95rem; color: var(--c-muted); }

/* ── Badges ── */
.badge-yes { color: var(--c-yes);   font-size: .9rem; font-weight: 700; }
.badge-no  { color: var(--c-no);    font-size: .9rem; font-weight: 700; }
.badge-unk { color: var(--c-muted); font-size: .9rem; font-weight: 600; }

/* ── Detail grid ── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }
.card {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.4rem;
  box-shadow: var(--shadow);
}
.card h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: .9rem; }
.presence-summary { display: flex; gap: 1rem; margin-bottom: .9rem; flex-wrap: wrap; }
.presence-list { list-style: none; display: flex; flex-direction: column; gap: .5rem; }
.pli { display: flex; align-items: center; gap: .6rem; font-size: .95rem; line-height: 1.2; }
.pli-icon { width: 1.4em; text-align: center; flex-shrink: 0; }
.pli-yes     { color: var(--c-text); }
.pli-no      { color: var(--c-muted); text-decoration: line-through; }
.pli-unknown { color: var(--c-muted); }
.pli-me { font-size: .8rem; color: var(--c-primary); font-weight: 600; }
.detail-header-actions { display: flex; gap: .6rem; align-items: flex-start; flex-wrap: wrap; }
.training-desc { color: var(--c-muted); font-size: .95rem; margin-top: .5rem; line-height: 1.5; }

/* ── Admin table ── */
.admin-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.admin-table th {
  text-align: left;
  padding: .6rem .85rem;
  border-bottom: 2px solid var(--c-border);
  color: var(--c-muted);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.admin-table td { padding: .6rem .85rem; border-bottom: 1px solid var(--c-border); vertical-align: middle; }
.row-inactive td { color: var(--c-muted); }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 3.5rem 1rem; color: var(--c-muted); }
.empty-icon  { font-size: 3.5rem; margin-bottom: 1.25rem; }
.empty-state p { margin-bottom: 1.25rem; font-size: 1rem; }

/* ── Past section ── */
.nav-link { color: inherit; text-decoration: underline dotted; text-underline-offset: 2px; }
.nav-link:hover { color: var(--c-primary); }
.past-section { margin-top: 1.75rem; }
.past-section summary { cursor: pointer; user-select: none; font-size: .95rem; }
.mt-1 { margin-top: 1rem; }

/* ── Footer ── */
.site-footer {
  text-align: center;
  padding: 1.25rem;
  font-size: .9rem;
  color: var(--c-muted);
  border-top: 1px solid var(--c-border);
  margin-top: auto;
}

/* ════════════════════════════════════════
   DESKTOP uniquement (≥ 769px)
   Réduit légèrement pour la densité bureau
   ════════════════════════════════════════ */
@media (min-width: 769px) {
  body { font-size: 15px; }

  .navbar { padding: .75rem 1.5rem; }
  .navbar-brand { font-size: 1.15rem; }
  .brand-icon { font-size: 1.4rem; }
  .navbar-links a { font-size: .9rem; }
  .user-pill { font-size: .85rem; padding: .2rem .75rem; }
  .btn-logout { font-size: .85rem; padding: .3rem .8rem; }

  .container { padding: 1.5rem 1rem; }

  .auth-card { padding: 2.5rem 2rem; }
  .auth-logo { font-size: 3rem; }
  .auth-card h1 { font-size: 1.5rem; }

  .form-group input:not([type="checkbox"]),
  .form-group textarea,
  .form-group select { padding: .55rem .75rem; font-size: .95rem; }

  .btn { padding: .5rem 1.1rem; font-size: .9rem; min-height: 38px; }
  .btn-full { padding: .65rem; font-size: .95rem; }
  .btn-sm { padding: .25rem .6rem; font-size: .8rem; min-height: 30px; }

  .page-header h1 { font-size: 1.4rem; }

  .tc-day { font-size: 1.4rem; }
  .tc-month { font-size: .7rem; }
  .tc-title { font-size: 1rem; }
  .tc-meta { font-size: .8rem; }

  .btn-presence { width: 38px; height: 38px; font-size: 1.1rem; }
  .btn-pres-big { font-size: 1rem; min-height: 48px; }

  .admin-table { font-size: .875rem; }
  .admin-table th { font-size: .75rem; padding: .5rem .75rem; }
  .admin-table td { padding: .5rem .75rem; }
}

/* ════════════════════════════════════════
   MOBILE : ajustements spécifiques (≤ 600px)
   ════════════════════════════════════════ */
@media (max-width: 600px) {
  .detail-grid { grid-template-columns: 1fr; }
  .form-row    { grid-template-columns: 1fr; }

  .page-header { flex-direction: column; }
  .page-header .btn { width: 100%; }

  .form-actions { flex-direction: column; }
  .form-actions .btn { width: 100%; }

  /* Navbar hamburger */
  .season-badge { display: none; }
  .nav-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,.15);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    padding: 6px;
    flex-shrink: 0;
  }
  .nav-toggle span {
    display: block;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform .2s, opacity .2s;
  }
  .nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle.open span:nth-child(2) { opacity: 0; }
  .nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  .navbar-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--c-primary);
    padding: .75rem 1.25rem 1rem;
    gap: .5rem;
    border-top: 1px solid rgba(255,255,255,.15);
    z-index: 99;
  }
  .navbar-links.open { display: flex; }
  .navbar-links a, .user-pill { font-size: 1rem; }
  .user-pill { background: none; padding: 0; }

  /* Admin : tableau → cartes */
  .admin-table thead { display: none; }
  .admin-table tr {
    display: block;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    margin-bottom: .85rem;
    padding: 1rem;
    background: var(--c-card);
  }
  .admin-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .4rem 0;
    border: none;
    font-size: .95rem;
  }
  .admin-table td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--c-muted);
    font-size: .8rem;
    text-transform: uppercase;
    margin-right: .75rem;
    flex-shrink: 0;
  }
  .actions-cell { justify-content: flex-end; padding-top: .5rem; border-top: 1px solid var(--c-border); }

  /* Cards entraînements : boutons en bas */
  .tc-actions {
    width: 100%;
    flex-direction: row;
    justify-content: flex-end;
    border-top: 1px solid var(--c-border);
    padding-top: .6rem;
    margin-top: .25rem;
  }
  .training-card { flex-wrap: wrap; }

  .detail-header-actions { width: 100%; }
  .detail-header-actions .btn { flex: 1; text-align: center; }
}

/* ════════════════════════════════════════
   EVENT TYPES - badges & labels
   ════════════════════════════════════════ */
.ev-badge {
  display: inline-block;
  font-size: .75rem;
  font-weight: 600;
  padding: .15rem .45rem;
  border-radius: 6px;
  margin-right: .3rem;
  vertical-align: middle;
}
.ev-training { background: #e0f2fe; color: #0369a1; }
.ev-match    { background: #fef9c3; color: #854d0e; }
.ev-other    { background: #f3e8ff; color: #7e22ce; }

.tc-vs       { font-weight: 600; }
.tc-loc-tag  { font-size: .9rem; margin-left: .2rem; }
.vs-label    { font-size: 1.1rem; font-weight: 500; color: var(--c-muted); margin-left: .4rem; }

/* ── Type selector (form) ── */
.type-selector {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
}
.type-option {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem .9rem;
  border: 2px solid var(--c-border);
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 500;
  transition: border-color .15s, background .15s;
}
.type-option:has(input:checked) {
  border-color: var(--c-primary);
  background: #eff6ff;
}
.type-option input { display: none; }

/* ── Checkbox label ── */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: .5rem;
  cursor: pointer;
  font-weight: 500;
}
.field-hint { font-size: .85rem; color: var(--c-muted); margin-top: .35rem; }

/* ════════════════════════════════════════
   MATCH RESULT
   ════════════════════════════════════════ */
.result-card { margin-bottom: 1.25rem; }

.result-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 1rem;
}
.result-team  { font-weight: 600; font-size: 1.05rem; }
.result-score {
  font-size: 2rem;
  font-weight: 700;
  padding: .25rem .75rem;
  border-radius: 8px;
}
.result-win  { background: var(--c-yes-bg);  color: var(--c-yes); }
.result-loss { background: var(--c-no-bg);   color: var(--c-no); }

.sets-list {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  justify-content: center;
}
.set-item {
  padding: .35rem .7rem;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .15rem;
  min-width: 64px;
}
.set-item span { font-size: .7rem; font-weight: 400; color: var(--c-muted); }
.set-won  { background: var(--c-yes-bg); color: var(--c-yes); }
.set-lost { background: var(--c-no-bg);  color: var(--c-no); }

/* ── Result form ── */
.sets-form { margin-bottom: .75rem; }

.sets-header {
  display: grid;
  grid-template-columns: 80px 1fr 24px 1fr;
  gap: .5rem;
  margin-bottom: .4rem;
  text-align: center;
}
.sets-col-label { font-size: .8rem; font-weight: 600; color: var(--c-muted); text-transform: uppercase; }

.set-row {
  display: grid;
  grid-template-columns: 80px 1fr 24px 1fr;
  gap: .5rem;
  align-items: center;
  margin-bottom: .5rem;
}
.set-label  { font-weight: 600; font-size: .9rem; }
.set-input  { width: 100%; text-align: center; padding: .45rem; border: 1px solid var(--c-border); border-radius: 8px; font-size: 1.1rem; font-weight: 600; }
.set-sep    { text-align: center; font-weight: 700; color: var(--c-muted); }

.sets-controls {
  display: flex;
  gap: .5rem;
  margin-top: .25rem;
}
.mt-1 { margin-top: .75rem; }

/* ════════════════════════════════════════
   CONTRIBUTIONS (match domicile)
   ════════════════════════════════════════ */
.contributions-card { margin-top: 1.25rem; }

.contrib-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  margin-bottom: .6rem;
}
.contrib-label {
  display: flex;
  align-items: center;
  gap: .35rem;
  padding: .4rem .8rem;
  border: 2px solid var(--c-border);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: border-color .15s, background .15s;
}
.contrib-label:has(input:checked) {
  border-color: var(--c-yes);
  background: var(--c-yes-bg);
}
.contrib-label input { display: none; }

.contrib-summary { border-top: 1px solid var(--c-border); padding-top: .75rem; }
.contrib-row     { margin-bottom: .35rem; font-size: .95rem; }
.text-muted      { color: var(--c-muted); font-size: .9rem; }

/* ── Admin sections ── */
.admin-section    { margin-bottom: 1.5rem; }
.inline-add-form  { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.inline-input     { flex: 1; min-width: 0; padding: .45rem .75rem; border: 1px solid var(--c-border); border-radius: 8px; font-size: .95rem; }
@media (max-width: 600px) {
  .inline-add-form { flex-direction: column; align-items: stretch; }
  .inline-add-form .btn { width: 100%; }
}
.btn-sm { padding: .3rem .65rem; font-size: .85rem; }
