/* Minimal styling for the Phase 10 dashboard - no build step, no framework. */

:root {
    --bg: #0f1115;
    --panel: #171a21;
    --border: #2a2e37;
    --text: #e6e8ec;
    --text-dim: #9aa0ab;
    --accent: #4f8cff;
    --high: #3ecf8e;
    --low: #e6584f;
    --favorite: #f5c518;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 -apple-system, Segoe UI, Roboto, sans-serif;
}

.site-header {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 12px 24px;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
}

.site-title { font-weight: 700; color: var(--accent); text-decoration: none; font-size: 18px; }
.site-nav a { color: var(--text-dim); text-decoration: none; margin-right: 16px; }
.site-nav a:hover { color: var(--text); }

main { max-width: 960px; margin: 0 auto; padding: 24px; }

h1 { margin-top: 0; }

table { width: 100%; border-collapse: collapse; margin: 16px 0; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--text-dim); font-weight: 600; font-size: 13px; text-transform: uppercase; }

a { color: var(--accent); }

.competition-block { margin-bottom: 32px; }

/* "/" landing page: country nav + current-season shortcuts */
.country-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 12px; }
.country-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 6px 14px;
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
}
.country-toggle:hover, .country-toggle[aria-expanded="true"] { border-color: var(--accent); }
.country-flag { display: block; border-radius: 2px; }
.country-flag--fallback { font-size: 16px; line-height: 1; }
/* flex-basis:100% forces this onto its own line within .country-nav's
   wrapping flex row, right under the button that revealed it, instead of
   sitting inline next to the other flag buttons - same technique
   .multi-toggle-group above already uses for the same reason. */
.competition-buttons { display: flex; flex-wrap: wrap; gap: 8px; flex-basis: 100%; margin: 0 0 4px; }
/* The bug: [hidden]'s default browser rule (display:none) and the class
   rule above both have equal (0,0,1,0) specificity - author CSS wins
   ties over the browser's own UA stylesheet, so "display:flex" was
   winning regardless of the hidden attribute, making every
   competition-buttons block permanently visible no matter what JS did
   to the attribute. This selector combines class+attribute (0,0,2,0) -
   strictly higher specificity, so hidden always wins now regardless of
   source order. */
