/* ==========================================================================
   Match list (js/match-list.js) – used by the match pages and the team page.
   Builds on the .st-* tokens and table of stats-modern.css.
   ========================================================================== */

.ml-table td {
    padding: var(--st-cell-y) var(--st-cell-x);
    border-bottom: 1px solid var(--st-line);
    text-align: center;
    white-space: nowrap;
}

.ml-table tbody tr:nth-child(even) td { background: var(--st-row-alt); }
.ml-table tbody tr:hover td { background: var(--st-row-hover); }
.ml-table tbody tr.ml-clickable { cursor: pointer; }

.ml-table .ml-home { text-align: right; }
.ml-table .ml-away { text-align: left; }
.ml-table .ml-self { font-weight: 700; }
.ml-table .ml-date { color: var(--st-muted); }
.ml-table a { color: inherit; text-decoration: none; }
.ml-table a:hover { color: var(--st-accent); text-decoration: underline; }

.ml-team {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.ml-home .ml-team { flex-direction: row-reverse; }

.ml-logo {
    width: var(--st-logo);
    height: var(--st-logo);
    object-fit: contain;
}

.ml-score {
    font-weight: 700;
    letter-spacing: 0.05em;
}

.ml-result {
    display: inline-block;
    width: 1.5em;
    line-height: 1.5em;
    border-radius: 0.3em;
    color: #fff;
    font-weight: 700;
    font-size: 0.85em;
}

.ml-result--w { background: #2e9d6a; }
.ml-result--d { background: #95a5a6; }
.ml-result--l { background: #d0544b; }

/* Home / draw / away win probability before the match. */
.ml-probs {
    display: flex;
    width: clamp(6rem, 4rem + 6vw, 9rem);
    height: 0.9rem;
    margin: 0 auto;
    border-radius: 0.3rem;
    overflow: hidden;
}

.ml-probs span { height: 100%; }
.ml-prob-home { background: #2e9d6a; }
.ml-prob-draw { background: #95a5a6; }
.ml-prob-away { background: #d0544b; }

/* Sortable column headers */
.ml-sort {
    all: unset;
    cursor: pointer;
    white-space: nowrap;
}

.ml-sort:focus-visible { outline: 2px solid var(--st-accent); outline-offset: 2px; }
.ml-sort[aria-sort] { color: var(--st-text); }
.ml-sort-arrow { opacity: 0.35; margin-left: 0.2em; }
.ml-sort[aria-sort] .ml-sort-arrow { opacity: 1; }

.ml-more {
    display: block;
    margin: 0.75rem auto;
    padding: 0.45rem 1rem;
    font: inherit;
    border: 1px solid var(--st-line-strong);
    border-radius: 0.5rem;
    background: #fff;
    color: var(--st-accent);
    cursor: pointer;
}

.ml-more:hover { background: var(--st-row-hover); }

/* Match plot shown when a row is clicked */
.ml-dialog {
    max-width: min(1200px, 95vw);
    max-height: 92vh;
    padding: 0;
    border: none;
    border-radius: 0.75rem;
    background: #fff;
}

.ml-dialog::backdrop { background: rgba(0, 0, 0, 0.85); }

.ml-dialog img {
    display: block;
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
}

.ml-dialog p {
    margin: 0;
    padding: 2rem 3rem;
    color: var(--st-muted);
}

.ml-dialog-close {
    position: absolute;
    top: 0.25rem;
    right: 0.5rem;
    border: none;
    background: none;
    font-size: 2rem;
    line-height: 1;
    color: #555;
    cursor: pointer;
}

/* Narrow screens: drop the date and the probability bar first. */
@media (max-width: 679px) {
    .ml-table .ml-p1 { display: none; }
}
