@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@400;500;600;700&display=swap');
@import url('stats_dashboard.css');

:root {
  --primary-color: #ff006b;
  --bg-color: rgba(13, 17, 23, 1);
  --text-color: #ffffff;
  --card-bg: rgba(13, 17, 23, 1);
  --border-color: rgba(19, 25, 34, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: 'Rajdhani', sans-serif;
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: inherit;
}

ul {
  list-style: none;
}

/* --- NAVIGACE --- */
.site-nav {
  position: fixed;
  top: 0;
  width: 100%;
  background: rgba(13, 17, 23, 1);
  border-bottom: 1px solid var(--border-color);
  z-index: 1000;
}

.nav-inner {
  max-width: 1300px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 90px;
  padding: 0 20px;
}

.logo img {
  height: 40px;
}

.nav-links {
  display: flex;
  gap: 30px;
}

.nav-links a {
  font-weight: 600;
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  position: relative;
  transition: color 0.3s;
}

.nav-links a:hover {
  color: var(--primary-color);
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: var(--primary-color);
  transform: translateX(-50%) scaleX(0);
  transition: transform 0.2s ease;
}

.nav-links a:hover::after {
  transform: translateX(-50%) scaleX(1);
}

.wrap {
  min-height: 660px;
  margin-top: 100px;
}


/* --- TABULKY --- */
.tables-container {
  display: flex;
  gap: 40px;
  flex-wrap: wrap;
}

.group-table {
  flex: 1;
  min-width: 300px;
}

.group-table h3 {
  color: #aaa;
  text-align: center;
  padding-bottom: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: var(--bg-color);
}

th, td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

th {
    background: var(--bg-color);

  color: #ff006b;
  font-weight: bold;
  text-transform: uppercase;
  font-size: 0.9rem;
  letter-spacing: 1px;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover {
  background-color: var(--border-color)
}

.team-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.team-logo-small {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.team-logo-mini {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.text-center {
  text-align: center;
}

/* --- HLAVNÍ SEKCE --- */
main {
  max-width: 1300px;
  margin: 40px auto;
  padding: 0 20px;
}

section {
  margin-bottom: 80px;
}

.section-title {
  font-size: 2rem;
  margin-bottom: 30px;
  border-left: 5px solid var(--primary-color);
  padding-left: 15px;
  text-transform: uppercase;
  letter-spacing: 2px;
}

/* --- HRÁČSKÉ STATISTIKY --- */
.filters {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 15px;
  gap: 10px;
}

.filter-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: #888;
  padding: 5px 15px;
  cursor: pointer;
  text-transform: uppercase;
  font-weight: bold;
  transition: all 0.2s;
}

.filter-btn:hover, .filter-btn.active {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.role-icon-img {
    width: 24px;
    height: 24px;
    display: block;
    margin: 0 auto;
}

.kda-highlight {
    font-weight: bold;
    color: #fff;
}

/* --- ZÁPASY (SERIES & HISTORY) --- */
.matches-list {
  display: flex;
  flex-direction: column;
  background: var(--bg-color);
  gap: 15px;
}

/* --- SERIES DETAIL --- */
.game-tabs {
  display: flex;
  justify-content: center;
  gap: 5px;
  margin: 20px auto;
  background: var(--bg-color);
  padding: 5px;
  border-radius: 8px;
  width: fit-content;
  border: 1px solid var(--border-color);
}

.tab-btn {
  background: transparent;
  border: none;
  padding: 8px 24px;
  border-radius: 6px;
  color: #666;
  cursor: pointer;
  font-weight: bold;
  text-transform: uppercase;
  font-size: 0.8rem;
  transition: all 0.2s;
}

.tab-btn:hover {
  color: #ccc;
  background-color: var(--border-color)
}

.tab-btn.active {
  color: #fff;
  background-color: var(--border-color);

}

.game-detail-content {
  display: none;
}

.game-detail-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.match-comparison {
  display: flex;
  flex-direction: column;
  gap: 0; /* Remove gap to make it tighter */
}

.role-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 0;
  min-height: 60px;
}

.p-side {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 15px;
}

.p-side.left {
  justify-content: flex-end;
  text-align: right;
}

.p-side.right {
  justify-content: flex-start;
  text-align: left;
}

/* Stat Cells */
.stat-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  color: #fff;
  font-size: 0.9rem;
}

.stat-cell small {
  color: #666;
  font-size: 0.7rem;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.stat-cell.kda-cell {
  min-width: 80px;
  align-items: center;
}

.score-val {
  font-weight: bold;
  font-size: 1rem;
  color: #fff;
}

.kda-ratio {
  font-size: 0.75rem;
  color: #888;
}

/* Damage Cell (Name + Bar) */
.dmg-cell {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 140px;
}

.p-side.left .dmg-cell {
  align-items: flex-end;
}

.p-side.right .dmg-cell {
  align-items: flex-start;
}

.p-name {
  color: #fff;
  font-weight: bold;
  font-size: 1rem;
  margin-bottom: 5px;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.p-side.left .bar-row {
  justify-content: flex-end;
}

.p-side.right .bar-row {
  justify-content: flex-start;
}

.bar-bg {
  width: 100px;
  height: 6px;
  background-color: var(--border-color);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.bar-fill {
  height: 100%;
  border-radius: 3px;
}

/* Float bars to correct side visually if needed, but width works from left by default. */
.p-side.left .bar-bg {
  display: flex;
  justify-content: flex-end; 
}

.bar-fill.blue {
  background-color: #00a8ff;
}

.bar-fill.red {
  background-color: #ff4757;
}

.dmg-val {
  color: #888;
  font-size: 0.8rem;
  min-width: 35px;
}

.role-center {
  width: 50px;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0.7;
}

.role-center img, .role-center .role-icon-img {
  width: 24px;
  height: 24px;
  filter: brightness(0.8);
}

.champ-icon {
  width: 42px;
  height: 42px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

@media (max-width: 768px) {
  .role-row {
    flex-wrap: wrap;
    height: auto;
    padding: 10px 0;
  }
  
  .p-side {
    flex-basis: 100%;
    margin-bottom: 10px;
    justify-content: center !important; /* Center content on mobile */
  }
  
  .role-center {
    display: none; /* Hide role icon on very small screens or move it */
  }

  /* Adjust ordering or stacking for mobile if needed */
  .stat-cell {
    min-width: 30px;
    font-size: 0.8rem;
  }
  
  .dmg-cell {
    min-width: 100px;
  }
  
  .bar-bg {
    width: 60px;
  }
}

/* --- STATISTIKY --- */
.stats-table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

.data-table th,
.data-table td {
  padding: 12px 15px;
}

#players-table th:nth-child(2),
#players-table td:nth-child(2) {
  padding-right: 2px;
  width: 1%; /* Shrink to fit content */
}

/* Header sortable styles */
.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 20px;
}

.sortable:hover {
    color: #fff;
}

.sort-icon {
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 5px;
    vertical-align: middle;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    opacity: 0.3;
}

th.sort-asc .sort-icon {
    border-bottom: 4px solid var(--primary-color);
    opacity: 1;
}

th.sort-desc .sort-icon {
    border-top: 4px solid var(--primary-color);
    opacity: 1;
}

/* --- PAGINATION --- */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 20px;
  gap: 10px;
}

.pagination-btn {
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 8px 16px;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
  font-weight: bold;
}

.pagination-btn:hover:not(:disabled) {
  background-color: var(--border-color);
  border-color: var(--bg-color);
  color: var(--primary-color);
}

.pagination-btn.active {
  background-color: var(--primary-color);
  border-color: var(--primary-color);   
  color: #fff;
}

.pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}



/* --- MATCHES (Script.js compatibility) --- */
.match-card {
  overflow: hidden;
  transition: border-color 0.2s;
  border: 1px solid var(--border-color);
}

.match-card:hover {
  border-color: var(--border-color);
}

.match-header {
  padding: 5px 15px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: background-color 0.2s;
  position: relative;
  min-height: 50px;
}

.match-header:hover {
  background-color: var(--border-color);
}

.match-header-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 100%;
}

.match-info-top {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  pointer-events: none;
  box-sizing: border-box;
  font-size: 0.6rem;
  color: #666;
  letter-spacing: 2px;
  font-weight: bold;
  text-transform: uppercase;
}

.team-score-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
  width: 100%;
}

