/* ============================================================
   SITE TOP & BOTTOM 10 SECTION
   ============================================================ */

.site-top-bottom-section {
  margin-bottom: 30px;
  width: 100%;
  max-width: 90%;
}

/* .stb-title and .stb-subtitle now use the shared
   .section-title / .section-subtitle classes from style.css.
   Add both classes in your HTML: class="section-title stb-title"
   to inherit consistent sizing across all sections. */

.stb-container {
  display: flex;
  gap: 24px;
}

.stb-tables-area {
  flex: 1;
  min-width: 0;
}

.stb-year-block {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

.stb-table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
}

.stb-table-header {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 2px;
}

.stb-table-header.top {
  color: var(--accent-green);
}

.stb-table-header.bottom {
  color: var(--accent-red);
}

.stb-table-year {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

/* Table Styling */
.stb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.stb-table thead th {
  text-align: left;
  padding: 8px 10px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  font-weight: 600;
  border-bottom: 1px solid var(--bg-card-border);
  white-space: nowrap;
}

.stb-table thead th.numeric {
  text-align: right;
}

.stb-table tbody tr {
  transition: background 0.15s;
}

.stb-table tbody tr:hover {
  background: rgba(33, 150, 243, 0.06);
}

.stb-table tbody td {
  padding: 7px 10px;
  border-bottom: 1px solid rgba(42, 63, 77, 0.4);
  color: var(--text-primary);
  white-space: nowrap;
}

.stb-table tbody td.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.stb-table tbody td.site-name {
  font-weight: 600;
}

/* Highlighted row (selected site) */
.stb-table tbody tr.stb-highlighted {
  background: rgba(255, 255, 255, 0.12);
}

.stb-table tbody tr.stb-highlighted td {
  color: #ffffff;
  font-weight: 600;
}

/* ============================================================
   CONDITIONAL FORMATTING — value/rank colors
   ============================================================ */

.stb-table tbody td.stb-good {
  color: var(--accent-green);
}

.stb-table tbody td.stb-bad {
  color: var(--accent-red);
}

/* ============================================================
   METRIC SELECTOR (right side)
   ============================================================ */

.stb-metric-selector {
  width: 260px;
  flex-shrink: 0;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: 8px;
  padding: 16px;
  align-self: flex-start;
  position: sticky;
  top: 80px;
}

.stb-selector-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--bg-card-border);
}

.stb-metric-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stb-metric-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 12px;
  color: var(--text-secondary);
}

.stb-metric-option:hover {
  background: rgba(33, 150, 243, 0.08);
}

.stb-metric-option.active {
  background: rgba(33, 150, 243, 0.12);
  color: var(--text-primary);
}

.stb-metric-option input[type="radio"] {
  accent-color: var(--accent-blue);
  margin: 0;
  width: 14px;
  height: 14px;
  cursor: pointer;
}

.stb-metric-option label {
  cursor: pointer;
  line-height: 1.3;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1200px) {
  .stb-container {
    flex-direction: column-reverse;
  }

  .stb-metric-selector {
    width: 100%;
    position: static;
  }

  .stb-metric-list {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .stb-metric-option {
    flex: 0 0 auto;
  }
}

@media (max-width: 768px) {
  .stb-year-block {
    grid-template-columns: 1fr;
  }

  .stb-title {
    font-size: 22px;
  }
}
