.club-main {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
}

:root {
  --lb-series-color-1: #60a5fa;
  --lb-series-color-2: #f472b6;
  --lb-series-color-3: #34d399;
  --lb-series-color-4: #fbbf24;
  --lb-series-color-5: #a78bfa;
  --lb-series-color-6: #f87171;
  --lb-series-color-7: #38bdf8;
  --lb-series-color-8: #4ade80;
  --lb-series-line-width: 1.5;
  --lb-series-point-radius: 2;
  --lb-series-point-stroke-color: #000;
  --lb-series-point-stroke-width: 1.5;
  --lb-axis-color: #444;
  --lb-grid-color: #2b2b2b;
  --lb-y-label-color: #999;
}
/* Header */
#header-club {
  display: flex;
  flex: 0 0 auto; /* Hauteur fixe */
  flex-shrink: 0; /* CRITIQUE: Ne jamais réduire la taille */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%; /* Prend toute la largeur du parent */
  background-color: rgb(0, 0, 0);
  border: 0.2rem solid var(--custom-white);
  border-radius: 0.6rem;
}

#site-name-club {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  text-align: center;
  font-family: "cooper", Georgia, "Times New Roman", Times, serif;
  font-weight: 800;
  background-color: var(--custom-white);
  letter-spacing: -0.1rem;
  text-shadow:
    2px 3px 1px rgb(100, 100, 100),
    4px 6px 4px rgba(0, 0, 0, 1);
  color: var(--custom-white); /* Couleur claire pour l'effet gravé */
  font-size: clamp(1rem, 1.8dvw, 1.8rem); /* Responsive */
  border-radius: 0.4rem;
  background-image: radial-gradient(ellipse, rgb(0, 80, 0), rgb(0, 0, 0));
}

#table-members-container,
#tables-list-container,
#pt-members-stats-container,
#pt-personal-stats-container,
#saved-hands-container,
#replayer-club-hands-container {
  font-family: "roboto-slab", "Times New Roman", Times, serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: min(750px, 96dvw); /* 96% largeur jusqu'à 750px */
  max-width: 97%;
  margin-top: 1rem;
  font-weight: 600;
  background-color: rgb(255, 245, 215);
  border: clamp(0.2rem, 0.5dvw, 0.3rem) solid var(--custom-green);
  box-shadow:
    1px 1px 0px rgb(255, 255, 255),
    -1px 1px 0px rgb(255, 255, 255),
    1px -1px 0px rgb(255, 255, 255),
    -1px -1px 0px rgb(255, 255, 255);
  border-radius: 0.4rem;
}

#pt-members-stats-container,
#pt-personal-stats-container,
#saved-hands-container,
#replayer-club-hands-container {
  width: 95%;
  max-width: 95%;
}
#table-members-container h3,
#tables-list-container h3,
#pt-members-stats-container h3,
#pt-personal-stats-container h3,
#saved-hands-container h3,
#replayer-club-hands-container h3 {
  font-family: "roboto-slab", "Times New Roman", Times, serif;
  font-weight: bold;
}

.replayer-action-group {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.replayer-action-btn {
  font-family: "roboto-slab", "Times New Roman", Times, serif;
  font-size: clamp(0.65rem, 1.2dvw, 0.8rem);
  font-weight: 700;
  line-height: 1.1;
  padding: 0.16rem 0.42rem;
  border-radius: 0.25rem;
  border: 0.1rem solid var(--custom-white);
  background: var(--gradient-green);
  color: var(--custom-white);
  cursor: pointer;
  min-width: 4.1rem;
  box-shadow:
    inset 1px 1px 2px rgba(255, 255, 255, 0.15),
    inset -1px -1px 2px rgba(0, 0, 0, 0.35);
}

.replayer-action-btn:hover {
  background: var(--gradient-green-hover);
}

#saved-hands-table,
#replayer-club-hands-table {
  table-layout: auto;
}

