/* === CONTAINER + SECTION === */
.results-section {
  padding: 2rem 1rem;
  background: #f9f9f9;
}

/* === HEADER === */

.results-section .event-header h2 {
  color: #010101 !important;
  /*background-color: #ffffff !important; /* light background stops inversion */
  text-align: center;
  font-size: 2rem;
  margin-bottom: 0.25rem; 
}

.event-header .event-title-text {
  color: #010101 !important;
}

.results-header h2 {
  text-align: center;
  font-size: 2rem;
  color: #010101;
  margin-bottom: .5rem;
}

.results-section .event-header h5 {
  margin-top: 0; /* remove browser default */
  margin-bottom: 1rem; /* optional: add a little breathing room below */
}
/*
.results-header h2 {
  text-align: left;
  font-weight: bold;
  font-size: 5rem;
  color: grey;
  margin-left: -.5rem;
  margin-bottom: -.5rem;
}
*/
/* === TAB NAVIGATION === */
.results-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  justify-content: center;
}

.tab-button {
  padding: 0.6rem 1rem;
  font-size: 1rem;
  background: #ddd;
  border: none;
  cursor: pointer;
  font-weight: bold;
  border-radius: 4px;
  transition: background 0.3s;
}

.tab-button.active,
.tab-button:hover {
  background: #3fa300;
  color: #fff;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.results-content .tab-content {
  display: none;
}
.results-content .tab-content.active {
  display: block;
}

/* === RESULTS TABLE === */
.results-table {
  width: 80% !important;
  border-collapse: collapse;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  margin-bottom: 2rem;
  margin: 0 auto;
  font-size: 0.95rem;
}

.results-table {
  width: 100%;
  min-width: 900px; /*  force table to be at least this wide */
  table-layout: fixed; /* allow browser to calculate natural widths */
}

.results-table th {
  background: #3fa300;
  color: white;
  font-weight: bold;
  padding: 0.5rem;
  text-align: center;
}

.results-table td {
  padding: 0.5rem;
  text-align: center;
  color: black;
  border: 1px solid #ddd;
  vertical-align: middle;
}

/* === ROW STYLES === */
.row-dark {
  background-color: #f5f5f5;
}

.row-light {
  background-color: #ffffff;
}

/* === ICONS & FLAGS === */
.country-flag {
  height: 1.5em;
  width: auto;           /* keep aspect ratio */
  max-width: 2em;        /* prevents Chrome blowout */
  vertical-align: middle;
  margin-left: 6px;
  object-fit: contain;
}

.podium-icon {
  color: #d4af37;
  font-size: 1.1rem;
}

/* === FOOTNOTE === */
.scoring-note {
  text-align: center;
  font-size: 0.85rem;
  color: #444;
  margin-top: -1rem;
}

/* === Column widths === */

.col-rank {
  width: 50px;
}

.col-name {
  max-width: 280px; /* ~40 characters with some wrapping */
  text-align: left;
}

.col-dog {
  max-width: 200px; /* ~30 characters */
  text-align: left;
}

.col-score {
  width: 80px;
}

.col-icon {
  width: 60px;
}

.col-link {
  width: 40px;
}

/* === Distance Table Column Widths (unique to this page) === */
.results-table .dt-rank    { width: 40px; }
.results-table .dt-name    { width: 220px; text-align: left; }
.results-table .dt-dog     { width: 180px; text-align: left; }

.results-table .dt-throw   { width: 50px; }
.results-table .dt-longest { width: 80px; }

.results-table .dt-total   { width: 70px; }
.results-table .dt-icon    { width: 45px; }
.results-table .dt-link    { width: 45px; }


/* === RESPONSIVE TABLES === */
.results-table-wrapper {
  width: 80%;
  overflow-x: auto;
}

@media (max-width: 768px) {
  /* 1. Hide Q column on mobile */
  .results-table th.col-q,
  .results-table td.col-q {
    display: none;
  }

  /* 2. Stack handler + dog name in same cell */
  .results-table td.col-name {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    white-space: normal;
  }

  .results-table td.col-name .dog-name {
    font-size: 0.85em;
    color: #555;
    margin-top: 2px;
  }

  /* Slightly smaller font on mobile */
  .results-table td,
  .results-table th {
    font-size: 0.85rem;
    padding: 0.4rem;
  }
}
/* ===== TABLE SCROLL WRAPPER ===== */
.results-table-wrapper {
  width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch; /* smooth scrolling on iOS */
}

/* optional visible scrollbar styling */
.results-table-wrapper::-webkit-scrollbar { height: 8px; }
.results-table-wrapper::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 4px; }

/* --- Column Width Definitions for OTC Table --- */

/* Fixed width columns */
.results-table .col-rank {
    width: 30px; /* Rank */
}
.results-table .col-tc-score {
    width: 45px; /* TC1, TC2, etc. */
}
.results-table .col-total {
    width: 60px; /* Total */
}
.results-table .col-icon {
    width: 35px; /* Trophy/Star */
}
.results-table .col-link {
    width: 60px; /* Scoresheet Link */
}

/* Variable width columns must allow wrapping */
.results-table .col-handler,
.results-table .col-dog {
    /* DO NOT set a width here! They will split the remaining space. */
    white-space: normal;
    word-break: break-word;
    text-align: left;
}

/* ===== TABLE BASE ===== */
.results-table {
  width: 100%;
  /* ensure table can grow wider than the viewport so the wrapper shows a scrollbar */
  min-width: 900px;            /* fallback for older browsers */
  border-collapse: collapse;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

/* keep flags constrained */
.country-flag {
  height: 2em;
  vertical-align: middle;
  margin-left: 6px;
  object-fit: contain;
  filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.4));
}

/* desktop: handler and dog on same line */
.results-table .col-name { white-space: normal; }
.results-table .col-name .dog-name {
  display: inline-block;
  margin-left: 0.5rem;
  font-size: 0.95rem;
  color: #555;
  font-weight: 600;
}

/* existing header/cell styles (kept for context) */
.results-table th {
  background: #3fa300;
  color: white;
  font-weight: bold;
  padding: 0.5rem;
  text-align: center;
}
.results-table td {
  padding: 0.5rem;
  text-align: center;
  color: black;
  border: 1px solid #ddd;
  vertical-align: middle;
}

/* small scrollbar-friendly tweak for very narrow screens */
@media (max-width: 480px) {
  .results-table th, .results-table td { padding: 0.35rem; font-size: 0.82rem; }
}

/* ===== MOBILE ADJUSTMENTS ===== */
@media (max-width: 768px) {
  /* hide the Q column on mobile */
  .results-table th.col-q,
  .results-table td.col-q { display: none; }

  /* stack Handler + Dog in same cell on mobile */
  .results-table td.col-name {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    white-space: normal;
  }
  .results-table td.col-name .dog-name {
    display: block;
    margin-top: 4px;
    font-size: 0.85rem;
    color: #555;
    font-weight: 500;
  }

  .results-table td.col-link {
    display: block;
    margin-top: 4px;
    font-size: 0.85rem;
    color: #555;
    font-weight: 500;
  }

  /* slightly tighter spacing on mobile */
  .results-table td,
  .results-table th {
    font-size: 0.85rem;
    padding: 0.4rem;
  }

  /* reduce min width on small phones if you prefer fewer horizontal scrolls,
     but leaving the min-width above will still produce a scroll when needed. */
  .results-table { min-width: 720px; }
}

/* If some outer container is aggressively hiding overflow, force the wrapper */
.results-table-wrapper { overflow-x: auto !important; }
