/* =========================================================================
   MATCHCENTER STYLES
   Mobile-first football schedule UI
   ========================================================================= */

:root {
  --bg: #0b0e13;
  --bg-2: #11151c;
  --bg-3: #161b24;
  --line: #1f2630;
  --line-2: #2a3340;
  --text: #eef1f5;
  --text-2: #9aa3b2;
  --text-3: #6b7585;
  --accent: #21d07a;        /* live / primary action */
  --accent-2: #ffcc00;       /* highlight / promo */
  --danger: #ff4757;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 20px rgba(0,0,0,.35);
  --tap: 44px;               /* min touch target */
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin:0; padding:0; }

/* Visually-hidden helper. Content stays in the accessibility tree and the
   crawlable DOM (useful for screen readers and AI/search bots that don't
   execute JS) while being invisible to sighted users. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
body {
  font-family: 'Inter Tight', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

/* ==== Layout shell ==== */
.app { max-width: 480px; margin: 0 auto; min-height: 100vh; background: var(--bg); position: relative; }
@media (min-width: 768px) {
  .app { max-width: 720px; }
  body { font-size: 16px; }
}

/* ==== Top header ==== */
/* Not sticky — fotmob-style: when the user scrolls, the brand/search row
   leaves the viewport and only the date strip stays pinned to the top. */
.topbar {
  background: rgba(11,14,19,.92);
  border-bottom: 1px solid var(--line);
}
/* Hero brand band: full-width horizontal banner. The logo PNG is square
   (1024x1024) so we use object-fit:cover with object-position:center to
   crop down to the wordmark strip, giving it a wide banner look. */
.topbar-brand {
  padding: 0;
  overflow: hidden;
}
.topbar-row {
  display: flex; align-items: center; gap: 8px;
  padding: 0 16px 10px;
}
.topbar-row .search { flex: 1; }
.logo {
  display: block;
  width: 100%;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  font-family: 'Bebas Neue', Impact, sans-serif;
  font-size: 42px;
  letter-spacing: 3px;
  line-height: 1;
  padding: 14px 16px 6px;
}
.logo b { color: var(--accent); font-weight: inherit; }
@media (min-width: 768px) {
  .logo { font-size: 56px; padding: 18px 16px 8px; }
}
.topbar-spacer { flex: 1; }
.icon-btn {
  width: var(--tap); height: var(--tap);
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--text-2);
  transition: background .15s, color .15s;
}
.icon-btn:hover, .icon-btn:active { background: var(--bg-3); color: var(--text); }

/* While the app is booting (init() hasn't settled the final language yet),
   hide any text whose language might be wrong:
     - elements with data-i18n / data-i18n-placeholder (static chrome)
     - the league chips strip and date-tab strip (rendered by JS using a
       potentially-wrong language until init's phase 3 settles things)
   The match list itself is OK — it shows skeleton (no translated text)
   until state.loading flips. The class is removed at the end of init().
   Layout-affecting elements keep their box via visibility:hidden rather
   than display:none, so the page doesn't reflow when text appears. */
html.lang-pending [data-i18n],
html.lang-pending [data-i18n-placeholder],
html.lang-pending #leagueChips,
html.lang-pending #dateTabs { visibility: hidden; }
html.lang-pending [data-i18n-placeholder]::placeholder { color: transparent; }

/* ==== Language menu ==== */
.lang-wrap { position: relative; }
.lang-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  margin: 0; padding: 6px 0;
  list-style: none;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  min-width: 180px;
  z-index: 100;
  max-height: 60vh;
  overflow-y: auto;
}
.lang-menu[hidden] { display: none; }
.lang-option {
  padding: 10px 16px;
  font-size: 14px;
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
}
.lang-option:hover, .lang-option:active { background: var(--bg-3); color: var(--text); }
.lang-option.active {
  color: var(--accent);
  font-weight: 600;
}

/* ==== Search ==== */
.search-wrap {
  padding: 8px 16px 14px;
  border-bottom: 1px solid var(--line);
}
.search {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: 0 16px;
  height: var(--tap);
  transition: border-color .15s, background .15s;
}
.search:focus-within { border-color: var(--accent); background: var(--bg-2); }
.search svg { color: var(--text-3); flex-shrink: 0; }
.search input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text); font-size: 15px;
  font-family: inherit;
}
.search input::placeholder { color: var(--text-3); }
.search-clear {
  color: var(--text-3); padding: 4px;
  display: none;
}
.search.has-value .search-clear { display: block; }