#saved-hands-table th,
#saved-hands-table td,
#replayer-club-hands-table th,
#replayer-club-hands-table td {
  white-space: nowrap;
}

#saved-hands-table .replayer-col-table,
#replayer-club-hands-table .replayer-col-table {
  white-space: normal;
}

#saved-hands-table .replayer-col-actions,
#replayer-club-hands-table .replayer-col-actions {
  min-width: 12.8rem;
}

@media (max-width: 860px) {
  #saved-hands-table,
  #replayer-club-hands-table {
    font-size: clamp(0.62rem, 1.9dvw, 0.78rem);
  }

  #saved-hands-table .replayer-col-actions,
  #replayer-club-hands-table .replayer-col-actions {
    min-width: 11rem;
  }

  .replayer-action-btn {
    min-width: 3.5rem;
    padding: 0.14rem 0.34rem;
  }
}

.club-table-scroll {
  width: 100%;
  overflow-x: auto;
}

/* Table styles */
.club-table {
  width: 98%;
  border-collapse: collapse;
  margin: 0.2rem 0rem;
  font-size: clamp(0.7rem, 1.5dvw, 1rem); /* Responsive */
  text-align: left;
  border: 0.15rem solid black;
  border-radius: 0.4rem;
  table-layout: fixed; /* Force chaque colonne à ne pas dépasser la largeur disponible */
  overflow-wrap: break-word; /* Coupe aux limites de mots (meilleur que break-all) */
}

.club-table th,
.club-table td {
  text-align: center;
  border: 1px solid var(--custom-white);
  padding: clamp(0.2rem, 0.4dvw, 0.4rem); /* Padding responsive */
  overflow: hidden;
  white-space: normal; /* ← essentiel */
  overflow: hidden;
  text-overflow: ellipsis; /* ne s'applique plus si plusieurs lignes */
  word-break: normal;
  overflow-wrap: anywhere;
}

.stats-table {
  width: 95%;
  margin: 0.2rem auto;
  table-layout: auto;
}

.stats-table th,
.stats-table td {
  white-space: nowrap;
  word-break: keep-all;
  overflow-wrap: normal;
  text-overflow: clip;
}

.stats-table th {
  white-space: normal;
  line-height: 1.05;
  min-height: 2.35em;
  height: 2.35em;
  vertical-align: middle;
}

.stats-table td {
  white-space: nowrap;
}

#club-settings-container .inline-checkbox {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.35rem;
}

.club-table th {
  background-color: rgb(0, 40, 0);
  color: var(--custom-white);
  font-weight: bold;
  text-shadow:
    1px 1px 0px black,
    -1px 1px 0px black,
    1px -1px 0px black,
    -1px -1px 0px black;
  box-shadow:
    inset 2px 1px 2px 0px rgb(0, 80, 0),
    inset -1px -2px 2px 0px rgb(0, 80, 0);
}

.club-table td {
  font-size: clamp(0.7rem, 1.3dvw, 0.9rem); /* Responsive */

  background-color: rgb(30, 30, 30);
  color: var(--custom-white);
  text-shadow:
    1px 1px 0px black,
    -1px 1px 0px black,
    1px -1px 0px black,
    -1px -1px 0px black;
  box-shadow:
    inset 1px 1px 4px 0px black,
    inset -1px -1px 4px 0px rgb(0, 0, 0);
}

/* Buy-in responsive display: prefer single line; if it wraps the min moves to the next line */
.buyin {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem;
  align-items: baseline;
}
.buyin .buyin-max {
  white-space: nowrap;
}
.buyin .buyin-min {
  white-space: nowrap;
  font-size: 0.85em;
  opacity: 0.9;
}

/* Opened table button: show red hover style while disabled (higher specificity to override .btn-disabled) */
#user-interface .btn-join-table.btn-already-open,
#user-interface .btn-join-table.btn-already-open[disabled] {
  background-image: var(--gradient-red-hover);
  color: var(--custom-white);
  border: 0.05rem solid #222;
  box-shadow: 0 1px 8px 0 rgba(0, 0, 0, 0.35);
  transform: scaleX(0.995) scaleY(0.96) translateY(0px);
  cursor: default;
  pointer-events: none;
  opacity: 1; /* override disabled opacity */
}

