/* =============================================================================
   [site-header.css] - top navigation: #header (logo, main pills, search, language)
   and .site-sports (sport tabs). Kept out of score24h.css so the old generic
   header rules there (.header, .logo, .nav-menu ...) cannot leak into this markup.
   Also holds the mobile bottom tab bar (.site-tabbar) and the home filter chips that
   sit under the sport tabs on mobile.
   On the home page this file is inlined in <head> (layouts/main.php) because the
   critical CSS is generated from the old header and must not paint first.
   Keep quotes and apostrophes out of comments: MinifyHelper::cssSafe pairs quotes before
   it strips comments, so a stray one deletes whole rule blocks from the inlined copy.
   ============================================================================= */

/* Same horizontal gutters as the page container (.hb-scope) so header and content edges line up */
#header.site-header,
.site-sports,
.wr-h1-title {
    --site-w: min(1320px, calc(100% - 2 * clamp(16px, 6vw, 100px)));
}

/* Row 1 --------------------------------------------------------------------- */

/* #header.site-header (1,1,0) outranks the plain #header rules baked into critical-home.min.css */
#header.site-header {
    display: block;
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
    padding: 0;
    border: 0;
    box-sizing: border-box;
    overflow: visible;
    background: #15161d;
}

.site-header__inner {
    display: flex;
    align-items: center;
    gap: 8px;
    width: var(--site-w);
    margin: 0 auto;
    padding: 15px 0 11px;
    box-sizing: border-box;
}

.site-header__logo {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    height: 48px;
    margin-right: 25px;
}

.site-header__logo img {
    display: block;
    height: 48px;
    width: auto;
}

.site-header__nav {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.site-header__pill {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 8px;
    height: 46px;
    padding: 0 16px;
    box-sizing: border-box;
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: 100px;
    color: #eee;
    font: 500 14px/20px var(--font-vn, 'Be Vietnam Pro', sans-serif);
    text-decoration: none;
    white-space: nowrap;
    transition: background-color .2s ease;
}

.site-header__pill img {
    display: block;
    width: 20px;
    height: 20px;
}

.site-header__pill:hover {
    background: rgba(255, 255, 255, .06);
}

.site-header__pill.is-active {
    background: #25252f;
    border-color: rgba(255, 255, 255, .12);
}

/* Red indicator hanging from the top edge of the active pill */
.site-header__pill.is-active::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 50%;
    width: 38px;
    height: 4px;
    transform: translateX(-50%);
    border-radius: 0 0 4px 4px;
    background: #fd0000;
}

.site-header__pill.is-soon,
.site-sports__tab.is-soon,
.site-sports__menu-item.is-soon {
    cursor: default;
}

.site-header__actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.site-header__search-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
}

.site-header__search-btn:hover {
    background: rgba(255, 255, 255, .06);
}

.site-header__search-btn img {
    display: block;
    width: 24px;
    height: 24px;
}

/* Mobile-only controls stay hidden on PC */
.site-header__search-pill,
.site-header__gear {
    display: none;
}

/* Language switch: markup keeps .language-select / .selected-language / .dropdown-language,
   the toggle behaviour lives in score24h.js */
#header .site-header__lang {
    position: relative;
}

#header .site-header__lang .selected-language {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 36px;
    padding: 0 8px;
    box-sizing: border-box;
    border-radius: 100px;
    background: #25252f;
    cursor: pointer;
}

#header .site-header__lang .selected-language:hover {
    background: #2f2f3a;
}

#header .site-header__lang .selected-language img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

/* Chevron is a pseudo-element so it survives the JS that swaps the flag markup on click */
#header .site-header__lang .selected-language::after {
    content: '';
    width: 16px;
    height: 16px;
    background: url(/images/arrow-down.png) center / contain no-repeat;
}

#header .site-header__lang .dropdown-language {
    top: 44px;
    z-index: 5;
    padding: 6px;
    gap: 4px;
    border-radius: 12px;
    background: #1c1c25;
    border: 1px solid rgba(255, 255, 255, .08);
}

#header .site-header__lang .language-item img {
    width: 24px;
    height: 24px;
}

/* Row 2: sport tabs ---------------------------------------------------------- */

.site-sports {
    position: relative;
    z-index: 900;
    width: 100%;
    padding-bottom: 1px;
    box-sizing: border-box;
    background: #0f1015;
}

/* Full-width hairline that fades from brand red to blue */
.site-sports::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1px;
    background: linear-gradient(90deg, #85080c, #2b2e84);
    pointer-events: none;
}

.site-sports__inner {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    width: var(--site-w);
    height: 49px;
    margin: 0 auto;
    background: transparent;
}