.competition-buttons[hidden] { display: none; }
.competition-btn {
    background: var(--panel);
    border: 1px solid var(--accent);
    border-radius: 6px;
    padding: 8px 16px;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
}
.competition-btn:hover { background: var(--accent); color: #fff; }
.all-seasons-toggle {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 13px;
    cursor: pointer;
    padding: 8px 0;
    margin-top: 8px;
}
.all-seasons-toggle:hover { color: var(--text); }
.all-seasons { margin-top: 8px; }

.gameweek-nav { display: flex; justify-content: space-between; align-items: center; margin: 16px 0; }
.gameweek-nav .disabled { color: var(--text-dim); }

.fixtures-table td.fixture-date { color: var(--text-dim); width: 100px; }
.fixtures-table td.fixture-status { color: var(--text-dim); width: 90px; }
.fixtures-table a { color: var(--text); text-decoration: none; }
.fixtures-table a:hover { color: var(--accent); }

.notice {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px 16px;
    color: var(--text-dim);
}

.breadcrumb { color: var(--text-dim); }
.breadcrumb a { color: var(--text-dim); }

.lineups { display: flex; gap: 32px; flex-wrap: wrap; }
.lineup-column { flex: 1; min-width: 280px; }
.lineup { list-style: none; padding: 0; margin: 0 0 16px; }
.lineup li { display: flex; align-items: center; gap: 6px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.position-tag {
    display: inline-block;
    min-width: 26px;
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-dim);
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 4px;
}
.minutes { color: var(--text-dim); font-size: 13px; margin-left: auto; }

.jersey-number { color: var(--text-dim); font-size: 12px; font-variant-numeric: tabular-nums; }

.stat-badges { display: inline-flex; gap: 4px; }
.stat-badge {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 11px;
    font-weight: 600;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1px 6px;
}
.stat-badge--goal { color: var(--high); border-color: var(--high); }
.stat-badge--assist { color: var(--accent); border-color: var(--accent); }

.rating-badge {
    display: inline-block;
    min-width: 40px;
    text-align: center;
    padding: 2px 8px;
    border-radius: 12px;
    background: var(--panel);
    border: 1px solid var(--border);
    font-weight: 700;
    cursor: pointer;
}
.rating-badge--high { color: var(--high); border-color: var(--high); }
.rating-badge--low { color: var(--low); border-color: var(--low); }
.rating-badge--unrated { color: var(--text-dim); font-weight: 400; cursor: default; font-size: 12px; }

.rating-popup {
    /* Always centered in the viewport, regardless of where the clicked
       badge sits on the page - anchor-relative positioning (the previous
       approach) could place this fully off-screen with no way to reach
       it, since a position:fixed element isn't part of page scroll.
       max-height + overflow-y keeps a tall breakdown table reachable via
       its own scrollbar instead of overflowing the viewport. */
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: min(400px, calc(100vw - 32px));
    max-height: 80vh;
    overflow-y: auto;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 16px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    z-index: 100;
    font-size: 13px;
}
.rating-popup h4 { margin: 0 0 8px; }

/* Player photo next to the name/subtitle - used by both the player-profile
   popup (h4) and the standalone /players/{id} page (h1); only rendered at
   all when a photo_url exists, so a player with none looks exactly as
   before (no empty avatar slot). */
.player-photo-header { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.player-photo-header h1, .player-photo-header h4 { margin: 0; }
.player-photo-header .season-context { margin: 2px 0 0; }
.player-photo { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; background: var(--panel); border: 1px solid var(--border); flex-shrink: 0; }
.rating-popup table {
    /* table-layout:fixed makes the columns respect the popup's own
       width instead of auto-sizing to fit the widest unbroken word
       (the global th rule's uppercase "CONTRIBUTION" was the one
       forcing a horizontal scrollbar) - break-word is the fallback for
       long stat names like "dribbles_completed" once columns are
       narrow. */
    width: 100%;
    table-layout: fixed;
    margin: 6px 0;
    font-size: 12px;
}
.rating-popup th, .rating-popup td {
    padding: 4px 6px;
    overflow-wrap: break-word;
    word-break: break-word;
}
.rating-popup th { font-size: 10px; }
.rating-popup th:first-child, .rating-popup td:first-child { width: 38%; }
.rating-popup .close-btn {
    position: absolute;
    top: 6px;
    right: 8px;
    cursor: pointer;
    color: var(--text-dim);
    background: none;
    border: none;
    font-size: 14px;
}
/* Unscoped like rating-windows/career-stats/efficiency-stats below - both
   the popup and the standalone player page render this same element. */
.player-age { color: var(--text-dim); font-size: 12px; margin-top: 4px; }
.market-value { color: var(--text-dim); font-size: 12px; margin-top: 4px; }
.nationality-flag { width: 16px; height: auto; vertical-align: middle; margin-right: 3px; border-radius: 1px; }
/* Only ever rendered when bio.injured === true (see player-profile.js/
   player-page.js's own formatBio()) - a real status worth standing out
   from the surrounding dim text, not just another dim fact in the list. */
.injured-flag { color: #d9534f; font-weight: 600; }

.player-name { cursor: pointer; text-decoration: underline dotted; text-underline-offset: 2px; }
.player-profile-arrow {
    display: inline-block;
    margin-left: 2px;
    color: var(--text-dim);
    text-decoration: none;
}
.player-profile-arrow:hover { color: var(--accent); }
/* Shared by the popup (player-profile.js) and the standalone /players/{id}
   page (templates/player.php) - both render the same PlayerProfileLookup
   shape, so both use the same classes rather than each having their own copy. */
.rating-windows { line-height: 1.7; margin: 8px 0; }
.career-stats { color: var(--text-dim); font-size: 12px; margin: 8px 0 0; }
.efficiency-stats { color: var(--text); font-size: 16px; font-weight: 700; margin: 6px 0 0; }
.efficiency-stats .disabled { font-weight: 400; }
.profile-link { margin: 4px 0 0; font-size: 13px; }

.season-context { color: var(--text-dim); margin-top: -8px; font-size: 13px; }
.report-filters { display: flex; align-items: center; gap: 16px; margin: 16px 0; flex-wrap: wrap; }
.report-filters select { background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 4px; padding: 4px 6px; }
.games-toggle a {
    display: inline-block;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    text-decoration: none;
    color: var(--text-dim);
    margin-right: 6px;
}
.games-toggle a.active { color: var(--accent); border-color: var(--accent); }
.games-count { color: var(--text-dim); font-size: 12px; }
/* Each season/competition toggle group takes its own full-width row within
   .report-filters' flex-wrap (flex-basis:100% forces the wrap) - keeps
   "click season" and "click competition" visually on separate lines,
   matching the mental model they're independent toggle groups. */
.multi-toggle-group { display: flex; align-items: center; gap: 8px; flex-basis: 100%; margin: 8px 0; }
.multi-toggle-label { color: var(--text-dim); font-size: 13px; min-width: 90px; }
.games-filter { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-dim); }
.games-filter input[type="number"] { width: 56px; background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 4px; padding: 3px 6px; margin-left: 4px; }
.games-filter button { background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 4px 10px; cursor: pointer; }
.games-filter button:hover { border-color: var(--accent); }

.report-table th a { color: var(--text-dim); text-decoration: none; }
.report-table th a:hover { color: var(--accent); }
.report-table th a.active { color: var(--accent); font-weight: 700; }
.report-table td.sorted { background: rgba(255, 255, 255, 0.03); }

.streak-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    background: var(--panel);
    border: 1px solid var(--high);
    color: var(--high);
    font-weight: 700;
}

.report-list { list-style: none; margin: 16px 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.report-list-item { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; }
.report-list-item:hover { border-color: var(--accent); }
.report-list-link { display: block; padding: 12px 16px; color: inherit; text-decoration: none; }
.report-list-name { font-size: 16px; font-weight: 700; }
.report-list-item:hover .report-list-name { color: var(--accent); }
.report-list-item p { color: var(--text-dim); margin: 4px 0 0; }

.scope-toggle {
    display: flex;
    width: 100%;
    /* Bottom border + padding is a deliberate section divider - blank
       space alone read as accidental/unfinished on request, so this adds
       a visible line under it too, separate from the toggle box's own
       border-radius/rounded-corner styling on the buttons themselves. */
    margin: 20px 0 36px;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--border);
}
.scope-toggle a {
    flex: 1;
    text-align: center;
    padding: 16px 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-dim);
    text-decoration: none;
    background: var(--panel);
    border: 1px solid var(--border);
    transition: background 0.15s ease, color 0.15s ease;
}
.scope-toggle a:first-child { border-radius: 10px 0 0 10px; border-right: none; }
.scope-toggle a:last-child { border-radius: 0 10px 10px 0; }
.scope-toggle a:hover { color: var(--text); }
.scope-toggle a.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.all-positions-link { color: var(--text-dim); text-decoration: none; font-size: 14px; border-bottom: 1px dashed var(--border); }
.all-positions-link:hover { color: var(--text); }
.all-positions-link.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* /backfill catalog page */
#catalog-search { display: block; width: 100%; max-width: 420px; padding: 8px 12px; margin-bottom: 20px; color: var(--text); }
/* Deliberately NO display property here - .competition-buttons on "/"
   learned this the hard way: [hidden]'s default browser rule
   (display:none) and an author rule setting display to anything else
   have equal specificity, and author CSS wins ties, silently making the
   hidden attribute do nothing. Leaving this at its default display:block
   sidesteps the whole conflict rather than needing a [hidden] override
   rule to fix it after the fact. */
