/* =========================================================
   Strongman Scoring – Light/Dark Theme + Branding CSS
   Uses CSS variables only (safe, teflon)
   ========================================================= */

/* ---------- Default (Dark) Theme ---------- */
:root {
  --bg: #0b1220;
  --card: #0f172a;
  --line: #1f2937;
  --text: #e5e7eb;
  --muted: #94a3b8;

  /* Brand accent – overridden per company */
  --accent: #22c55e;

  --danger: #dc2626;
  --success: #16a34a;
    --line: rgba(17,24,39,.10);
    --soft: rgba(17,24,39,.04);
    --shadow: 0 10px 30px rgba(0,0,0,.06);
    --shadow2: 0 6px 18px rgba(0,0,0,.06);
    --radius: 16px;
}

/* ---------- Light Theme ---------- */
body[data-theme="light"] {
  --bg: #f5f7fb;
  --card: #ffffff;
  --line: #e5e7eb;
  --text: #0f172a;
  --muted: #475569;

  --danger: #dc2626;
  --success: #16a34a;
}

/* ---------- Base Layout ---------- */
* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.container {
  max-width: 1300px;
  margin: 0 auto;
  padding: 16px;
}

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 14px;
}

/* ---------- Layout Helpers ---------- */
.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
}

small {
  color: var(--muted);
}

/* ---------- Links ---------- */
a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ---------- Buttons ---------- */
button {
  font: inherit;
  border-radius: 10px;
  padding: 8px 14px;
  cursor: pointer;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
}

button:hover {
  border-color: var(--accent);
}

/* Primary button uses BRAND COLOUR */
button.primary {
  background: var(--accent);
  color: #ffffff;
  border: none;
  font-weight: 700;
}

button.primary:hover {
  filter: brightness(0.95);
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
}

.badge:hover {
  border-color: var(--accent);
  color: var(--text);
}

/* ---------- Inputs ---------- */
input,
select {
  font: inherit;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
}

input::placeholder {
  color: var(--muted);
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
}

/* ---------- Tables ---------- */
table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: middle;
}

th {
  background: var(--card);
  position: sticky;
  top: 0;
  z-index: 1;
  font-weight: 600;
}

/* ---------- Status Colours ---------- */
.status-ok {
  color: var(--success);
  font-weight: 600;
}

.status-dns,
.status-dnf {
  color: var(--danger);
  font-weight: 600;
}

/* ---------- Toast ---------- */
#toast {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 9999;
}

/* ---------- Utility ---------- */
.text-muted { color: var(--muted); }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* ---------- Branding polish ---------- */
img {
  max-width: 100%;
  height: auto;
}
/* Base logo styling */
.brand-logo {
  height: 36px;
  max-width: 200px;
  object-fit: contain;
}

/* Light theme: improve contrast for transparent logos */
body[data-theme="light"] .brand-logo {
  filter: brightness(0.8) contrast(1.2);
}

/* Dark theme: reset (usually looks best) */
body[data-theme="dark"] .brand-logo {
  filter: none;
}
.brand-logo-wrap {
  background: rgba(255,255,255,0.85);
  padding: 6px 10px;
  border-radius: 10px;
}

body[data-theme="dark"] .brand-logo-wrap {
  background: rgba(255,255,255,0.1);
}

body[data-theme="light] .brand-logo {
  filter: invert(1);
}

