/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f7f5f2;
  --bg-dark: #111111;
  --card: #ffffff;
  --card-border: #eeeae5;
  --accent: #df1c4a;
  --text: #131115;
  --text2: #716e6c;
  --text3: #b0ada9;
  --radius: 16px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --max-w: 1024px;
}

html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

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

/* ===== HEADER ===== */
.site-header {
  background: var(--bg-dark);
  background-image: url('../img/header-bg.jpg');
  background-size: cover;
  background-position: center top;
  position: relative;
  overflow: hidden;
  width: 100%;
}

.site-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0) 100%);
  pointer-events: none;
}

.site-header::after { display: none; }

.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 24px 16px 0;
  position: relative;
  z-index: 1;
}

.match-detail-header .header-inner { padding-bottom: 24px; }

.header-badge {
  position: absolute;
  top: 24px;
  right: 16px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.85);
  border-radius: 100px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  z-index: 2;
}

.badge-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: none;
  background: none;
  font-size: inherit;
}

.header-title {
  font-size: 26px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.15;
  margin-bottom: 8px;
}

.header-subtitle {
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  font-weight: 700;
  margin-bottom: 24px;
}

/* ===== TABS (inside header) ===== */
.page-tabs {
  display: flex;
  align-items: flex-end;
  gap: 16px;
}

.page-tab {
  padding: 0 0 16px;
  font-size: 14px;
  font-weight: 400;
  color: rgba(255,255,255,0.7);
  background: none;
  border: none;
  border-bottom: 4px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
  border-radius: 2px 2px 0 0;
}

.page-tab.active {
  color: #ffffff;
  font-weight: 700;
  border-bottom-color: var(--accent);
}

.page-tab:hover:not(.active) { color: rgba(255,255,255,0.9); }

/* Tab panels */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ===== SUB-FILTERS ===== */
.filters-bar {
  background: var(--bg);
  padding: 12px 16px;
  display: flex;
  gap: 8px;
  max-width: var(--max-w);
  margin: 0 auto;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 400;
  transition: all 0.15s;
  white-space: nowrap;
  border: none;
}

.filter-chip.active {
  background: #131115;
  color: #ffffff;
}

.filter-chip:not(.active) {
  background: #eeeae5;
  color: #131115;
}

.filter-chip:hover:not(.active) { background: #e0dbd5; }

/* ===== MAIN CONTENT ===== */
.main-content {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 0 32px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ===== DATE SECTION — grouped white card ===== */
.date-section {
  margin: 0 16px 16px;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
}

.date-header {
  padding: 16px 16px 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.date-header.today { color: var(--accent); }

/* Divider with horizontal margin between header→card and card→card */
.date-section .date-header + .match-card::before,
.date-section .match-card + .match-card::before {
  content: '';
  display: block;
  height: 1px;
  background: var(--card-border);
  margin: 0 16px;
}

/* ===== MATCH CARD ===== */
.match-card {
  display: block;
  background: var(--card);
  overflow: hidden;
  transition: background 0.12s;
}

.match-card:hover { background: #faf8f6; }

.match-card-inner {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  gap: 8px;
  min-height: 52px;
}

/* Home name — right-aligned */
.home-name {
  flex: 1;
  font-size: 12px;
  font-weight: 400;
  color: var(--text);
  text-align: right;
  line-height: 1.3;
}

/* Away name — left-aligned */
.away-name {
  flex: 1;
  font-size: 12px;
  font-weight: 400;
  color: var(--text);
  text-align: left;
  line-height: 1.3;
}

/* Logos — no circle, as-is */
.team-logo {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.team-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Center score/time block */
.match-center {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  width: 50px;
  justify-content: center;
}

.match-score-val {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  min-width: 16px;
  text-align: center;
  line-height: 1;
}

.score-dash {
  font-size: 14px;
  font-weight: 400;
  color: var(--text2);
  line-height: 1;
}

.match-time {
  font-size: 12px;
  font-weight: 700;
  color: var(--text2);
  white-space: nowrap;
  line-height: 1;
  text-align: center;
}

/* Venue line */
.match-venue {
  padding: 0 16px 10px;
  font-size: 10px;
  color: var(--text2);
  line-height: 1.4;
  text-align: center;
}

/* Round view: date sub-label centered above match row */
.match-date-label {
  font-size: 10px;
  font-weight: 400;
  color: var(--text2);
  text-align: center;
  padding: 10px 16px 0;
  line-height: 1;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text2);
}
.empty-state .icon { font-size: 40px; margin-bottom: 10px; opacity: 0.5; }
.empty-state p { font-size: 15px; font-weight: 500; }

/* ===== PLACEHOLDER TAB ===== */
.tab-placeholder {
  padding: 60px 24px;
  text-align: center;
  color: var(--text2);
  font-size: 15px;
}

/* ===== MATCH DETAIL HEADER ===== */
.match-detail-header {
  background: var(--bg-dark);
  background-image: url('../img/header-bg.jpg');
  background-size: cover;
  background-position: center top;
  position: relative;
  overflow: hidden;
  width: 100%;
}

.match-detail-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.35) 0%, rgba(0,0,0,0.55) 100%);
  pointer-events: none;
}

.match-competition-tag {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,0.55);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.match-detail-teams {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.detail-team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.detail-team-logo {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  color: white;
  border: 2px solid rgba(255,255,255,0.18);
  overflow: hidden;
}

.detail-team-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
}

.detail-team-name {
  font-size: 13px;
  font-weight: 700;
  color: white;
  line-height: 1.3;
}

.detail-score-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.detail-score {
  font-size: 48px;
  font-weight: 900;
  color: white;
  line-height: 1;
  letter-spacing: -3px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.detail-score .dash {
  color: rgba(255,255,255,0.3);
  font-weight: 300;
  font-size: 36px;
}

.detail-match-time {
  font-size: 13px;
  color: rgba(255,255,255,0.6);
  display: flex;
  align-items: center;
  gap: 5px;
}

.match-meta-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 12px;
  color: rgba(255,255,255,0.55);
}

.meta-item { display: flex; align-items: center; gap: 5px; }

/* ===== BACK BUTTON ===== */
.back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  color: white;
  font-size: 22px;
  line-height: 1;
  transition: background 0.15s;
  flex-shrink: 0;
  margin-bottom: 10px;
}

