/* =========================================================
   RESULTS – SHARED BASICS
   ========================================================= */

.filters-results {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.filters-results select {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #ccc;
  height: 36px;
  font-size: 14px;
  min-width: 180px;
  flex: 0 0 auto !important; 
  width: auto !important;
}        

.loading {
  padding: 2rem;
  text-align: center;
  font-weight: 500;
  color: #555;
}

.detail-back {
  margin-bottom: 16px;
  font-size: 14px;
}

.detail-back a {
  text-decoration: none;
  color: #000;
}

/* =========================================================
   DETAIL RESULT ROOT
   ========================================================= */

#detail-result-root {
  padding: 24px 64px;
  font-family: system-ui, sans-serif;
}

/* =========================================================
   RESULT CARD
   ========================================================= */

#detail-result-root .result-card {
  margin-top: 24px;
  padding: 0;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  overflow: hidden;
}

#detail-result-root .result-header {
  padding: 16px 18px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

#detail-result-root .result-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

#detail-result-root .badge {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 6px;
  background: #2F4999;
  color: #fff;
}

/* =========================================================
   RESULT TABLE – HARD RESET
   ========================================================= */

#detail-result-root .result-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

/* kill ALL legacy constraints */
#detail-result-root .result-table th,
#detail-result-root .result-table td {
  width: auto !important;
  border: none !important;
  text-align: left !important;
  white-space: nowrap;
  vertical-align: middle;
  padding: 14px 18px;
  font-size: 14px;
}

/* =========================================================
   SEPARATORS (single clean system)
   ========================================================= */

/* Header separator */
#detail-result-root .result-table thead tr {
  position: relative;
}

#detail-result-root .result-table thead tr::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 0;
  height: 1px;
  background: #000;
}

/* Body row separators */
#detail-result-root .result-table tbody tr {
  position: relative;
}

#detail-result-root .result-table tbody tr::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 0;
  height: 1px;
  background: #000;
}

/* =========================================================
   COLUMN SPACING (FLOW, NOT JUSTIFY)
   ========================================================= */

/* Place → Nom */
#detail-result-root .result-table th:nth-child(1),
#detail-result-root .result-table td:nth-child(1) {
  padding-right: 24px;
}

/* Nom → Club */
#detail-result-root .result-table th:nth-child(2),
#detail-result-root .result-table td:nth-child(2) {
  padding-right: 128px;
}

/* Club → Results */
#detail-result-root .result-table th:nth-child(3),
#detail-result-root .result-table td:nth-child(3) {
  padding-right: 128px;
}

/* =========================================================
   LICENCE PILL
   ========================================================= */

#detail-result-root .licence {
  display: inline-block;
  background: #2F4999;
  color: #fff;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 6px;
}

#detail-result-root .category-group {
  display: inline-flex;
  align-items: center;
  gap: 8px; /* space between badge and icons */
}

/* Icons container */

#detail-result-root .category-icons {
  display: inline-flex;
  align-items: center;
  gap: 6px; /* space between the two icons */
}

/* SVG sizing safety */

#detail-result-root .category-icons svg {
  display: block;
}

#results-root {
  padding: 24px 64px;
  font-family: system-ui, sans-serif;
}

/* Filters */
#results-root .filters-results {
  display: flex;
  gap: 12px;
  margin-bottom: 28px;
}

/* Month section */
#results-root .month {
  margin-bottom: 40px;
}

#results-root .month h2 {
  font-size: 20px;
  font-weight: 600;
  margin: 24px 0 12px;
}

/* Table */
#results-root table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

/* Header */
#results-root thead th {
  font-size: 12px;
  font-weight: 500;
  color: #555;
  text-align: left;
  padding: 10px 18px;
}

/* Rows */
#results-root tbody td {
  padding: 12px 18px;
  font-size: 14px;
  vertical-align: middle;
}

/* Column widths */
#results-root th:nth-child(1),
#results-root td:nth-child(1) {
  width: 110px;
}

#results-root th:nth-child(2),
#results-root td:nth-child(2) {
  width: auto;
}

#results-root th:nth-child(3),
#results-root td:nth-child(3) {
  width: 240px;
}

#results-root th:nth-child(4),
#results-root td:nth-child(4) {
  width: 110px;
  text-align: right;
}

/* Separators */
#results-root thead tr {
  border-bottom: 1px solid #000;
}

#results-root tbody tr {
  border-bottom: 1px solid #000;
}

/* Button */
#results-root .details-btn {
  white-space: nowrap;
}

