/* ===================================================
   TSUKA — Thème FSCF
   Couleurs: Bleu marine #003087 / Rouge #C8102E
   =================================================== */

:root {
  --fscf-bleu: #003087;
  --fscf-bleu-clair: #1a4fa0;
  --fscf-bleu-pale: #e8eef8;
  --fscf-rouge: #C8102E;
  --fscf-rouge-hover: #a50d25;
  --fscf-gris: #f5f6fa;
  --fscf-texte: #1a1a2e;
}

/* Barre de navigation */
.navbar-tsuka {
  background-color: var(--fscf-bleu);
  border-bottom: 3px solid var(--fscf-rouge);
  padding: 0.5rem 1rem;
}

.navbar-tsuka .navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #fff;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-decoration: none;
}

.navbar-tsuka .navbar-brand img {
  height: 48px;
  width: auto;
  background: #fff;
  border-radius: 6px;
  padding: 3px 6px;
}

.navbar-tsuka .navbar-brand span.app-name {
  color: #fff;
}

.navbar-tsuka .navbar-brand span.app-subtitle {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.75rem;
  font-weight: 400;
  display: block;
  line-height: 1;
}

.navbar-tsuka .nav-link {
  color: rgba(255, 255, 255, 0.85) !important;
  font-weight: 500;
  transition: color 0.2s;
}

.navbar-tsuka .nav-link:hover,
.navbar-tsuka .nav-link.active {
  color: #fff !important;
}

.navbar-tsuka .nav-link.active {
  border-bottom: 2px solid var(--fscf-rouge);
}

.navbar-tsuka .dropdown-menu {
  border-top: 3px solid var(--fscf-rouge);
}

.navbar-tsuka .navbar-toggler {
  border-color: rgba(255, 255, 255, 0.4);
}

.navbar-tsuka .navbar-toggler-icon {
  filter: invert(1);
}

/* Badges de profil */
.badge-admin {
  background-color: var(--fscf-rouge);
  color: #fff;
}

.badge-resp-juge {
  background-color: #6f42c1;
  color: #fff;
}

.badge-juge {
  background-color: var(--fscf-bleu);
  color: #fff;
}

/* Contenu principal */
body {
  background-color: var(--fscf-gris);
  color: var(--fscf-texte);
  font-family: 'Segoe UI', system-ui, sans-serif;
}

.main-content {
  padding-top: 1.5rem;
  padding-bottom: 3rem;
  min-height: calc(100vh - 120px);
}

/* En-têtes de page */
.page-header {
  background: linear-gradient(135deg, var(--fscf-bleu) 0%, var(--fscf-bleu-clair) 100%);
  color: #fff;
  padding: 1.25rem 1.5rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
}

.page-header .btn-header {
  background-color: #fff;
  color: var(--fscf-bleu);
  font-weight: 600;
  border: none;
}

.page-header .btn-header:hover {
  background-color: var(--fscf-rouge);
  color: #fff;
}

.page-header .text-muted,
.page-header p {
  color: rgba(255, 255, 255, 0.80) !important;
}

/* Cartes */
.card {
  border: none;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 48, 135, 0.08);
}

.card-header-tsuka {
  background-color: var(--fscf-bleu);
  color: #fff;
  border-radius: 8px 8px 0 0 !important;
  font-weight: 600;
  padding: 0.75rem 1rem;
}

/* Forcer le texte blanc sur tous les enfants des headers bleu foncé */
.card-header-tsuka *,
.card-header-tsuka .form-check-label,
.card-header-tsuka label,
.card-header-tsuka small {
  color: #fff;
}

.card-header-tsuka .text-muted,
.card-header-tsuka small.text-muted {
  color: rgba(255, 255, 255, 0.7) !important;
}

/* Thead des tableaux : même logique */
.table-tsuka thead th,
.table-tsuka thead th * {
  color: #fff;
}

