/* ============================================================
   OCEŃ SĘDZIEGO — Main Stylesheet
   Ekstraklasa Theme: Navy (#0D1B4B) + White + Gold accents
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ---- CSS Variables ---- */
:root {
  --navy: #0D1B4B;
  --navy-light: #1a2d6e;
  --navy-dark: #070e2a;
  --white: #ffffff;
  --off-white: #f4f6fb;
  --gold: #F5C518;
  --gold-dark: #d4a900;
  --green: #1cc67e;
  --red: #e63946;
  --gray-100: #f0f2f8;
  --gray-200: #dce1ef;
  --gray-400: #8c99bb;
  --gray-600: #4a5580;
  --shadow-sm: 0 2px 8px rgba(13, 27, 75, 0.10);
  --shadow-md: 0 6px 24px rgba(13, 27, 75, 0.15);
  --shadow-lg: 0 12px 40px rgba(13, 27, 75, 0.20);
  --radius: 14px;
  --radius-sm: 8px;
  --transition: 0.2s ease;
}

/* ---- Reset & Base ---- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--off-white);
  color: var(--navy);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

/* Sticky footer — sections fill remaining viewport height */
body>section {
  flex: 1;
}

/* ---- Navbar ---- */
.navbar {
  background: var(--navy);
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar__inner {
  max-width: 1100px;
  margin: auto;
  padding: 0 1.5rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar__brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--white);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.3px;
  cursor: pointer;
}

.navbar__brand-logo {
  height: 28px;
  width: auto;
  display: block;
}

.navbar__brand span strong {
  color: var(--gold);
}

.navbar__links {
  display: flex;
  gap: 0.25rem;
}

.nav-link {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.nav-link:hover,
.nav-link.active {
  background: rgba(255, 255, 255, 0.12);
  color: var(--white);
}

.nav-link.active {
  color: var(--gold);
  font-weight: 600;
}

/* Mobile nav */
@media (max-width: 600px) {
  .navbar__brand span {
    display: none;
  }

  .nav-link {
    padding: 0.5rem 0.7rem;
    font-size: 0.82rem;
  }
}

/* ---- Hero ---- */
.hero {
  background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 50%, var(--navy-light) 100%);
  color: var(--white);
  padding: 5rem 1.5rem 4rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='40' fill='none' stroke='rgba(255,255,255,0.03)' stroke-width='20'/%3E%3Cline x1='10' y1='50' x2='90' y2='50' stroke='rgba(255,255,255,0.03)' stroke-width='2'/%3E%3C/svg%3E") center/cover;
}

.hero__title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 900;
  letter-spacing: -1.5px;
  line-height: 1.1;
  margin-bottom: 1rem;
  position: relative;
}

.hero__title span {
  color: var(--gold);
}

.hero__subtitle {
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.75);
  max-width: 500px;
  margin: 0 auto 2rem;
  line-height: 1.6;
  position: relative;
}

.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 0.4rem 1rem;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-bottom: 2rem;
  backdrop-filter: blur(8px);
  position: relative;
}

/* ---- Main Content ---- */
.main-content {
  flex: 1;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  padding: 2rem 1.5rem 4rem;
}

/* ---- Section headings ---- */
.section-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--navy);
  margin-bottom: 1.25rem;
}

.section-title span {
  color: var(--navy-light);
  font-weight: 400;
}

/* ---- Match Cards Grid ---- */
.matches-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.match-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  border: 1.5px solid transparent;
  position: relative;
  overflow: hidden;
}

.match-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--navy), var(--navy-light));
  opacity: 0;
  transition: opacity var(--transition);
}

.match-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--gray-200);
}

.match-card:hover::before {
  opacity: 1;
}

.match-card__round {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--navy-light);
  margin-bottom: 1rem;
}

.match-card__teams {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.team {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--navy);
  flex: 1;
}

.team.home {
  text-align: left;
}

.team.away {
  text-align: right;
}

.match-card__vs {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-400);
  flex-shrink: 0;
}

.match-card__score {
  text-align: center;
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: -2px;
  color: var(--navy);
  margin-bottom: 0.5rem;
}

.match-card__date {
  font-size: 0.8rem;
  color: var(--gray-400);
  margin-bottom: 1rem;
}

.match-card__cta {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--navy-light);
  opacity: 0;
  transition: opacity var(--transition);
}

.match-card:hover .match-card__cta {
  opacity: 1;
}

/* ---- Matches page ---- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.filter-bar label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-600);
}

.filter-select {
  appearance: none;
  background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%230D1B4B' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 1rem center;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 0.55rem 2.5rem 0.55rem 1rem;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--navy);
  cursor: pointer;
  transition: border-color var(--transition);
  min-width: 180px;
}

.filter-select:focus {
  outline: none;
  border-color: var(--navy);
}

/* ---- Match Detail ---- */
.match-header {
  background: linear-gradient(135deg, var(--navy-dark), var(--navy));
  color: var(--white);
  border-radius: var(--radius);
  padding: 2rem 2rem 2.5rem;
  margin-bottom: 2rem;
  position: relative;
}

.btn-back {
  font-size: 0.82rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.65);
  padding: 0.3rem 0;
  margin-bottom: 1.5rem;
  display: inline-block;
  transition: color var(--transition);
}

.btn-back:hover {
  color: var(--white);
}

