/* market-ratings.css — Market Ratings table + trend chart */

/* ========================================
   GLOBAL OVERRIDES
   ======================================== */
.market-ratings-page button {
    background-color: transparent !important;
    margin-bottom: 0 !important;
}
.market-ratings-page button:hover {
    background-color: transparent !important;
}


.market-ratings-page {
    padding: 15px 20px;
}

/* ========================================
   CONTROLS ROW (Sport tabs)
   ======================================== */
.mr-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

/* ========================================
   FILTER CONTROLS + HCA CALLOUT
   ======================================== */
.mr-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 12px 16px;
    background-color: var(--tmb-gray-100);
    border: 1px solid var(--tmb-gray-300);
    border-radius: 4px;
}

.mr-filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mr-filter-group label {
    font-size: 11px;
    font-weight: bold;
    color: var(--tmb-gray-600);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mr-filter-group select {
    font-size: 13px;
    padding: 5px 10px;
    min-width: 140px;
    height: 34px;
}

.mr-halflife-group {
    min-width: 220px;
}

/* .info-tooltip is defined in front.css; these are this page's differences. */
.info-tooltip .tooltip-text {
    font-size: 0.8rem;
    text-transform: none; /* .mr-filter-group label is uppercase; this text is a paragraph, not a label */
}
.info-tooltip .tooltip-text.tooltip-wide {
    width: 300px;
}

.mr-halflife-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Spread / Total and Games / Days are front.css's .tmb-pill (2026-10-23). */

.mr-halflife-slider {
    width: 90px;
}

.mr-halflife-value {
    font-size: 12px;
    color: var(--tmb-gray-600);
    min-width: 52px;
}

.mr-hca-callout {
    font-size: 14px;
    color: var(--tmb-gray-900);
}

.mr-hca-label {
    color: var(--tmb-gray-600);
    margin-right: 6px;
}

.mr-hca-value {
    font-weight: 900;
    color: var(--tmb-brand-dark);
    font-size: 16px;
}

/* ========================================
   TABLE + CHART LAYOUT
   ======================================== */
.mr-body-container {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.mr-table-col {
    flex: 0 0 40%;
    max-width: 40%;
    overflow-x: auto;
}

/* Table-Only widget (my-dashboards): the chart column is omitted, so let the
   table take the full width instead of sitting at 40% with dead space. */
.mr-body-container.mr-table-only .mr-table-col {
    flex: 1 1 100%;
    max-width: 100%;
}

.mr-chart-col {
    flex: 1 1 60%;
    min-width: 0;
}

.mr-team-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.mr-team-table thead th {
    text-align: left;
    font-size: 11px;
    font-weight: bold;
    color: var(--tmb-gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 10px;
    border-bottom: 2px solid var(--tmb-gray-300);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

/* Numeric columns (rank/rating/sched/games): header and data both
   right-aligned so labels sit directly above the values they describe,
   matching standard numeric-table convention. Team stays left (text). */
.mr-team-table thead th.mr-col-num,
.mr-team-table td.mr-col-num {
    text-align: right;
}

.mr-team-table thead th:hover {
    color: var(--tmb-brand-dark);
}

.mr-team-table thead th.mr-sort-active {
    color: var(--tmb-brand-dark);
}

.mr-team-table thead th.mr-sort-active::after {
    content: ' \25BC';
    font-size: 9px;
}

.mr-team-table thead th.mr-sort-active.mr-sort-asc::after {
    content: ' \25B2';
}

.mr-team-table tbody tr {
    cursor: pointer;
    border-bottom: 1px solid var(--tmb-gray-300);
}

.mr-team-table tbody tr:hover {
    background-color: var(--tmb-gray-100);
}

.mr-team-table tbody tr.mr-row-selected {
    background-color: var(--tmb-good-8);
}

.mr-team-table td {
    padding: 7px 10px;
    color: var(--tmb-gray-900);
    text-align: left;
}

.mr-team-table td.mr-rank-cell {
    color: var(--tmb-gray-600);
    font-weight: 600;
    width: 40px;
}

.mr-team-table td.mr-rating-cell {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.mr-rating-elo-ml {
    font-size: 11px;
    font-weight: 400;
    color: var(--tmb-gray-600);
    margin-left: 4px;
}

/* Extra separation from Rating so the bar reads as its own column
   instead of an appendage of the rating number next to it. */
.mr-team-table thead th[data-sort="sched_rating"],
.mr-team-table td.mr-sched-cell {
    padding-left: 24px !important;
    border-left: 1px solid var(--tmb-gray-300);
}

.mr-team-table td.mr-sched-cell {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    width: 140px;
}

.mr-sched-wrap {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.mr-sched-bar-track {
    position: relative;
    flex: 1 1 auto;
    max-width: 60px;
    height: 6px;
    border-radius: 3px;
    /* weakest schedule (red) -> average (neutral) -> toughest (green) */
    background: linear-gradient(to right, var(--tmb-bad-8), var(--tmb-warning-bg), var(--tmb-brand-light));
}

.mr-sched-bar-marker {
    position: absolute;
    top: -2px;
    bottom: -2px;
    width: 3px;
    margin-left: -1.5px;
    border-radius: 1px;
    background-color: var(--tmb-gray-900);
    box-shadow: 0 0 0 1px var(--tmb-white-90);
}

.mr-sched-val {
    color: var(--tmb-gray-900);
    min-width: 42px;
    text-align: right;
}

.mr-sched-rank {
    color: var(--tmb-gray-600);
    font-size: 11px;
    margin-left: 2px;
}

.mr-sched-empty {
    color: var(--tmb-gray-400);
}

.mr-loading, .mr-no-data {
    color: var(--tmb-gray-600);
    padding: 20px;
    font-size: 14px;
    text-align: center;
}

/* ========================================
   CHART
   ======================================== */
.mr-chart-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--tmb-gray-900);
    margin: 0 0 8px 0;
}

.mr-chart-wrap {
    position: relative;
    width: 100%;
    height: 420px;
}

.mr-chart-wrap canvas {
    width: 100% !important;
    height: 100% !important;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 767px) {
    .content-wrapper > .market-ratings-page {
        padding: 10px 16px !important;
    }
}

/* Container-query version of the block above: everything else here is
   inside .tmb-cq-root (see market-ratings-body.php), so it responds to
   THIS WIDGET'S width — narrow on a /my-dash/ column even on a wide
   desktop screen, same as narrow-viewport on the real standalone page. */

/* Filters at mid widths (a typical /my-dash/ column is ~500-900px): the four
   groups need ~850px to sit on one line, but .mr-filters is already
   flex-wrap:wrap, so let them WRAP onto a second line rather than stacking
   one-per-row — stacking cost four rows of height for no readability gain.
   Packed left, because space-between spreads a half-full wrapped row apart. */
@container (max-width: 900px) {
    .mr-filters {
        justify-content: flex-start;
    }
}

/* Genuinely narrow (phone, or a very thin dashboard column): now stack, and
   let the season select fill the width. */
@container (max-width: 480px) {
    .mr-filters {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .mr-filter-group select {
        width: 100%;
    }
}

/* Body: table and chart go one above the other well before the filters need
   to stack — two side-by-side columns stop working around 767px. */
@container (max-width: 767px) {
    .mr-body-container {
        flex-direction: column;
    }

    .mr-table-col,
    .mr-chart-col {
        flex: 1 1 100%;
        max-width: 100%;
        width: 100%;
    }

    .mr-chart-wrap {
        height: 300px;
    }

    .mr-chart-title {
        font-size: 13px;
    }
}

/* ========================================
   THE PAGE: the line-vs-actual charts under the table and rating chart
   ======================================== */
/* /market-ratings/ only (since 2026-10-08, when /market-trends/ was merged
   into it): market-trends-body.php is printed under .mr-body-container, its
   two charts side by side, a card each. Scoped to .market-ratings-page,
   which a /my-dash/ widget does not have. The charts' own rules, and the
   colour that tells one from the other, are market-trends.css. */

/* Nothing to draw (a season the ratings do not reach, which the Season
   select lists for the line charts): one line of text, not a 420px gap. */
.market-ratings-page .mr-chart-wrap:has(> .mr-no-data) {
    height: auto;
}

.market-ratings-page .mr-lines-section {
    margin-top: 32px;
    padding-top: 20px;
    border-top: 2px solid var(--tmb-gray-300);
}

.market-ratings-page .mr-section-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--tmb-gray-600);
    margin: 0 0 12px 0;
}

/* A card a chart. The wrap is 350px for a title and a 300px canvas; the
   card's padding is added to it, so the canvas keeps its room. */
.market-ratings-page .mt-chart-wrap {
    box-sizing: border-box;
    height: 382px;
    padding: 14px 16px 18px;
    background-color: #fff;
    border: 1px solid var(--tmb-gray-300);
    border-radius: 6px;
    box-shadow: 0 1px 3px var(--tmb-black-5);
}

.market-ratings-page .mt-chart-totals {
    border-top: 3px solid var(--tmb-purple);
}

.market-ratings-page .mt-chart-lines {
    border-top: 3px solid var(--tmb-blue);
}

@container (min-width: 768px) {
    /* Half the row each. */
    .market-ratings-page .mt-charts-container {
        flex-direction: row;
        gap: 24px;
    }

    .market-ratings-page .mt-chart-wrap {
        flex: 1 1 0;
        min-width: 0;
    }

    /* Side by side with the rating chart, a college table (360 rows)
       scrolls inside its column with its header held, so the charts under
       it are a screen or two down, not 10,000px. A 32-team table fits
       whole. Stacked (a container of 767px or less) the table is as long
       as its league, as before. */
    .market-ratings-page .mr-table-col {
        max-height: 1060px;
        overflow-y: auto;
    }

    /* The rating chart is shorter than a league's table: it travels down
       the page beside the table (under the fixed header and the sport
       bar), so a click on row 25 has its chart next to it. */
    .market-ratings-page .mr-chart-col {
        position: sticky;
        top: 140px;
    }

    .market-ratings-page .mr-team-table thead th {
        position: sticky;
        top: 0;
        z-index: 1;
        background-color: #fff;
        /* A collapsed table's border does not travel with a sticky cell. */
        box-shadow: inset 0 -2px 0 var(--tmb-gray-300);
    }
}

@container (max-width: 767px) {
    .market-ratings-page .mt-chart-wrap {
        height: 312px;
    }
}
