/*
 * ========================================================================
 * GLOBAL / PAGE LAYOUT
 * ========================================================================
 */

.ajaxLoading {
    cursor: progress !important;
}

html,
body {
    height: 100%;
}

.page-wrap {
    min-height: 100%;
    margin-bottom: -120px;
}

.page-wrap::after {
    content: "";
    display: block;
}

.site-footer,
.page-wrap::after {
    height: 120px;
}


/*
 * ========================================================================
 * MAIN NAVIGATION
 * ========================================================================
 */

#mainNavBar {
    --bs-navbar-padding-y: 0.25rem;

    position: fixed !important;
    top: 0;
    right: 0;
    left: 0;

    width: 100%;

    z-index: 1030;
}

#mainNavBarSpacer {
    display: block;
}


/* Club identity
 * ------------------------------------------------------------------------
 */

#mainNavBar .navbar-app-logo {
    margin-right: 0.4rem;
    padding: 0;
}

#mainNavBar .navbar-app-logo-image {
    width: 1.875rem;
    height: 1.5rem;

    object-fit: contain;
}

#mainNavBar .navbar-app-name {
    margin-right: 0.75rem;

    padding-top: 0.2rem;
    padding-bottom: 0.2rem;

    font-size: 1rem;
    font-weight: 600;
}

/* Navigation controls
 * ------------------------------------------------------------------------
 */

#mainNavBar .nav-link {
    padding-top: 0.3rem;
    padding-bottom: 0.3rem;
}

#mainNavBar .nav-item {
    margin-bottom: 0 !important;
}

#mainNavBar .navbar-nav {
    margin-top: 0.25rem !important;
}

#mainNavBar .navbar-toggler {
    padding: 0.2rem 0.45rem;
    font-size: 1rem;
}

#mainNavBar .btn {
    padding: 0.3rem 0.6rem;
    font-size: 0.875rem;
}


/* Team/date filters
 * ------------------------------------------------------------------------
 */

#mainNavBar .navbar-filter-controls {
    display: flex;
    align-items: flex-start;

    gap: 0.4rem;
    margin-top: 0.25rem;
}

#mainNavBar .navbar-filter-controls > * {
    margin-right: 0 !important;
    margin-bottom: 0.25rem !important;
}

#mainNavBar .navbar-team-filter,
#mainNavBar .navbar-date-filters {
    display: contents;
}

#mainNavBar .navbar-team-filter > *,
#mainNavBar .navbar-date-filters > * {
    margin-right: 0 !important;
    margin-bottom: 0.25rem !important;
}

/* Date picker labels, input and calendar button share one input group. */
#mainNavBar .navbar-date-filters > .form-floating {
    flex: 0 0 9rem;
    min-width: 9rem;
}

#mainNavBar .navigation-date-picker {
    position: relative;
}

#mainNavBar .navigation-date-picker .form-control {
    height: 3rem;
    min-height: 3rem;
    padding: 1rem 2.35rem 0.2rem 0.65rem;
    font-size: 0.8rem;
}

#mainNavBar .navigation-date-picker .form-label {
    padding: 0.7rem 2.35rem 0.7rem 0.65rem;
    font-size: 0.75rem;
}

#mainNavBar .navigation-date-picker-toggle {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 3;
    width: 2.25rem;
    height: 3rem;
    padding: 0;
    color: var(--bs-body-color);
}

#mainNavBar .navbar-filter-controls .form-floating > .form-control,
#mainNavBar .navbar-filter-controls .form-floating > .form-select {
    height: 3rem;
    min-height: 3rem;
}

#mainNavBar .navbar-filter-controls .form-floating > .form-control {
    padding: 1rem 0.65rem 0.2rem;
}

#mainNavBar .navbar-filter-controls .form-floating > .form-select {
    padding-top: 1.15rem;
    padding-bottom: 0.2rem;
}