/* ==== Banner slot ==== */
.banner-slot {
  margin: 14px 16px;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  aspect-ratio: 16 / 6;
  background:
    radial-gradient(circle at 20% 30%, rgba(33,208,122,.25), transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(255,204,0,.18), transparent 50%),
    linear-gradient(135deg, #1a2332 0%, #0f1620 100%);
  border: 1px solid var(--line-2);
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  cursor: pointer;
}
.banner-slot::before {
  content: ''; position: absolute; inset: 0;
  background-image:
    repeating-linear-gradient(45deg, transparent 0 12px, rgba(255,255,255,.02) 12px 13px);
  pointer-events: none;
}
.banner-content { position: relative; z-index: 1; max-width: 65%; }
.banner-eyebrow {
  font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--accent-2); font-weight: 700;
  margin-bottom: 4px;
}
.banner-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 22px; letter-spacing: .5px; line-height: 1.05;
  color: var(--text); margin-bottom: 4px;
}
.banner-sub {
  font-size: 12px; color: var(--text-2);
}
.banner-cta {
  background: var(--accent);
  color: #032213; font-weight: 700;
  padding: 10px 16px; border-radius: 999px;
  font-size: 13px; letter-spacing: .3px;
  position: relative; z-index: 1;
  box-shadow: 0 4px 14px rgba(33,208,122,.35);
  flex-shrink: 0;
}

/* ==== League filter chips ==== */
.league-filter {
  padding: 4px 0 12px;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.chips {
  display: flex; gap: 8px;
  padding: 0 16px;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  font-size: 13px; font-weight: 500;
  color: var(--text-2);
  transition: all .15s;
  scroll-snap-align: start;
  height: 36px;
  white-space: nowrap;
}
.chip:hover { color: var(--text); }
.chip.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
  font-weight: 600;
}
.chip-emblem {
  width: 20px; height: 20px;
  border-radius: 3px;
  background: var(--line-2);
  display: grid; place-items: center;
  font-size: 9px; font-weight: 800;
  flex-shrink: 0;
}
.chip.active .chip-emblem { background: rgba(0,0,0,.15); color: var(--bg); }

/* Image variant: white rounded tile so logos of any colour (including dark
   marks like the Champions League starball) stay readable on the dark UI. */
.chip-emblem.chip-emblem-img {
  background: #fff;
  object-fit: contain;
  padding: 2px;
}
.chip.active .chip-emblem.chip-emblem-img { background: #fff; }

/* ==== Date tabs ==== */
.date-tabs {
  display: flex; gap: 4px;
  padding: 12px 16px;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--line);
  /* Sticky so it stays visible while scrolling through the multi-day list. */
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(11,14,19,.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.date-tabs::-webkit-scrollbar { display: none; }
.date-tab {
  flex-shrink: 0;
  min-width: 64px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  text-align: center;
  color: var(--text-2);
  transition: all .15s;
  border: 1px solid transparent;
}
.date-tab .day { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; opacity: .8; }
.date-tab .num { font-size: 18px; font-weight: 700; line-height: 1.1; margin-top: 2px; }
.date-tab.active {
  background: var(--bg-3);
  border-color: var(--accent);
  color: var(--text);
}
.date-tab.active .day { color: var(--accent); opacity: 1; }
.date-tab.today { color: var(--text); }

/* ==== Match list ==== */
.matches { padding: 8px 0 100px; }

/* ==== Day section (fotmob-style continuous scroll) ====
   Each visible day in the date strip gets its own section here so the
   user can scroll vertically through the whole week instead of clicking
   a tab to swap views. */
.day-section { margin-bottom: 6px; }
.day-header {
  font-size: 13px; font-weight: 700;
  letter-spacing: .4px;
  text-transform: uppercase;
  color: var(--text);
  padding: 14px 16px 10px;
  background: var(--bg);
  border-top: 1px solid var(--line);
}
.day-section:first-child .day-header { border-top: none; }
.day-header .day-meta {
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-3);
  margin-left: 8px;
  font-size: 12px;
}
.day-header.is-today { color: var(--accent); }
.day-header.is-today .day-meta { color: var(--text-2); }

/* Empty-day row: keeps no-match days in the scroll/anchor flow but takes
   minimal vertical space so it doesn't dominate the viewport. */
.day-section.is-empty .day-header {
  color: var(--text-2);
  padding-bottom: 6px;
}
.day-empty {
  padding: 10px 16px 14px;
  font-size: 12px;
  color: var(--text-3);
  font-style: italic;
}

.league-section { margin-bottom: 4px; }
.league-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px 10px;
  background: var(--bg);
}
.league-emblem {
  width: 22px; height: 22px;
  border-radius: 4px;
  background: var(--bg-3);
  display: grid; place-items: center;
  font-size: 10px; font-weight: 800;
  flex-shrink: 0;
}
.league-emblem img { width:100%; height:100%; object-fit: contain; }

/* Image variant for league section headers — white rounded tile so any
   logo colour (including dark marks like CL) stays readable on the dark UI.
   Matches the top filter chips. */
img.league-emblem.league-emblem-img {
  background: #fff;
  object-fit: contain;
  padding: 2px;
}
.league-name {
  font-size: 13px; font-weight: 600;
  color: var(--text);
  flex: 1;
  text-transform: uppercase; letter-spacing: .4px;
}
.league-country {
  font-size: 11px; color: var(--text-3);
  font-weight: 400; text-transform: none; letter-spacing: 0;
  margin-left: 6px;
}
.league-count {
  font-size: 11px; color: var(--text-3);
  background: var(--bg-3);
  padding: 3px 8px; border-radius: 999px;
}

