/* =====================================================
   MAIN TABS
   ===================================================== */

.fr-tabs {
    position: relative;
    width: 100%;
    margin: 0 auto;
}


/* Hide radio buttons */

.fr-tabs > input[type="radio"] {
    display: none !important;
}


/* =====================================================
   TAB BUTTONS
   ===================================================== */

.fr-tab-buttons {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    width: 100%;
}


.fr-tab-buttons label {
    flex: 1 1 0;
    min-width: 0;
    padding: 12px 10px;
    background: #222;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    display: block;
    text-align: center;
    white-space: nowrap;
    border-radius: 6px 6px 0 0;
    margin: 0;
}


.fr-tab-buttons label:hover {
    background: #333;
}


/* =====================================================
   TAB CONTENT
   ===================================================== */

.fr-tab-content {
    display: block;
    visibility: hidden;
    position: absolute;
    left: 0;
    width: 100%;
    height: 0;
    overflow: hidden;
    padding: 0;
    background: #111;
    border: none;
    border-radius: 0 6px 6px 6px;
    box-sizing: border-box;
    pointer-events: none;
}

/* Common filters are shown once above the tabs. */
.fr-tab-content .lr-filter-group:nth-child(-n+3),
.fr-tab-content .lr-table-controls {
    display: none;
}

.fr-common-filters .lr-filter-group {
    align-items: flex-start;
    gap: 8px;
}

.fr-common-filters .lr-gender-switch {
    display: inline-flex !important;
    align-items: stretch;
    align-self: flex-start;
    width: max-content !important;
    max-width: max-content;
    background: #3a3a3a;
    border-radius: 6px;
    overflow: hidden;
}

.fr-common-filters .lr-gender-switch button {
    width: auto !important;
    flex: 0 0 auto !important;
    margin: 0;
    padding: 6px 10px;
    font-size: 12px;
    line-height: 1.2;
    border: none;
    border-radius: 0;
    background: transparent;
    color: #ccc;
    font-weight: 700;
    cursor: pointer;
}

.fr-common-filters .lr-gender-switch button.is-active {
    background: #0099ff;
    color: #fff;
}

.fr-common-filters .lr-cat-stage-row {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    margin-top: 0;
}

.fr-common-filters .lr-cat-form,
.fr-common-filters .lr-stage-form {
    flex: 0 0 auto;
    width: auto;
    display: block;
    margin-top: 0;
}

.fr-common-filters .lr-cat-form select,
.fr-common-filters .lr-stage-form select {
    width: auto;
    height: auto;
    padding: 6px 8px;
    font-size: 12px;
    line-height: 1.2;
    border-radius: 6px;
    box-sizing: border-box;
    background: #ff0000;
    color: #fff;
    border: none;
}

.fr-common-filters .lr-table-controls {
    justify-content: space-between;
    align-items: center;
    margin-top: 16px !important;
}

.fr-common-filters .lr-refresh-form,
.fr-common-filters .fr-refresh-button {
    width: auto;
}

.fr-common-filters .fr-refresh-button {
    padding: 6px 8px;
    font-size: 12px;
    line-height: 1.2;
    border-radius: 6px;
}

.fr-ajax-status {
    display: none;
    margin: 0 0 10px;
    color: #fff;
    font-size: 14px;
}

.fr-tabs.is-updating .fr-ajax-status {
    display: block;
}

.fr-tabs.is-updating .fr-tab-content {
    opacity: 0.55;
    pointer-events: none;
}

.fr-refresh-button {
    padding: 6px 8px;
    background: #0099ff;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.fr-refresh-notice {
    margin: 0 0 12px;
    color: #fff;
    font-size: 14px;
}


/* =====================================================
   SHOW SELECTED TAB
   ===================================================== */

#fr-tab-jersey:checked ~ #fr-content-jersey,
#fr-tab-sprint:checked ~ #fr-content-sprint,
#fr-tab-kom:checked ~ #fr-content-kom {
    display: block !important;
    visibility: visible;
    position: relative;
    height: auto;
    overflow: visible;
    padding: 20px;
    border: 1px solid #333;
    pointer-events: auto;
}


/* =====================================================
   SELECTED TAB BUTTON
   ===================================================== */

