/* =========================================================
   ScoreB - stylesheet
   ========================================================= */

:root {
  --bg: #0e1117;
  --bg-elevated: #161b24;
  --bg-card: #1b212c;
  --border: #2a3140;
  --text: #eef1f6;
  --text-dim: #9aa4b2;
  --accent: #23c56d;
  --accent-dark: #17974f;
  --live: #ff4d4f;
  --radius: 10px;
  --header-h: 64px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: #F2F2F2;
  color: var(--text);
  font-family: "Segoe UI", Roboto, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }

/* ---------- Header ---------- */
header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.tittle h1 { 
margin: 0; 
font-size: 28px; 
letter-spacing: 0.5px; 
color:  #C9D1D9;
}

.tittle h1 span { color: #006CFF; }

header nav ul {
  list-style: none;
  display: flex;
  gap: 24px;
  margin: 0;
  padding: 0;
}

header nav ul li a {
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
}

header nav ul li a:hover { color: var(--text); }

.login { display: flex; align-items: center; gap: 8px; color: var(--text-dim); }

.login .btn {
  background: #0EA5E9;
  color: #04160b;
  padding: 7px 16px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 14px;
}

/* ---------- Sub-nav / search ---------- */
.container {
display: flex;
align-items: center;
justify-content: space-between;
padding: 14px 24px;
border-bottom: 1px solid var(--text-dim);
gap: 16px;
flex-wrap: wrap;
background: #0EA5E9;
}

.sport-nav ul {
  list-style: none;
  display: flex;
  gap: 20px;
  margin: 0;
  padding: 0;
}

.sport-nav ul li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: white;
  font-size: 14px;
  cursor: pointer;
  transition: color 0.2s ease;
}

.sport-nav ul li a { transition: color 0.2s ease; }

.sport-nav ul li.active,
.sport-nav ul li.active a {
  color: #000;
  font-weight: 700;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 8px 14px;
  min-width: 260px;
  flex: 1;
  max-width: 380px;
}

.search-box input {
background: transparent;
border: none;
outline: none;
color: var(--text);
width: 100%;
font-size: 13px;
}

.search-box i { color: var(--text-dim); font-size: 13px; }

/* ---------- Layout grid ---------- */
.layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 20px;
  padding: 20px 24px 40px;
  align-items: start;
  transition: grid-template-columns 0.25s ease;
}

.layout.detail-open {
  grid-template-columns: 220px minmax(0, 1fr) 380px;
}

.left-panel {
  background: var(--bg-elevated);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: sticky;
  top: calc(var(--header-h) + 20px);
}

.left-panel-placeholder {
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
}

.left-panel-placeholder i { font-size: 22px; margin-bottom: 8px; display: block; }

@media (max-width: 900px) {
  .layout, .layout.detail-open { grid-template-columns: 1fr; }
  .left-panel { display: none; }
}