.match {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  transition: background .15s;
}
.match:hover, .match:active { background: var(--bg-2); }
.match-time {
  font-size: 13px; font-weight: 600;
  color: var(--text-2);
  text-align: center;
  line-height: 1.3;
}
.match-time .status-live {
  color: var(--accent);
  display: flex; align-items: center; justify-content: center; gap: 4px;
  font-size: 12px;
}
.match-time .status-live::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.5s infinite;
}
.match-time .status-ft {
  color: var(--text-3); font-size: 11px;
}

.match-teams {
  display: flex; flex-direction: column; gap: 6px;
  min-width: 0;
}
.team {
  display: flex; align-items: center; gap: 10px;
  min-width: 0;
}
.team-crest {
  width: 22px; height: 22px;
  flex-shrink: 0;
  object-fit: contain;
  display: inline-block;
}
/* Placeholder used when we have no crest URL — keeps the row aligned without
   triggering a broken-image icon. */
.team-crest-empty {
  background: var(--bg-3);
  border-radius: 4px;
}
.team-name {
  flex: 1;
  font-size: 14px; font-weight: 500;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.match.is-finished .team:not(.winner) .team-name { color: var(--text-3); }
.team-score {
  font-size: 14px; font-weight: 700;
  color: var(--text-2);
  flex-shrink: 0; margin-left: 8px;
}
.team.winner .team-score { color: var(--text); }
.match.is-live .team-score { color: var(--accent); }

.match-meta {
  display: flex; flex-direction: column; gap: 4px;
  align-items: flex-end;
}
.tv-channels {
  display: flex; gap: 4px;
  flex-wrap: wrap; justify-content: flex-end;
  max-width: 90px;
}
.tv-pill {
  font-size: 9px; font-weight: 600;
  padding: 3px 6px;
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  border-radius: 4px;
  color: var(--text-2);
  text-transform: uppercase; letter-spacing: .3px;
  white-space: nowrap;
}

/* ==== Empty state ==== */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-3);
}
.empty-state svg { color: var(--line-2); margin-bottom: 12px; }
.empty-state h3 { color: var(--text-2); font-size: 16px; margin: 0 0 4px; font-weight: 600; }
.empty-state p { font-size: 13px; margin: 0; }

/* ==== Loading skeletons ==== */
.skeleton {
  background: linear-gradient(90deg, var(--bg-3) 25%, var(--line-2) 50%, var(--bg-3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ==== Footer ==== */
.footer {
  padding: 20px 16px 30px;
  text-align: center;
  color: var(--text-3);
  font-size: 11px;
  border-top: 1px solid var(--line);
  margin-top: 30px;
}
.footer a { color: var(--text-2); }
.footer-links { margin-top: 8px; }
.footer-links a { color: var(--text-2); margin: 0 6px; text-decoration: underline; text-underline-offset: 2px; }

/* ==== Legal / prose pages (privacy.html, terms.html) ==== */
.legal {
  padding: 20px 18px 60px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.65;
}
.legal h1 {
  font-family: 'Bebas Neue', sans-serif;
  letter-spacing: 1px;
  font-size: 32px;
  margin: 8px 0 4px;
}
.legal .meta {
  color: var(--text-3);
  font-size: 12px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}
.legal h2 {
  font-size: 18px;
  margin: 28px 0 8px;
  color: var(--text);
}
.legal h3 {
  font-size: 15px;
  margin: 18px 0 6px;
  color: var(--text-2);
  font-weight: 600;
}
.legal p, .legal li { color: var(--text-2); }
.legal strong { color: var(--text); font-weight: 600; }
.legal ul { padding-left: 22px; margin: 6px 0 12px; }
.legal li { margin: 4px 0; }
.legal a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.legal a:hover { color: #4ee49a; }
.legal table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 13px;
}
.legal th, .legal td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}
.legal th { background: var(--bg-2); color: var(--text); font-weight: 600; }
.legal td { color: var(--text-2); }
.legal .toc {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin: 8px 0 24px;
}
.legal .toc h2 { margin: 0 0 6px; font-size: 13px; color: var(--text-2); text-transform: uppercase; letter-spacing: 1px; }
.legal .toc ol { padding-left: 20px; margin: 0; }
.legal .toc li { margin: 2px 0; }
.legal .toc a { color: var(--text); text-decoration: none; }
.legal .toc a:hover { color: var(--accent); }
.legal .back {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-2);
  font-size: 13px;
  padding: 6px 0 14px;
}
.legal .back:hover { color: var(--accent); }

/* ==== Mini banner (between sections) ==== */
.mini-banner {
  margin: 8px 16px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, rgba(255,204,0,.08), rgba(33,208,122,.08));
  border: 1px solid var(--line-2);
  display: flex; align-items: center; gap: 12px;
  font-size: 12px;
}
.mini-banner-icon {
  width: 32px; height: 32px;
  background: var(--accent-2);
  border-radius: 8px;
  display: grid; place-items: center;
  flex-shrink: 0;
  color: #1a1a1a; font-weight: 800; font-size: 14px;
}
.mini-banner-text { flex: 1; }
.mini-banner-text b { color: var(--text); display: block; margin-bottom: 2px; }
.mini-banner-text span { color: var(--text-2); }