/* Admin buttons */
#nav-admin-actions:not(.hidden) {
  display: flex;
  justify-content: space-between;
  gap: 0.3rem;
}

#nav-admin-actions.hidden {
  display: none;
}

#nav-admin-actions button {
  background: var(--gradient-red);
}

#nav-admin-actions button:not(:disabled):hover {
  background: var(--gradient-red-hover);
  transform: scale(0.995) translateY(1px);
}

#create-table-container span {
  display: inline-block;
  width: 10%;
  text-align: right;
  font-family: "bevan", Georgia, serif;
  font-weight: lighter;
}

/* Animation flash pour mise à jour temps réel */
@keyframes flashCell {
  0% {
    color: rgb(250, 190, 0);
    text-shadow:
      0 0 1px rgba(250, 190, 0, 0.8),
      0 0 2px rgba(250, 190, 0, 0.5);
  }
  50% {
    color: rgb(250, 190, 0);
    text-shadow:
      0 0 2px rgba(250, 190, 0, 1),
      0 0 4px rgba(250, 190, 0, 0.8);
  }
  100% {
    color: inherit;
    text-shadow: none;
  }
}

.flash-update {
  animation: flashCell 2s ease-out;
}

/* Message informatif mobile */
#mobile-table-info {
  margin: 0.5rem 0;
  padding: 0.5rem;
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 4px;
  font-size: 0.9rem;
  color: #856404;
  text-align: center;
}

/* Boutons Join désactivés sur mobile */
.btn-disabled-mobile {
  background: var(--gradient-red);
  color: white;
  cursor: not-allowed;
  opacity: 0.8;
  transform: translateY(2px);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* ===============================
   Styles Leaderboard
   =============================== */

#leaderboard-section {
  margin: 1rem auto;
  max-width: 1200px;
  padding: 0.5rem;
  background: var(--gradient-green);
  border: 2px solid var(--custom-green);
  border-radius: 0.4rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.leaderboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--custom-green);
}

.leaderboard-header h3 {
  color: #ffd700;
  font-size: clamp(1rem, 2vw, 1.3rem);
  margin: 0;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.leaderboard-mode-switch {
  display: flex;
  gap: 0.5rem;
}

.leaderboard-mode-btn {
  padding: 0.3rem 0.8rem;
  background: var(--gradient-green);
  color: #ccc;
  border: 1px solid #555;
  border-radius: 0.3rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: clamp(0.75rem, 1.3vw, 0.9rem);
}

.leaderboard-mode-btn:hover {
  background: var(--gradient-green-hover);
  color: #fff;
}

.leaderboard-mode-btn.active {
  background: var(--gradient-green);
  color: #fff;
  border-color: #ffd700;
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

/* Filtres */
.leaderboard-filters {
  margin-bottom: 0.2rem;
  padding: 0.2rem;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 0.2rem;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  align-items: flex-end;
  margin-bottom: 0.2rem;
}

.filter-row:last-child {
  margin-bottom: 0;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.04rem;
  min-width: 56px;
  flex: 1 1 56px;
}

.filter-group label {
  color: #ffd700;
  font-size: 0.55rem;
  font-weight: 600;
  white-space: nowrap;
}

.leaderboard-hint {
  font-size: 0.55rem;
  color: #bbb;
  line-height: 1.1;
}

.filter-group select,
.filter-group input {
  padding: 0.08rem 0.16rem;
  background: #fff;
  color: #000;
  border: 1px solid #555;
  border-radius: 0.14rem;
  font-size: 0.6rem;
  min-width: 0;
  line-height: 1.05;
}

.filter-group select option {
  background: #fff;
  color: #000;
}

.filter-group select:focus,
.filter-group input:focus {
  outline: none;
  border-color: var(--custom-green);
  box-shadow: 0 0 4px rgba(0, 128, 0, 0.5);
}

.leaderboard-refresh {
  padding: 0.08rem 0.3rem;
  background: var(--gradient-green);
  color: #fff;
  border: 1px solid #ffd700;
  border-radius: 0.14rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.58rem;
  transition: all 0.2s ease;
  align-self: flex-end;
  white-space: nowrap;
  line-height: 1.05;
}

.leaderboard-refresh:hover {
  background: var(--gradient-green-hover);
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

/* Visibilité conditionnelle */
.aggregated-only {
  display: flex;
}

.precise-only {
  display: none;
}

.filters-standard {
  display: block;
}

.filters-sessions {
  display: none;
}

.custom-dates.hidden,
#custom-dates-row.hidden {
  display: none;
}

/* Contenu leaderboard */
.leaderboard-content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-weight: 600;
}

.leaderboard-table-container {
  overflow-x: auto;
}

.leaderboard-graph {
  background: rgba(0, 0, 0, 0.2);
  padding: 0.2rem;
  border-radius: 0.15rem;
  border: 1px solid #333;
  max-height: 360px;
  overflow-y: auto;
}

.leaderboard-controls {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: nowrap;
  overflow-x: auto;
}

.tab-bar {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(0, 0, 0, 0.85);
  padding: 0.2rem 0.4rem;
  border-radius: 0.3rem;
  border: 1px solid rgba(255, 215, 0, 0.25);
}

.tab-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  overflow-y: auto;
}