#mainNavBar .navbar-team-filter .form-select,
#mainNavBar .navbar-team-filter .form-label {
    font-size: 0.8rem;
}

#mainNavBar .navbar-filter-controls .form-floating > label {
    padding: 0.7rem 0.65rem;
}


/* Menu search
 * ------------------------------------------------------------------------
 */

#mainNavBar .menu-search-wrapper {
    flex: 0 1 18rem;

    min-width: 12rem;

    padding: 0.25rem 0.5rem;
}

#mainNavBar .menu-search-wrapper input {
    min-width: 0;
}


@media (min-width: 768px) and (max-width: 1199.98px) {
    .navbar-filter-controls {
        display: grid;
        grid-template-columns: 2fr 1fr 1fr;
        gap: .75rem;
        align-items: end;
        width: 100%;
    }

    .navbar-date-filters {
        display: contents;
    }
}

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

@media (max-width: 767.98px) {
    body {
        height: auto;
        min-height: 100%;
    }

    #mainNavBar > .container-fluid {
        column-gap: 0.25rem;
    }

    #mainNavBar .navbar-app-name {
        flex: 1 1 auto;

        min-width: 0;
        margin-right: 0.25rem;

        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    #mainNavBar .navbar-filter-controls {
        flex-wrap: wrap;
        gap: 0.25rem 0.4rem;
    }

    #mainNavBar .navbar-filter-controls > * {
        flex: 1 1 9.5rem;
        min-width: 0;
    }

    #mainNavBar .navbar-filter-controls > .navbar-team-filter {
        display: block;
        flex: 1 1 100%;

        width: 100%;
    }

    #mainNavBar .navbar-filter-controls > .navbar-date-filters {
        display: flex;
        flex: 1 1 100%;

        width: 100%;

        gap: 0.4rem;
    }

    #mainNavBar .navbar-team-filter > * {
        width: 100%;
    }

    #mainNavBar .navbar-date-filters > * {
        flex: 1 1 0;

        width: 50%;
        min-width: 0;
    }

    #mainNavBar .navbar-filter-controls .form-control,
    #mainNavBar .navbar-filter-controls .form-select {
        font-size: 0.8rem;
    }

    #mainNavBar .navbar-filter-controls .form-label {
        font-size: 0.75rem;
    }

    #mainNavBar .nav-link {
        padding-top: 0.25rem;
        padding-bottom: 0.25rem;

        font-size: 0.9rem;
    }

    #mainNavBar .menu-search-wrapper {
        flex-basis: 100%;

        min-width: 0;

        padding-right: 0;
        padding-left: 0;
    }

    #navbarMenuItems {
        overflow: hidden;
    }

    #mainPageMenu {
        flex: 0 1 auto;

        overflow-y: auto;

        overscroll-behavior: contain;
        scrollbar-width: thin;
        -webkit-overflow-scrolling: touch;
    }

    #navbarMenuItems .menu-search-wrapper,
    #navbarMenuItems .navbar-user-menu {
        flex-shrink: 0;
    }

    body.mobile-menu-open .sponsor-ticker {
        display: none !important;
    }
}


/*
 * ========================================================================
 * DROPDOWNS
 * ========================================================================
 */

.dropdown-menu {
    max-height: 50vh;
    overflow-y: auto;
}


/*
 * ========================================================================
 * SPONSOR TICKER / FOOTER
 * ========================================================================
 */

.sponsor-ticker {
    padding: 0.25rem 0;

    overflow: hidden;

    border-top: 1px solid var(--bs-border-color);
    box-shadow: 0 -0.15rem 0.5rem rgba(0, 0, 0, 0.12);
}

.sponsor-ticker-viewport {
    width: 100%;
    overflow: hidden;
}

.sponsor-ticker-track,
.sponsor-ticker-group {
    display: flex;
    align-items: center;

    width: max-content;
}