/* RESULTS LIST (div grid, not table) */
#results-root .month-header.grid,
#results-root .event.grid {
  display: grid;
  grid-template-columns: 110px 1fr 240px 110px;
  gap: 12px;
  align-items: center;
}

#results-root .month-header.grid {
  font-size: 12px;
  font-weight: 500;
  color: #555;
  padding: 10px 18px;
  border-bottom: 1px solid #000;
}

#results-root .event.grid {
  padding: 12px 18px;
  font-size: 14px;
  border-bottom: 1px solid #000;
}

#results-root .event .details-btn {
  justify-self: end;
  white-space: nowrap;
}

/* =========================
   RESULTS LIST — MOBILE
========================= */
@media (max-width: 768px) {
  /* kill the huge desktop padding */
  #results-root {
    padding: 16px 12px;
  }

  /* filters: wrap + full width selects */
  #results-root .filters,
  #results-root .filters-results {
    flex-wrap: wrap;
    gap: 10px;
  }
  #results-root .filters select,
  #results-root .filters-results select {
    min-width: 0;
    width: 100% !important;
    flex: 1 1 100% !important;
  }

  /* header row doesn't fit on mobile */
  #results-root .month-header.grid {
    display: none;
  }

  /* turn each event row into a stacked card */
  #results-root .event.grid {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 12px 0;              /* remove left/right padding so separators span full width */
    border-bottom: 1px solid #000; /* full-width line */
  }

  /* reduce visual noise */
  #results-root .event-title {
    font-weight: 600;
  }

  /* button alignment */
  #results-root .event .details-btn {
    justify-self: start;
  }
}

/* =========================
   RESULT DETAIL — TABLET + MOBILE SCROLL
========================= */
@media (max-width: 1024px) {
  /* reduce big gutters */
  #detail-result-root {
    padding: 16px 12px;
  }

  /* filters stack */
  #detail-result-root .filters-results {
    flex-wrap: wrap;
    gap: 10px;
  }
  #detail-result-root .filters-results select {
    width: 100% !important;
    min-width: 0 !important;
    flex: 1 1 100% !important;
  }

  /* IMPORTANT: card must allow inner scrolling */
  #detail-result-root .result-card {
    overflow: hidden; /* keeps rounded corners */
  }

  /* Make the TABLE itself scroll horizontally */
  #detail-result-root .result-table {
    display: block;                /* enables overflow on the table box */
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
  }

  /* Force a minimum width so columns don't collapse */
  #detail-result-root .result-table thead,
  #detail-result-root .result-table tbody {
    display: table;
    width: max-content;            /* key: expand to full content width */
    min-width: 100%;               /* at least fill card width */
    border-collapse: collapse;
  }

  /* Your separator system uses left/right insets; make them full-width in scroll area */
  #detail-result-root .result-table thead tr::after,
  #detail-result-root .result-table tbody tr::after {
    left: 0 !important;
    right: 0 !important;
  }

  /* Reduce cell padding on small screens */
  #detail-result-root .result-table th,
  #detail-result-root .result-table td {
    padding: 12px 12px;
    font-size: 13px;
  }

  /* Remove the huge desktop spacing that wastes width */
  #detail-result-root .result-table th:nth-child(2),
  #detail-result-root .result-table td:nth-child(2),
  #detail-result-root .result-table th:nth-child(3),
  #detail-result-root .result-table td:nth-child(3) {
    padding-right: 24px;
  }
}

/* =========================
   RESULT DETAIL — SCROLL (ALIGNED HEADER/BODY)
========================= */
@media (max-width: 1024px) {
  #detail-result-root { padding: 16px 12px; }

  /* wrapper scroll */
  #detail-result-root .result-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
  }

  /* restore real table layout so columns align */
  #detail-result-root .result-table {
    display: table !important;
    width: max-content;     /* table can be wider than card */
    min-width: 100%;        /* but at least fill the card */
    border-collapse: collapse;
    table-layout: auto;     /* keep your current sizing behavior */
  }

  /* undo the old hack if it exists */
  #detail-result-root .result-table thead,
  #detail-result-root .result-table tbody {
    display: table-row-group !important;
    width: auto !important;
  }

  /* tighten spacing a bit */
  #detail-result-root .result-table th,
  #detail-result-root .result-table td {
    padding: 12px 12px;
    font-size: 13px;
  }

  /* separators: full width inside scroll area */
  #detail-result-root .result-table thead tr::after,
  #detail-result-root .result-table tbody tr::after {
    left: 0 !important;
    right: 0 !important;
  }
}