/**
 * Style dla Systemu Turniejów Wewnętrznych
 * Interaktywne tabele z sortowaniem
 */

/* Kontener główny */
#turniejeTablesContainer {
  margin-top: 30px;
}

#tournamentSeasonSwitcher {
  margin-top: 20px;
}

.season-switcher {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  background: var(--card);
  padding: 16px 20px;
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--border);
}

.season-switcher__label {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.season-switcher__chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.season-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
  color: var(--text);
}

.season-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(51, 54, 135, 0.15);
}

.season-chip.active {
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 70%, transparent));
  color: white;
  border-color: transparent;
  box-shadow: 0 6px 16px rgba(51, 54, 135, 0.25);
}

.season-chip__badge {
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.25);
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.season-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  background: var(--card);
  border-radius: 16px;
  padding: 18px 24px;
  margin-bottom: 24px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.season-summary__info h3 {
  margin: 0;
  font-size: 1.4rem;
}

.season-summary__info p {
  margin: 4px 0 0;
  color: var(--text-muted);
}

.season-summary__stats {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.season-summary__stats strong {
  font-size: 1.8rem;
  color: var(--text);
}

.season-summary__target {
  font-weight: 700;
}

@media (max-width: 768px) {
  .season-switcher,
  .season-summary {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Nawigacja między turniejami */
.tournament-navigation {
  background: var(--card);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 30px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.tournament-nav-header h3 {
  margin: 0 0 15px;
  color: var(--text);
  font-size: 1.1rem;
}

.tournament-nav-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 15px;
}

.tournament-nav-btn {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 10px 15px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  min-width: 80px;
}

.tournament-nav-btn:hover {
  background: linear-gradient(135deg, 
    color-mix(in srgb, var(--primary) 60%, var(--surface) 40%),
    color-mix(in srgb, var(--primary) 40%, var(--surface) 60%)
  );
  color: var(--text);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Upewnij się, że tekst przy hover jest widoczny */
.tournament-nav-btn:hover .nav-btn-number,
.tournament-nav-btn:hover .nav-btn-month {
  color: var(--text);
  opacity: 1;
}

.tournament-nav-btn.active {
  background: linear-gradient(135deg, 
    var(--primary),
    color-mix(in srgb, var(--primary) 85%, var(--surface) 15%)
  );
  color: white;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 30%, transparent),
              0 6px 20px rgba(0, 0, 0, 0.25),
              inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transform: scale(1.05) translateY(-2px);
  position: relative;
}

/* Dodaj wskaźnik wybranego kafelka */
.tournament-nav-btn.active::after {
  content: '✓';
  position: absolute;
  top: -10px;
  right: -10px;
  background: var(--ok);
  color: white;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Upewnij się, że tekst w aktywnym przycisku jest zawsze widoczny */
.tournament-nav-btn.active .nav-btn-number,
.tournament-nav-btn.active .nav-btn-month {
  color: white;
  opacity: 1;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.nav-btn-number {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
}

.nav-btn-month {
  font-size: 0.85rem;
  margin-top: 5px;
  text-transform: uppercase;
  opacity: 0.8;
}

.nav-btn-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--warn);
  color: black;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 600;
}

.tournament-nav-controls {
  display: flex;
  gap: 10px;
  padding-top: 15px;
  border-top: 1px solid var(--border);
}

.nav-control-btn {
  background: transparent;
  border: 2px solid rgba(51, 54, 135, 0.15);
  border-radius: 12px;
  padding: 10px 18px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text);
}

[data-theme="dark"] .nav-control-btn {
  border-color: rgba(255, 255, 255, 0.15);
}

.nav-control-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(51, 54, 135, 0.2);
  background: color-mix(in srgb, var(--primary) 5%, transparent);
}

/* Wrapper dla tabel */
.tournament-tables-wrapper {
  min-height: 400px;
}

/* Wrapper pojedynczej tabeli */
.tournament-table-wrapper {
  background: var(--card);
  border-radius: 20px;
  padding: 0;
  margin-bottom: 40px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.tournament-table-wrapper:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

/* Nagłówek tabeli z logo */
.tournament-table-header {
  background: linear-gradient(135deg, var(--brand) 0%, #1a1a4d 100%);
  color: white;
  padding: 25px;
  border-radius: 20px 20px 0 0;
  position: relative;
}

/* Zapewnij, że tekst w nagłówku zawsze jest widoczny */
.tournament-table-header .tournament-title,
.tournament-table-header .tournament-subtitle,
.tournament-table-header .tournament-info {
  color: white;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.tournament-logos {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
}

.logo-kts,
.logo-sponsor {
  width: 150px;
  height: 100px;
  object-fit: contain;
}

.logo-sponsor {
  width: 200px; /* Auto Andreas logo większe */
  height: 100px;
}

/* Logo na ciemnym tle - używamy białego tła pod logo dla lepszej widoczności */
.tournament-table-header .logo-kts,
.tournament-table-header .logo-sponsor {
  background: rgba(255, 255, 255, 0.95);
  padding: 10px;
  border-radius: 10px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
  filter: none;
  mix-blend-mode: normal;
  opacity: 1;
}

.tournament-title-wrapper {
  flex: 1;
  text-align: center;
}

.tournament-title {
  font-size: 1.8rem;
  font-weight: 700;
  margin: 0 0 5px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  letter-spacing: 1px;
}

.tournament-subtitle {
  font-size: 1.3rem;
  font-weight: 500;
  margin: 0 0 10px;
  opacity: 0.95;
}

.tournament-info {
  font-size: 1rem;
  opacity: 0.9;
  margin: 0;
}

/* Kontener tabeli */
.tournament-table-container {
  padding: 20px;
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  scrollbar-color: color-mix(in srgb, var(--primary) 45%, transparent) color-mix(in srgb, var(--surface) 85%, transparent);
  scrollbar-width: thin;
}

.tournament-table-container::-webkit-scrollbar {
  height: 10px;
}

.tournament-table-container::-webkit-scrollbar-track {
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  border-radius: 999px;
}

.tournament-table-container::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--primary) 45%, transparent);
  border-radius: 999px;
}

.tournament-table-container::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--primary) 60%, transparent);
}