/* Checkbox sur fond bleu foncé : contour blanc */
.card-header-tsuka .form-check-input {
  border-color: rgba(255, 255, 255, 0.6);
  background-color: rgba(255, 255, 255, 0.15);
}

.card-header-tsuka .form-check-input:checked {
  background-color: #fff;
  border-color: #fff;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23003087' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e");
}

/* Boutons */
.btn-primary {
  background-color: var(--fscf-bleu);
  border-color: var(--fscf-bleu);
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--fscf-bleu-clair);
  border-color: var(--fscf-bleu-clair);
}

.btn-danger {
  background-color: var(--fscf-rouge);
  border-color: var(--fscf-rouge);
}

.btn-danger:hover {
  background-color: var(--fscf-rouge-hover);
  border-color: var(--fscf-rouge-hover);
}

/* Tableau */
.table-tsuka thead th {
  background-color: var(--fscf-bleu);
  color: #fff;
  border-color: var(--fscf-bleu-clair);
  font-weight: 600;
  vertical-align: middle;
}

.table-tsuka tbody tr:hover {
  background-color: var(--fscf-bleu-pale);
}

/* Configuration agrès */
.agres-row td {
  opacity: .45;
  transition: opacity .15s;
}
.agres-row.selected td {
  opacity: 1;
}
.agres-row td:first-child {
  opacity: 1;
}

/* Formulaire de connexion */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--fscf-bleu) 0%, #001f5a 100%);
}

.login-card {
  width: 100%;
  max-width: 420px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.login-header {
  background: #fff;
  padding: 2rem;
  text-align: center;
  border-bottom: 3px solid var(--fscf-rouge);
}

.login-header img {
  height: 80px;
  margin-bottom: 1rem;
}

.login-header h1 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--fscf-bleu);
  letter-spacing: 0.1em;
  margin: 0;
}

.login-header p {
  color: #666;
  font-size: 0.85rem;
  margin: 0.25rem 0 0;
}

.login-body {
  background: #fff;
  padding: 2rem;
}

/* Alertes */
.alert {
  border-left: 4px solid;
  border-radius: 6px;
}

.alert-success {
  border-left-color: #28a745;
}

.alert-danger {
  border-left-color: var(--fscf-rouge);
}

.alert-warning {
  border-left-color: #ffc107;
}

.alert-info {
  border-left-color: var(--fscf-bleu);
}

/* Pied de page */
.footer-tsuka {
  background-color: var(--fscf-bleu);
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
  padding: 0.75rem;
  font-size: 0.8rem;
}

/* Agrès checkbox list */
.agres-checkbox-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.5rem;
}

.agres-checkbox-list .form-check {
  background: var(--fscf-bleu-pale);
  border: 1px solid #c5d5ed;
  border-radius: 6px;
  padding: 0.5rem 0.75rem 0.5rem 2rem;
}

.agres-checkbox-list .form-check-input:checked {
  background-color: var(--fscf-bleu);
  border-color: var(--fscf-bleu);
}

/* ── Dossard (badge contrôle licence) ────────────── */
.badge-dossard {
  display: inline-block;
  background: transparent;
  color: var(--fscf-rouge);
  border: 1.5px solid var(--fscf-rouge);
  border-radius: 4px;
  font-weight: 700;
  font-size: .8rem;
  padding: 2px 6px;
  min-width: 2rem;
  text-align: center;
}
.badge-dossard.controle {
  color: #198754;
  border-color: #198754;
}

/* ── Séparateur horaire (liste gymnastes notation) ── */
.horaire-sep {
  padding: .25rem .65rem;
  font-size: .7rem; font-weight: 700;
  letter-spacing: .05em;
  color: #fff; background: var(--fscf-bleu);
  text-transform: uppercase;
}