/* Light theme: normal */
body[data-theme="dark"] .brand-logo {
  filter: none;
}

 .lbWrap{ max-width: 1200px; margin: 0 auto; padding: 10px 12px 40px; }

  .lbHero{
    border-radius: var(--radius);
    background: linear-gradient(135deg, rgba(17,24,39,.06), rgba(17,24,39,.02));
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    padding: 18px 18px;
    margin: 10px 0 14px;
  }
  .lbHeroTop{
    display:flex; align-items:flex-start; justify-content:space-between; gap:12px;
  }
  .lbTitle{
    margin:0;
    font-size: 18px;
    letter-spacing: .2px;
    color: var(--text);
  }
  .lbSub{
    margin-top:6px;
    color: var(--muted);
    font-size: 13px;
    display:flex;
    align-items:center;
    gap:10px;
    flex-wrap:wrap;
  }

  .pill{
    display:inline-flex;
    align-items:center;
    gap:8px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,.75);
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    color: var(--muted);
  }
  .dot{
    width:8px; height:8px; border-radius:50%;
    background: #22c55e;
    box-shadow: 0 0 0 0 rgba(34,197,94,.55);
    animation: pulse 1.4s infinite;
  }
  @keyframes pulse{
    0%{ box-shadow: 0 0 0 0 rgba(34,197,94,.55); }
    70%{ box-shadow: 0 0 0 10px rgba(34,197,94,0); }
    100%{ box-shadow: 0 0 0 0 rgba(34,197,94,0); }
  }

  .btnRow{ display:flex; gap:10px; flex-wrap:wrap; justify-content:flex-end; }
  .btn{
    display:inline-flex;
    align-items:center;
    gap:8px;
    border-radius: 999px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    text-decoration:none;
    font-size: 13px;
    box-shadow: 0 1px 0 rgba(0,0,0,.04);
    transition: transform .08s ease, box-shadow .15s ease, background .15s ease;
    white-space:nowrap;
  }
  .btn:hover{ transform: translateY(-1px); box-shadow: var(--shadow2); background: rgba(255,255,255,.95); }
  .btn.primary{
    background: rgba(17,24,39,.92);
    color: #fff;
    border-color: rgba(17,24,39,.92);
  }
  .btn.primary:hover{ background: rgba(17,24,39,1); }

  .divCard{
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--card);
    box-shadow: var(--shadow2);
    margin: 14px 0;
    overflow:hidden;
  }

  .divHead{
    display:flex;
    justify-content:space-between;
    align-items:flex-start;
    gap:12px;
    padding: 14px 14px 12px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(17,24,39,.03), rgba(17,24,39,.00));
  }
  .divName{
    margin:0;
    font-size: 16px;
    color: var(--text);
  }
  .divMeta{
    margin-top: 6px;
    color: var(--muted);
    font-size: 12px;
  }

  .section{
    padding: 12px 14px 14px;
  }

  .tableWrap{
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow:auto;
    background: #fff;
  }

  table{
    width:100%;
    border-collapse: collapse;
    min-width: 520px;
  }
  th, td{
    padding: 10px 10px;
    border-bottom: 1px solid var(--line);
    text-align:left;
    font-size: 13px;
    vertical-align: middle;
  }
  thead th{
    position: sticky;
    top: 0;
    z-index: 2;
    background: #fff;
    font-size: 12px;
    letter-spacing: .2px;
    color: var(--muted);
    text-transform: none;
  }
  tbody tr:nth-child(odd){ background: rgba(17,24,39,.02); }
  tbody tr:hover{ background: rgba(17,24,39,.045); }

  .colPlace{ width: 90px; }
  .colBib{ width: 90px; color: var(--muted); }
  .colTotal{ width: 110px; text-align:right; }
  td.colTotal strong{ font-size: 14px; }

  .place{
    display:inline-flex;
    align-items:center;
    gap:8px;
    font-weight: 700;
    color: var(--text);
  }
  .medal{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,.9);
    font-size: 14px;
  }
  .muted{ color: var(--muted); font-weight: 600; }

  .toggleRow{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:10px;
    margin: 12px 0 10px;
  }
  .toggleBtn{
    cursor:pointer;
    user-select:none;
    display:inline-flex;
    align-items:center;
    gap:8px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #fff;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text);
  }
  .toggleBtn:hover{ box-shadow: var(--shadow2); transform: translateY(-1px); }
  .chev{ display:inline-block; transition: transform .15s ease; }
  .collapsed .chev{ transform: rotate(-90deg); }

  .pointsWrap{ margin-top: 10px; }
  .pointsHidden{ display:none; }

  .stickyStatus{
    position: sticky;
    top: 10px;
    z-index: 50;
    display:flex;
    justify-content:flex-end;
    margin: 10px 0 0;
    pointer-events:none;
  }
  .stickyStatus .pill{ pointer-events:auto; }

  @media (max-width: 700px){
    .lbHeroTop{ flex-direction: column; align-items: stretch; }
    .btnRow{ justify-content:flex-start; }
    table{ min-width: 560px; } /* keep scroll rather than squish */
  }
  /* show/hide breakdown */
.pointsHidden{ display:none !important; }

/* rotate chevron when open/closed */
.toggleBtn .chev{ display:inline-block; transition: transform .15s ease; }
.toggleBtn.collapsed .chev{ transform: rotate(-90deg); }

/* make toggle look clickable (optional if already styled) */
.toggleBtn{ cursor:pointer; user-select:none; }