/* Przyciski eksportu i sekcja pomocy */
.export-buttons {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-bottom: 20px;
}

/* Sekcja pomocy */
.tournament-help-section {
  margin-bottom: 10px;
}

.help-btn {
  padding: 10px 18px;
  border: 2px solid rgba(51, 54, 135, 0.15);
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] .help-btn {
  border-color: rgba(255, 255, 255, 0.15);
}

.help-btn:hover {
  border-color: color-mix(in srgb, var(--primary) 80%, transparent);
  color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(51, 54, 135, 0.12);
  background: color-mix(in srgb, var(--primary) 15%, var(--surface) 85%);
}

.help-btn.active,
.help-btn:active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 4px 16px rgba(51, 54, 135, 0.3);
}

.help-content {
  margin-top: 15px;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: top;
}

.help-content[style*="display: none"] {
  animation: none;
}

.help-content.show {
  animation: slideDown 0.3s ease;
}

.help-content.hide {
  animation: slideUp 0.3s ease;
}

.help-card {
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--surface) 98%, var(--primary) 2%),
    var(--surface)
  );
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 15px;
}

.help-card h4 {
  margin: 0 0 15px;
  color: var(--primary);
  font-size: 1.1rem;
}

.help-card h5 {
  margin: 15px 0 10px;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
}

.help-card ul {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

.help-card li {
  margin-bottom: 8px;
  line-height: 1.5;
}

.help-card li strong {
  color: var(--text);
}

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    max-height: 800px;
    transform: translateY(0);
  }
}

