/* =====================================================
   ANFIELD.PL – WYNIKI (mobile-first)
   Dark theme + akcenty LFC, układ fotmob-like
   ===================================================== */

:root {
  /* bazowe (spójne z base.css) */
  --bg: #0b0b0c;
  --surface: #131216;
  --surface-2: #19181d;

  --text: #e5e7eb;
  --muted: #9ca3af;
  --accent: var(--red, #e11d48);
  --accent-2: var(--red-2, #fb7185);

  /* wyniki */
  --win: #16a34a;
  --draw: #6b7280;
  --lose: #dc2626;

  --radius: 12px;
  --shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

/* ===== page ===== */
body.theme-dark {
  background: var(--bg);
  color: var(--text);
}

.results-page {
  max-width: min(1080px, 94vw);
  margin-inline: auto;
  padding-block: 1rem 2.25rem;
}

.page-title {
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  color: var(--accent);
  text-align: center;
  margin: 0 0 1rem;
}

/* ===== controls ===== */
/* --- Stylowanie pola wyboru sezonu (SELECT) --- */

.season-select-wrap {
  display: flex; /* Użyj flexbox, by kontrolować label i select */
  gap: 0.75rem;
  align-items: center;
  font-size: 0.95rem;
  margin-bottom: 0.75rem; /* Odsunięcie od chipów */
  color: var(--text);
  font-weight: 600;
}

#season-select {
  /* Podstawowe stylowanie INPUTów/SELECTów */
  appearance: none; /* Ukrywa domyślny wygląd (strzałki) w większości przeglądarek */
  width: auto; /* Zamiast 100% dla pełnej szerokości */
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  padding: 0.65rem 2.2rem 0.65rem 0.9rem; /* Dodatkowe padding po prawej na strzałkę */
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;

  /* Pozycjonowanie własnej strzałki */
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="rgba(255,255,255,0.8)" d="M7 10l5 5 5-5z"/></svg>');
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 16px;
}

#season-label {
  color: var(--muted);
}

.controls {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.chip {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 999px;
  font-size: 0.85rem;
  padding: 0.45rem 0.75rem;
}
.chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.searchbox {
  margin-top: 0.75rem;
}
.searchbox input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  padding: 0.65rem 0.9rem;
  font-size: 0.95rem;
}

/* ===== list ===== */
.results-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: visible;
  background: var(--surface);
}

/* ===== card ===== */
.match {
  position: relative;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  transition: background 0.15s ease;
  overflow: visible;
}
.match:last-child {
  border-bottom: none;
}
@media (hover: hover) {
  .match:hover {
    background: var(--surface-2);
  }
}

/* --- MOBILE: meta nad teams --- */
.match-head {
  display: grid;
  grid-template-areas:
    "meta"
    "teams";
  grid-template-columns: 1fr;
  row-gap: 0.5rem;
  padding: 0.9rem 1rem;
}
.meta {
  grid-area: meta;
  text-align: left;
  align-items: flex-start;
  width: 100%;
}
.teams {
  grid-area: teams;
}

/* skrócona vs pełna wersja meta */
.meta-row {
  font-size: 0.52rem;
  line-height: 1.2;
}
.meta--full {
  display: none;
}
.meta--compact {
  display: block;
  color: var(--surface-2);
  font-weight: 100;
}

/* --- DESKTOP ≥640px: meta na prawo --- */
@media (min-width: 640px) {
  .match-head {
    grid-template-areas: "teams meta";
    grid-template-columns: 1fr var(--meta-w);
    align-items: center;
  }
  .meta {
    text-align: center;
    align-items: center;
    width: var(--meta-w);
  }
  .meta--full {
    display: block;
  }
  .meta--compact {
    display: none;
    font-size: 18px;
    font-weight: 200;
  }
}

.match-head::after {
  content: "";
  position: absolute;
  right: 0.9rem;
  bottom: 0.85rem;
  width: 6px;
  height: 6px;
  border-right: 2px solid rgba(255, 255, 255, 0.45);
  border-bottom: 2px solid rgba(255, 255, 255, 0.45);
  transform: rotate(-45deg);
  transition: transform 0.18s ease;
}
.match[aria-expanded="true"] .match-head::after {
  transform: rotate(45deg);
}

/* ==== TEAMS: nazwa–herb | wynik | herb–nazwa ==== */
.teams {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  column-gap: 0.8rem;
}

.team {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}
/* Zmodyfikuj: Domyślne style dla nazwy (mobile first) */
.team .name {
  order: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: clamp(90px, 26vw, 220px);
  font-weight: 600;
  line-height: 1.1;
  /* --- Mobile: Zmniejszona czcionka i tylko skrót --- */
  font-size: 0.88rem; /* Niewielkie zmniejszenie czcionki */
}

