/* ==========================================================================
   Results Page Styles
   ========================================================================== */

/* ==========================================================================
   Results / cup filters (league, season, match day, cup round)
   ==========================================================================
   Mobile: label + chevrons + select share one line and never wrap.
   Desktop (>= md): the label moves above the chevrons + select row.
   The flex direction itself is handled by Bootstrap utilities in the markup
   (see partials/filterStepper.js); this only guards against wrapping and
   keeps the labels/selects aligned in a column. */

.results-filter-label {
    white-space: nowrap;
}

/* Keep the mobile labels the same width so all selects line up vertically. */
@media (max-width: 767.98px) {
    .results-filter-label {
        flex: 0 0 auto;
        min-width: 5rem;
    }
}

/* Let a long option (e.g. "Achtelfinale") shrink instead of pushing the
   next chevron out of the row. */
.results-filter,
.results-filter select {
    min-width: 0;
    max-width: 100%;
}

/* Results table cell with fixed width for ranking */
.results-rank-cell {
    width: 30px;
}

/* Games table: keep team1 (left) and team2 (right) columns symmetric.
   table-layout: fixed lets the explicit width on the centered score column
   take effect, and the two team columns split the remaining width equally. */
.results-games-table {
    table-layout: fixed;
    width: 100%;
}

.results-games-table td,
.results-games-table th {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Clickable team columns open the team page. Keep the normal text colour
   (team names carry their own winner/my-team styling) instead of the default
   info tint that td.hover-text applies, but keep the pointer + hover bg. */
.game-teams-table td.hover-text {
    color: inherit;
}

/* Scorer/Suspended player image containers are now in components/player.css */

/* Substitution indicators in squad lists */
.sub-out {
    color: var(--bs-danger);
    font-size: 0.8rem;
    white-space: nowrap;
}

.sub-in {
    color: var(--bs-success);
    font-size: 0.8rem;
    white-space: nowrap;
}

/* Goals and cards behind a player's name in the squad list (#648). Sized to sit
   in a table row: the ticker's own card and badge are built for a feed line and
   are a head taller than the text here. */
.squad-event {
    font-size: 0.8rem;
    white-space: nowrap;
}

.squad-event .badge {
    padding: 0.15em 0.35em;
    vertical-align: middle;
}

.squad-event .spiel-ticker__card {
    width: 0.55rem;
    height: 0.8rem;
    vertical-align: -0.1rem;
}

/* "How the cup works" folds like a collapsible card but keeps the alert's
   look: its title line is the toggle, the chevron sits top right. */
.cup-info > .collapsible-card-toggle {
    padding: 0;
    border: 0;
    background: none;
}

/* Cup Trophy Icon */
.cup-trophy-icon {
    font-size: 5rem;
    line-height: 1;
}

/* On mobile the cup filters keep their labels inline, so give the row the
   horizontal space back. */
@media (max-width: 767.98px) {
    .cup-trophy-icon {
        font-size: 3rem;
    }
}

/* On narrow phones the filters need the full width — the trophy is pure
   decoration, so it goes first. Bootstrap has no breakpoint at 430px. */
@media (max-width: 430px) {
    .cup-trophy-icon {
        display: none;
    }
}

/* ==========================================================================
   Cup Bracket (#753)
   Each game is one line, symmetric around its score — name, crest, score,
   crest, name — and lines between the rounds show which two games lead to
   which game of the next. Compact mode drops the names so the bracket fits a
   phone; the crest keeps the name as its title.
   ========================================================================== */

.cup-bracket-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    margin: 1.5rem 0 0.75rem;
}

.cup-bracket-switches {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.25rem;
}