.sponsor-ticker-track {
    animation:
            sponsor-ticker-scroll
            var(--sponsor-ticker-duration, 45s)
            linear
            infinite;

    will-change: transform;
}

.sponsor-ticker-group {
    flex: 0 0 auto;
    justify-content: space-around;

    min-width: 100vw;

    gap: 0.75rem;
    padding-right: 0.75rem;
}

.sponsor-ticker-item {
    display: flex;
    flex: 0 0 17rem;
    align-items: center;

    height: 3rem;

    gap: 0.6rem;
    padding: 0.25rem 0.6rem;

    overflow: hidden;

    color: var(--bs-body-color);
    text-decoration: none;

    background: var(--bs-body-bg);

    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
}

.sponsor-ticker-item:hover,
.sponsor-ticker-item:focus-visible {
    color: var(--bs-body-color);

    border-color: var(--bs-primary);
    outline: 0;
}

.sponsor-ticker-logo {
    display: flex;
    flex: 0 0 4.25rem;
    align-items: center;
    justify-content: center;

    height: 2.4rem;
}

.sponsor-ticker-logo img {
    width: 100%;
    height: 100%;
    max-width: 100%;

    object-fit: contain;
}

.sponsor-ticker-details {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;

    min-width: 0;
}

.sponsor-ticker-name,
.sponsor-ticker-description {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sponsor-ticker-name {
    font-size: 0.8rem;
    font-weight: 700;
}

.sponsor-ticker-description {
    color: var(--bs-secondary-color);
    font-size: 0.7rem;
}

.sponsor-ticker-track:hover,
.sponsor-ticker-track:focus-within {
    animation-play-state: paused;
}

body.has-sponsor-ticker .page-wrap {
    /* The navbar spacer is a sibling before main, so include it in the
       viewport calculation instead of adding its height to the page. */
    min-height: calc(100% - var(--main-navbar-height, 0px));

    box-sizing: border-box;

    margin-bottom: 0;
    padding-bottom: 4rem;
}

body.has-sponsor-ticker .page-wrap::after {
    height: 0;
}

@keyframes sponsor-ticker-scroll {
    from {
        transform: translate3d(0, 0, 0);
    }

    to {
        transform: translate3d(-50%, 0, 0);
    }
}

@media (max-width: 575.98px) {
    .sponsor-ticker-item {
        flex-basis: calc(100vw - 2rem);
    }
}

@media (prefers-reduced-motion: reduce) {
    .sponsor-ticker-viewport {
        overflow-x: auto;
    }

    .sponsor-ticker-track {
        animation: none;
    }

    .sponsor-ticker-group[aria-hidden="true"] {
        display: none;
    }
}


/*
 * ========================================================================
 * MEDIA
 * ========================================================================
 */

.carousel-item {
    height: 120px;
}

.carousel-item img {
    height: 100%;

    object-fit: cover;
    object-position: center;
}

.video-player {
    height: calc(100vh - 500px);
}


/*
 * ========================================================================
 * MODALS / SPECIAL COMPONENTS
 * ========================================================================
 */

/* Group score modal
 * ------------------------------------------------------------------------
 */

.group-score-modal-content {
    background-color: var(--bs-tertiary-bg);
    border: 2px solid var(--bs-primary-border-subtle);
}

.group-score-modal-content .modal-header {
    color: var(--bs-primary-text-emphasis);
    background-color: var(--bs-primary-bg-subtle);
}


/* Group identity
 * ------------------------------------------------------------------------
 */

.group-color-indicator {
    display: inline-block;

    width: 1rem;
    min-width: 1rem;
    height: 1rem;

    vertical-align: middle;

    border: 1px solid var(--bs-border-color);
    border-radius: 0.25rem;
}

.group-identity {
    white-space: nowrap;
}


/* Exercise details modal
 * ------------------------------------------------------------------------
 */

.exercise-details-content img {
    max-width: 100%;
    height: auto;
}

.exercise-details-content table {
    width: 100%;
}

.exercise-details-content p:last-child {
    margin-bottom: 0;
}

#exerciseDetailsModal .exercise-detail-section {
    padding: 0.75rem 1rem;

    background-color: var(--bs-tertiary-bg);

    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
}

