/* ── Tableau des joueurs ────────────────────────────────────────────────────── */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}
.players-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}
.players-table th,
.players-table td {
  padding: 8px;
  border: 1px solid #eee;
  text-align: center;
}
.players-table th {
    background: #f0f0f7;
    cursor: pointer;
    position: sticky;
    top: 0;
    z-index: 1;
}
.players-table tr:nth-child(even) {
    background: #fafafb;
}
.players-table tr:hover td {
    background: #e4e4fc;
}
.players-table button {
    background: none;
    border: none;
    font-size: 1.2em;
    cursor: pointer;
    margin: 0 2px;
    /* Touch targets */
    padding: 8px 10px;
    min-width: 36px;
    min-height: 36px;
}
/* Détail pliable pour la liste des joueurs */
#players-details summary {
  cursor: pointer;
  list-style: none;
}
#players-details summary h2 {
  display: inline;
}

/* ── Table planning ─────────────────────────────────────────────────────────── */
.planning-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    margin-bottom: 1.5em;
}
.planning-table th, .planning-table td {
    border: 1px solid #ccc;
    padding: 8px 5px;
    text-align: center;
}
.planning-table th {
    background: #f8f8f8;
    position: sticky;
    top: 0;
    z-index: 1;
}
.planning-table tr:nth-child(even) {
    background: #f4f8fa;
}
/* Zébrage gagnant et hover (conservés pour compat) */
.winner-row td, .winner-row {
    background: #aaffc3 !important;
    font-weight: 600;
    color: #256900;
}
.planning-table tr:hover td    { background: #d4e6fc !important; }
.planning-table tr.hover-block td { background: #d4e6fc !important; }

/* ── Indicateur d'étapes (création de tournoi) ─────────────────────────────── */
.setup-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 18px 0 4px 0;
    font-size: 0.95em;
}
.setup-steps .step {
    padding: 5px 14px;
    border-radius: 18px;
    background: #e5e7eb;
    color: #9ca3af;
    font-weight: 500;
}
.setup-steps .step.done {
    background: #d1fae5;
    color: #059669;
}
.setup-steps .step.active {
    background: #ffb400;
    color: #222;
    font-weight: 700;
}
.setup-steps .step-arrow {
    color: #9ca3af;
    font-size: 1.2em;
}

/* ── Paramètres tableau ─────────────────────────────────────────────────────── */
.param-container {
    background: #fff;
    max-width: 500px;
    margin: 28px auto 0 auto;
    padding: 25px 30px 20px 30px;
    border-radius: 13px;
    box-shadow: 0 4px 18px rgba(60,60,130,0.09);
}
.param-form {
    display: flex;
    flex-direction: column;
    gap: 19px;
}
.row-2 {
    display: flex;
    gap: 22px;
}
.row-2 > div {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
}
.param-form label {
    margin-bottom: 4px;
    font-weight: 500;
}
.param-form input[type="number"], .param-form select {
    padding: 8px 7px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1.07em;
    background: #fafcff;
    transition: border .17s;
}
.param-form input[type="number"]:focus, .param-form select:focus {
    border: 1.5px solid #3b82f6;
    outline: none;
}
.param-form input[type="checkbox"] {
    width: 20px; height: 20px;
    accent-color: #3b82f6;
}
.param-btn-save {
    margin: 10px 0 0 0;
    background: var(--clr-blue);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 1.1em;
    padding: 12px 0;
    font-weight: bold;
    cursor: pointer;
    transition: background .17s;
    width: 100%;
}
.param-btn-save:hover {
    background: var(--clr-blue-dark);
}
.param-actions {
    display: flex;
    gap: 12px;
    margin-top: 18px;
    justify-content: center;
}
.param-btn {
    background: #4d6aff;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 9px 14px;
    font-size: 1em;
    cursor: pointer;
    font-weight: 500;
    transition: background .15s;
}
.param-btn:hover {
    background: #364ba0;
}
.param-btn-danger {
    background: var(--clr-red);
}
.param-btn-danger:hover {
    background: var(--clr-red-dark);
}

/* ── Classement de poule ─────────────────────────────────────────────────────── */
.classement-poule {
  margin-top: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  overflow: hidden;
}
.classement-poule summary {
  cursor: pointer;
  padding: 8px 14px;
  background: #f8fafc;
  font-weight: 600;
  font-size: 0.92em;
  color: #374151;
  user-select: none;
  list-style: none;
}
.classement-poule summary::-webkit-details-marker { display: none; }
.classement-poule summary::before { content: "▶ "; font-size: 0.75em; }
.classement-poule[open] summary::before { content: "▼ "; }
.classement-poule-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  font-size: 0.9em;
}
.classement-poule-table th {
  background: #f1f5f9;
  padding: 6px 10px;
  text-align: center;
  font-size: 0.85em;
  color: #64748b;
  border-bottom: 1px solid #e2e8f0;
}
.classement-poule-table th:nth-child(2) { text-align: left; }
.classement-poule-table td {
  padding: 6px 10px;
  text-align: center;
  border-bottom: 1px solid #f0f0f0;
}
.classement-poule-table td:nth-child(2) { text-align: left; font-weight: 500; }
.classement-poule-table tr.qualifie td { background: #f0fdf4; color: #15803d; }
.classement-poule-table tr.qualifie td:nth-child(2)::after { content: " ✓"; font-size: 0.8em; opacity: 0.7; }
.classement-poule-table tr.repechage td { background: #fefce8; color: #854d0e; }
.classement-poule-table tr.repechage td:nth-child(2)::after { content: " ↑"; font-size: 0.8em; opacity: 0.7; }

/* Pool jump anchor links */
.poule-jumps {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.poule-jump-link {
  display: inline-flex;
  align-items: center;
  font-size: 0.82em;
  padding: 4px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  color: #374151;
  text-decoration: none;
  background: #f9fafb;
  white-space: nowrap;
  min-height: 32px;
}
.poule-jump-link:hover { background: #f1f5f9; color: #0a2342; }

/* ── Page d'aide ────────────────────────────────────────────────────────── */
.aide-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 14px 18px;
    margin-bottom: 12px;
}
.aide-steps { counter-reset: aide-step; padding: 0; list-style: none; }
.aide-steps li {
    counter-increment: aide-step;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 10px;
}
.aide-steps li::before {
    content: counter(aide-step);
    min-width: 24px; height: 24px;
    background: #1d4ed8; color: #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.82em; font-weight: 700;
    flex-shrink: 0; margin-top: 1px;
}
.aide-tip {
    background: #eff6ff;
    border-left: 3px solid #3b82f6;
    padding: 9px 14px;
    border-radius: 0 6px 6px 0;
    font-size: 0.9em;
    margin: 10px 0;
    color: #1e3a8a;
}
.aide-warn {
    background: #fffbeb;
    border-left: 3px solid #f59e0b;
    padding: 9px 14px;
    border-radius: 0 6px 6px 0;
    font-size: 0.9em;
    margin: 10px 0;
    color: #78350f;
}
.aide-table { width: 100%; border-collapse: collapse; font-size: 0.9em; margin: 8px 0; }
.aide-table th { background: #f3f4f6; padding: 7px 10px; text-align: left; border: 1px solid #e5e7eb; }
.aide-table td { padding: 7px 10px; border: 1px solid #e5e7eb; vertical-align: top; }
.aide-table td:first-child { font-weight: 600; white-space: nowrap; }
kbd {
    display: inline-block;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-bottom: 2px solid #9ca3af;
    border-radius: 4px;
    padding: 1px 7px;
    font-size: 0.85em;
    font-family: monospace;
    color: #111;
}
.aide-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

/* ── Phase finales ──────────────────────────────────────────────────────────── */
.tab {
  display: none;
}
.tab.active {
  display: block;
}

/* Navigation par onglets (finales) */
.tab-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 16px 0;
}
.tab-btn {
  background: #e5e7eb;
  color: #374151;
  border: none;
  padding: 6px 16px;
  border-radius: 18px;
  font-size: 1em;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.tab-btn:hover,
.tab-btn.active {
  background: #ffb400;
  color: #222;
}

/* Titre de sous-tableau */
.subtab-title {
  color: #555;
  font-size: 1em;
  font-weight: 600;
  margin: 14px 0 6px 0;
  padding-bottom: 4px;
  border-bottom: 1px solid #eee;
}

/* ------ Tournament bracket view ------ */
#bracket-view {
  overflow-x: auto;
  padding: 8px 0 24px;
}
.bracket-segment {
  margin-bottom: 36px;
}
.bracket-seg-title {
  font-weight: 700;
  font-size: 0.95em;
  color: #1e40af;
  padding: 7px 20px;
  border-left: 4px solid #3b82f6;
  background: #eff6ff;
  margin-bottom: 12px;
}
/* Bracket de finales : déplacé dans static/css/bracket.css (CSS unique paramétré),
   chargé par bracket_frame.html et bracket2.html. */

/* ── Badge repêchage ────────────────────────────────────────────────────── */
.badge-repechage {
  display: inline-block;
  background: #fbbf24;
  color: #78350f;
  font-size: 0.68em;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  vertical-align: middle;
  margin-left: 4px;
  letter-spacing: 0.03em;
}

/* ── Grille 2 poules côte à côte ────────────────────────────────────────────── */
.poules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(520px, 1fr));
  gap: 14px;
  align-items: start;
}
.poules-grid .poule-card { margin-bottom: 0; }
/* Dernière card seule sur sa ligne → pleine largeur */
.poules-grid .poule-card:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

/* ── Poule cards (nouveau design) ───────────────────────────────────────────── */
.poule-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  margin-bottom: 14px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.poule-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #f8fafc;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid #e5e7eb;
  gap: 12px;
}
.poule-header:hover { background: #f1f5f9; }
.poule-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  overflow: hidden;
}
.poule-toggle-icon {
  font-size: 0.7em;
  color: #6b7280;
  transition: transform 0.2s;
  flex-shrink: 0;
}
.poule-players {
  font-size: 0.82em;
  color: #9ca3af;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.poule-print-btn {
  font-size: 0.85em;
  color: #6b7280;
  text-decoration: none;
  padding: 3px 8px;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  background: #fff;
  flex-shrink: 0;
}
.poule-print-btn:hover { background: #f3f4f6; color: #374151; }
.poule-body { padding: 0; }

.handicap-badge {
  display: inline-block;
  font-size: 0.7em;
  background: #dbeafe;
  color: #1e40af;
  border-radius: 3px;
  padding: 0 4px;
  margin-left: 4px;
  vertical-align: middle;
}

/* ── Boutons actions compacts ───────────────────────────────────────────────── */
.btn-action {
  border: none;
  border-radius: 4px;
  padding: 3px 7px;
  font-size: 0.82em;
  cursor: pointer;
  font-weight: 600;
  line-height: 1.4;
}
.btn-blue { background: var(--clr-blue); color: #fff; }
.btn-blue:hover { background: var(--clr-blue-dark); }
.btn-gray { background: var(--clr-gray-settings); color: #fff; }
.btn-gray:hover { background: var(--clr-gray-tool); }
.btn-red  { background: transparent; color: #d1d5db; border: 1px solid #e5e7eb; }
.btn-red:hover  { background: #fee2e2; color: #dc2626; border-color: #fca5a5; }
/* Rendre F1/F2 légèrement visible au survol de la ligne */
.match-clickable:hover .btn-red { color: #f87171; border-color: #fca5a5; }

@media (max-width: 767px) {
  /* Grilles poules : une colonne sur mobile */
  .poules-grid { grid-template-columns: 1fr !important; }
  .poules-grid .poule-card:last-child:nth-child(odd) { grid-column: auto; }

  /* Touch targets agrandis */
  .poule-header  { padding: 14px 12px; }
  .poule-print-btn { padding: 8px; font-size: 1.1em; }
  .poule-jump-link { min-height: 40px; padding: 6px 14px; font-size: 0.88em; }
  .classement-poule summary { padding: 12px 14px; }
  /* Finales tab buttons */
  .tab-btn { padding: 10px 16px; min-height: 40px; }
  /* Tables toast : full-width on mobile */
  #tables-toast { right: 8px !important; left: 8px !important; max-width: none !important; bottom: 16px !important; }
  /* Masquer le widget tables en ligne (trop dense) sur mobile */
  #tables-widget { display: none !important; }

  /* Players table compact */
  .players-table th, .players-table td { font-size: 14px; padding: 6px 3px; }

  /* Param container */
  .param-container { padding: 14px 6px; }
  .row-2 { flex-direction: column; gap: 8px; }
  .param-actions { flex-direction: column; gap: 7px; }
}