.team .name .full-name {
  display: none; /* Ukryj pełną nazwę na mobile */
}

.team .name .short-name {
  display: inline; /* Pokaż skrót na mobile */
  font-weight: 700;
}
.team.right .name {
  order: 2;
  text-align: right;
}
.team .logo {
  order: 2;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  object-fit: contain;
}
.team.right .logo {
  order: 1;
}

.teams > .team:not(.right) {
  /* Wyrównaj cały flex-kontener `.team` wewnątrz kolumny siatki `.teams` */
  justify-self: flex-end;
}

/* wynik – kolorujemy TYLKO wynik */
.score {
  display: inline-flex;
  align-items: center;
  justify-content: center; /* **TO JEST KLUCZOWE** – Wyśrodkowuje zawartość wewnątrz bloku score */
  min-width: 64px;
  padding: 0.22rem 0.6rem;
  font-weight: 800;
  font-size: 1.08rem;
  border-radius: 8px;
  color: #fff;
  background: var(--draw); /* default (np. przed FT) */
}
.match.win .score {
  background: var(--win);
}
.match.draw .score {
  background: var(--draw);
}
.match.lose .score {
  background: var(--lose);
}

/* meta (liga/kolejka/data) */
.meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
  text-align: right;
  font-size: 0.65rem;
  line-height: 1.15;
  color: var(--muted);
}
.meta .comp {
  color: var(--accent-2);
  font-weight: 600;
}

/* ===== details (accordion) ===== */
/* === Detale: płynne otwieranie (auto-height) === */
.match-details {
  overflow: hidden;
  height: 0; /* start zamknięte */
  padding: 0 15rem; /* padding dojdzie po otwarciu */
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  transition: height 220ms ease, padding 220ms ease;
}
.match[aria-expanded="true"] .match-details {
  padding: 0.3rem 2rem; /* widoczny padding tylko gdy otwarte */
  overflow: visible;
}

/* pigułki i lista (bez zmian funkcjonalnych) */
.details-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.5rem;
  margin: 0.15rem 0 0.8rem;
}

/* zapobiegamy „przycinaniu” w trakcie animacji */
.results-list,
.match {
  overflow: visible;
}

/* Zaokrąglenie góry pierwszego elementu na liście */
.results-list .match:first-child {
  border-top-left-radius: var(--radius);
  border-top-right-radius: var(--radius);
}

/* Zaokrąglenie dołu ostatniego elementu na liście */
.results-list .match:last-child {
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
}
.notes {
  margin: 0 0 0.35rem;
  color: var(--text);
}
.venue {
  margin: 0 0 0.65rem;
  color: var(--muted);
  font-size: 0.85rem;
}

/* pigułki linków (zapowiedź/relacja) */
.details-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.15rem 0 0.8rem;
}
.details-links a {
  display: inline-block;
  text-decoration: none;
  background: var(--accent);
  color: #fff;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}
.details-links a:hover {
  background: var(--accent-2);
}

/* --- nie przycinaj rozwiniętych kart --- */
.results-list {
  overflow: visible;
}
.match {
  overflow: visible;
}

/* lista artykułów (articles[]) */
.articles {
  border-top: 1px dashed var(--line);
  padding-top: 0.75rem;
}
.articles-head {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}
.articles-list {
  display: grid;
  gap: 0.4rem;
  list-style: none;
  padding: 0;
  margin: 0;
}
.articles-list li a {
  display: flex;
  gap: 0.7rem;
  align-items: baseline;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
  color: var(--text);
  text-decoration: none;
}
.articles-list li a:hover {
  background: rgba(255, 255, 255, 0.06);
}
.articles-list .type {
  min-width: 86px;
  text-transform: capitalize;
  color: var(--accent-2);
  font-size: 0.8rem;
  font-weight: 600;
}
.articles-list .title {
  font-size: 0.92rem;
  line-height: 1.25;
}

/* ===== load more ===== */
.load-more-wrap {
  text-align: center;
  margin-top: 1.25rem;
}
.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 0.7rem 1.1rem;
  font-weight: 800;
  box-shadow: var(--shadow);
}
.btn:hover {
  background: var(--accent-2);
}

/* ===== responsive ===== */
/* Dodaj/zmodyfikuj w bloku @media (min-width: 640px) */
@media (min-width: 640px) {
  /* Przywróć pełne nazwy i ukryj skróty */
  .team .name {
    font-size: 0.95rem; /* Przywróć lub ustaw odpowiedni rozmiar dla tabletów/desktopów */
  }
  .team .name .full-name {
    display: inline; /* Pokaż pełną nazwę */
  }
  .team .name .short-name {
    display: none; /* Ukryj skrót */
  }
  .team .logo {
    width: 42px;
    height: 42px;
  }
  /* ... reszta twoich styli dla desktopu ... */
}