.country-leagues { flex-basis: 100%; margin: 4px 0 20px; }
.league-block { margin: 4px 0; }
.league-toggle {
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 14px;
}
.league-toggle:hover { border-color: var(--accent); }
.season-list { list-style: none; margin: 4px 0 12px 16px; padding: 0; }
.season-row { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.season-year { min-width: 90px; color: var(--text-dim); }
.queue-btn {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--panel);
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}
.queue-btn:disabled { opacity: 0.5; cursor: default; }
.queue-btn--add { color: var(--high); border-color: var(--high); }
.queue-btn--remove { color: var(--low); border-color: var(--low); }
/* Muted by default, deliberately not alarming-red like --remove - this
   sits next to "Added ✓" as a rare, deliberate action, not a routine
   toggle, and the real safety net is the confirm() dialog, not the
   button's color. Reddens only on hover/focus, as a "yes, this one bites"
   cue right when you're about to click it. */
.queue-btn--delete { color: var(--text-dim); border-color: var(--border); font-size: 12px; }
.queue-btn--delete:hover, .queue-btn--delete:focus-visible { color: var(--low); border-color: var(--low); }
.queue-status { color: var(--text-dim); font-size: 13px; }
.queue-status--added { color: var(--high); }
.estimate-badge {
    font-family: monospace;
    font-size: 11px;
    color: var(--text-dim);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 6px;
}