.site-sports__scroll {
    display: flex;
    align-items: stretch;
    gap: 2px;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.site-sports__scroll::-webkit-scrollbar {
    display: none;
}

.site-sports__tab {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 10px;
    padding: 0 16px;
    color: #eee;
    font: 500 14px/20px var(--font-vn, 'Be Vietnam Pro', sans-serif);
    text-decoration: none;
    white-space: nowrap;
    transition: background-color .2s ease;
}

.site-sports__tab img,
.site-sports__menu-item img {
    display: block;
    width: 20px;
    height: 20px;
}

.site-sports__tab:hover {
    background: rgba(255, 255, 255, .05);
}

.site-sports__tab.is-active {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, .125) 100%);
}

/* Sports after the first six: behind See more on PC, in the scroller on mobile */
.site-sports__tab.is-extra {
    display: none;
}

.site-sports__next {
    display: none;
}

.site-sports__more {
    position: relative;
    display: flex;
    align-items: stretch;
    flex: 0 0 auto;
}

.site-sports__more-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    border: 0;
    background: transparent;
    color: #eee;
    font: 500 14px/20px var(--font-vn, 'Be Vietnam Pro', sans-serif);
    white-space: nowrap;
    cursor: pointer;
}

.site-sports__more-toggle img {
    display: block;
    width: 16px;
    height: 16px;
    transition: transform .2s ease;
}

.site-sports__more.is-open .site-sports__more-toggle img {
    transform: rotate(180deg);
}

.site-sports__menu {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 1001;
    display: none;
    flex-direction: column;
    gap: 2px;
    min-width: 200px;
    padding: 6px;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 12px;
    background: #1c1c25;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
}

.site-sports__more.is-open .site-sports__menu {
    display: flex;
}

.site-sports__menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: #eee;
    font: 500 14px/20px var(--font-vn, 'Be Vietnam Pro', sans-serif);
    text-decoration: none;
    white-space: nowrap;
}

.site-sports__menu-item:hover {
    background: rgba(255, 255, 255, .06);
}

/* Mobile tab bar: hidden on PC */
.site-tabbar {
    display: none;
}

/* Page title strip above the header: same band color as row 1 so they read as one bar */
.wr-h1-title {
    background: #15161d;
}

body .wr-h1-title h1 {
    width: var(--site-w);
    padding-left: 0;
    padding-right: 0;
}

/* Mobile --------------------------------------------------------------------- */