#exerciseDetailsModal .exercise-detail-label {
    margin-bottom: 0.35rem;

    color: var(--bs-secondary-color);

    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

#exerciseDetailsModal .exercise-details-content > :last-child {
    margin-bottom: 0;
}

#exerciseDetailsModal #exerciseDetailsMediaContainer img,
#exerciseDetailsModal #exerciseDetailsMediaContainer video {
    display: block;

    max-width: 100%;
    max-height: 55vh;

    margin: 0 auto;
}


/*
 * ========================================================================
 * COMMON BOOTSTRAP TABLE LAYOUT
 * ========================================================================
 */

/*
 * Bootstrap Table creates both a fixed header and the table's original
 * thead. The original thead must retain its column geometry, but should
 * not consume visible vertical space.
 */

body.common-table-page
.fixed-table-container > .fixed-table-body > table > thead {
    visibility: hidden;
}

body.common-table-page
.fixed-table-container > .fixed-table-body > table > thead > tr,
body.common-table-page
.fixed-table-container > .fixed-table-body > table > thead > tr > th {
    height: 0 !important;

    padding-top: 0 !important;
    padding-bottom: 0 !important;

    line-height: 0 !important;

    border-top: 0 !important;
    border-bottom: 0 !important;
}

body.common-table-page
.fixed-table-container > .fixed-table-body > table > thead > tr > th > * {
    height: 0 !important;
    min-height: 0 !important;

    overflow: hidden !important;
}


/* Desktop table page
 * ------------------------------------------------------------------------
 */

@media (min-width: 768px) {
    body.common-table-page {
        height: 100%;
        overflow: hidden;
    }

    body.common-table-page .page-wrap {
        overflow: hidden;
    }

    /*
     * Auto-height desktop table
     * ------------------------------------------------------------------------
     */
    body.common-table-page.common-table-auto-height {
        height: auto;
        min-height: 100%;
        overflow-x: hidden;
        overflow-y: auto;
    }

    body.common-table-page.common-table-auto-height .page-wrap {
        overflow: visible;
    }

    body.common-table-page.common-table-auto-height
    .bootstrap-table .fixed-table-body {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }

    /*
     * Keep the Bootstrap Table toolbar visible while an auto-height
     * table scrolls with the page.
     */
    body.common-table-page.common-table-auto-height
    .bootstrap-table .fixed-table-toolbar {
        position: sticky;
        top: var(--main-navbar-height, 3.5rem);
        z-index: 1020;

        background-color: var(--bs-body-bg);
    }

    /*
     * Auto-height tables use the original table header.
     * Only undo the rules that deliberately hide/collapse it.
     */
    body.common-table-page.common-table-auto-height
    .fixed-table-container > .fixed-table-body > table > thead {
        visibility: visible !important;
        position: sticky;
        top: calc(
                var(--main-navbar-height, 3.5rem) +
                var(--common-table-toolbar-height, 3rem) - 1px
        );
        z-index: 1010;

        background-color: var(--bs-body-bg);
    }

    body.common-table-page.common-table-auto-height
    .fixed-table-container > .fixed-table-body > table > thead > tr,
    body.common-table-page.common-table-auto-height
    .fixed-table-container > .fixed-table-body > table > thead > tr > th {
        height: auto !important;
        line-height: normal !important;
        border-top: 1px solid var(--bs-border-color) !important;
        border-bottom: 1px solid var(--bs-border-color) !important;
    }

    body.common-table-page.common-table-auto-height
    .fixed-table-container > .fixed-table-body > table > thead > tr > th {
        padding-top: .25rem !important;
        padding-bottom: .25rem !important;
    }

    body.common-table-page.common-table-auto-height
    .fixed-table-container > .fixed-table-body > table > thead > tr > th > * {
        height: auto !important;
        min-height: initial !important;
        overflow: initial !important;
    }
}