/* /login */
.login-wrap { max-width: 340px; margin: 40px auto 0; }
.login-form { display: flex; flex-direction: column; gap: 6px; }
.login-form label { color: var(--text-dim); font-size: 13px; margin-top: 8px; }
.login-form input {
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 14px;
}
.login-form input:focus { outline: none; border-color: var(--accent); }
.login-form button {
    margin-top: 16px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 10px 0;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.login-form button:hover { opacity: 0.9; }
.notice--error { color: var(--low); border-color: var(--low); }

/* /cron */
.cron-table td { vertical-align: top; }
.cron-badge {
    font-family: monospace;
    font-size: 11px;
    color: var(--text-dim);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 6px;
}
.cron-command { font-family: monospace; font-size: 12px; color: var(--text-dim); margin-top: 4px; }
.cron-description { color: var(--text-dim); font-size: 13px; }
.cron-file {
    font-family: monospace;
    font-size: 11px;
    color: var(--accent);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 6px;
    margin-left: 6px;
}
.cron-unrecognized {
    font-size: 11px;
    color: var(--low);
    border: 1px solid var(--low);
    border-radius: 4px;
    padding: 1px 6px;
    margin-left: 6px;
}

/* Logged-in indicator + logout in .site-nav */
.site-nav { display: flex; align-items: center; flex: 1; }
.site-nav .nav-spacer { flex: 1; }
.current-user { color: var(--text-dim); font-size: 13px; margin-right: 12px; }
.logout-form { display: inline; margin: 0; }
.logout-form button {
    background: none;
    border: none;
    color: var(--text-dim);
    text-decoration: underline;
    cursor: pointer;
    font-size: 13px;
    padding: 0;
}
.logout-form button:hover { color: var(--text); }

/* /lists, and the player-page favorites star + "+ Add to list" popover */
.list-actions { display: flex; align-items: center; gap: 8px; margin: 8px 0 16px; position: relative; }
.favorite-star {
    background: none;
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    color: var(--text-dim);
}
.favorite-star.is-active { color: var(--favorite); border-color: var(--favorite); }
.favorite-star:disabled { opacity: 0.5; cursor: default; }
.add-to-list-btn {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 6px 14px;
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
}
.add-to-list-btn:hover { border-color: var(--accent); }
/* .add-to-list-popover also carries .rating-popup for its fixed/centered
   chrome (confirmed position:fixed - viewport-relative, so this pre-
   rendered/hidden div needs no positioning JS of its own, unlike a
   tooltip anchored to its trigger). */
.add-to-list-checklist { list-style: none; margin: 8px 0; padding: 0; max-height: 240px; overflow-y: auto; }
.add-to-list-checklist label { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 0; }
.add-to-list-loading { color: var(--text-dim); }
.add-to-list-new-form { display: flex; gap: 6px; margin-top: 8px; border-top: 1px solid var(--border); padding-top: 8px; }
.new-list-form, .rename-list-form { display: flex; gap: 8px; margin: 16px 0; }
.new-list-form input, .rename-list-form input, .add-to-list-new-form input {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 10px;
}
.new-list-form button, .rename-list-form button, .add-to-list-new-form button {
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 12px;
    cursor: pointer;
}
.new-list-form button:hover, .rename-list-form button:hover, .add-to-list-new-form button:hover { border-color: var(--accent); }
.delete-list-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-dim);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    margin-bottom: 16px;
}
.delete-list-btn:hover, .delete-list-btn:focus-visible { color: var(--low); border-color: var(--low); }
.list-empty-message { color: var(--text-dim); }
