/* ==========================================================================
   Sportlomo Results Page — structural layout CSS
   Colors / fonts / sizes are controlled by the backend (sportlomo.php dynamic CSS).
   This file must not contain hardcoded brand colours.
   ========================================================================== */

/* ── Container ──────────────────────────────────────────────────────────── */
.result_page { width: 100%; }

/* ── Filter bar ─────────────────────────────────────────────────────────── */
.result_page .result-search { margin-bottom: 15px; }
.result_page .result-search .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.result_page .result-search .rs-filter-left,
.result_page .result-search .rs-filter-right { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.result_page .result-search .rs-filter-right { margin-left: auto; }
.result_page .result-search .rs-col { display: flex !important; align-items: center !important; gap: 6px; flex-shrink: 0; }
.result_page .datepicker { width: 110px; height: 36px !important; line-height: 36px !important; padding: 0 8px !important; border: 1px solid #ccc; border-radius: 3px; box-sizing: border-box !important; vertical-align: middle; margin: 0 !important; }
.result_page .btn-search {
    display: inline-flex !important; align-items: center !important; padding: 0 24px !important;
    height: 36px !important; line-height: 36px !important; box-sizing: border-box !important; margin: 0 !important;
    font-size: 14px; font-weight: bold; border: none; cursor: pointer;
    text-decoration: none; transition: background 0.2s ease-in-out, color 0.2s ease-in-out;
}
.result_page .result-search select {
    width: auto !important;
    min-width: 140px;
    height: 36px !important;
    padding: 0 8px !important;
    border: 1px solid #ccc;
    border-radius: 3px;
    box-sizing: border-box !important;
    margin: 0 !important;
    color: #333 !important;
    vertical-align: middle;
}
.result_page .ar-filter-label { font-size: 14px; white-space: nowrap; line-height: 36px !important; display: inline-flex !important; align-items: center !important; }

/* ── Heading ─────────────────────────────────────────────────────────────── */
.result_page .heading-container { display: flex; align-items: center; padding: 10px 0 15px; }
.result_page .heading-container .title { margin: 0; }

/* ── Override league-table.css float / table-cell layout ───────────────── */
/* league-table.css sets float:left; width:calc(100%/6); display:table-cell on every
   .column-six li — replace entirely with flexbox so columns align correctly. */
.result_page .league-table .column-six {
    display: flex !important;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 8px 0;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    gap: 4px;
}
.result_page .league-table .column-six li {
    flex: 1;
    float: none !important;
    width: auto !important;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-width: 0;
    list-style: none;
    padding: 6px 14px;
    text-align: center;
}
/* league-table.css: li:last-child { text-align:left!important; margin-left:15px }
   — reset so the last column doesn't shift */
.result_page .league-table .column-six li:last-child {
    text-align: center !important;
    margin-left: 0 !important;
}

/* ── Fixed-width columns (header + body share the same value) ───────────── */
.result_page .column-six .fvs,
.result_page .column-six .col-score { flex: 0 0 148px !important; min-width: 0; }

.result_page .column-six .fmore,
.result_page .column-six .col-more  { flex: 0 0 80px !important; min-width: 0; }

/* ── Team cells ──────────────────────────────────────────────────────────── */
/* Source order: fteam1 = [name][logo], flogo2 = [logo][name]. No flex-direction
   reversal needed; gap tightened so logo sits tight to the team name.
   .fteam2 is the away cell on the competition_fixtures_results page (the partial's
   default away layout puts logo+name in a single <a class> inside li.fteam2 rather
   than the separate li.flogo2 the standalone results page uses) — it must get the
   same away-cell treatment as .flogo2 so the away logo/name align like the home
   cell. The standalone results away cell has no .fteam2 class and the fixtures-page
   away cell already carries .flogo2, so these additions are no-ops there.

   Specificity note: these selectors must out-rank the generic
   ".result_page .league-table .column-six li" rule above (which sets
   justify-content:center for every column) — otherwise that rule silently wins
   and the whole name+logo group gets centred as one block instead of pinned to
   the VS-side edge, so the logo drifts left/right with the team-name length on
   every row. Repeating the ".league-table .column-six li" chain here (instead of
   just ".fteam1") keeps this rule's specificity higher regardless of source order. */
.result_page .league-table .column-six li.fteam1 { flex-direction: row; gap: 4px; justify-content: flex-end; }
.result_page .league-table .column-six li.flogo2,
.result_page .league-table .column-six li.fteam2 { flex-direction: row; gap: 4px; justify-content: flex-start; }

/* Logo <a>: never shrinks, stays vertically + horizontally centred even when
   the sibling name <a> grows taller due to text wrapping. Logo lives at
   :last-child for fteam1 (name first) and :first-child for flogo2 (logo first).
   The single-anchor .fteam2 away cell matches both :first-child and :last-child. */
.result_page .fteam1 > a:last-child,
.result_page .flogo2 > a:first-child,
.result_page .fteam2 > a:first-child {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* Name <a>: shrinks to content; text wraps when necessary */
.result_page .fteam1 > a:first-child,
.result_page .flogo2 > a:last-child,
.result_page .fteam2 > a:last-child {
    flex: 0 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
}
.result_page .fteam1 a,
.result_page .flogo2 a,
.result_page .fteam2 a { text-decoration: none; }
/* Team name: wrap long names gracefully */
.result_page .fteam1 .data.team1,
.result_page .flogo2 .data.team2,
.result_page .fteam2 .data.team2 {
    word-break: break-word;
    white-space: normal;
}
.result_page .ar-team-logo { width: 40px; height: 40px; object-fit: contain; display: block; flex-shrink: 0; }

/* ── Score display ───────────────────────────────────────────────────────── */
.result_page .vs-result {
    display: flex; justify-content: center; align-items: center; gap: 6px;
}
.result_page .vs-result .homeScore,
.result_page .vs-result .awayScore {
    min-width: 36px;
    display: inline-flex; justify-content: center; align-items: center;
    font-weight: 700; font-size: 1.2rem;
    padding: 6px 8px; border-radius: 4px;
}

/* ── Column header row ───────────────────────────────────────────────────── */
.result_page .ar-col-header { padding: 6px 0 !important; }
.result_page .ar-col-header li { font-weight: 600; font-size: 13px; }

/* ── Competition / Date headers ──────────────────────────────────────────── */
.result_page .compheader { padding: 7px 10px; }
.result_page .compheader .expand-item label { margin: 0; cursor: pointer; }
.result_page .compheader .expand-item label a { color: inherit; text-decoration: none; cursor: pointer; }
.result_page .compheader .expand-item label a:hover { text-decoration: underline; }
.result_page .competition-date { padding: 8px 10px; }

/* ── More button / Expand panel ──────────────────────────────────────────── */
.result_page .fmore .icon-more {
    display: inline-block; padding: 6px 14px;
    font-size: 12px; font-weight: bold;
    border: none; cursor: pointer;
    text-decoration: none;
    transition: background 0.2s ease-in-out, color 0.2s ease-in-out;
    white-space: nowrap;
}
/* league-table.css sets opacity:.3 on .control-menu:hover — cancel it so
   the backend hover background colour is visible at full opacity */
.result_page .league-table .column-six li:last-child .control-menu:hover {
    opacity: 1 !important;
}
.result_page .expand-table { padding: 8px 12px; background: rgba(0,0,0,0.04); clear: both; }
.result_page .expand-table .expand-item { display: inline-block; padding: 3px 8px; font-size: 13px; }
.result_page .fmore-small.fmore { display: none !important; }

/* ── Datepicker — minimal structure (no theme colours) ───────────────────── */
.ui-datepicker { background: #fff; border: 1px solid #ccc; border-radius: 4px; padding: 8px; z-index: 9999 !important; font-size: 13px; }
.ui-datepicker table { border-collapse: collapse; width: 100%; }
.ui-datepicker td, .ui-datepicker th { padding: 2px; text-align: center; }
.ui-datepicker td a, .ui-datepicker td span { display: block; padding: 3px 5px; text-decoration: none; border-radius: 2px; }
.ui-datepicker-header { position: relative; padding: 4px 0 6px; text-align: center; font-weight: bold; }
.ui-datepicker-prev, .ui-datepicker-next { position: absolute; top: 4px; cursor: pointer; padding: 2px 6px; }
.ui-datepicker-prev { left: 0; }
.ui-datepicker-next { right: 0; }
.ui-datepicker-title { line-height: 1.8; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media only screen and (max-width: 989px) {
    .result_page .league-table .column-six { align-items: flex-start; }
    /* The desktop rule above pins the whole name+logo block to one edge (flex-end/
       flex-start) so the logo lines up across rows. Below this width the cell
       stacks name/logo vertically instead of sitting flush to that edge, so
       re-centre the LI itself (same specificity trick as above to guarantee this
       wins). */
    .result_page .league-table .column-six li.fteam1,
    .result_page .league-table .column-six li.flogo2,
    .result_page .league-table .column-six li.fteam2 {
        justify-content: center;
    }
    /* The home cell (.fteam1) uses ONE anchor wrapping both the name and the
       logo (span.data.team1 + img + overlay span) — unlike the away cell
       (.flogo2/.fteam2), which uses two separate <a> siblings. Setting
       flex-direction on the outer <li> (below) only reorders siblings, so it
       is a no-op for the home cell's single child; the actual stacking has
       to be applied to the anchor itself. Without this, home stayed
       side-by-side at every width while away correctly stacked. DOM order
       inside the anchor is name-span, then img, so column-reverse puts the
       logo on top and the name below it, matching the away cell's layout. */
    .result_page .fteam1 > a {
        flex-direction: column-reverse;
        align-items: center;
        justify-content: center;
    }
}
@media only screen and (max-width: 768px) {
    /* Stack logo above/below name; re-centre the logo anchors in the stacked layout */
    .result_page .result-search .rs-filter-right { margin-left: 0; }
    .result_page .result-search .rs-col .btn-search{ width: 30%; }
    .result_page .expand-table{ text-align: left !important; }

    .result_page .league-table .column-six li.fteam1,
    .result_page .league-table .column-six li.flogo2,
    .result_page .league-table .column-six li.fteam2 {
        justify-content: center;
    }
    .result_page .fteam1 { flex-direction: column-reverse; }
    .result_page .flogo2,
    .result_page .fteam2 { flex-direction: column; }
    .result_page .fteam1 > a:first-child,
    .result_page .flogo2 > a:last-child,
    .result_page .fteam2 > a:last-child { flex-shrink: 0; width: auto; }
    .result_page .fteam1 > a:last-child,
    .result_page .flogo2 > a:first-child,
    .result_page .fteam2 > a:first-child { flex: unset; width: 100%; justify-content: center; }
    .result_page .vs-result .homeScore,
    .result_page .vs-result .awayScore { min-width: 30px; font-size: 1rem; padding: 4px 6px; }
}
@media only screen and (max-width: 767px) {
    /* Hide optional columns on mobile */
    /* .result_page is shared by BOTH halves of competition_fixtures_results.php
       (its fixtures wrapper is class="... result_page slm-fx-page", results is
       "... result_page slm-ar-page") — so this rule, written for the standalone
       Results page's .ar-time-col, was already hiding CFR's Results time column
       for free, but never touched CFR's Fixtures time column, which uses .time
       instead (fixtures_render.php's single-mode class). Adding .time here
       only affects contexts carrying .result_page — the standalone Fixtures
       page doesn't use that class, so it's unaffected. */
    .result_page .vanue,
    .result_page .time,
    .result_page .ar-time-col,
    .result_page .ar-referee-col { display: none !important; }
    /* Hide matching header placeholders */
    .result_page .ar-col-header .col-time,
    .result_page .ar-col-header .col-venue,
    .result_page .ar-col-header .col-referee { display: none !important; }
    /* More button: show small, hide large */
    .result_page .fmore.large-more-btn { display: none !important; }
    .result_page .fmore-small.fmore { display: flex !important; }
    /* Tighten score column on mobile; also reduce cell padding and gap */
    .result_page .column-six .fvs,
    .result_page .column-six .col-score { flex: 0 0 110px !important; }
    .result_page .league-table .column-six { gap: 2px; }
    .result_page .league-table .column-six li { padding: 6px 8px; }
    /* Stack filter row */
    .result_page .result-search .row { flex-direction: column; align-items: flex-start; }
    .result_page .result-search .rs-filter-right { margin-left: 0; }
}
@media only screen and (max-width: 565px) {
    .result_page .compheader .expand-item label { font-size: 12px; }
    .result_page .vs-result .homeScore,
    .result_page .vs-result .awayScore { font-size: 14px; min-width: 26px; }
}