@media (min-width: 640px) {
  .team .logo {
    width: 42px;
    height: 42px;
  }
  .page-title {
    text-align: left;
    margin-bottom: 1.1rem;
  }
}
@media (min-width: 1024px) {
  .match-head {
    grid-template-columns: 1fr auto 220px;
    padding: 1.05rem 1.25rem;
  }
  .score {
    font-size: 1.18rem;
  }
  .articles-list {
    grid-template-columns: 1fr 1fr;
  }
}
/* === Wyniki: twardy reset layoutu drużyn (nadpisuje base.css) === */
.results-list .team,
.results-list .team.right {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.results-list .team .name {
  order: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: clamp(90px, 26vw, 220px);
  line-height: 1.1;
  font-weight: 600;
}

.results-list .team .logo {
  order: 2;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  object-fit: contain;
}

/* prawa strona: herb -> nazwa */
.results-list .team.right .logo {
  order: 1;
}
.results-list .team.right .name {
  order: 2;
  text-align: right;
}

/* środkowy wynik zawsze w jednej linii */
.results-list .score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
}
/* ===== stałe szerokości kolumn (meta + score) ===== */
:root {
  --meta-w: 150px; /* prawa kolumna z ligą/datą (mobile możesz dać 160px) */
  --score-w: 68px; /* SZEROKOŚĆ SŁUPKA NA WYNIK – tu wyrównujemy wszystko */
}

/* header wiersza: lewe bloki, wynik, meta */
.match-head {
  display: grid;
  grid-template-columns: 1fr var(--meta-w); /* lewa część (teams) | meta */
  column-gap: 1rem;
}

/* wewnątrz lewej części rozkładamy: home | SCORE | away */
.teams {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--score-w) minmax(0, 1fr);
  align-items: center;
  column-gap: 0.8rem;
}

/* wynik – sztywny box o szerokości score-w, zawsze centralnie */
.score {
  width: var(--score-w);
  min-width: var(--score-w);
  justify-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.22rem 0.6rem;
  font-weight: 800;
  font-size: 1.08rem;
  border-radius: 8px;
  color: #fff;
}

/* meta ma stałą szerokość, więc cała prawa kolumna się nie „faluje” */
.meta {
  width: var(--meta-w);
  justify-self: end;
  text-align: right;
}

/* teamy – jednolinijkowo, z elipsą (bez zawijania pod herb) */
.team {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}
.team .name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: clamp(90px, 26vw, 220px);
  font-weight: 600;
  line-height: 1.1;
}
.team .logo {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  object-fit: contain;
}
.team .name {
  order: 1;
}
.team .logo {
  order: 2;
}
.team.right .logo {
  order: 1;
}
.team.right .name {
  order: 2;
  text-align: right;
}

/* kolory wyniku (już masz – zostawiam dla spójności) */
.match.win .score {
  background: var(--win);
}
.match.draw .score {
  background: var(--draw);
}
.match.lose .score {
  background: var(--lose);
}

/* lekka korekta na desktopie – więcej miejsca na meta */
@media (min-width: 1024px) {
  :root {
    --meta-w: 220px;
    --score-w: 70px;
  }
  .match-head {
    grid-template-columns: 1fr var(--meta-w);
  }
}
.match-head::after {
  content: "";
  position: absolute;
  right: 0.9rem;
  bottom: 0.8rem;
  width: 6px;
  height: 6px;
  border-right: 2px solid rgba(255, 255, 255, 0.45);
  border-bottom: 2px solid rgba(255, 255, 255, 0.45);
  transform: rotate(-45deg);
  transition: transform 0.18s ease;
}
.match[aria-expanded="true"] .match-head::after {
  transform: rotate(45deg);
}
/* ===== details (accordion) ===== */
.match-details {
  display: block; /* utrzymujemy blok, ale sterujemy wysokością */
  overflow: hidden; /* maskuj w trakcie animacji */
  height: 0; /* start zamknięte */
  padding: 0 1rem; /* w animacji padding jest zarządzany klasami */
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  transition: height 220ms ease, padding 220ms ease;
  /* DODANA REGUŁA: Neutralizuje max-height: 0 z base.css */
  max-height: none;
}

