/* =========================================
   LAYOUT CONTAINER
========================================= */

.table-aligned-container {
  max-width: 1280px;
  margin: 0 auto;
}

/* =========================================
   HEADER + CONTROLS
========================================= */

.table-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 10px;
}

#tableHeader {
  margin: 0;
  padding-left: 2px;
  font-size: 28px;
  font-weight: 700;
}

.table-controls {
  display: flex;
  gap: 24px;
}

.control-block {
  display: flex;
  flex-direction: column;
}

.control-block label {
  font-size: 12px;
  margin-bottom: 4px;
  color: #ccc;
}

.table-controls select {
  background: #1f212d;
  color: #ccc;
  border: none;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 14px;
}

.table-scroll {
  max-height: 600px;
  overflow: auto;
}


/* =========================================
   TABLE WRAPPER (CRITICAL)
========================================= */

.table-wrapper {
  position: relative;
  background: #181a24;
  border-radius: 12px;

  overflow: hidden;      /* keep */
  border: 1px solid #2a2d3a;

  isolation: isolate;
  contain: paint;
}

/* =========================================
   TABLE STRUCTURE
========================================= */

.table-wrapper table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;

  border-top: 1px solid #2a2d3a;
  border-left: 1px solid #2a2d3a;
}

/* =========================================
   STICKY HEADER (PERFECT 2-ROW)
========================================= */

.table-wrapper thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #111;
  background-clip: padding-box;
}


.table-wrapper thead::before {
  content: "";
  position: sticky;
  top: 0;
  display: block;
  height: 1px;
  background: #111;
  z-index: 11;
}

/* LOCK TABLE STRUCTURE */
.table-wrapper table {
  table-layout: fixed;
}

/* SCROLL AT WRAPPER LEVEL */
.table-wrapper {
  max-height: 600px;
  overflow-y: auto;
}


/* Header styling 
.table-wrapper thead th {
  background: #111;
  color: #aaa;
  font-weight: 600;
  text-align: left;
  border-bottom: 1px solid #2a2d3a;
  border-right: 1px solid #2a2d3a;
}

/* Remove right border on last column 
.table-wrapper th:last-child,
.table-wrapper td:last-child {
  border-right: none;
}

/* Group headers (Jury / Televote) 
.table-wrapper thead th[colspan="3"] {
  text-align: center;
  color: #ccc;
  font-weight: 600;
}

/* =========================================
   TABLE CELLS
========================================= */

.table-wrapper th,
.table-wrapper td {
  padding: 12px 16px;
  font-size: 13px;
  text-align: left;

  border-bottom: 1px solid #2a2d3a;
  border-right: 1px solid #2a2d3a;
}

/* Row hover */
.table-wrapper tbody tr:hover td {
  background: rgba(255,255,255,0.04);
}

.table-wrapper td {
  transition: background 0.2s ease;
}

/* =========================================
   COLUMN DIVIDERS
========================================= */

/* Divider before Televote */
.table-wrapper table th:nth-child(10),
.table-wrapper table td:nth-child(10) {
  border-left: 2px solid #2a2d3a;
}

/* Optional subtle group divider */
#semiHead th:nth-child(7),
#semiHead th:nth-child(10) {
  border-left: 1px solid rgba(255,255,255,0.1);
}

/* =========================================
   FLAGS + ICONS
========================================= */

.flag {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 12px;
}

.play-icon i {
  color: #e50914;
  cursor: pointer;
}

/* =========================================
   BADGES
========================================= */

.badge.q {
  background: #00c853;
  color: black;
  font-weight: bold;
  padding: 3px 8px;
  border-radius: 12px;
}

.badge.dnq {
  background: #e50914;
  color: white;
  font-weight: bold;
  padding: 3px 8px;
  border-radius: 12px;
}

/* =========================================
   PILLS (RANK)
========================================= */

.pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

.pill-q {
  background: #00c853;
  color: black;
}

.pill-dnq {
  background: #ff1744;
  color: white;
}

/* =========================================
   RESPONSIVE
========================================= */

@media (max-width: 800px) {
  .table-header-row {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* =========================================
   SOLID HEADER BLOCK (FIXES BLEED)
========================================= */

.table-wrapper thead th {
  color: #aaa;
  font-weight: 600;
  border-bottom: 1px solid #2a2d3a;
  border-right: 1px solid #2a2d3a;
}

.table-wrapper thead {
  background: #111;
  position: relative;
  z-index: 2;
}

.dnq-merged {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px 0;
}

/* make sure badge truly centers visually */
.dnq-merged .badge {
  display: inline-block;
}


/* keep badge above line */
.badge.dnq {
  position: relative;
  z-index: 1;
}

.dnq-full {
  text-align: center;
  padding: 14px 0;
  background: rgba(255,255,255,0.02);
}

.dnq-full .badge {
  margin-right: 10px;
}

.dnq-year {
  color: #aaa;
  font-size: 13px;
}