#fr-tab-jersey:checked ~ .fr-tab-buttons label[for="fr-tab-jersey"],
#fr-tab-sprint:checked ~ .fr-tab-buttons label[for="fr-tab-sprint"],
#fr-tab-kom:checked ~ .fr-tab-buttons label[for="fr-tab-kom"] {
    background: #0099ff;
}


/* =====================================================
   LEADERBOARD
   ===================================================== */

.fr-leaderboard {
    padding: 16px;
    background: #0b0b0b;
    border-radius: 12px;
    color: #fff;
    font-family: 'Roboto', Arial, sans-serif;
    width: 100%;
    box-sizing: border-box;
}


/* =====================================================
   UPDATED
   ===================================================== */

.lr-updated {
    font-size: 14px;
    color: #999;
    margin-bottom: 15px;
}


/* =====================================================
   FILTERS
   ===================================================== */

.lr-filters {
    display: flex;
    flex-direction: column;
    gap: 20px;
}


.lr-filter-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}


.lr-filter-form {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}


.lr-filter-form button {
    width: 100%;
    padding: 12px;
    font-size: 14px;
    border-radius: 8px;
    border: none;
    background: #3a3a3a;
    color: #ccc;
    font-weight: 700;
    cursor: pointer;
}


.lr-filter-form button.selected {
    background: #0099ff;
    color: #fff;
}


/* =====================================================
   STAGES
   ===================================================== */

.lr-stage-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}


.lr-stage-grid button {
    padding: 6px 10px !important;
    font-size: 12px !important;
    border-radius: 6px !important;
    text-transform: none !important;
    white-space: nowrap !important;
    line-height: 1.2 !important;
}


.lr-stage-grid button.selected {
    background: #ff0000 !important;
    color: #fff !important;
}


/* =====================================================
   SELECTS
   ===================================================== */

.lr-filter-form select,
.lr-search-form select,
.lr-search-form input[type="text"] {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    background: #1a1a1a;
    color: #fff;
    border: 1px solid #333;
    box-sizing: border-box;
}


/* =====================================================
   JERSEY COLOURS
   ===================================================== */

.lr-filter-form button[value="GC"].selected {
    background: #ffcc00 !important;
    color: #000 !important;
}


.lr-filter-form button[value="SPRINT"].selected {
    background: #00cc44 !important;
    color: #fff !important;
}