.match-header__round {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--gold);
  font-weight: 700;
  margin-bottom: 1rem;
}

.match-header__teams {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  font-size: clamp(1rem, 3vw, 1.4rem);
  font-weight: 800;
  text-align: center;
}

.match-header__score {
  background: rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  padding: 0.4rem 1.2rem;
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 900;
  letter-spacing: -1px;
  white-space: nowrap;
}

/* ---- Referee Cards ---- */
.referees-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.referee-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1.5px solid var(--gray-200);
  text-align: center;
  transition: box-shadow var(--transition);
}

.referee-card:hover {
  box-shadow: var(--shadow-md);
}

.referee-card__role {
  display: inline-block;
  background: var(--navy);
  color: var(--white);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 0.25rem 0.8rem;
  border-radius: 999px;
  margin-bottom: 1.5rem;
}

.referee-card__photo {
  margin-bottom: 1rem;
}

.referee-avatar,
.rank-avatar--initials {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--navy), var(--navy-light));
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 800;
  margin: 0 auto;
}

.referee-card__photo img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto;
  border: 3px solid var(--gray-200);
}

.referee-card__name {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--navy);
}

.referee-card__score {
  font-size: 2.5rem;
  font-weight: 900;
  letter-spacing: -2px;
  margin-bottom: 0.2rem;
}

.referee-card__votes-count {
  font-size: 0.78rem;
  color: var(--gray-400);
  margin-bottom: 1.5rem;
}

.score--positive {
  color: var(--green);
}

.score--negative {
  color: var(--red);
}

.score--neutral {
  color: var(--gray-600);
}

/* ---- Vote Buttons ---- */
.referee-card__actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 0.75rem;
}

.vote-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  font-size: 1.8rem;
  border: 2.5px solid var(--gray-200);
  background: var(--white);
  transition: all var(--transition);
  line-height: 1;
}

.vote-btn:hover:not(:disabled) {
  transform: scale(1.12);
}

.vote-btn--up:hover:not(:disabled) {
  background: rgba(28, 198, 126, 0.12);
  border-color: var(--green);
}

.vote-btn--down:hover:not(:disabled) {
  background: rgba(230, 57, 70, 0.12);
  border-color: var(--red);
}

.vote-btn--active-up {
  background: rgba(28, 198, 126, 0.15);
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(28, 198, 126, 0.15);
}

.vote-btn--active-down {
  background: rgba(230, 57, 70, 0.15);
  border-color: var(--red);
  box-shadow: 0 0 0 4px rgba(230, 57, 70, 0.15);
}

.vote-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.voted-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gray-600);
  margin-top: 0.25rem;
}

/* ---- Ranking Table ---- */
.ranking-table-wrapper {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  border: 1.5px solid var(--gray-200);
}

.ranking-table {
  width: 100%;
  border-collapse: collapse;
}

.ranking-table th {
  background: var(--navy);
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 1rem 1.25rem;
  text-align: left;
}

.ranking-table th:last-child {
  text-align: center;
}

.ranking-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}

.ranking-table tr:last-child td {
  border-bottom: none;
}

.ranking-table tr:hover td {
  background: var(--off-white);
}

.ranking-top td {
  background: rgba(245, 197, 24, 0.06);
}

.rank-pos {
  font-size: 1.1rem;
  font-weight: 700;
  width: 50px;
}

.rank-name__inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
}

.rank-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.rank-avatar--initials {
  width: 38px !important;
  height: 38px !important;
  font-size: 0.85rem !important;
  margin: 0 !important;
  /* override 'margin: 0 auto' from referee-avatar */
  flex-shrink: 0 !important;
}

.rank-score {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -1px;
}

.rank-votes {
  text-align: center;
  font-size: 0.9rem;
  color: var(--gray-600);
}

/* ---- Spinner ---- */
.spinner {
  display: flex;
  justify-content: center;
  padding: 3rem 0;
}

.spinner div {
  width: 40px;
  height: 40px;
  border: 4px solid var(--gray-200);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

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

/* ---- Empty / Error states ---- */
.empty-msg,
.error-msg {
  text-align: center;
  padding: 3rem 1rem;
  font-size: 0.95rem;
  color: var(--gray-400);
  font-weight: 500;
}

.error-msg {
  color: var(--red);
}

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(calc(100% + 3rem));
  background: var(--navy);
  color: var(--white);
  padding: 0.8rem 1.5rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 999;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
}

.toast--visible {
  transform: translateX(-50%) translateY(0);
}

.toast--success {
  background: var(--green);
}

.toast--error {
  background: var(--red);
}

/* ---- Footer ---- */
.footer {
  background: var(--navy-dark);
  color: rgba(255, 255, 255, 0.4);
  text-align: center;
  font-size: 0.78rem;
  padding: 1.25rem;
  letter-spacing: 0.3px;
}

.footer strong {
  color: rgba(255, 255, 255, 0.7);
}

/* ---- Responsive ---- */
@media (max-width: 700px) {
  .match-header__teams {
    flex-direction: column;
    gap: 0.5rem;
  }

  .referees-grid {
    grid-template-columns: 1fr;
  }

  .matches-grid {
    grid-template-columns: 1fr;
  }

  .ranking-table th:last-child,
  .ranking-table td:last-child {
    display: none;
  }
}