/* ---------- Mobile fixes (index page header / sport-nav / league groups) ---------- */
@media (max-width: 640px) {
  html, body { overflow-x: hidden; }

  header {
    padding: 0 14px;
  }

  .tittle h1 { font-size: 22px; }

  .login .btn { padding: 6px 12px; font-size: 13px; }

  /* Blue sub-nav bar: stop it from overflowing the viewport width */
  .container {
    padding: 10px 14px;
    gap: 10px;
  }

  .sport-nav {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .sport-nav::-webkit-scrollbar { display: none; }

  .sport-nav ul {
    flex-wrap: nowrap;
    gap: 16px;
    width: max-content;
  }

  .search-box {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  /* Main content area: equal left/right spacing, no leftover gap */
  .layout {
    padding: 14px 14px 30px;
    gap: 14px;
  }

  .date-nav {
    flex-wrap: wrap;
    row-gap: 8px;
  }

  .date-picker { margin-left: 0; }

  .league-group {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
  }

  .match-row {
    grid-template-columns: 46px 1fr 50px;
    padding: 10px 12px;
    gap: 8px;
  }
}

/* ---------- Date nav ---------- */
.date-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.date-btn {
  background: #0EA5E9;
  border: 1px solid var(--border);
  color: white;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.date-btn:hover { border-color: var(--accent); }

.today-btn {
  width: auto;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
}

.today-btn:disabled {
  opacity: 0.5;
  cursor: default;
  border-color: var(--border);
}

.current-date {
  font-weight: 600;
  font-size: 15px;
  min-width: 110px;
}

.date-picker {
  background: #0EA5E9;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 13px;
  margin-left: auto;
}

.status-bar {
color: var(--text-dim);
font-size: 12px;
margin-bottom: 14px;
min-height: 16px;
}

/* ---------- League groups / matches ---------- */
.league-group {
  background: white;
  border: 1px solid var(--text-dim);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}

.league-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #0EA5E9;
  border-bottom: 1px solid var(--text-dim);
}

.league-header img { width: 20px; height: 20px; object-fit: contain; }
.league-name { font-size: 13px; font-weight: 600; }
.league-country { font-size: 12px; color: white; margin-left: 4px; }

.match-row {
  display: grid;
  grid-template-columns: 56px 1fr 60px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--text-dim);
  gap: 10px;
}

.match-row:last-child { border-bottom: none; }
.match-row:hover { background: rgba(255, 255, 255, 0.03); }

.match-status {
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  color: var(--text-dim);
}

.match-status.live { color: var(--live); }
.match-status.finished { color: var(--text-dim); }
.match-status.scheduled { color: #222; }

.match-teams { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

.team-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: #222;
  min-width: 0;
}

.team-line span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-line img { width: 18px; height: 18px; object-fit: contain; flex-shrink: 0; }
.team-line.winner { color: #222; font-weight: Bold; }

.match-score {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
  font-size: 13.5px;
  font-weight: 700;
 color: #222;
}

/* ---------- Sport switch transition ---------- */
#matches-container {
  transition: opacity 0.2s ease, transform 0.2s ease;
  opacity: 1;
  transform: translateY(0);
}

#matches-container.fading {
  opacity: 0;
  transform: translateY(6px);
}

.empty-state, .error-state {
  padding: 40px 16px;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
}

.error-state { color: #ff8080; }

/* ---------- Match detail card ---------- */
.match-detail {
  display: none;
  position: sticky;
  top: calc(var(--header-h) + 20px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: calc(100vh - var(--header-h) - 40px);
  overflow: hidden;
  flex-direction: column;
}

.layout.detail-open .match-detail { display: flex; }

.close-detail {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.35);
  border: none;
  color: var(--text);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.close-detail:hover { background: rgba(255, 255, 255, 0.15); }

.match-detail-header {
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  position: relative;
}

.detail-league {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-dim);
  text-align: center;
  margin-bottom: 10px;
}

.detail-teams {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
}

.detail-team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  font-size: 12.5px;
  font-weight: 600;
}

.detail-team img { width: 40px; height: 40px; object-fit: contain; }

.detail-score-wrap { text-align: center; }
.detail-score { font-size: 24px; font-weight: 800; }
.detail-status { font-size: 11px; color: var(--live); font-weight: 700; margin-top: 2px; }

.detail-meta {
  text-align: center;
  font-size: 11.5px;
  color: var(--text-dim);
  margin-top: 10px;
}

.detail-tabs {
  display: flex;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  flex-shrink: 0;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 12.5px;
  font-weight: 600;
  padding: 12px 14px;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
}

.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-btn:hover { color: var(--text); }

.detail-content {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

.detail-placeholder, .detail-loading, .detail-empty, .detail-error {
  color: var(--text-dim);
  font-size: 13px;
  text-align: center;
  padding: 30px 10px;
}

.detail-error { color: #ff8080; }

.detail-loading i { margin-right: 6px; }

/* ---- Summary tab (events) ---- */
.event-list { display: flex; flex-direction: column; gap: 2px; }

.event-row {
  display: grid;
  grid-template-columns: 1fr 44px 1fr;
  align-items: center;
  gap: 8px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}

.event-row:last-child { border-bottom: none; }

.event-minute { color: var(--accent); font-weight: 700; text-align: center; }

.event-side { display: flex; align-items: center; gap: 6px; min-width: 0; }
.event-side.event-home { justify-content: flex-end; text-align: right; flex-direction: row-reverse; }
.event-side.event-away { justify-content: flex-start; text-align: left; flex-direction: row; }
.event-side .player { font-weight: 600; }
.event-side .assist { color: var(--text-dim); font-size: 11.5px; }
.event-icon { width: 16px; text-align: center; color: var(--text-dim); flex-shrink: 0; }
.event-icon.goal { color: var(--accent); }
.event-icon.yellow { color: #f2c744; }
.event-icon.red { color: var(--live); }

/* ---- Lineups tab (pitch) ---- */
.lineups-wrap { display: flex; flex-direction: column; gap: 14px; }

.formation-label {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-dim);
  font-weight: 600;
}

.pitch {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  background: repeating-linear-gradient(
    to bottom,
    #1e5e34,
    #1e5e34 10%,
    #226b3a 10%,
    #226b3a 20%
  );
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 6px;
  overflow: hidden;
}

.pitch::before {
  /* halfway line */
  content: "";
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 2px;
  background: rgba(255, 255, 255, 0.35);
}

.pitch::after {
  /* center circle */
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 60px; height: 60px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.pitch-box {
  position: absolute;
  left: 50%;
  width: 46%;
  height: 12%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  transform: translateX(-50%);
}

.pitch-box.top { top: -2px; border-top: none; }
.pitch-box.bottom { bottom: -2px; border-bottom: none; }

.pitch-player {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 44px;
}

.pitch-player .dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--accent);
  color: var(--text);
  font-size: 10.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pitch-player.away .dot { border-color: #4d9dff; }

.pitch-player .name {
  font-size: 9.5px;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  text-align: center;
  line-height: 1.1;
  max-width: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lineup-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  font-size: 11.5px;
  color: var(--text-dim);
}

.lineup-meta .coach-label { font-weight: 600; color: var(--text); }

.subs-list {
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.subs-title { font-weight: 700; color: var(--text); margin-bottom: 4px; font-size: 12.5px; }

/* ---- H2H tab ---- */
.h2h-list { display: flex; flex-direction: column; gap: 6px; }

.h2h-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: var(--bg-elevated);
  border-radius: 8px;
  font-size: 12px;
}

.h2h-row .h2h-team { display: flex; align-items: center; gap: 6px; overflow: hidden; }
.h2h-row .h2h-team img { width: 16px; height: 16px; object-fit: contain; }
.h2h-row .h2h-team.right { flex-direction: row-reverse; text-align: right; }
.h2h-row .h2h-score { font-weight: 700; font-size: 13px; }
.h2h-date { font-size: 10.5px; color: var(--text-dim); text-align: center; margin-top: 2px; }

/* ---- Standings tab ---- */
.standings-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }

.standings-table th {
  text-align: left;
  color: var(--text-dim);
  font-weight: 600;
  padding: 6px 4px;
  border-bottom: 1px solid var(--border);
}

.standings-table td {
  padding: 6px 4px;
  border-bottom: 1px solid var(--border);
}

.standings-table td.team-cell { display: flex; align-items: center; gap: 6px; }
.standings-table td.team-cell img { width: 16px; height: 16px; object-fit: contain; }
.standings-table tr.highlight { background: rgba(35, 197, 109, 0.08); }
.standings-table td, .standings-table th { text-align: center; }
.standings-table td.team-cell, .standings-table th.team-th { text-align: left; }

/* ---- Stats tab ---- */
.stats-list { display: flex; flex-direction: column; gap: 12px; }

.stat-row .stat-values {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 4px;
}

.stat-row .stat-label {
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.stat-bar {
  display: flex;
  height: 6px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--border);
}

.stat-bar .home-bar { background: var(--accent); }
.stat-bar .away-bar { background: #4d9dff; }

/* ==========================================================
   Full-screen match page (match.html)
   Only ever reached from a small screen (see MOBILE_BREAKPOINT
   in script.js) - it reuses the same .match-detail-header /
   .detail-tabs / .detail-content classes as the sidebar card
   on the home page, just laid out to fill the whole viewport.
   ========================================================== */
html, body {
  height: 100%;
}

.match-page-body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
}

.match-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.match-page-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  height: var(--header-h);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.match-page-back {
  background: none;
  border: none;
  color: var(--text);
  font-size: 18px;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

.match-page-back:hover { background: rgba(255, 255, 255, 0.08); }

.match-page-title h1 { margin: 0; font-size: 18px; }

.match-page .match-detail-header {
  border-radius: 0;
}

.match-page .detail-tabs {
  position: sticky;
  top: var(--header-h);
  z-index: 9;
}

.match-page .detail-content {
  flex: 1;
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
}
