/* Terraces 5 specific fixes for tournament-leaderboard control.
   Keep this minimal so we align with Scotland's compact leaderboard treatment. */

.table-block .select--custom {
    min-height: 3.8rem;
    font-size: 1.5rem;
}

@media (min-width: 768px) {
    /* Keep Division + Type selectors inline on Terraces 5, like Scotland. */
    .table-block .select--custom.col-md-5.col-sm-12 {
        display: inline-block;
        width: auto;
        min-width: 18rem;
        max-width: 24rem;
        vertical-align: middle;
    }

    .table-block .select--custom.col-md-5.col-sm-12 + .select--custom.col-md-5.col-sm-12 {
        margin-left: 1rem;
    }
}

/* Reduce vertical density introduced by previous override. */
.custom-table-leaderboard .table__row {
    padding-top: 1.2rem;
    padding-bottom: 1.2rem;
}

@media (min-width: 480px) {
    .table-leaderboard-fix .table-text,
    .table-leaderboard-fix .generic-table td,
    .generic-table .table-leaderboard-fix td {
        max-width: unset;
        min-width: unset;
        width: unset;
    }
}

@media (min-width: 992px) {
    .table-leaderboard-fix .table-text,
    .table-leaderboard-fix .generic-table td,
    .generic-table .table-leaderboard-fix td {
        max-width: unset;
        min-width: unset;
        width: unset;
    }

    .table-leaderboard-fix .table-text--position {
        width: 40px;
    }
}

@media (min-width: 1200px) {
    .table-leaderboard-fix .table-text--position {
        max-width: unset;
        min-width: unset;
        width: 48px;
    }
}

.table-leaderboard-fix .table__row .pga img,
.table-leaderboard-fix .table__row .country img {
    width: unset;
    height: unset;
    margin: 0 auto;
}

.table-leaderboard-fix .table__row .arrow img {
    width: unset;
    height: unset;
    display: inline-block;
}

.table-leaderboard-fix .pga,
.table-leaderboard-fix .country,
.table-leaderboard-fix .arrow {
    width: 33px;
    padding: 0;
    text-align: center;
}

.table-leaderboard-fix .arrow {
    width: 90px;
}

/* Match Scotland player identity line treatment (name + flag + club). */
.table-leaderboard-fix .entry-name {
    min-width: 16rem;
}

.table-leaderboard-fix .entry-name .player-names {
    margin-bottom: .2rem;
}

.table-leaderboard-fix .entry-name .player-names .table-text {
    font-weight: 500;
    line-height: 1.35;
}

.table-leaderboard-fix .entry-name .entrant-info {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding-left: .8rem;
    padding-right: .8rem;
    line-height: 1.2;
}

.table-leaderboard-fix .entry-name .entrant-info img {
    display: inline-block;
    width: auto;
    height: auto;
    max-width: 16px;
    max-height: 12px;
    vertical-align: middle;
}

.table-leaderboard-fix .entry-name .entrant-info .table-text-small {
    color: #8d8d93;
    text-transform: uppercase;
    letter-spacing: 0;
}

/* Round scores are rendered as anchors; make them look like plain table values. */
.table-leaderboard-fix .stat a.table-text {
    text-decoration: none;
    color: inherit;
}

.table-leaderboard-fix .stat a.table-text:hover,
.table-leaderboard-fix .stat a.table-text:focus,
.table-leaderboard-fix .stat a.table-text:active {
    text-decoration: none;
    color: inherit;
}

/* Keep right-side stat columns visually aligned across rows. */
.table-leaderboard-fix ._l-right-col .stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex: 0 0 64px;
    width: 64px;
    min-width: 64px;
    max-width: 64px;
}

.table-leaderboard-fix ._l-right-col .stat:first-child,
.table-leaderboard-fix ._l-right-col .stat:last-child {
    flex-basis: 72px;
    width: 72px;
    min-width: 72px;
    max-width: 72px;
}

.table-leaderboard-fix ._l-right-col .stat.stat--thru {
    flex-basis: 56px;
    width: 56px;
    min-width: 56px;
    max-width: 56px;
}

.table-leaderboard-fix ._l-right-col .stat .table-text,
.table-leaderboard-fix ._l-right-col .stat .table-text-small {
    width: 100%;
    text-align: center;
}

/* Values should be slightly bolder than labels. */
.table-leaderboard-fix ._l-right-col .stat .table-text {
    font-weight: 600;
}

/* Round-by-round values are anchors: ensure they never look like links. */
.table-leaderboard-fix ._l-right-col .stat a.table-text,
.table-leaderboard-fix ._l-right-col .stat a.table-text:visited,
.table-leaderboard-fix ._l-right-col .stat a.table-text:hover,
.table-leaderboard-fix ._l-right-col .stat a.table-text:focus,
.table-leaderboard-fix ._l-right-col .stat a.table-text:active {
    text-decoration: none !important;
    border-bottom: 0 !important;
    color: inherit !important;
    font-weight: 600;
}

@media (max-width: 767.98px) {
    .table-leaderboard-fix ._l-right-col .stat {
        flex-basis: 52px;
        width: 52px;
        min-width: 52px;
        max-width: 52px;
    }

    .table-leaderboard-fix ._l-right-col .stat:first-child,
    .table-leaderboard-fix ._l-right-col .stat:last-child {
        flex-basis: 58px;
        width: 58px;
        min-width: 58px;
        max-width: 58px;
    }

    .table-leaderboard-fix ._l-right-col .stat.stat--thru {
        flex-basis: 46px;
        width: 46px;
        min-width: 46px;
        max-width: 46px;
    }
}