.cup-bracket-scroll {
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

/* The lines are drawn into an SVG over the whole bracket, measured from the
   cards (CupBracket._drawLines). */
.cup-bracket {
    position: relative;
    display: flex;
    align-items: stretch;
    gap: 2rem;
    min-width: max-content;
}

.cup-bracket-lines {
    position: absolute;
    left: 0;
    top: 0;
    pointer-events: none;
    overflow: visible;
}

.cup-bracket-lines path {
    fill: none;
    /* The table-line ink: drawn in the light mode, the quiet grey-green in the
       dark one — the card border is a dark seam there and vanished. */
    stroke: var(--app-table-border);
    stroke-width: 1.5;
}

.cup-bracket-round {
    display: flex;
    flex-direction: column;
    width: 17rem;
}

.cup-bracket-round-title {
    font-weight: bold;
    text-align: center;
    margin-bottom: 0.5rem;
    color: var(--bs-secondary-color);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Every next-round game stands in the middle between its two feeders: the
   games are spread evenly over the full height, and the server orders each
   round so the feeders of a game stand next to each other. */
.cup-bracket-matches {
    display: flex;
    flex-direction: column;
    flex: 1;
    justify-content: space-around;
    gap: 0.5rem;
}

.cup-bracket-match {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.375rem;
    background: var(--bs-body-bg);
    font-size: 0.85rem;
    line-height: 1.2;
}

.cup-bracket-match.u-cursor-pointer:hover {
    border-color: var(--bs-primary);
}

.cup-bracket-team {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
    border-radius: 0.25rem;
    transition: background-color 0.1s ease-in-out;
}

.cup-bracket-team--home {
    justify-content: flex-end;
}

.cup-bracket-team--away {
    justify-content: flex-start;
}

/* Team sides are anchors to the team page; keep the surrounding text styling.
   `utilities.css` makes every link an inline-block (`a:link`, 0-1-1), which
   beat the flex row above — the home side then sat left of its column instead
   of against the score. */
.cup-bracket-match a.cup-bracket-team {
    display: flex;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}

.cup-bracket-team--highlight {
    background-color: var(--bs-warning-bg-subtle);
}

.cup-bracket-match .cup-bracket-emblem {
    flex-shrink: 0;
    /* `.emblem-thumb` brings 12px on the right and −8px on top for inline
       text; in this row the gap does the spacing. */
    margin: 0;
}

.cup-bracket-team-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cup-bracket-team-name--won {
    font-weight: bold;
}

.cup-bracket-score {
    min-width: 2.25rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
    font-weight: bold;
}

.cup-bracket-score--upcoming {
    color: var(--bs-secondary-color);
    font-weight: normal;
}

.cup-bracket-bye {
    color: var(--bs-secondary-color);
    font-style: italic;
    font-size: 0.8rem;
}

/* Compact: crests and score only — three rounds side by side fit a phone. */
.cup-bracket--compact .cup-bracket-round {
    width: 6.75rem;
}

.cup-bracket--compact .cup-bracket {
    gap: 0.75rem;
}

/* On a phone the bracket uses the full width, like a `wide-on-mobile` table:
   pulled out of the page card by its 2rem padding, with a little air kept. */
@media screen and (max-width: 768px) {
    .cup-bracket-scroll {
        margin: 0 -2rem;
        padding: 0 0.5rem 0.5rem;
    }
}

.cup-bracket--compact .cup-bracket-team-name {
    display: none;
}

/* ==========================================================================
   Hall of Fame
   ========================================================================== */

.hof-winners {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.hof-winner-card {
    position: relative;
    /* Keeps the gradient's z-index: -1 inside the card instead of behind the page. */
    isolation: isolate;
    overflow: hidden;
    flex: 1;
    min-width: 250px;
    border: var(--bs-card-border-width, 2px) solid var(--app-card-border);
    /* Die handgezeichnete Kartenecke des Themes als Token (base.css, #706). */
    border-radius: var(--app-card-corner);
    padding: 1.25rem;
    background: var(--bs-body-bg);
}

/* The winner's two team colours (set per card as --hof-color-1/2), faded so
   the team and user names on top stay readable on any colour pair. */
.hof-winner-card::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(135deg, var(--hof-color-1, transparent), var(--hof-color-2, transparent));
    opacity: 0.3;
}

.hof-winner-title {
    margin-bottom: 1.25rem;
    font-size: 1.5rem;
}

.hof-gold {
    color: var(--app-hof-gold);
}

.hof-winner-content {
    display: flex;
    align-items: center;
    /* Emblem always left, team and user name always beside it — never
       wrapped underneath. When the card gets narrow the emblem gives way
       (below), not the row. */
    flex-wrap: nowrap;
    gap: 1.5rem;
    cursor: pointer;
}

/* Keeps its intrinsic size while there is room, shrinks to at most 45% of the
   row when there isn't — the SVG scales with it. */
.hof-emblem {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 45%;
}

.hof-emblem svg {
    max-width: 100%;
    height: auto;
}

/* Takes the rest of the row and may shrink below its longest word: a team
   name too long for it breaks rather than pushing out of the card. */
.hof-winner-info {
    flex: 1 1 0;
    min-width: 0;
    overflow-wrap: anywhere;
}

.hof-winner-content:hover .hof-team-name {
    text-decoration: underline;
}

.hof-team-name {
    font-weight: bold;
    font-size: 1.5rem;
}

.hof-username {
    color: var(--bs-secondary);
    font-size: 1.1rem;
    margin-top: 0.35rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.hof-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid rgba(var(--app-black-rgb), 0.1);
    display: inline-block;
    vertical-align: middle;
    margin-top: -4px;
}

.hof-user-avatar--default {
    background-color: rgba(var(--bs-body-color-rgb), 0.05);
}

.hof-winner-card--sm .hof-user-avatar {
    width: 20px;
    height: 20px;
}

/* Size variants for lower league champions */
.hof-winner-card--md .hof-winner-title {
    font-size: 1.25rem;
}

.hof-winner-card--md .hof-team-name {
    font-size: 1.25rem;
}

.hof-winner-card--md .hof-username {
    font-size: 1rem;
}

.hof-winner-card--sm .hof-winner-title {
    font-size: 1.1rem;
}

.hof-winner-card--sm .hof-team-name {
    font-size: 1.1rem;
}

.hof-winner-card--sm .hof-username {
    font-size: 0.9rem;
}

.hof-comments-section {
    max-width: 620px;
}

.hof-comment {
    border-bottom: 1px solid var(--bs-border-color);
    padding: 0.75rem 0;
}

.hof-comment:last-child {
    border-bottom: none;
}

.hof-comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.hof-comment-author {
    font-weight: bold;
    font-size: 0.9rem;
}

.hof-comment-time {
    color: var(--bs-secondary);
    font-size: 0.8rem;
}

.hof-comment-text {
    font-size: 0.95rem;
    overflow-wrap: break-word;
    white-space: pre-wrap;
}

.hof-comment-actions {
    margin-top: 0.25rem;
}

.hof-like-btn {
    font-size: 0.85rem;
    color: var(--bs-secondary);
}

.hof-like-btn:hover {
    color: var(--bs-danger);
}

/* Match day recap */
.match-day-recap {
    border-left: 4px solid var(--bs-info);
}

.match-day-recap-image {
    width: 120px;
    min-width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--app-recap-image-1) 0%, var(--app-recap-image-2) 100%);
    border-radius: 8px;
    overflow: hidden;
}