@keyframes slideUp {
  from {
    opacity: 1;
    max-height: 800px;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    max-height: 0;
    transform: translateY(-10px);
  }
}

.export-buttons-group {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.export-buttons .btn {
  font-size: 0.9rem;
  padding: 10px 18px;
  border: 2px solid rgba(51, 54, 135, 0.15);
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] .export-buttons .btn {
  border-color: rgba(255, 255, 255, 0.15);
}

.export-buttons .btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(51, 54, 135, 0.2);
  background: color-mix(in srgb, var(--primary) 5%, transparent);
}

/* Legenda */
.legend-info {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 10px 15px;
  background: linear-gradient(135deg, 
    color-mix(in srgb, var(--surface) 95%, var(--primary) 5%),
    var(--surface)
  );
  border-radius: 10px;
  border: 1px solid var(--border);
  animation: fadeIn 0.3s ease;
}

.legend-title {
  font-weight: 600;
  color: var(--primary);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.85rem;
  color: var(--muted);
}

.legend-item span {
  font-weight: 700;
  font-size: 1rem;
}

/* Tabela wyników */
.tournament-results-table {
  display: inline-table;
  width: auto;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--bg);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

/* Nagłówek tabeli */
.tournament-results-table thead {
  background: linear-gradient(135deg, 
    color-mix(in srgb, var(--surface) 90%, var(--primary) 10%),
    var(--surface)
  );
}

.tournament-results-table th {
  padding: 15px 12px;
  text-align: center;
  font-weight: 600;
  color: var(--text);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  position: relative;
  user-select: none;
}

.tournament-results-table th.sortable {
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.tournament-results-table th.sortable:hover {
  background: color-mix(in srgb, var(--surface) 80%, var(--primary) 20%);
}

.tournament-results-table th.sorted {
  background: color-mix(in srgb, var(--surface) 85%, var(--primary) 15%);
  color: var(--primary);
  font-weight: 600;
}

/* Ikona sortowania */
.sort-icon {
  display: inline-block;
  margin-left: 5px;
  font-size: 0.85em;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.sortable:hover .sort-icon,
.sorted .sort-icon {
  opacity: 1;
}

/* Komórki tabeli */
.tournament-results-table td {
  padding: 12px 10px;
  text-align: center;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .tournament-results-table td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.tournament-results-table tbody tr {
  transition: background-color 0.2s ease;
}

.tournament-results-table tbody tr:hover {
  background: color-mix(in srgb, var(--bg) 95%, var(--primary) 5%);
}

/* Wiersze top 3 - bazują na atrybucie data-place */
.tournament-results-table tr[data-place="1"],
.tournament-results-table tr[data-place="2"],
.tournament-results-table tr[data-place="3"] {
  background: linear-gradient(90deg,
    rgba(255, 215, 0, 0.05) 0%,
    rgba(255, 215, 0, 0.02) 100%
  );
}

/* Komórka miejsca */
.place-cell {
  font-weight: 700;
  font-size: 1.1rem;
  position: relative;
}

.place-cell.gold {
  color: #FFD700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.place-cell.silver {
  color: #C0C0C0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.place-cell.bronze {
  color: #CD7F32;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.medal-icon {
  display: inline-block;
  margin-left: 5px;
  font-size: 1.2em;
}

/* Komórka nazwiska */
.name-cell {
  text-align: left !important;
  font-weight: 500;
  padding-left: 20px !important;
  white-space: nowrap;
  min-width: max-content;
}

/* Komórki punktów */
.points-cell {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--primary);
}

.points-cell.adjusted {
  color: var(--acc);
  background: color-mix(in srgb, var(--bg) 95%, var(--acc) 5%);
}

/* Komórki wyników turniejów */
.result-cell {
  position: relative;
  min-width: 80px;
}

.result-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.result-cell .points {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text);
}

.result-cell .place {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 2px;
}

.result-cell.top-result {
  background: color-mix(in srgb, var(--bg) 90%, var(--ok) 10%);
}

.result-cell:hover {
  background: color-mix(in srgb, var(--bg) 85%, var(--primary) 15%);
}

/* Podświetlenie przy sortowaniu po turnieju */
.result-cell.highlighted-tournament {
  background: color-mix(in srgb, var(--bg) 85%, var(--primary) 15%);
  border: 2px solid var(--primary);
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.1);
  padding-bottom: 15px; /* Dodatkowa przestrzeń dla wskaźnika różnicy */
}

