/* Container */
.wrf-wrap{
  max-width: 980px;
  margin: 18px auto;
  padding: 0 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Controls */
.wrf-controls{
  display:flex;
  gap:10px;
  margin-bottom:12px;
}

.wrf-controls select,
.wrf-controls input{
  width:100%;
  padding:12px 12px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background:#fff;
  font-size: 14px;
  outline:none;
}

.wrf-controls select:focus,
.wrf-controls input:focus{
  border-color:#fc4c02;
  box-shadow: 0 0 0 3px rgba(252,76,2,.12);
}

/* Card */
.wrf-card{
    margin-top:20px;
  background:#fff;
  border-radius:8px;
  box-shadow: 0 10px 30px rgba(0,0,0,.06);
  overflow:auto;
}

/* Table */
.wrf-table{
  width:100%;
  border-collapse: collapse;
  min-width: 760px;
}


.wrf-table thead th{
  background-color: #477ff8;
  color: #ffffff;
  font-weight: 700;
  letter-spacing: .04em;
  border:0px;
}


.wrf-table td{
  padding: 14px 14px;
  border: none;
  font-size: 14px;
  color:#111827;
  white-space: nowrap;
}
.wrf-table tr{
  border-bottom: 1px solid #e5e7eb;
}

.wrf-table tbody tr:hover{
  background:#fafafa;
}

/* Emphasis */
.wrf-table td:nth-child(4){
  font-weight: 700;
}

.rank-cell{
  font-weight: 800;
  font-size: 16px;
  width: 72px;
}

/* Pagination */
.wrf-pagination{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  justify-content:center;
  margin-top: 14px;
}

.wrf-pagination button{
  border:1px solid #e5e7eb;
  background:#fff;
  padding: 8px 10px;
  border-radius:10px;
  cursor:pointer;
}

.wrf-pagination button.active{
  background:#fc4c02;
  color:#fff;
  border-color:#fc4c02;
}

/* Mobile padding */
@media (max-width: 640px) {
  .wrf-wrap{
    padding: 0 12px;
  }
  .wrf-controls{
    flex-direction: column;
  }
  .wrf-table{
    min-width: 640px;
  }
}


/* Podium emphasis (more Strava-like) 
.wrf-top1 td { background: linear-gradient(90deg, #fff7cc, #ffffff); }
.wrf-top2 td { background: linear-gradient(90deg, #f1f5f9, #ffffff); }
.wrf-top3 td { background: linear-gradient(90deg, #fff0e6, #ffffff); }
*/
.wrf-top1 .rank-cell, .wrf-top2 .rank-cell, .wrf-top3 .rank-cell {
  font-size: 18px;
}

/* Make time align nicely */
.wrf-table td:last-child {
  font-variant-numeric: tabular-nums;
}

/* Gender pill (cleaner) */
.wrf-gender-pill{
  display:inline-flex;
  align-items:center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #111827;
}

/* Optional: subtle row divider feel
.wrf-table tbody tr{
  border-left: 3px solid transparent;
}
.wrf-top1{ border-left-color:#facc15; }
.wrf-top2{ border-left-color:#9ca3af; }
.wrf-top3{ border-left-color:#fb923c; }
 */

/* Category separator row */
.wrf-cat-row td{
  background:#6c7da1 !important;
  color:#fff !important;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  border-top: none !important;
  padding: 12px 14px !important;
}

.wrf-cat-row td span{
  opacity: .9;
  font-weight: 700;
}


/* =========================
   Mobile: convert table to cards
   ========================= */
@media (max-width: 640px) {
  /* remove min width so it doesn't force horizontal scroll */
  .wrf-table{
    min-width: 0 !important;
    border-spacing: 0 10px;
    background: #152a69;
  }

  /* hide table header */
  .wrf-table thead{
    display: none;
  }

.wrf-card{
  background:none;
}

  /* each row becomes a card */
  .wrf-table tbody tr{
    display: block;
    margin-top: 10px;
    border:none;
  }

  /* each cell becomes a row with label + value */
  .wrf-table tbody td{
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    white-space: normal;
  }

  /* remove the desktop row-border layout and make a single card border */
  .wrf-table tbody td{
    border: none;
  }

  .wrf-table tbody tr{
    border: 0px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
  }

  /* labels using data-label attribute (we'll add these in Step 2 below) */
  .wrf-table tbody td::before{
    content: attr(data-label);
    font-size: 12px;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: .04em;
    flex: 0 0 auto;
  }

  /* make the value bold for important fields */
  .wrf-table tbody td[data-label="Name"]{
    font-weight: 800;
  }

  /* category banner row should stay full-width and readable */
  .wrf-cat-row td{
    display: block !important;
    border: none !important;
    border-radius: 0 !important;
  }
}


@media (max-width: 640px){

  /* Make each finisher row a grid card */
  .wrf-table tbody tr:not(.wrf-cat-row){
    display: grid !important;
    grid-template-columns: 64px minmax(0, 1fr);
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
    margin-bottom: 12px;
  }

  /* Default: all cells stack full width */
  .wrf-table tbody tr:not(.wrf-cat-row) td{
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border: none !important;
    white-space: normal;
  }

  /* Rank becomes header left */
  .wrf-table tbody tr:not(.wrf-cat-row) td.rank-cell{
    grid-column: 1;
    grid-row: 1;
    background: #f9fafb;
    justify-content: center;
    font-weight: 800;
    font-size: 18px;
    padding: 12px 10px;
  }
  .wrf-table tbody tr:not(.wrf-cat-row) td.rank-cell::before{
    display:none !important;
  }

  /* Name becomes header right (same cell, moved up — not duplicated) */
  .wrf-table tbody tr:not(.wrf-cat-row) td.wrf-name-cell{
    grid-column: 2;
    grid-row: 1;
    background-color: #f9fafb;
    text-align: right;

    /* make it look like a header title */
    display: block !important;
    padding: 12px 14px;
    font-weight: 900;
    font-size: 15px;

    /* keep it to one line */
    white-space: nowrap !important;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }
  .wrf-table tbody tr:not(.wrf-cat-row) td.wrf-name-cell::before{
    display:none !important;
  }

  /* Labels for the rest of the fields */
  .wrf-table tbody tr:not(.wrf-cat-row) td::before{
    content: attr(data-label);
    font-size: 12px;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: .04em;
  }
}

.wrf-table thead th{
  background-color: #477ff8;
  color: #ffffff;
  font-weight: 700;
  letter-spacing: .04em;
  border:0px;
}