.match[aria-expanded="true"] .match-details {
  padding: 0.15rem 1rem;
}
@media (prefers-reduced-motion: no-preference) {
  .match-details {
    animation: detailsFade 0.2s ease;
  }
  @keyframes detailsFade {
    from {
      opacity: 0.7;
      transform: translateY(-3px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}
/* --- domyślnie: mobile-first --- */
.match-head {
  display: grid;
  grid-template-columns: 1fr; /* 1 kolumna */
  row-gap: 0.5rem;
  padding: 0.9rem 1rem;
}

/* meta ma osobny wiersz NAD teams */
.meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  text-align: left;
  width: 100%;
}
.meta-row {
  font-size: 0.58rem;
  line-height: 1.2;
}
.meta--full {
  display: none;
} /* na mobile chowamy pełną */
.meta--compact {
  display: block;
  color: var(--muted);
}
.meta--compact {
  color: var(--accent-2);
  font-weight: 200;
} /* pierwszy wiersz ma akcent? możesz zostawić */

.teams {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--score-w) minmax(0, 1fr);
  align-items: center;
  column-gap: 0.8rem;
}

.score {
  width: var(--score-w);
  min-width: var(--score-w);
  justify-self: center;
}

/* --- od tablet/desktop: meta wraca na prawo, pełna wersja --- */
@media (min-width: 640px) {
  .match-head {
    grid-template-columns: 1fr var(--meta-w); /* teams | meta */
    align-items: center;
  }
  .meta {
    text-align: right;
    align-items: flex-end;
    width: var(--meta-w);
  }
  .meta--full {
    display: block;
  }
  .meta--compact {
    display: none;
  }
}

.notes {
  margin: 0 0 0.35rem;
  color: var(--text);
}
.venue {
  margin: 0 0 0.6rem;
  color: var(--muted);
  font-size: 0.85rem;
}

/* linki */
.details-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.1rem 0 0.8rem;
}
.details-links a {
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}
.details-links a:hover {
  background: var(--accent-2);
}

/* artykuły */
.articles {
  border-top: 1px dashed var(--line);
  padding-top: 0.75rem;
}
.articles-head {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}
.articles-list {
  display: grid;
  gap: 0.4rem;
  list-style: none;
  padding: 0;
  margin: 0;
}
.articles-list li a {
  display: flex;
  gap: 0.7rem;
  align-items: baseline;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
  color: var(--text);
  text-decoration: none;
}
.articles-list li a:hover {
  background: rgba(255, 255, 255, 0.06);
}
.articles-list .type {
  min-width: 86px;
  text-transform: capitalize;
  color: var(--accent-2);
  font-size: 0.8rem;
  font-weight: 600;
}
.articles-list .title {
  font-size: 0.92rem;
  line-height: 1.25;
}
@media (min-width: 1024px) {
  .articles-list {
    grid-template-columns: 1fr 1fr;
  }
}

/* load more */
.load-more-wrap {
  text-align: center;
  margin-top: 1.25rem;
}
.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 0.7rem 1.1rem;
  font-weight: 800;
  box-shadow: var(--shadow);
}
.btn:hover {
  background: var(--accent-2);
}

/* „pigułki” linków – dużo/mało linków? układ sam się zwinie/przeniesie */
.details-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.5rem;
  margin: 0.15rem 0 0.8rem;
}

/* lista artykułów niżej też responsywnie */
.articles-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.4rem;
}
@media (min-width: 1024px) {
  .articles-list {
    grid-template-columns: 1fr 1fr;
  }
}

/* bezpieczeństwo: nie przycinaj niczego */
.results-list,
.match {
  overflow: visible;
}

/* =====================================================
   ANFIELD.PL – NADCHODZĄCE MECZE (scroll horizontal)
   ===================================================== */

.upcoming-bar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem 0.5rem 1rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.upcoming-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0 1rem;
  margin-bottom: 0.5rem;
}

.upcoming-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
}

.upcoming-all {
  font-size: 0.85rem;
  color: var(--win);
  text-decoration: none;
  font-weight: 600;
}
.upcoming-all:hover {
  color: var(--accent-2);
}

.upcoming-scroll {
  display: flex;
  gap: 0.9rem;
  overflow-x: auto;
  padding: 0 3rem;
  scroll-snap-type: x mandatory;
}
.upcoming-scroll::-webkit-scrollbar {
  height: 7px;
}
.upcoming-scroll::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 3px;
}

.upcoming-card {
  flex: 0 0 auto;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 0.6rem;
  margin-bottom: 0.6rem;
  min-width: 170px;
  text-align: center;
  scroll-snap-align: start;
  transition: none;
}
.upcoming-card:hover {
  background: var(--surface-2); /* Ustaw tło takie samo jak domyślne */
  cursor: default; /* Ustaw kursor na domyślny, jeśli element nie ma być klikalny */
}

.upcoming-teams {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin-bottom: 0.25rem;
}
.upcoming-teams img {
  width: 38px;
  height: 38px;
  object-fit: contain;
}
.upcoming-teams span {
  font-weight: 700;
  font-size: 0.85rem;
}

.upcoming-date {
  font-size: 0.7rem;
  color: var(--muted);
  margin-bottom: 0.15rem;
}
.upcoming-comp {
  font-size: 0.8rem;
  color: var(--accent-2);
  font-weight: 600;
}
.upcoming-time {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text);
}