/*
 * ========================================================================
 * MOBILE TABLE / CARD VIEW
 * ========================================================================
 */

@media (max-width: 767.98px) {

    /*
     * Hide desktop CRUD controls.
     * Actions are available from the mobile card popup menu.
     */

    #tbbtnModify,
    #tbbtnDelete {
        display: none !important;
    }


    /*
     * Bootstrap Table container
     * --------------------------------------------------------------------
     */

    .bootstrap-table .fixed-table-container {
        border: 0;
    }

    /*
     * Mobile table toolbar
     * --------------------------------------------------------------------
     *
     * Keep custom actions, search and Bootstrap Table actions on one line.
     */

    .bootstrap-table .fixed-table-toolbar {
        position: sticky;
        top: var(--main-navbar-height, 3.5rem);
        z-index: 1020;

        display: flex;
        align-items: center;

        width: 100%;
        gap: 0.4rem;

        padding: 0.4rem 0;

        background-color: var(--bs-body-bg);
        border-bottom: 1px solid var(--bs-border-color);
    }

    .bootstrap-table .fixed-table-toolbar::after {
        display: none;
    }

    .bootstrap-table .fixed-table-toolbar:empty {
        display: none !important;
    }

    .bootstrap-table .fixed-table-toolbar .search,
    .bootstrap-table .fixed-table-toolbar .columns,
    .bootstrap-table .fixed-table-toolbar .bs-bars {
        float: none !important;
        margin: 0 !important;
    }

    /* Custom toolbar actions */

    .bootstrap-table .fixed-table-toolbar .bs-bars {
        order: 1;
        flex: 0 0 auto;

        width: auto;
        padding: 0 !important;
    }

    /*
     * tbCommon contains an mb-3 intended for the desktop layout.
     * Remove it when the toolbar is rendered as one mobile row.
     */
    .bootstrap-table .fixed-table-toolbar #tbCommon,
    .bootstrap-table .fixed-table-toolbar #tbCommon > div,
    .bootstrap-table .fixed-table-toolbar #tbCommon [role="group"] {
        margin: 0 !important;
        padding: 0 !important;
    }

    .bootstrap-table .fixed-table-toolbar .bs-bars .btn {
        margin: 0 !important;
    }


    /* Search */

    .bootstrap-table .fixed-table-toolbar .search {
        order: 2;
        flex: 1 1 auto;

        min-width: 0;
    }

    .bootstrap-table .fixed-table-toolbar .search .input-group {
        width: 100%;
    }


    /* Bootstrap Table actions */

    .bootstrap-table .fixed-table-toolbar .columns {
        order: 3;
        flex: 0 0 auto;

        width: auto;
    }

    .bootstrap-table .fixed-table-body {
        overflow: visible;
    }


    /*
     * Card rows
     * --------------------------------------------------------------------
     */

    .bootstrap-table .fixed-table-body tbody tr {
        display: block;

        width: 100%;
        margin-bottom: 0.75rem;

        overflow: visible;

        background-color: var(--bs-tertiary-bg);

        border: 1px solid var(--bs-border-color);
        border-radius: 0.5rem;
    }

    /*
     * Don't let normal Bootstrap table-cell styling affect cards.
     */
    .bootstrap-table .fixed-table-body tbody tr > td {
        display: block;

        width: 100% !important;
        max-width: 100% !important;

        --bs-table-bg-type: transparent !important;
        --bs-table-accent-bg: transparent !important;

        background-color: transparent !important;
        box-shadow: none !important;

        border: 0 !important;
    }


    /*
     * Card fields
     * --------------------------------------------------------------------
     */

    .bootstrap-table .card-view {
        display: grid;
        grid-template-columns: minmax(105px, 38%) minmax(0, 1fr);

        gap: 0.25rem 0.75rem;
        padding: 0.45rem 0.75rem;

        font-size: 0.875rem;

        border-bottom: 1px solid var(--bs-border-color);
    }

    .bootstrap-table .card-view:last-child {
        border-bottom: 0;
    }

    .bootstrap-table .card-view .card-view-title {
        width: auto !important;
        min-width: 0;

        color: var(--bs-secondary-color);

        font-size: 0.875rem;
        font-weight: 600;

        overflow-wrap: normal;
        word-break: normal;
    }

    .bootstrap-table .card-view .card-view-value {
        width: auto !important;
        min-width: 0;

        color: var(--bs-body-color);

        font-size: 0.875rem;
        font-weight: 400;

        overflow-wrap: anywhere;
    }


    /*
     * Card title
     * --------------------------------------------------------------------
     */

    .bootstrap-table .mobile-card-title {
        display: flex;
        align-items: center;

        gap: 0.5rem;
        padding: 0.65rem 0.75rem;

        background-color: var(--bs-secondary-bg);

        border-bottom: 1px solid var(--bs-border-color);
        border-radius: 0.5rem 0.5rem 0 0;

        font-size: 0.95rem;
        font-weight: 700;

        cursor: pointer;
    }

    .bootstrap-table .mobile-card-title-text {
        flex: 1 1 auto;

        min-width: 0;

        overflow-wrap: anywhere;
    }

    .bootstrap-table .mobile-card-id,
    .bootstrap-table .mobile-card-dropdown,
    .bootstrap-table .mobile-card-detail-toggle {
        flex: 0 0 auto;
    }

    .bootstrap-table .mobile-card-id {
        font-size: 0.7rem;
        font-weight: 500;
    }

    .bootstrap-table .mobile-card-title:hover {
        background-color: var(--bs-tertiary-bg);
    }

    .bootstrap-table .mobile-card-title:focus-visible {
        outline: 2px solid var(--bs-primary);
        outline-offset: -2px;
    }

    .bootstrap-table .mobile-card-title:active {
        opacity: 0.85;
    }


    /*
     * Popup indicator
     *
     * Detail-enabled cards have their own chevron, so only ordinary cards
     * need the popup-menu indicator.
     * --------------------------------------------------------------------
     */

    .bootstrap-table
    .mobile-card-title:not(:has(.mobile-card-detail-toggle))::after {
        content: "\F282";

        flex: 0 0 auto;

        font-family: "bootstrap-icons";
        font-size: 0.8rem;

        opacity: 0.6;
    }


    /*
     * Popup menu anchor
     *
     * Bootstrap Dropdown needs this element as its positioning anchor,
     * although the title itself is the visible trigger.
     * --------------------------------------------------------------------
     */

    .bootstrap-table .mobile-card-dropdown {
        position: relative;
    }

    .bootstrap-table .mobile-card-dropdown-toggle {
        position: absolute !important;

        width: 1px !important;
        height: 1px !important;

        margin: 0 !important;
        padding: 0 !important;

        overflow: hidden !important;

        border: 0 !important;

        opacity: 0 !important;
        pointer-events: none !important;
    }


    /*
     * Detail expand/collapse button
     * --------------------------------------------------------------------
     */

    .bootstrap-table .mobile-card-detail-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;

        width: 2rem;
        height: 2rem;

        margin-left: 0.15rem;
        padding: 0;

        color: inherit;

        background: transparent !important;

        border: 0 !important;
        border-radius: 0.375rem;
    }

    .bootstrap-table .mobile-card-detail-toggle:hover,
    .bootstrap-table .mobile-card-detail-toggle:focus-visible {
        background-color: rgba(255, 255, 255, 0.12) !important;
    }
}

.bootstrap-table tr.return-row-highlight {
    outline: 3px solid var(--bs-primary);
    outline-offset: -3px;
}
