/* Palette copied exactly from the Android app's theme (ui/theme/Color.kt) and
   the desktop app, so all three clients look like one product. */
:root {
  --bg: #0F1115;
  --bg-elevated: #1A1D23;
  --panel: #1A1D23;
  --panel-hover: #22262E;
  --border: #2A2F3A;
  --text: #E2E8F0;
  --text-muted: #94A3B8;
  --text-faint: #64748B;
  --accent: #00FF66;      /* LiveGreen - active states, links, positive */
  --accent-hover: #00D154;
  --accent-ink: #0D2E1A;
  --live: #EF4444;        /* LiveRed - reserved for postponed/cancelled/errors */
  --halftime: #FBBF24;    /* HalftimeYellow */
  --radius: 8px;
  --card-radius: 16px;    /* matches Android MatchCard / desktop match-row-inner */
}

[data-theme="light"] {
  --bg: #f4f5f7;
  --bg-elevated: #ffffff;
  --panel: #ffffff;
  --panel-hover: #f0f2f5;
  --border: #e2e5ea;
  --text: #1a1f29;
  --text-muted: #6b7280;
  --text-faint: #94a3b8;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: inherit; text-decoration: none; }
button, select, input { font-family: inherit; }

/* ---------- Topbar ---------- */
.topbar {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar-inner {
  max-width: 1280px; margin: 0 auto; padding: 0 16px;
  display: flex; align-items: center; height: 56px; gap: 24px;
}
.brand { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 700; flex-shrink: 0; }
.brand-mark {
  width: 26px; height: 26px; flex-shrink: 0;
  animation: ball-spin 6s linear infinite;
}
@keyframes ball-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.brand-name b { color: var(--accent); font-weight: 800; }
.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.lang-select {
  background: var(--panel); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 6px 10px; font-size: 13px; cursor: pointer;
}
.icon-btn {
  background: var(--panel); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius); width: 34px; height: 34px; cursor: pointer; font-size: 15px;
}
.icon-btn:hover { background: var(--panel-hover); }

/* ---------- Live ticker marquee (matches desktop app) ---------- */
.ticker {
  display: flex; align-items: stretch; background: linear-gradient(180deg, #14100A, #0D0B08);
  border-bottom: 1px solid var(--border); height: 34px; overflow: hidden;
}
.ticker[hidden] { display: none; }
.ticker-label {
  display: flex; align-items: center; gap: 6px; background: var(--accent); color: var(--accent-ink);
  font-weight: 800; font-size: 11px; letter-spacing: 1.5px; padding: 0 14px; flex-shrink: 0;
}
.ticker-label::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent-ink); animation: pulse 1.4s infinite; }
.ticker-track-wrap { flex: 1; overflow: hidden; position: relative; }
.ticker-track { display: flex; align-items: center; height: 100%; white-space: nowrap; width: max-content; animation: ticker-scroll 40s linear infinite; }
.ticker-track:hover { animation-play-state: paused; }
@keyframes ticker-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.ticker-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 0 16px; font-size: 12.5px;
  color: var(--text-muted); border-right: 1px solid var(--border); height: 34px;
}
.ticker-chip .tc-team { color: var(--text); font-weight: 600; }
.ticker-chip .tc-score { color: var(--accent); font-weight: 800; }
.ticker-chip .tc-min { color: var(--accent); font-size: 11px; font-weight: 700; }

/* ---------- Date navigator ---------- */
.date-nav-wrap { background: var(--bg-elevated); border-bottom: 1px solid var(--border); }
.date-nav {
  max-width: 1280px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 14px;
}
.live-pill {
  display: flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 20px;
  background: var(--panel); color: var(--text); border: 1px solid var(--border);
  font-size: 13px; font-weight: 700; cursor: pointer;
}
.live-pill:hover { background: var(--panel-hover); }
.live-pill.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.live-pill.active .live-dot { background: var(--accent-ink); }
.date-arrow {
  width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--panel); color: var(--text); font-size: 16px; cursor: pointer; line-height: 1;
}
.date-arrow:hover { background: var(--panel-hover); }
.date-label { font-size: 14px; font-weight: 700; min-width: 90px; text-align: center; }

/* ---------- Layout ---------- */
.layout { max-width: 1280px; margin: 0 auto; padding: 20px 16px; display: flex; gap: 20px; align-items: flex-start; }

/* ---------- Sidebar (Competitions - matches desktop app) ---------- */
.sidebar {
  width: 240px; flex-shrink: 0; background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; position: sticky; top: 76px;
  display: flex; flex-direction: column; max-height: calc(100vh - 96px);
}
.sidebar-section-header {
  background: none; border: none; color: var(--text-faint); font-weight: 700; font-size: 11px;
  letter-spacing: 1.4px; text-transform: uppercase; display: flex; align-items: center;
  justify-content: space-between; width: 100%; padding: 0 0 10px; cursor: pointer;
}
.sidebar-section-header .chevron { width: 12px; height: 12px; transition: transform .15s ease; }
.sidebar-section-header[aria-expanded="false"] .chevron { transform: rotate(-90deg); }
.sidebar-section-header[aria-expanded="false"] ~ .sidebar-search,
.sidebar-section-header[aria-expanded="false"] ~ .league-list { display: none; }
.sidebar-search { margin-bottom: 10px; flex-shrink: 0; }
.sidebar-search input {
  width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font-size: 13px;
}
.sidebar-search input::placeholder { color: var(--text-faint); }
.league-list { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; min-height: 0; }
.league-item {
  background: none; border: none; width: 100%; text-align: left;
  padding: 7px 8px; border-radius: 9px; font-size: 13px; cursor: pointer; color: var(--text-muted);
  display: flex; align-items: center; gap: 9px;
}
.league-item:hover { background: var(--panel-hover); color: var(--text); }
.league-item.active { background: rgba(0,255,102,0.12); color: var(--accent); font-weight: 600; }
.league-item img { width: 20px; height: 20px; object-fit: contain; flex-shrink: 0; border-radius: 4px; }
.league-item-text { min-width: 0; overflow: hidden; }
.league-item-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.league-item-country { font-size: 11px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.league-item.active .league-item-country { color: var(--accent); opacity: .8; }

.content { flex: 1; min-width: 0; }
.content-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; flex-wrap: wrap; gap: 6px; }
.content-header h1 { font-size: 20px; margin: 0; }
.status-line { font-size: 12.5px; color: var(--text-muted); }