/* ── Liste notation : item gymnaste ──────────────── */
.gym-dossard {
  font-size: .72rem; font-weight: 700;
  background: transparent; color: var(--fscf-rouge);
  border: 1.5px solid var(--fscf-rouge);
  border-radius: 4px; padding: 2px 5px;
  min-width: 32px; text-align: center; flex-shrink: 0;
}
.gym-item.active .gym-dossard { color: #fff; border-color: rgba(255,255,255,.6); }

/* ── Panneau notation : grand dossard gymnaste ───── */
.gym-header-dossard {
  font-size: 2rem; font-weight: 900;
  background: transparent; color: var(--fscf-rouge);
  border: 2px solid var(--fscf-rouge);
  border-radius: 8px; padding: 0 .75rem; line-height: 2.4rem;
}

/* ── Drag & drop (SortableJS) ────────────────────── */
.drag-handle { cursor: grab; color: #adb5bd; font-size: 1.1rem; padding: 0 .3rem; }
.drag-handle:active { cursor: grabbing; }
.sortable-ghost  { opacity: .35; background: var(--fscf-bleu-pale) !important; }
.sortable-chosen { background: #fff3cd !important; }

/* ── Engagements : en-têtes de groupe / rotation ─── */
.group-header td {
  background: var(--fscf-bleu); color: #fff;
  font-weight: 700; font-size: .8rem;
  padding: .3rem .75rem; border-bottom: none !important;
}
.group-header.rotation-header td {
  background: #6c757d; font-weight: 600;
  font-size: .75rem; padding: .2rem .75rem;
}
.btn-header-inline {
  font-size: .65rem; padding: 1px 6px;
  line-height: 1.4; border-radius: 3px; opacity: .85;
}
.btn-header-inline:hover { opacity: 1; }
.drop-empty td {
  border: 2px dashed #adb5bd; background: #f8f9fa;
  color: #6c757d; text-align: center;
  font-size: .8rem; padding: .4rem;
}
.rotation-group.drag-over .drop-empty td {
  border-color: var(--fscf-bleu); background: #e8edf7;
}

/* ── Layout interface de notation ────────────────── */
.notation-layout {
  display: flex; gap: 0;
  height: calc(100vh - 70px); overflow: hidden;
}
.notation-panel { flex: 1; overflow-y: auto; padding: 1rem 1.25rem; }

/* ── Liste gymnastes ─────────────────────────────── */
.gym-item {
  display: flex; align-items: center; gap: .5rem;
  padding: .45rem .65rem; cursor: pointer;
  border-bottom: 1px solid #dee2e6; transition: background .1s;
}
.gym-item:hover { background: #e9ecef; }
.gym-item.active { background: var(--fscf-bleu); color: #fff; }
.gym-item.active .text-muted { color: rgba(255,255,255,.7) !important; }

/* ── Panneau gymnaste ────────────────────────────── */
.gym-header-panel {
  display: flex; align-items: center; gap: 1rem;
  margin-bottom: 1rem; padding-bottom: .75rem;
  border-bottom: 2px solid var(--fscf-bleu);
}

/* ── Cartes agrès ────────────────────────────────── */
.agres-card { border: 1px solid #dee2e6; border-radius: 8px; margin-bottom: .75rem; overflow: hidden; }
.agres-card-header {
  background: var(--fscf-bleu); color: #fff;
  padding: .4rem .75rem; display: flex; align-items: center; gap: .5rem; font-weight: 600;
}
.agres-card-header.verrouille { background: #6c757d; }
.agres-card-header.valide     { background: #198754; }
.agres-card-body { padding: .75rem; }
.passage-tab-header {
  font-size: .8rem; font-weight: 600; color: var(--fscf-bleu);
  border-bottom: 1px solid #dee2e6; margin-bottom: .5rem; padding-bottom: .25rem;
}

/* ── Saisie des notes ────────────────────────────── */
.penalites-grid { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .5rem; }
.penalite-input { width: 72px; }
.note-result { font-size: 1.1rem; font-weight: 700; }
.note-result.ecart { color: var(--fscf-rouge); }
.note-finale-big { font-size: 1.4rem; font-weight: 900; color: var(--fscf-bleu); }
.note-d-exclu { text-decoration: line-through; opacity: .5; }
.btn-calcul  { background: #0d6efd; color: #fff; }
.btn-valider { background: #198754; color: #fff; }
.badge-impose { background: #dc3545; font-size: .65rem; }
.badge-libre  { background: #0d6efd; font-size: .65rem; }

/* ── Responsive mobile (notation) ───────────────── */
@media (max-width: 767px) {
  .notation-layout { flex-direction: column; height: auto; overflow: visible; }
  .gymnaste-list {
    width: 100% !important; border-right: none;
    border-bottom: 2px solid var(--fscf-bleu); max-height: 45vh;
  }
  .gymnaste-list.mobile-hidden { display: none !important; }
  .notation-panel.mobile-hidden { display: none !important; }
  .notation-panel { padding: .5rem .75rem; }
  .penalites-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: .5rem; }
  .penalite-input { width: 100%; min-height: 48px; font-size: 1.1rem; text-align: center; }
  .note-d-input, .bonif-input, .pj-input { min-height: 44px; font-size: .95rem; }
  .note-result { font-size: 1.3rem; }
  .note-finale-big { font-size: 1.6rem; }
  .passage-actions { flex-wrap: wrap; }
  .passage-actions > div:first-child { width: 100%; margin-bottom: .4rem; }
  .passage-actions > .ms-auto { margin-left: 0 !important; width: 100%; }
  .passage-actions .btn { flex: 1; }
  .gym-header-dossard { font-size: 1.5rem; line-height: 2rem; }
}

/* --- Palmarès (partagé) --- */
.table-palmares { font-size: .9rem; }
.table-palmares thead th {
  background: #f1f3f5; font-size: .75rem;
  text-transform: uppercase; letter-spacing: .04em; white-space: nowrap;
}
.table-palmares td, .table-palmares th { vertical-align: middle; border-left: 0; border-right: 0; }
.rang-cell { font-weight: 700; font-size: 1rem; min-width: 44px; text-align: center; }
.medaille {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  font-weight: 900; font-size: .85rem; color: #fff;
}
.medaille-1 { background: linear-gradient(135deg, #f5c842, #b8860b); }
.medaille-2 { background: linear-gradient(135deg, #c0c0c0, #808080); }
.medaille-3 { background: linear-gradient(135deg, #cd7f32, #8b4513); }
.ex-aequo-badge { font-size: .6rem; color: #6c757d; display: inline; margin-left: .2rem; }
.note-agres { font-weight: 600; font-variant-numeric: tabular-nums; }
.note-agres.vide { color: #adb5bd; }
.note-retenue { font-weight: 600; font-variant-numeric: tabular-nums; }
.note-non-retenue { font-variant-numeric: tabular-nums; color: #999; text-decoration: line-through; }
.note-vide { color: #adb5bd; }
.total-cell { font-weight: 900; font-size: 1rem; font-variant-numeric: tabular-nums; color: var(--fscf-bleu); }
.ligne-incomplet td { background: #fffbf0 !important; }

/* ── En-tête palmarès (partagé coupe / championnat / CNI) ── */
.palmares-header {
  background: var(--fscf-bleu-pale, #e8f0fe);
  color: var(--fscf-bleu, #1a3a6b);
  border: 1px solid var(--fscf-bleu, #1a3a6b);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.75rem;
}
.palmares-header h2 { font-size: 1.5rem; font-weight: 800; margin-bottom: .25rem; }
.palmares-header .meta { opacity: .8; font-size: .95rem; }
.palmares-logo { max-height: 52px; max-width: 120px; object-fit: contain; }
@media (max-width: 767px) {
  .palmares-header h2 { font-size: 1.2rem; }
}