.team-wrapper {
  display: flex;
  align-items: center;
  flex: 1;
}

.team-content {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #888;
  transition: all 0.2s;
  cursor: pointer;
}

.team-content:hover {
  color: #fff;
  transform: translateY(-1px);
}

/* --- TEAMS GRID --- */
.teams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.team-card {
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: all 0.2s ease;
  height: 180px;
}

.team-card:hover {
  background-color: var(--border-color);
}

.team-card-logo {
  width: 80px;
  height: 80px;
  object-fit: contain;
  margin-bottom: 15px;
}

.team-card-name {
  color: #fff;
  font-weight: bold;
  font-size: 1.1rem;
  text-align: center;
  text-transform: uppercase;
}

.team-content.winner {
  color: #fff;
  font-weight: bold;
}

.team-wrapper.left {
  flex-direction: row;
  justify-content: flex-end;
}

.team-wrapper.right {
  flex-direction: row;
  justify-content: flex-start;
}

.t-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.t-name {
  font-size: 1.1rem;
  text-transform: uppercase;
}

.main-score {
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
  padding: 2px 15px;
  min-width: 70px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  gap: 8px;
}

.vs-text {
  font-size: 0.9rem;
  color: #666;
  font-weight: normal;
  margin-top: 2px;
}



@media (max-width: 768px) {
  .team-score-container {
      gap: 10px;
  }
  .t-name {
      display: none;
  }
  .t-logo {
      width: 40px;
      height: 40px;
  }
  .main-score {
      font-size: 1.5rem;
      padding: 5px 15px;
  }
}

.match-detail {
  display: none;
  padding: 20px;
  border-top: 1px solid var(--border-color);
}

/* --- PLAYER PROFILE --- */
.player-header-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--bg-color);
  padding: 30px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  margin-bottom: 30px;
  flex-wrap: wrap;
  gap: 20px;
}