/* ---------- Matches: rounded cards matching Android/desktop ---------- */
.league-group { margin-bottom: 18px; }
.league-group-header {
  display: flex; align-items: center; gap: 8px; padding: 8px 4px; font-size: 12px;
  font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-faint);
}
.league-group-header .country { color: var(--text-muted); }

.match-row {
  display: grid; grid-template-columns: 56px 1fr 34px; align-items: center;
  gap: 10px; padding: 12px 14px; background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--card-radius); cursor: pointer; margin-bottom: 6px;
  transition: background .1s ease, border-color .1s ease;
}
.match-row:hover { background: var(--panel-hover); }
.match-row.is-live { border-color: rgba(0,255,102,0.4); }

.match-status { font-size: 12px; font-weight: 700; text-align: center; color: var(--text-muted); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.match-status.live { color: var(--accent); }
.match-status.ht { color: var(--halftime); }

.match-teams { min-width: 0; }
.team-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; padding: 3px 0; }
.team-name-wrap { display: flex; align-items: center; gap: 8px; min-width: 0; }
.team-logo {
  width: 18px; height: 18px; object-fit: contain; flex-shrink: 0; border-radius: 2px;
  background: var(--panel-hover);
}
.team-logo.placeholder { visibility: hidden; }
.team-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.team-score { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 18px; text-align: right; }

.live-dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
  animation: pulse 1.4s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

/* pin / favorite star */
.match-pin {
  background: none; border: none; color: var(--text-faint); cursor: pointer;
  display: flex; align-items: center; justify-content: center; width: 24px; height: 24px;
}
.match-pin:hover { color: var(--accent); }
.match-pin.pinned { color: var(--accent); }
.match-pin svg { width: 13px; height: 13px; }

.loading-state, .empty-state, .error-state {
  padding: 60px 20px; text-align: center; color: var(--text-muted); font-size: 14px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
}
.error-state { color: var(--live); }

/* ---------- Standings (honest placeholder - no data source yet) ---------- */
.standings-placeholder {
  padding: 60px 20px; text-align: center; color: var(--text-muted); font-size: 14px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
}

.site-footer { text-align: center; color: var(--text-muted); font-size: 12px; padding: 30px 16px; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .sidebar { display: none; }
  .main-nav { gap: 0; }
  .brand-name { display: none; }
  .match-row { grid-template-columns: 44px 1fr 28px; }
}

/* RTL adjustments */
html[dir="rtl"] .team-score { text-align: left; }
html[dir="rtl"] .ticker-chip { border-right: none; border-left: 1px solid var(--border); }

/* ---------- Legal / static content pages ---------- */
.legal-wrap { max-width: 780px; margin: 0 auto; padding: 40px 20px 60px; }
.legal-wrap h1 { font-size: 26px; margin: 0 0 6px; }
.legal-updated { color: var(--text-faint); font-size: 12.5px; margin: 0 0 30px; }
.legal-wrap h2 { font-size: 17px; margin: 30px 0 10px; color: var(--text); }
.legal-wrap p { line-height: 1.7; color: var(--text-muted); margin: 0 0 14px; font-size: 14.5px; }
.legal-wrap ul { color: var(--text-muted); line-height: 1.8; font-size: 14.5px; margin: 0 0 14px; padding-inline-start: 20px; }
.legal-wrap li { margin-bottom: 4px; }
.legal-wrap a { color: var(--accent); text-decoration: underline; }
.legal-wrap strong { color: var(--text); }
.back-link { display: inline-block; margin-bottom: 20px; color: var(--text-muted); font-size: 13.5px; }
.back-link:hover { color: var(--text); }

/* ---------- Footer links ---------- */
.footer-links { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; margin-bottom: 10px; }
.footer-links a { color: var(--text-muted); font-size: 12.5px; }
.footer-links a:hover { color: var(--text); }

/* ---------- Cookie consent banner (EU/GDPR) ---------- */
.cookie-banner {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 100;
  max-width: 640px; margin: 0 auto; background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px 18px; box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px;
}
.cookie-banner[hidden] { display: none; }
.cookie-banner p { margin: 0; font-size: 13px; color: var(--text-muted); line-height: 1.6; flex: 1; min-width: 220px; }
.cookie-banner a { color: var(--accent); text-decoration: underline; }
.cookie-banner-actions { display: flex; gap: 8px; flex-shrink: 0; }
.cookie-btn {
  border-radius: 8px; padding: 8px 16px; font-size: 13px; font-weight: 700; cursor: pointer; border: 1px solid var(--border);
}
.cookie-btn.accept { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.cookie-btn.decline { background: none; color: var(--text-muted); }
.cookie-btn.decline:hover { color: var(--text); }