.result-cell.tournament-gold {
  background: linear-gradient(135deg, 
    rgba(255, 215, 0, 0.3) 0%, 
    rgba(255, 215, 0, 0.1) 100%
  );
  border-color: #FFD700;
}

.result-cell.tournament-silver {
  background: linear-gradient(135deg, 
    rgba(192, 192, 192, 0.3) 0%, 
    rgba(192, 192, 192, 0.1) 100%
  );
  border-color: #C0C0C0;
}

.result-cell.tournament-bronze {
  background: linear-gradient(135deg, 
    rgba(205, 127, 50, 0.3) 0%, 
    rgba(205, 127, 50, 0.1) 100%
  );
  border-color: #CD7F32;
}

/* Medal w komórce turnieju */
.tournament-medal {
  position: absolute;
  top: -8px;
  right: -8px;
  font-size: 1.2rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
  animation: medalPulse 1s ease-in-out;
}

/* Wskaźnik różnicy miejsc */
.place-diff {
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  animation: diffSlide 0.5s ease-out;
}

.place-diff.better {
  background: linear-gradient(135deg, #4CAF50, #45a049);
  color: white;
  box-shadow: 0 2px 4px rgba(76, 175, 80, 0.3);
}

.place-diff.worse {
  background: linear-gradient(135deg, #f44336, #da190b);
  color: white;
  box-shadow: 0 2px 4px rgba(244, 67, 54, 0.3);
}

.place-diff.same {
  background: linear-gradient(135deg, #9E9E9E, #757575);
  color: white;
  box-shadow: 0 2px 4px rgba(158, 158, 158, 0.3);
}

@keyframes diffSlide {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes medalPulse {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Nagłówki turniejów */
.turniej-header {
  background: color-mix(in srgb, var(--surface) 95%, var(--acc) 5%);
  min-width: 90px;
  white-space: nowrap; /* Zapobiegaj łamaniu tekstu */
}

/* Zapewnij, że nagłówki turniejów są dobrze wyrównane */
.tournament-results-table th.turniej-header {
  text-align: center;
  padding-left: 8px;
  padding-right: 8px;
}

/* Zapewnij, że tabela nie łamie kolumn */
.tournament-results-table {
  table-layout: auto; /* Automatyczne dopasowanie szerokości kolumn */
}

.tournament-results-table thead tr {
  display: table-row; /* Upewnij się, że nagłówki są w jednym rzędzie */
}

.tournament-results-table th {
  display: table-cell; /* Upewnij się, że każdy nagłówek jest w swojej kolumnie */
  vertical-align: middle;
}

/* Podświetlenie nagłówka sortowanego turnieju */
.tournament-results-table th.sorted.turniej-header {
  background: linear-gradient(135deg, 
    color-mix(in srgb, var(--primary) 100%, transparent),
    color-mix(in srgb, var(--primary) 70%, var(--surface) 30%)
  );
  color: var(--text);
  font-weight: 700;
  box-shadow: inset 0 -3px 0 var(--primary);
  position: relative;
}

/* Dodaj podkreślenie dla lepszej widoczności */
.tournament-results-table th.sorted.turniej-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary);
}

[data-theme="dark"] .tournament-results-table th.sorted.turniej-header {
  background: linear-gradient(135deg, 
    color-mix(in srgb, var(--primary) 30%, var(--surface) 70%),
    color-mix(in srgb, var(--primary) 15%, var(--surface) 85%)
  );
  color: var(--text);
}

/* Responsywność - Tablet */
@media (max-width: 1024px) {
  .tournament-table-wrapper {
    border-radius: 16px;
  }
  
  .tournament-table-header {
    padding: 20px;
  }
  
  .tournament-title {
    font-size: 1.5rem;
  }
  
  .tournament-subtitle {
    font-size: 1.1rem;
  }
  
  .logo-kts {
    width: 100px;
    height: 70px;
  }
  
  .logo-sponsor {
    width: 130px;
    height: 70px;
  }
  
  .tournament-results-table {
    font-size: 0.95rem;
  }

  .tournament-results-table th,
  .tournament-results-table td {
    padding: 10px 8px;
  }

  .name-cell {
    min-width: max-content;
    white-space: nowrap;
  }
}

/* Responsywność - Mobile */
@media (max-width: 767px) {
  .tournament-logos {
    flex-direction: column;
    gap: 15px;
  }
  
  .logo-kts {
    width: 80px;
    height: 60px;
  }
  
  .logo-sponsor {
    width: 110px;
    height: 60px;
  }
  
  .tournament-title {
    font-size: 1.2rem;
  }
  
  .tournament-subtitle {
    font-size: 1rem;
  }
  
  .tournament-info {
    font-size: 0.85rem;
  }
  
  .tournament-table-container {
    padding: 15px;
    overflow-x: auto;
  }
  
  .tournament-results-table {
    min-width: 600px;
    font-size: 0.85rem;
  }
  
  .export-buttons {
    justify-content: center;
  }
  
  .export-buttons .btn {
    font-size: 0.8rem;
    padding: 6px 12px;
  }
  
  .tournament-results-table th,
  .tournament-results-table td {
    padding: 8px 5px;
  }
  
  .name-cell {
    min-width: max-content;
    padding-left: 10px !important;
    white-space: nowrap;
  }
  
  .result-cell {
    min-width: 70px; /* Zwiększ minimalną szerokość */
  }
  
  /* Nagłówki turniejów na mobile */
  .turniej-header {
    min-width: 70px; /* Dopasuj do szerokości komórek */
    font-size: 0.75rem; /* Zmniejsz czcionkę jeśli trzeba */
    padding: 8px 4px;
  }
  
  .medal-icon {
    display: block;
    margin: 5px auto 0;
  }
}

/* Animacje */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tournament-table-wrapper {
  animation: fadeIn 0.5s ease-out;
}

/* Dark mode adjustments */
[data-theme="dark"] .tournament-table-header {
  background: linear-gradient(135deg, 
    color-mix(in srgb, var(--brand) 80%, white 20%) 0%, 
    color-mix(in srgb, #1a1a4d 80%, white 20%) 100%
  );
}

/* Logo w dark mode pozostają białe dzięki filtrowi invert */

[data-theme="dark"] .tournament-results-table {
  background: var(--surface);
}

[data-theme="dark"] .tournament-results-table thead {
  background: linear-gradient(135deg, 
    color-mix(in srgb, var(--card) 90%, var(--primary) 10%),
    var(--card)
  );
}

[data-theme="dark"] .result-cell.top-result {
  background: color-mix(in srgb, var(--surface) 90%, var(--ok) 10%);
}

[data-theme="dark"] .points-cell.adjusted {
  background: color-mix(in srgb, var(--surface) 95%, var(--acc) 5%);
}

/* Print styles */
@media print {
  .export-buttons {
    display: none !important;
  }
  
  .tournament-table-wrapper {
    box-shadow: none;
    page-break-inside: avoid;
  }
  
  .tournament-table-header {
    background: none;
    color: black;
    border: 2px solid #333;
  }
  
  .logo-kts,
  .logo-sponsor {
    filter: none;
  }
  
  .tournament-results-table {
    box-shadow: none;
    border: 1px solid #333;
  }
}