.player-profile-main {
  padding: 30px;
}

.ph-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.ph-team-logo-wrapper img {
  width: 100px;
  height: 100px;
}

.ph-info {
  display: flex;
  flex-direction: column;
}

.ph-role {
  margin-bottom: 5px;
}
.ph-role img, .ph-role .role-icon-img {
    width: 24px;
    height: 24px;
}

.ph-name {
  margin: 0;
  font-size: 2.5rem;
  color: #fff;
  line-height: 1.1;
}

.ph-team-name {
  color: #888;
  font-size: 1.2rem;
  font-weight: bold;
}

.ph-right {
  display: flex;
  gap: 40px;
}

.ph-stat-big {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ph-val {
  font-size: 2.5rem;
  font-weight: bold;
  color: #fff;
  line-height: 1;
}

.ph-label {
  color: #666;
  font-size: 0.9rem;
  letter-spacing: 1px;
  margin-top: 5px;
}

.stats-grid-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 15px;
  margin-bottom: 30px;
}

.stat-card {
  background-color: var(--bg-color);
  padding: 15px;
  border-radius: 8px;
  text-align: center;
  border: 1px solid var(--border-color);
}

.stat-card h3 {
  margin: 0 0 5px 0;
  font-size: 0.8rem;
  color: #888;
}

.stat-card span {
  font-size: 1.5rem;
  font-weight: bold;
  color: #fff;
  display: block;
}

.stat-card small {
  color: #555;
  font-size: 0.7rem;
  text-transform: uppercase;
}

.profile-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
}

@media (max-width: 900px) {
  .profile-split {
    grid-template-columns: 1fr;
  }
  .player-header-card {
    flex-direction: column;
    text-align: center;
  }
  .ph-left {
    flex-direction: column;
  }
}

.pp-champ-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pp-champ-cell img {
  width: 32px;
  height: 32px;
  border-radius: 4px;
}

/* Matches List Simple */
.matches-list-simple {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pp-match-row {
  display: flex;
  align-items: center;
  background-color: var(--bg-color);
  border-radius: 6px;
  overflow: hidden;
  height: 60px;
  padding-right: 15px;
}

.pp-match-result {
  width: 40px;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: bold;
  font-size: 1.1rem;
}

.pp-match-result.win {
  background-color: var(--win-bg-color);
  color: var(--win-color);
  border-right: 2px solid var(--win-color);
}

.pp-match-result.loss {
  background-color: var(--loss-bg-color);
  color: var(--loss-color);
  border-right: 2px solid var(--loss-color);  
}

.pp-match-champ {
  padding: 0 15px;
}

.pp-match-champ img {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  display: block;
}

.pp-match-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.pp-match-meta {
  font-size: 0.8rem;
  color: #888;
}

.pp-match-kda {
  font-weight: bold;
  color: #fff;
  font-size: 1rem;
}

.pp-match-stats {
  display: flex;
  gap: 15px;
  font-size: 0.9rem;
  color: #ccc;
}

.pp-match-stats div {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.pp-match-stats span {
  font-size: 0.7rem;
  color: #666;
  text-transform: uppercase;
}

.btn-back {
  display: inline-block;
  margin-top: 20px;
  color: #ff006b;
  text-decoration: none;
  border: 1px solid #ff006b;
  padding: 10px 20px;
  border-radius: 4px;
  transition: all 0.2s;
}

.btn-back:hover {
  background-color: #ff006b;
  color: #fff;
}

/* --- Team Profile Compact Match History Adjustments --- */
.profile-section .match-card .role-row {
    padding: 2px 0;
    min-height: 40px;
}

.profile-section .match-card .p-side {
    gap: 5px;
}

.profile-section .match-card .champ-icon {
    width: 30px;
    height: 30px;
}

.profile-section .match-card .stat-cell {
    min-width: 30px;
    font-size: 0.75rem;
}

.profile-section .match-card .stat-cell small {
    font-size: 0.6rem;
}

.profile-section .match-card .stat-cell.kda-cell {
    min-width: 60px;
}

.profile-section .match-card .score-val {
    font-size: 0.85rem;
}

.profile-section .match-card .dmg-cell {
    min-width: 80px;
}

.profile-section .match-card .p-name {
    font-size: 0.85rem;
    margin-bottom: 2px;
}

.profile-section .match-card .bar-bg {
    width: 60px;
    height: 4px;
}

.profile-section .match-card .dmg-val {
    font-size: 0.7rem;
    min-width: 25px;
}

.profile-section .match-card .role-center {
    width: 30px;
}

.profile-section .match-card .role-center img,
.profile-section .match-card .role-center .role-icon-img {
    width: 18px;
    height: 18px;
}

/* Compact Header for Profile Matches */
.profile-section .match-card .match-header {
    min-height: 40px;
}

.profile-section .match-card .main-score {
    font-size: 1.2rem;
}

.profile-section .match-card .t-logo {
    width: 28px;
    height: 28px;
}

.profile-section .match-card .t-name {
    font-size: 0.9rem;
}

.profile-section .match-card .match-info-top {
    font-size: 0.5rem;
}