.tab-bar .tab-btn {
  font-family: "roboto-slab", "Times New Roman", Times, serif;
  font-weight: bold;
  padding: 0.3rem 0.6rem;
  border: 1px solid #555;
  background: #222;
  color: #ddd;
  border-radius: 0.25rem;
  cursor: pointer;
  font-size: var(--ui-text-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.1;
}

.tab-bar .tab-btn.active {
  border-color: #ffd700;
  color: #ffd700;
  box-shadow: 0 0 6px rgba(255, 215, 0, 0.3);
}

.tab-panel.hidden {
  display: none;
}

.lb-graph-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.4rem;
  margin-bottom: 0.2rem;

  color: #ddd;
  border: 1px solid #333;
  border-radius: 0.15rem;
  padding: 0.15rem 0.2rem;
}

.lb-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  white-space: nowrap;
}

.lb-legend-swatch {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  display: inline-block;
}

.lb-graph-svg {
  width: 100%;
  height: 160px;
  display: block;
  border: 0.25rem solid rgb(0, 0, 0);
  border-radius: 0.15rem;
  background: var(--gradient-light-green);
}

.lb-series {
  margin-bottom: 0.2rem;
  padding: 0.2rem;
  background: #2a2a2a;
  border-left: 2px solid var(--custom-green);
  border-radius: 0.15rem;
}

.lb-series div:first-child {
  font-weight: 600;
  color: #4ade80;
  margin-bottom: 0.15rem;
  font-size: 0.65rem;
}

.lb-points {
  color: #aaa;
  line-height: 1.1;
}

/* Responsive */
@media (max-width: 900px) {
  .filter-row {
    gap: 0.12rem;
  }

  .filter-group {
    min-width: 52px;
    flex: 1 1 52px;
  }

  .filter-group label {
    font-size: 0.52rem;
  }

  .filter-group select,
  .filter-group input {
    padding: 0.06rem 0.12rem;
    font-size: 0.58rem;
  }

  .leaderboard-refresh {
    padding: 0.06rem 0.25rem;
    font-size: 0.58rem;
  }

  .lb-series div:first-child {
    font-size: 0.58rem;
  }

  .lb-points {
    font-size: 0.48rem;
  }

  .lb-graph-legend {
    font-size: 0.5rem;
    padding: 0.12rem 0.16rem;
  }

  .lb-graph-svg {
    height: 140px;
  }
}

