/* standings.css */

/* === Standings Table === */
.standings-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.85rem;
  color: #e6f0ff;
  background: rgba(19, 46, 87, 0.1);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 1rem;
  overflow: hidden;
}

/* coins arrondis */
.standings-table thead tr:first-child th:first-child { border-top-left-radius: 1rem; }
.standings-table thead tr:first-child th:last-child  { border-top-right-radius: 1rem; }

/* Thead */
.standings-table thead {
  background: rgba(37, 99, 235, 0.25);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

/* Style des th */
.standings-table th {
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  color: #bfdbfe;
  padding: 0.5rem 0.4rem;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  vertical-align: middle;
  text-align: center;
}

/* Body rows */
.standings-tr {
  transition: background .25s ease;
  cursor: pointer;
}
.standings-tr:hover { background: rgba(59, 130, 246, 0.12); }

/* Table cells */
.standings-table td {
  padding: 0.45rem 0.4rem;
  font-size: 0.82rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  text-align: center;
  vertical-align: middle;
  line-height: 1.2;
}

/* === Cell content wrapper === */
.standings-table td > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
}

/* Team col (logo + nom) */
.standings-table td:nth-child(2) > div {
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  gap: .35rem;
}

/* Team name container with true ellipsis */
.standings-team-name {
  flex-shrink: 1;        /* Peut rétrécir dans le flex container */
  min-width: 0;          /* Crucial pour ellipsis dans flex */
  overflow: hidden;       /* Cache le surplus */
  text-overflow: ellipsis; /* Affiche '...' */
  white-space: nowrap;    /* Pas de retour à la ligne */
}
/* === Main & sub values === */
.standings-td-main {
  transition: transform 0.22s ease;
}
.standings-td-sub {
  font-size: 0.7rem;
  line-height: 1.1;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transform: translateY(-6px);
  transition: max-height 0.22s ease, opacity 0.2s ease, transform 0.22s ease;
}

/* Only shift numeric cells when expanded */
.standings-tr-expanded td:not(:nth-child(2)) .standings-td-main {
  transform: translateY(-0.2rem);
}
.standings-tr-expanded .standings-td-sub {
  max-height: 24px;
  opacity: 1;
  transform: translateY(0);
}

/* PTS en gras */
.standings-table td:nth-child(10) .standings-td-main {
  font-weight: 700;
}

/* Colonnes (desktop) */
.standings-table th:nth-child(1),  .standings-table td:nth-child(1)  { width: 8%;  text-align: center; }
.standings-table th:nth-child(2),  .standings-table td:nth-child(2)  { width: 20%; text-align: left; }
.standings-table th:nth-child(3),  .standings-table td:nth-child(3),
.standings-table th:nth-child(4),  .standings-table td:nth-child(4),
.standings-table th:nth-child(5),  .standings-table td:nth-child(5),
.standings-table th:nth-child(6),  .standings-table td:nth-child(6),
.standings-table th:nth-child(7),  .standings-table td:nth-child(7),
.standings-table th:nth-child(8),  .standings-table td:nth-child(8)  { width: 7%;  text-align: center; }
.standings-table th:nth-child(9),  .standings-table td:nth-child(9),
.standings-table th:nth-child(10), .standings-table td:nth-child(10) { width: 10%; text-align: center; }

/* ========================= */
/* ===== MOBILE UPDATE ===== */
/* ========================= */

@media (max-width: 639px) {

  /* Colonnes visibles */
  .standings-table th,
  .standings-table td {
    display: table-cell;
  }

  /* Masquer GF (7) et GA (8) */
  .standings-table th:nth-child(7),
  .standings-table td:nth-child(7),
  .standings-table th:nth-child(8),
  .standings-table td:nth-child(8) {
    display: none;
  }

  /* Ajuster les largeurs */
  .standings-table th:nth-child(1),
  .standings-table td:nth-child(1) { width: 8%; }
  .standings-table th:nth-child(2),
  .standings-table td:nth-child(2) { width: 30%; }
  .standings-table th:nth-child(3),
  .standings-table td:nth-child(3),
  .standings-table th:nth-child(4),
  .standings-table td:nth-child(4),
  .standings-table th:nth-child(5),
  .standings-table td:nth-child(5),
  .standings-table th:nth-child(6),
  .standings-table td:nth-child(6) { width: 10%; }
  .standings-table th:nth-child(9),
  .standings-table td:nth-child(9),
  .standings-table th:nth-child(10),
  .standings-table td:nth-child(10) { width: 10.5%; }

  /* === Rows un peu plus hautes === */
  .standings-table th,
  .standings-table td {
    padding: 0.4rem 0.25rem;   /* ↑ augmenté */
    font-size: 0.72rem;
    line-height: 1.25;         /* plus respirant */
  }

  .standings-table td img {
    height: 18px;
    width: 18px;
  }

  .standings-td-sub {
    font-size: 0.65rem;
    max-height: 0;
  }

  .standings-tr-expanded .standings-td-sub {
    max-height: 22px;
  }
}

/* Highlight équipe focus */
.standings-tr-focus {
  background: rgba(254, 205, 211, 0.1);
  transition: background 0.25s ease;
}
.standings-tr-focus:hover {
  background: rgba(254, 205, 211, 0.2);
}

.standings-tr-focus-1 {
  background: rgba(134, 239, 172, 0.2);
  transition: background 0.25s ease;
}
.standings-tr-focus-1:hover {
  background: rgba(134, 239, 172, 0.3);
}

.standings-tr-focus-2 {
  background: rgba(254, 205, 240, 0.2);
  transition: background 0.25s ease;
}
.standings-tr-focus-2:hover {
  background: rgba(254, 205, 240, 0.3);
}

/* Scrollable standings container */
.standings-scroll {
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  border-radius: 1rem;
}

@media (max-width: 639px) {
  .standings-scroll {
    max-height: calc(5 * 1.7rem);
  }
}

/* === Swipe wrapper horizontal === */
.standings-swipe-wrapper {
  display: flex;
  flex-direction: row;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
  gap: 0;
  scroll-padding: 0.5rem;
  padding: 0;
}

/* Mobile swipe */
@media (max-width: 639px) {
  .standings-swipe-wrapper {
    scroll-snap-type: x mandatory;
    scroll-padding: 0;
  }

  .standings-swipe-wrapper .comp-standings {
    flex: 0 0 100%;
    scroll-snap-align: start;
    margin: 0;
    padding: 0;
  }
}

/* Desktop swipe */
@media (min-width: 640px) {
  .standings-swipe-wrapper {
    padding: 0;
    gap: 1rem;
  }

  .standings-swipe-wrapper .comp-standings {
    flex: 1 1 auto;
    min-width: 320px;
    margin: 0;
  }
}