.lr-filter-form button[value="POLKA"].selected {
    background-color: #cc0000 !important;
    background-image:
        radial-gradient(circle, #ffffff 1.3px, transparent 1.45px),
        radial-gradient(circle, #ffffff 1.3px, transparent 1.45px) !important;
    background-size: 9px 9px !important;
    background-position: 0 0, 4.5px 4.5px !important;
    color: #fff !important;
}


/* =====================================================
   CATEGORY COLOURS
   ===================================================== */

.lr-filter-form button[value="A"].selected {
    background: #ff0000 !important;
    color: #fff !important;
}


.lr-filter-form button[value="B"].selected {
    background: #00cc44 !important;
    color: #fff !important;
}


.lr-filter-form button[value="C"].selected {
    background: #0066ff !important;
    color: #fff !important;
}


.lr-filter-form button[value="D"].selected {
    background: #ff8c00 !important;
    color: #fff !important;
}


.lr-filter-form button[value="E"].selected {
    background: #8000ff !important;
    color: #fff !important;
}


.lr-filter-form button[value="WOMENS"].selected {
    background: #8000ff !important;
    color: #fff !important;
}


/* =====================================================
   TABLE
   ===================================================== */

.lr-table-wrapper {
    background: #111;
    border-radius: 12px;
    margin-top: 10px;
}

.lr-table-scroll {
    overflow: auto;
    max-height: min(70vh, 720px);
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}


.fr-table {
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: none !important;
}


.fr-table thead th {
    position: sticky;
    top: 0;
    z-index: 20;
    background: #0b0b0b !important;
    border-bottom: 2px solid #333 !important;
    box-shadow: 0 1px 0 #333;
}


.fr-table th,
.fr-table td {
    padding: 10px !important;
    font-size: 13px !important;
    line-height: 1.2 !important;
    border: none !important;
    white-space: nowrap;
}


/* =====================================================
   ZP / ZR
   ===================================================== */

.btn-link button {
    display: inline-block !important;
    padding: 4px 8px !important;
    font-size: 11px !important;
    border-radius: 4px !important;
    white-space: nowrap !important;
    border: none !important;
    cursor: pointer;
}


.btn-link button.zp {
    background: #ff8c00 !important;
    color: #fff !important;
}


.btn-link button.zr {
    background: #0066ff !important;
    color: #fff !important;
}


/* =====================================================
   TABLE CONTROLS
   ===================================================== */

.lr-table-controls {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 12px !important;
    margin-bottom: 10px;
}


.lr-search-form {
    display: flex;
    gap: 10px;
}


.lr-table-controls input[type="text"],
.lr-table-controls select {
    padding: 6px 8px !important;
    font-size: 12px !important;
    border-radius: 6px !important;
    background: #1a1a1a;
    color: #fff;
    border: 1px solid #333;
    width: auto !important;
}


/* =====================================================
   PAGINATION
   ===================================================== */

.lr-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 20px;
}


.fr-page-btn {
    padding: 2px 6px;
    line-height: 1.1;
    font-size: 12px;
    margin: 3px;
    background: #0099ff;
    color: #000 !important;
    border-radius: 8px;
    font-weight: 700;
    text-decoration: none !important;
    display: inline-block;
}


/* =====================================================
   TABLET
   ===================================================== */

@media (min-width: 600px) and (max-width: 1024px) {

    .lr-filter-form {
        grid-template-columns: repeat(3, 1fr);
    }

    .lr-stage-grid {
        grid-template-columns: repeat(4, 1fr);
    }

}


/* =====================================================
   DESKTOP
   ===================================================== */

@media (min-width: 1025px) {

    .fr-leaderboard {
        padding: 25px;
    }

    .lr-filters {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 20px;
    }

    .lr-filter-group {
        flex: 1 1 200px;
    }

    .lr-filter-form {
        grid-template-columns: repeat(6, auto);
    }

    .lr-stage-grid {
        grid-template-columns: repeat(10, auto);
    }

    .fr-table th,
    .fr-table td {
        font-size: 14px !important;
        padding: 12px !important;
    }

    .fr-table thead th {
        border-bottom: 1px solid #333 !important;
    }

}


/* =====================================================
   MOBILE
   ===================================================== */

@media (max-width: 900px) {

    .fr-table th.th-zp,
    .fr-table th.th-zr {
        display: table-cell !important;
    }

    .fr-table td.btn-link {
        display: table-cell !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .btn-link button {
        display: inline-block !important;
    }

}


/* =====================================================
   JERSEY TYPE BUTTONS
   ===================================================== */

.lr-jersey-type-form,
#fr-content-jersey .lr-jersey-type-form {
    display: grid;
    grid-template-columns: repeat(3, 4.4rem);
    gap: 12px;
    justify-content: start;
    width: auto;
    max-width: 100%;
}

.lr-jersey-type-form button,
.lr-jersey-type-form button.selected,
#fr-content-jersey .lr-jersey-type-form button,
#fr-content-jersey .lr-jersey-type-form button.selected {
    width: 4.4rem;
    height: auto;
    min-height: 0;
    padding: 3px;
    background: transparent !important;
    border: 2px solid transparent !important;
    border-radius: 8px;
    box-shadow: none !important;
    filter: none;
    line-height: 0;
}

.lr-jersey-type-form button.lr-jersey-btn--gc.selected,
#fr-content-jersey .lr-jersey-type-form button.lr-jersey-btn--gc.selected {
    border-color: #ffe14a !important;
}

.lr-jersey-type-form button.lr-jersey-btn--sprint.selected,
#fr-content-jersey .lr-jersey-type-form button.lr-jersey-btn--sprint.selected {
    border-color: #009a3a !important;
}

.lr-jersey-type-form button.lr-jersey-btn--polka.selected,
#fr-content-jersey .lr-jersey-type-form button.lr-jersey-btn--polka.selected {
    border-color: #fff !important;
}

.lr-jersey-type-form button img,
#fr-content-jersey .lr-jersey-type-form button img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
    pointer-events: none;
}

.fr-leaderboard .lr-gc-mixed-note {
    margin: 0 0 12px;
    font-size: 12px;
    font-weight: 700;
    color: #f7ff00;
    line-height: 1.2;
}