/* Round values may be injected as inner a.round_link HTML from API. */
.table-leaderboard-fix a.round_link,
.table-leaderboard-fix a.round_link:visited,
.table-leaderboard-fix a.round_link:hover,
.table-leaderboard-fix a.round_link:focus,
.table-leaderboard-fix a.round_link:active {
    text-decoration: none !important;
    border-bottom: 0 !important;
    color: inherit !important;
    font-weight: 600;
}

@media (max-width: 767.98px) {
    .table-block .select--custom.col-md-5.col-sm-12 + .select--custom.col-md-5.col-sm-12 {
        margin-left: 0;
        margin-top: .8rem;
    }

    .table-leaderboard-fix .entry-name {
        min-width: 0;
    }

    .table-leaderboard-fix .entry-name .entrant-info {
        padding-left: 0;
        padding-right: 0;
    }
}

.tournament-leaderboard-control .leaderboard-header { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; }
.tournament-leaderboard-control .leaderboard-header .block-header__title { margin: 0; }
.tournament-leaderboard-control .leaderboard-header .block-header__cta { margin: 0; }
.tournament-leaderboard-control .leaderboard-search { flex: 0 1 32rem; min-width: 0; max-width: 100%; margin-left: auto; }
.tournament-leaderboard-control .leaderboard-search input { box-sizing: border-box; width: 100%; max-width: 32rem; min-height: 44px; padding: .8rem 1.2rem; border: 1px solid #929292; border-radius: 4px; background: #fff; color: #202020; font: inherit; }
.tournament-leaderboard-control .leaderboard-table-section { margin-bottom: 2rem; }
.tournament-leaderboard-control .table__row ._l-left-col { min-width: 0; padding-left: 0; }
.tournament-leaderboard-control .table__row .entry-name { min-width: 0; }
.tournament-leaderboard-control .leaderboard-entry-heading { display: flex; align-items: baseline; gap: 2px; min-width: 0; }
.tournament-leaderboard-control .leaderboard-entry-heading .player-names { min-width: 0; margin-bottom: 0; overflow-wrap: anywhere; }
.tournament-leaderboard-control .leaderboard-favourite { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 24px; width: 24px; height: 24px; padding: 0; border: 0; background: transparent; color: #595959; font-size: 2.2rem; line-height: 1; cursor: pointer; }
.tournament-leaderboard-control .leaderboard-favourite.is-favourite { color: #946600; }
.tournament-leaderboard-control button:disabled { opacity: .5; cursor: default; }
.tournament-leaderboard-control .leaderboard-error { color: #a51d24; overflow-wrap: anywhere; }
.tournament-leaderboard-control .leaderboard-dialog-backdrop { position: fixed; inset: 0; z-index: 11000; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0, 0, 0, .55); }
.tournament-leaderboard-control .leaderboard-favourites-dialog { position: relative; width: 100%; max-width: 440px; max-height: calc(100vh - 32px); overflow-y: auto; padding: 32px 24px 24px; border-radius: 6px; background: #fff; color: #202020; box-shadow: 0 8px 32px rgba(0, 0, 0, .2); overflow-wrap: anywhere; }
.tournament-leaderboard-control .leaderboard-favourites-dialog h3 { margin: 0 32px 20px 0; font-size: 2rem; line-height: 1.4; letter-spacing: 0; }
.tournament-leaderboard-control .leaderboard-favourites-dialog p,
.tournament-leaderboard-control .leaderboard-dialog-message { margin-bottom: 20px; font-size: 1.5rem; line-height: 1.5; }
.tournament-leaderboard-control .leaderboard-dialog-close { position: absolute; top: 4px; right: 4px; width: 44px; height: 44px; border: 0; background: transparent; color: inherit; font-size: 2.8rem; cursor: pointer; }
.tournament-leaderboard-control .leaderboard-dialog-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.tournament-leaderboard-control .leaderboard-auth-link { box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; flex: 1 1 140px; min-width: 0; height: auto; min-height: 44px; padding: 12px 16px; border-width: 1px; border-style: solid; border-radius: 4px; background: transparent; font: inherit; font-weight: 600; line-height: 1.4; text-align: center; text-decoration: none; white-space: normal; overflow-wrap: anywhere; }
.tournament-leaderboard-control .leaderboard-auth-link::before { width: 100%; border-radius: 3px; }
.tournament-leaderboard-control .leaderboard-auth-link .button__text { position: relative; z-index: 1; white-space: normal; overflow-wrap: anywhere; }
.tournament-leaderboard-control .leaderboard-auth-link:hover { text-decoration: none; }
.tournament-leaderboard-control .leaderboard-auth-link--secondary::before { width: 0; }
.tournament-leaderboard-control .leaderboard-auth-link--secondary:hover::before,
.tournament-leaderboard-control .leaderboard-auth-link--secondary:focus::before { width: 100%; }
.tournament-leaderboard-control .leaderboard-dialog-dismiss { display: block; min-height: 44px; margin: 16px auto 0; border: 0; background: transparent; color: inherit; text-decoration: underline; font: inherit; cursor: pointer; }
.tournament-leaderboard-control .leaderboard-player-choice { display: flex; gap: 12px; align-items: center; width: 100%; min-height: 44px; padding: 10px 0; border: 0; border-bottom: 1px solid #ddd; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.tournament-leaderboard-control .leaderboard-player-choice[aria-pressed="true"] { font-weight: 700; }
.tournament-leaderboard-control .leaderboard-favourite:focus-visible,
.tournament-leaderboard-control .leaderboard-favourites-dialog :focus-visible { outline: 2px solid #167361; outline-offset: 2px; }
.tournament-leaderboard-control .leaderboard-auth-link:focus-visible { outline-color: currentColor; }