@media (max-width: 767px) {
    .wr-h1-title {
        background: #121418;
    }

    body .wr-h1-title h1 {
        width: auto;
        padding-left: 12px;
        padding-right: 12px;
    }

    #header.site-header {
        background: #0f1015;
    }

    /* 54px tall: match-detail JS pins its sticky bars below #header using its height */
    .site-header__inner {
        width: 100%;
        padding: 12px;
    }

    .site-header__logo,
    .site-header__logo img {
        height: 40px;
    }

    .site-header__logo {
        margin-right: 0;
    }

    .site-header__nav,
    .site-header__search-btn,
    #header .site-header__lang {
        display: none;
    }

    .site-header__actions {
        gap: 8px;
    }

    .site-header__search-pill {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        height: 30px;
        padding: 0 14px 0 10px;
        border: 0;
        border-radius: 100px;
        background: #1c1c25;
        color: #8c8c92;
        font: 400 13px/18px var(--font-vn, 'Be Vietnam Pro', sans-serif);
        cursor: pointer;
    }

    .site-header__search-pill img {
        display: block;
        opacity: .8;
    }

    .site-header__gear {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 30px;
        height: 30px;
        padding: 0;
        border: 0;
        border-radius: 50%;
        background: #1c1c25;
        cursor: pointer;
    }

    .site-header__gear img {
        display: block;
        width: 18px;
        height: 18px;
    }

    .site-sports {
        background: transparent;
    }

    .site-sports::after {
        display: none;
    }

    .site-sports__inner {
        position: relative;
        width: 100%;
        height: auto;
        background: transparent;
    }

    .site-sports__scroll {
        flex: 1 1 auto;
        gap: 0;
        padding: 0 46px 0 10px;
    }

    .site-sports__tab {
        position: relative;
        flex-direction: column;
        justify-content: center;
        gap: 4px;
        min-width: 64px;
        height: 52px;
        padding: 0 13px;
        box-sizing: border-box;
        border-radius: 8px 8px 0 0;
        font-size: 13px;
        line-height: 18px;
    }

    .site-sports__tab.is-extra {
        display: flex;
    }

    .site-sports__tab.is-active {
        background: linear-gradient(180deg, rgba(255, 255, 255, 0) 20%, rgba(255, 255, 255, .16) 100%);
    }

    .site-sports__tab.is-active::after {
        content: '';
        position: absolute;
        left: 30%;
        right: 30%;
        bottom: 0;
        height: 2px;
        border-radius: 2px;
        background: #fd0000;
    }

    .site-sports__next {
        position: absolute;
        top: 50%;
        right: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 28px;
        height: 28px;
        padding: 0;
        transform: translateY(-50%);
        border: 0;
        border-radius: 50%;
        background: #24252d;
        cursor: pointer;
    }

    .site-sports__next.is-hidden {
        display: none;
    }

    .site-sports__more {
        display: none;
    }

    /* Filter chips (All / Live / Upcoming / Finished): the toolbar is display:none!important on mobile in
       score24h.css; bring back only its chips row, right under the sport tabs. */
    .home-match-feed > .match-toolbar {
        display: flex !important;
        padding: 0;
        margin: 0;
        border: 0;
        background: transparent;
    }

    .home-match-feed > .match-toolbar > :not(.match-toolbar__tabs) {
        display: none !important;
    }

    .home-match-feed > .match-toolbar .match-toolbar__tabs {
        gap: 8px;
        padding: 6px 0 0 0;
    }

    .home-match-feed > .match-toolbar .match-filter-tab {
        position: relative;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 auto;
        align-self: center;
        height: 32px !important;
        min-height: 32px !important;
        padding: 0 16px !important;
        box-sizing: border-box;
        border: 1px solid transparent;
        border-radius: 100px;
        background: #1c1c25;
    }

    .home-match-feed > .match-toolbar .match-filter-tab__label,
    .home-match-feed > .match-toolbar .match-filter-tab__label--active {
        color: #8c8c92;
        font-size: 12px;
        font-weight: 500;
        line-height: 20px;
    }

    .home-match-feed > .match-toolbar .match-filter-tab.is-active {
        border-color: #fd0000;
        background: rgba(253, 0, 0, .08);
    }

    .home-match-feed > .match-toolbar .match-filter-tab.is-active .match-filter-tab__label,
    .home-match-feed > .match-toolbar .match-filter-tab.is-active .match-filter-tab__label--active {
        color: #fff;
        font-weight: 600;
        /*text-transform: uppercase;*/
    }

    .home-match-feed > .match-toolbar .match-card__live-dot {
        display: none;
    }

    /* Live count sits on the top-right corner of the chip */
    .home-match-feed > .match-toolbar .match-filter-tab__badge-wrap {
        position: absolute;
        top: -6px;
        left: auto;
        right: -4px;
        min-width: 16px;
        height: 16px;
        padding: 0 4px;
        box-sizing: border-box;
    }

    /* Bottom tab bar ------------------------------------------------------- */
    .site-tabbar {
        position: fixed;
        left: 16px;
        right: 16px;
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        z-index: 1080;
        display: block;
        pointer-events: none;
    }

    body.has-drawer-open .site-tabbar {
        opacity: 0;
        pointer-events: none;
    }

    .site-tabbar__bar {
        display: flex;
        align-items: center;
        gap: 0;
        height: 60px;
        padding: 4px 3px;
        box-sizing: border-box;
        border: 1px solid rgba(255, 255, 255, .08);
        border-radius: 100px;
        background: #202129;
        box-shadow: 0 4px 4px rgba(0, 0, 0, .25);
        pointer-events: auto;
    }

    .site-tabbar__item {
        display: flex;
        flex: 1 1 auto;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        min-width: 0;
        align-self: stretch;
        padding: 2px 6px;
        box-sizing: border-box;
        border: .5px solid transparent;
        border-radius: 100px;
        color: #8c8c8e;
        font: 500 10px/12px var(--font-vn, 'Be Vietnam Pro', sans-serif);
        text-decoration: none;
    }

    .site-tabbar__item.is-active {
        border-color: #5a5a5a;
        background: linear-gradient(160deg, #0f1015 0%, rgba(105, 105, 107, .475) 60%, #0f1015 100%);
        color: #eee;
    }

    .site-tabbar__item.is-soon {
        cursor: default;
    }

    /* Icon files are white strokes; the mask lets the item color tint them */
    .site-tabbar__icon {
        display: block;
        width: 20px;
        height: 20px;
        flex-shrink: 0;
        background: currentColor;
        -webkit-mask: var(--icon) center / contain no-repeat;
        mask: var(--icon) center / contain no-repeat;
    }

    .site-tabbar__label {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Pages without the tab bar (SiteNav::showsTabBar: match, league, club, player): the floating drawer button sat
       above the bar (bottom 88px, score24h.css), it drops to the bottom edge */
    body.no-tabbar .home-mobile-fab {
        bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    }
}