/* ===============================
   Leaderboard Styles
   =============================== */

#leaderboard-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(1200px, 96dvw);
  max-width: 97%;
  background-color: rgb(255, 240, 200);
  border: clamp(0.2rem, 0.5dvw, 0.3rem) solid var(--custom-green);
  box-shadow:
    2px 2px 0px rgb(100, 100, 100),
    -2px 2px 0px rgb(100, 100, 100),
    2px -2px 0px rgb(100, 100, 100),
    -2px -2px 0px rgb(100, 100, 100);
  border-radius: 0.4rem;
  padding: 1rem;
}

.leaderboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 1rem;
}

.leaderboard-header h3 {
  font-family: "roboto-slab", Georgia, serif;
  font-weight: bolder;
  font-size: clamp(1.2rem, 2dvw, 1.8rem);
  color: var(--custom-white);
  margin: 0;
}

.leaderboard-mode-btn {
  padding: 0.5rem 1rem;
  font-family: "roboto-slab", Georgia, serif;
  font-size: clamp(0.8rem, 1.2dvw, 1rem);
  font-weight: bolder;
  text-shadow:
    1px 1px 0px black,
    -1px 1px 0px black,
    1px -1px 0px black,
    -1px -1px 0px black;
  background: var(--gradient-green);
  color: var(--custom-white);
  border: 2px solid var(--color-grey);
  border-radius: 0.4rem;
  cursor: pointer;
  transition: all 0.2s;
}

.leaderboard-mode-btn:hover {
  background: var(--gradient-green-hover);
}

.leaderboard-mode-btn.active {
  background: var(--gradient-green-hover);
  color: var(--custom-white);
  border-color: var(--custom-white);
}

.leaderboard-filters {
  width: 100%;
  margin-bottom: 1rem;
  padding: 1rem;
  background-color: rgba(0, 0, 0, 0.1);
  border-radius: 0.4rem;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  margin-bottom: 0.8rem;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1 1 auto;
  min-width: 120px;
}

.filter-group label {
  font-family: "roboto-slab", Georgia, serif;
  font-size: clamp(1rem, 1.2dvw, 1.2rem);
  font-weight: 900;
  text-shadow:
    1px 1px 0px black,
    -1px 1px 0px black,
    1px -1px 0px black,
    -1px -1px 0px black;
  color: var(--custom-white);
}

.filter-group select,
.filter-group input {
  padding: 0.5rem;
  font-size: clamp(0.8rem, 1dvw, 0.9rem);
  border: 2px solid rgb(100, 100, 100);
  border-radius: 0.3rem;
  background-color: white;
}

.leaderboard-refresh {
  padding: 0.6rem 1.2rem;
  font-family: "roboto-slab", Georgia, serif;
  font-size: clamp(0.85rem, 1.1dvw, 1rem);
  text-shadow:
    1px 1px 0px black,
    -1px 1px 0px black,
    1px -1px 0px black,
    -1px -1px 0px black;
  background: var(--gradient-green);
  color: var(--custom-white);
  border: 2px solid rgb(0, 60, 0);
  border-radius: 0.4rem;
  cursor: pointer;
  transition: all 0.2s;
  align-self: flex-end;
}

.leaderboard-refresh:hover {
  background: var(--gradient-green-hover);
  transform: translateY(-1px);
}

.leaderboard-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 100%;
}

.leaderboard-table-container {
  width: 100%;
  overflow-x: auto;
}

.leaderboard-graph {
  width: 100%;
  min-height: 0;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid #333;
  border-radius: 0.15rem;
  padding: 0.2rem;
  max-height: 360px;
  overflow-y: auto;
}

.leaderboard-col-hidden {
  display: none;
}

/* Classes de visibilité pour les modes */
.aggregated-only.hidden,
.precise-only.hidden,
.filters-standard.hidden,
.filters-sessions.hidden {
  display: none;
}
