/* race-result theme — mirrors event.d2sorganizer.id/new-design/D2S Home.dc.html */

:root {
  --bg-gradient: linear-gradient(165deg, #04231a 0%, #073a26 26%, #0c6b43 58%, #14a35f 100%);
  --text: #eafaf0;
  --text-muted: rgba(234, 250, 240, 0.72);
  --text-faint: rgba(234, 250, 240, 0.48);
  --accent: #d8f34a;
  --accent-soft: rgba(216, 243, 74, 0.16);
  --accent-ink: #04231a;
  --link: #a8f36b;
  --card-bg: rgba(255, 255, 255, 0.055);
  --card-border: rgba(255, 255, 255, 0.13);
  --row-border: rgba(255, 255, 255, 0.09);
  --row-hover: rgba(255, 255, 255, 0.05);
  --pill-bg: rgba(255, 255, 255, 0.07);
  --pill-border: rgba(255, 255, 255, 0.16);
  --input-bg: rgba(255, 255, 255, 0.06);
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  background: var(--bg-gradient);
  background-attachment: fixed;
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.rr-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 20px 80px;
}

/* Top bar */
.rr-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.rr-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.rr-brand img { height: 28px; width: auto; display: block; }
.rr-brand span { font-size: 15px; color: var(--text-muted); }

.rr-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--pill-border);
  background: var(--pill-bg);
  color: var(--text);
  font-weight: 700;
  font-size: 14px;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}

.rr-back:hover { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.rr-back svg { width: 16px; height: 16px; }

/* Header */
.rr-header { text-align: center; margin-bottom: 30px; }

.rr-header-logo {
  display: block;
  height: 68px;
  width: auto;
  margin: 0 auto 20px;
}

.rr-header .rr-eyebrow {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.rr-header h1 {
  margin: 0;
  font-size: clamp(26px, 4vw, 40px);
  font-weight: 800;
  letter-spacing: 0.01em;
}

.rr-header p {
  margin: 10px 0 0;
  color: var(--text-muted);
  font-size: 15px;
}

/* Filter pills */
.rr-filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.rr-filter-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 4px 10px 8px 2px;
  align-self: center;
}

.rr-pill {
  appearance: none;
  border: 1px solid var(--pill-border);
  background: var(--pill-bg);
  color: var(--text-muted);
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  padding: 9px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease, transform 100ms ease;
  white-space: nowrap;
}

.rr-pill:hover { border-color: rgba(255, 255, 255, 0.32); color: var(--text); }

.rr-pill.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.rr-pill.is-active:hover { transform: translateY(-1px); }

/* Search */
.rr-search {
  position: relative;
  margin: 18px 0 22px;
}

.rr-search svg {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-faint);
  pointer-events: none;
}

.rr-search input {
  width: 100%;
  padding: 14px 18px 14px 48px;
  border-radius: 16px;
  border: 1px solid var(--card-border);
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
}

.rr-search input::placeholder { color: var(--text-faint); }
.rr-search input:focus { border-color: var(--accent); }

/* Table card */
.rr-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  overflow: hidden;
  backdrop-filter: blur(14px);
}

.rr-table-wrap { overflow-x: auto; }

table.rr-table { width: 100%; border-collapse: collapse; min-width: 760px; }

.rr-table thead th {
  text-align: left;
  padding: 16px 18px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.045);
  border-bottom: 1px solid var(--card-border);
  white-space: nowrap;
  user-select: none;
}

.rr-table th.sortable { cursor: pointer; }
.rr-table th.sortable:hover { color: var(--text); }

.rr-sort-icon { display: inline-flex; vertical-align: middle; margin-left: 5px; opacity: 0.55; }
.rr-table th.is-sorted .rr-sort-icon { opacity: 1; color: var(--accent); }
.rr-sort-icon svg { width: 11px; height: 11px; }

.rr-table tbody td {
  padding: 14px 18px;
  font-size: 14px;
  border-bottom: 1px solid var(--row-border);
  white-space: nowrap;
}

.rr-table tbody tr { cursor: pointer; transition: background 120ms ease; }
.rr-table tbody tr:hover { background: var(--row-hover); }
.rr-table tbody tr:last-child td { border-bottom: none; }

.rr-table td.rr-name { font-weight: 700; white-space: normal; }
.rr-table td.rr-time { font-variant-numeric: tabular-nums; font-weight: 700; }
.rr-table td.rr-bib { font-variant-numeric: tabular-nums; color: var(--text-muted); }

.rr-open-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  border: 1px solid var(--pill-border);
  background: transparent;
  color: var(--text-muted);
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}

.rr-open-btn svg { width: 14px; height: 14px; }
tr:hover .rr-open-btn { border-color: var(--accent); color: var(--accent); }

.rr-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent);
}

/* States */
.rr-empty, .rr-loading {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
}

.rr-empty svg { width: 40px; height: 40px; margin-bottom: 12px; opacity: 0.5; }

/* Footer / pagination */
.rr-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px 20px;
  border-top: 1px solid var(--card-border);
}