[data-bs-theme=dark] .match-day-recap-image {
    background: linear-gradient(135deg, var(--app-card-bg) 0%, var(--app-btn-neutral-bg) 100%);
}

.match-day-recap-image:empty {
    display: none;
}

.match-day-recap-image svg,
.match-day-recap-image img,
.match-day-recap-image canvas {
    max-width: 100%;
    max-height: 100%;
}

/* Cross table (#631) — the season's results as a home × away matrix.
   A full league is 16 columns wide, so the table scrolls sideways inside the
   overlay instead of stretching the page, and the home column stays put. */
.cross-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.cross-table {
    width: auto;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.8rem;
    white-space: nowrap;
    /* Both shades are opaque on purpose: the home column is sticky, and a
       translucent background there would let the cells scrolling underneath
       show through. Bootstrap's own greys (`--bs-tertiary-bg` is #f8f9fa here)
       sit too close to the body background to tell two rows apart. */
    --cross-table-zebra: var(--app-table-zebra);
    --cross-table-self: var(--app-table-self);
}

[data-bs-theme="dark"] .cross-table {
    --cross-table-zebra: var(--app-table-zebra);
    --cross-table-self: var(--app-table-self);
}

.cross-table th,
.cross-table td {
    vertical-align: middle;
    text-align: center;
    padding: 0.25rem 0.4rem;
    /* A light grid instead of Bootstrap's row separators: without vertical
       lines a wide matrix is hard to read across (#631). */
    border: 1px solid var(--bs-border-color-translucent);
}