.back-btn:hover { background: rgba(255,255,255,0.18); }

/* ===== EVENTS SECTION ===== */
.section { margin: 0 12px 10px; }

.section-header {
  padding: 14px 4px 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text2);
}

.events-card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
}

.events-grid { display: grid; grid-template-columns: 1fr 1px 1fr; }
.events-col { padding: 10px 0; }
.events-divider { background: var(--card-border); margin: 10px 0; }

.event-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  font-size: 13px;
  color: var(--text);
}

.event-item.away-event { flex-direction: row-reverse; text-align: right; }

.event-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}

.event-icon.goal { background: #f0fdf4; }
.event-icon.yellow { background: #fffbeb; }
.event-icon.red { background: #fef2f2; }
.event-icon.sub { background: #f0f4ff; }

.event-minute { font-size: 11px; font-weight: 700; color: var(--text2); min-width: 24px; flex-shrink: 0; }
.event-player { font-weight: 500; line-height: 1.3; }

/* ===== INFO CARD ===== */
.info-card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
}

.info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--card-border);
  gap: 12px;
}

.info-row:last-child { border-bottom: none; }
.info-label { font-size: 13px; color: var(--text2); font-weight: 500; display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.info-value { font-size: 13px; color: var(--text); font-weight: 600; text-align: right; }

/* ===== REFEREES ===== */
.referees-list { padding: 4px 0; }

.referee-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--card-border);
}

.referee-item:last-child { border-bottom: none; }
.referee-role { font-size: 12px; color: var(--text2); width: 120px; flex-shrink: 0; }
.referee-name { font-size: 14px; color: var(--text); font-weight: 500; }

/* ===== STANDINGS / SCORERS ===== */
.standings-card, .scorers-card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 12px;
}

.standings-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--card-border);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text2);
  background: #f8f8f6;
}

.standings-table, .scorers-table { width: 100%; border-collapse: collapse; font-size: 13px; }

.standings-table th, .scorers-table th {
  padding: 8px 10px;
  text-align: right;
  font-size: 11px;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 1px solid var(--card-border);
  background: #f8f8f6;
}

.standings-table th:first-child, .standings-table th:nth-child(2),
.scorers-table th:first-child, .scorers-table th:nth-child(2) { text-align: left; }

.standings-table td, .scorers-table td {
  padding: 10px 10px;
  text-align: right;
  color: var(--text2);
  border-bottom: 1px solid var(--card-border);
}

.standings-table tr:last-child td, .scorers-table tr:last-child td { border-bottom: none; }
.standings-table td:first-child, .scorers-table td:first-child { text-align: left; color: var(--text2); font-weight: 700; width: 28px; }
.standings-table td:nth-child(2), .scorers-table td:nth-child(2) { text-align: left; font-weight: 600; color: var(--text); }
.standings-table td .pts { font-weight: 800; color: var(--accent); font-size: 14px; }
.standings-table tbody tr:hover td, .scorers-table tbody tr:hover td { background: #f8f8f6; }

.standing-team { display: flex; align-items: center; gap: 8px; }
.standing-logo { width: 22px; height: 22px; object-fit: contain; }
.scorers-table td:last-child { text-align: right; font-weight: 800; color: var(--accent); font-size: 15px; }
.scorers-table .team-name-small { font-size: 11px; color: var(--text2); margin-top: 1px; }

/* ===== FOOTER ===== */
.site-footer {
  border-top: 1px solid var(--card-border);
  padding: 16px;
  text-align: center;
  font-size: 12px;
  color: var(--text2);
}
.site-footer a { color: var(--accent); }

/* ===== UTILS ===== */
.hidden { display: none !important; }
.fade-in { animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ===== LOADING SPINNER ===== */
.loading-state {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 60px 20px;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--card-border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner-white {
  border-color: rgba(255,255,255,0.2);
  border-top-color: #ffffff;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== MATCH DETAIL PAGE ===== */
.match-detail-page {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .header-title { font-size: 22px; }
  .match-card-inner { padding: 10px 12px; }
  .team-logo { width: 28px; height: 28px; }
}