.rr-footer .rr-count { font-size: 13px; color: var(--text-muted); }

.rr-pager { display: flex; align-items: center; gap: 6px; }

.rr-pager button {
  appearance: none;
  border: 1px solid var(--pill-border);
  background: var(--pill-bg);
  color: var(--text);
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
}

.rr-pager button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.rr-pager button:disabled { opacity: 0.35; cursor: not-allowed; }
.rr-pager .rr-page-info { font-size: 13px; color: var(--text-muted); padding: 0 6px; min-width: 90px; text-align: center; }

/* Detail page */
.rr-detail-card {
  max-width: 560px;
  margin: 0 auto;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  overflow: hidden;
  backdrop-filter: blur(14px);
}

.rr-detail-head {
  padding: 26px 28px 20px;
  text-align: center;
  border-bottom: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.04);
}

.rr-detail-head h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.rr-detail-rows { padding: 8px 28px 26px; }

.rr-detail-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid var(--row-border);
}

.rr-detail-row:last-child { border-bottom: none; }

.rr-detail-row dt {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
}

.rr-detail-row dd {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  text-align: right;
}

.rr-detail-row.rr-emphasis dd { font-size: 20px; color: var(--accent); }

.rr-detail-back {
  display: block;
  margin: 22px auto 0;
  width: fit-content;
}

/* Certificate CTA */
.rr-cert-cta {
  padding: 4px 28px 26px;
  text-align: center;
}

.rr-cert-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  padding: 14px 20px;
  border-radius: 14px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 800;
  font-size: 15px;
  transition: transform 100ms ease, box-shadow 150ms ease;
}

.rr-cert-btn:hover { color: var(--accent-ink); transform: translateY(-1px); box-shadow: 0 10px 24px rgba(216, 243, 74, 0.25); }
.rr-cert-btn svg { width: 18px; height: 18px; }

.rr-cert-unavailable {
  display: block;
  font-size: 13px;
  color: var(--text-faint);
}

/* Certificate view page */
.rr-cert-frame {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 16px;
  backdrop-filter: blur(14px);
}

.rr-cert-frame img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
}

.rr-cert-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 22px;
}

.rr-cert-actions .rr-cert-btn { width: auto; padding: 14px 28px; }

@media (max-width: 700px) {
  .rr-shell { padding: 18px 12px 60px; }
  .rr-topbar { flex-direction: column; align-items: stretch; gap: 12px; margin-bottom: 20px; }
  .rr-back { justify-content: center; }
  .rr-header { margin-bottom: 22px; }
  .rr-header-logo { height: 50px; margin-bottom: 14px; }
  .rr-header p { font-size: 14px; }
  .rr-filter-label { width: 100%; margin: 2px 0 6px; }
  .rr-pill { padding: 8px 13px; font-size: 12.5px; }
  .rr-footer { flex-direction: column; align-items: stretch; text-align: center; }
  .rr-pager { justify-content: center; }

  /* Collapse the results table into a stacked card list — a horizontally
     scrolling table is unusable on a phone, so below this width each row
     becomes a self-contained card instead. */
  .rr-table-wrap { overflow-x: visible; }
  table.rr-table { min-width: 0; width: 100%; }
  .rr-table thead { display: none; }
  .rr-table tbody, .rr-table tr { display: block; width: 100%; }

  .rr-table tbody tr {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 10px;
    row-gap: 5px;
    padding: 14px 34px 14px 18px;
    border-bottom: 1px solid var(--row-border);
  }

  .rr-table tbody tr:last-child { border-bottom: none; }

  .rr-table tbody tr::after {
    content: '';
    position: absolute;
    right: 16px;
    top: 50%;
    width: 7px;
    height: 7px;
    border-right: 2px solid var(--text-faint);
    border-bottom: 2px solid var(--text-faint);
    transform: translateY(-50%) rotate(-45deg);
  }

  .rr-table td {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    padding: 0;
    border: none;
    white-space: normal;
    font-size: 12.5px;
    color: var(--text-muted);
  }

  .rr-table td[data-label]::before {
    content: attr(data-label);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-faint);
  }

  .rr-table td.rr-name {
    order: -3;
    flex: 1 1 100%;
    font-size: 16px;
    font-weight: 800;
    color: var(--text);
    white-space: normal;
  }

  .rr-table td.rr-time {
    order: -2;
    flex: 1 1 100%;
    justify-content: flex-end;
    font-size: 18px;
    font-weight: 800;
    color: var(--accent);
  }

  .rr-table td.rr-bib { order: -1; font-variant-numeric: tabular-nums; }

  .rr-table td:last-child { display: none; } /* open-icon column: the whole card is already tappable */

  .rr-detail-head { padding: 22px 18px 16px; }
  .rr-detail-rows { padding: 6px 18px 22px; }
  .rr-detail-row dt { font-size: 12px; }
  .rr-detail-row dd { font-size: 14px; }
  .rr-detail-row.rr-emphasis dd { font-size: 18px; }
  .rr-cert-cta { padding: 4px 18px 22px; }
  .rr-cert-frame { padding: 10px; }
}