.cross-table__corner,
.cross-table__home {
    position: sticky;
    left: 0;
    z-index: 2;
    text-align: center;
    min-width: 2.5rem;
}

.cross-table__corner {
    z-index: 3;
    text-align: left;
}

.cross-table__home,
.cross-table__away {
    cursor: pointer;
}

.cross-table__emblem {
    display: inline-flex;
    width: 20px;
    height: 20px;
    vertical-align: middle;
}

.cross-table__emblem svg {
    width: 100%;
    height: 100%;
}

.cross-table__cell {
    min-width: 3rem;
    font-variant-numeric: tabular-nums;
}

/* Bootstrap paints `.table > :not(caption) > * > *` (specificity 0,1,2), so the
   row shading and the result colours have to out-specify that or they never
   reach the cell. */
.cross-table tbody tr.cross-table__row--even > td,
.cross-table tbody tr.cross-table__row--even > th {
    background-color: var(--cross-table-zebra);
}

.cross-table tbody tr > td.cross-table__self {
    background-color: var(--cross-table-self);
}

.cross-table td.cross-table__cell--win {
    color: var(--bs-success);
    font-weight: 600;
}

.cross-table td.cross-table__cell--loss {
    color: var(--bs-danger);
    font-weight: 600;
}

.cross-table td.cross-table__cell--draw {
    color: var(--bs-secondary-color);
}

/* A fixture still to come carries its date, which must not compete with the
   scores around it. */
.cross-table td.cross-table__cell--scheduled {
    color: var(--bs-secondary-color);
    font-size: 0.7rem;
}

.cross-table td[data-cross-game] {
    cursor: pointer;
}

.cross-table__row--mine .cross-table__home,
.cross-table th.cross-table__col--mine {
    font-weight: 700;
}

.cross-table tbody tr > td.cross-table__cell--mine {
    background-color: rgba(var(--app-accent-rgb), 0.12);
}

/* The dark band belongs to the **home** column, not to the header row (#631
   follow-up): every table in the app has a dark header, and here that read as
   "everything below me is home" — while the clubs up there are the away side.
   `components/table.css` paints thead cells with `!important`, so undoing it
   takes the same weight. */
.cross-table thead tr th.cross-table__away {
    background: var(--bs-body-bg);
    color: inherit;
    border-radius: 0;
    border-bottom: 1px solid var(--bs-border-color-translucent);
}

/* The corner cell is the top of the home column and belongs to it. Last in the
   file on purpose: it has to win over the zebra shading above, which sets a
   background on the row's header cell as well. */
.cross-table thead tr th.cross-table__corner,
.cross-table tbody tr > th.cross-table__home {
    background: linear-gradient(136deg, var(--app-ground) 0%, var(--app-ground-lift) 100%);
    color: var(--app-ink-on-accent);
}


/* Game details: the two team columns take the sides, the score column the
   middle (#706). */
.game-details-col--side {
    width: 40%;
}

.game-details-col--mid {
    width: 20%;
}

/* Team statistics table: the emblem column is only as wide as the thumbnail. */
.team-stats-emblem-cell {
    width: 32px;
}

/* What a club brings from last season, behind its name in the league table
   (#745): (M)eister, (N)eu, (A)bsteiger, (P)okalsieger. Small and kept on one
   line, so the compact table on a phone does not break the row. */
.standing-badge {
    font-size: 0.75em;
    color: var(--bs-secondary-color);
    text-decoration: none;
    white-space: nowrap;
    cursor: help;
}
