/*
 * RTK op/nedrykning – standings enhancements (v3)
 * Fokus: ingen unødvendig horisontal scroll på desktop + smallere "Hold"-kolonne + lidt luft til højre.
 */

/* Base wrapper – vi beholder wrapperen altid, men scrollbar vises kun hvis nødvendigt */
.rtk-standings-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  padding-right: 18px; /* "luft" til højre */
  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;
}

/* Sørg for at tabellen faktisk kan krympe */
.rtk-standings-scroll > table.rtk-enhanced-standings--v3 {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  table-layout: fixed !important;
  border-collapse: collapse;
}

/* Stabil box-model så faste bredder ikke vokser pga. padding */
.rtk-standings-scroll > table.rtk-enhanced-standings--v3 th,
.rtk-standings-scroll > table.rtk-enhanced-standings--v3 td {
  box-sizing: border-box;
}

/* Standard: tal-kolonner = no-wrap, Hold = wrap */
.rtk-standings-scroll > table.rtk-enhanced-standings--v3 th,
.rtk-standings-scroll > table.rtk-enhanced-standings--v3 td {
  white-space: nowrap;
}

/* Hold-kolonnen (2) må gerne bryde linjer og være smallere */
.rtk-standings-scroll > table.rtk-enhanced-standings--v3 th:nth-child(2),
.rtk-standings-scroll > table.rtk-enhanced-standings--v3 td:nth-child(2) {
  white-space: normal !important;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Gør Hold-kolonnen tydeligt smallere (men stadig læsbar) */
.rtk-standings-scroll > table.rtk-enhanced-standings--v3 th:nth-child(2) {
  width: 28% !important;
}

/* Små justeringer af padding så tabellen lettere "fitter" */
.rtk-standings-scroll > table.rtk-enhanced-standings--v3 th,
.rtk-standings-scroll > table.rtk-enhanced-standings--v3 td {
  padding-left: 10px;
  padding-right: 10px;
}

/* # kolonnen */
.rtk-standings-scroll > table.rtk-enhanced-standings--v3 th:nth-child(1),
.rtk-standings-scroll > table.rtk-enhanced-standings--v3 td:nth-child(1) {
  width: 44px !important;
}

/* K/V/U/T (3-6) */
.rtk-standings-scroll > table.rtk-enhanced-standings--v3 th:nth-child(3),
.rtk-standings-scroll > table.rtk-enhanced-standings--v3 td:nth-child(3),
.rtk-standings-scroll > table.rtk-enhanced-standings--v3 th:nth-child(4),
.rtk-standings-scroll > table.rtk-enhanced-standings--v3 td:nth-child(4),
.rtk-standings-scroll > table.rtk-enhanced-standings--v3 th:nth-child(5),
.rtk-standings-scroll > table.rtk-enhanced-standings--v3 td:nth-child(5),
.rtk-standings-scroll > table.rtk-enhanced-standings--v3 th:nth-child(6),
.rtk-standings-scroll > table.rtk-enhanced-standings--v3 td:nth-child(6) {
  width: 44px !important;
  text-align: center;
}

/* Legs / Diff / Pts / Δ */
.rtk-standings-scroll > table.rtk-enhanced-standings--v3 th:nth-child(7),
.rtk-standings-scroll > table.rtk-enhanced-standings--v3 td:nth-child(7) { width: 90px !important; text-align: center; }
.rtk-standings-scroll > table.rtk-enhanced-standings--v3 th:nth-child(8),
.rtk-standings-scroll > table.rtk-enhanced-standings--v3 td:nth-child(8) { width: 70px !important; text-align: center; }
.rtk-standings-scroll > table.rtk-enhanced-standings--v3 th:nth-child(9),
.rtk-standings-scroll > table.rtk-enhanced-standings--v3 td:nth-child(9) { width: 60px !important; text-align: center; }
.rtk-standings-scroll > table.rtk-enhanced-standings--v3 th:nth-child(10),
.rtk-standings-scroll > table.rtk-enhanced-standings--v3 td:nth-child(10) { width: 60px !important; text-align: center; }

/* Δ-kolonnen: ingen "ramme" (top/bund) */
.rtk-standings-scroll > table.rtk-enhanced-standings--v3 th.rtk-delta-col,
.rtk-standings-scroll > table.rtk-enhanced-standings--v3 td.rtk-delta-col {
  border-top: none !important;
  border-bottom: none !important;
  border-right: none !important;
}

/* Fjern evt. sidste højre kant fra hele tabellen (luft til højre) */
.rtk-standings-scroll > table.rtk-enhanced-standings--v3 th:last-child,
.rtk-standings-scroll > table.rtk-enhanced-standings--v3 td:last-child {
  border-right: none !important;
}

/* Mobil: behold horisontal scroll og giv tabellen lidt minimumsbredde */
@media (max-width: 640px) {
  .rtk-standings-scroll {
    padding-right: 12px;
  }

  .rtk-standings-scroll > table.rtk-enhanced-standings--v3 {
    min-width: 680px !important;
  }
}

/* --- Op/Nedrykning streger (metode 2: "fake row" med stiplet linje) --- */
.rtk-enhanced-standings--v3 tr.rtk-divider-row td {
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  height: 0 !important;
  line-height: 0 !important;
}

.rtk-enhanced-standings--v3 tr.rtk-divider-row td .rtk-divider-line {
  width: 100%;
  height: 0;
  border-top: 2px dashed rgba(176, 145, 10, 0.95);
}

/* Giv lidt luft i siderne så linjen flugter pænt med cellernes indre padding */
.rtk-enhanced-standings--v3 tr.rtk-divider-row td {
  padding-left: 12px !important;
  padding-right: 12px !important;
}

/* --- Delta kolonne farver --- */
.rtk-enhanced-standings--v3 th.rtk-delta-col {
  color: rgba(176, 145, 10, 0.95) !important;
}

.rtk-enhanced-standings--v3 td.rtk-delta-col {
  text-align: right !important;
  padding-right: 14px !important;
}

.rtk-enhanced-standings--v3 .rtk-delta-up { color: rgba(176, 145, 10, 0.95); font-weight: 700; }
.rtk-enhanced-standings--v3 .rtk-delta-down { color: #d9534f; font-weight: 700; }
.rtk-enhanced-standings--v3 .rtk-delta-flat { color: rgba(255, 255, 255, 0.6); }
