/* Tournament Results CSS - Dark Theme */

/* Global responsive fixes */
@media screen and (max-width: 768px) {
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }
  
  /* Ensure content uses full width in news posts */
  .news-detail {
    padding: 0 !important;
    max-width: 100% !important;
  }
  
  .news-content {
    padding: 0 !important;
  }
}

/* Tournament results inside news posts */
.news-content .tournament-winners,
.news-content .tournament-results {
  margin-left: -20px;
  margin-right: -20px;
  width: calc(100% + 40px);
  max-width: none;
  box-sizing: border-box;
}

@media screen and (max-width: 768px) {
  .news-content .tournament-winners,
  .news-content .tournament-results {
    margin-left: -15px;
    margin-right: -15px;
    width: calc(100% + 30px);
    border-radius: 0;
  }
}

.tournament-winners {
  background-color: #2A2A2A;
  color: #F0F0F0;
  padding: 20px;
  margin-bottom: 25px;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  border: 1px solid #444444;
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
}

.tournament-winners h2 {
  color: #FFFFFF;
  margin-top: 0;
  margin-bottom: 15px;
  font-size: 1.5rem;
  border-bottom: 1px solid #444444;
  padding-bottom: 10px;
  position: sticky;
  top: 0;
  background-color: #2A2A2A;
  z-index: 10;
}

.winners-list {
  list-style-type: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.winner-item {
  background-color: #333333;
  padding: 10px 15px;
  border-radius: 6px;
  margin-bottom: 5px;
  transition: all 0.3s ease;
  flex: 1 1 200px;
  display: flex;
  align-items: center;
}

.medal-icon {
  font-size: 2em; /* Make medal icons twice as big */
  margin-right: 10px;
  display: inline-block;
}

.winner-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.winner-position-1 {
  background-color: rgba(255, 215, 0, 0.2);
  color: #FFD700;
  border-left: 4px solid #FFD700;
  font-weight: bold;
}

.winner-position-2 {
  background-color: rgba(192, 192, 192, 0.2);
  color: #E0E0E0;
  border-left: 4px solid #C0C0C0;
  font-weight: bold;
}

.winner-position-3 {
  background-color: rgba(205, 127, 50, 0.2);
  color: #DDA06E;
  border-left: 4px solid #CD7F32;
  font-weight: bold;
}

.tournament-results {
  background-color: #2A2A2A;
  color: #F0F0F0;
  padding: 20px;
  margin-bottom: 25px;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  border: 1px solid #444444;
  overflow: visible;
  width: 100%;
  box-sizing: border-box;
}

.tournament-results h2 {
  color: #FFFFFF;
  margin-top: 0;
  margin-bottom: 15px;
  font-size: 1.5rem;
  border-bottom: 1px solid #444444;
  padding-bottom: 10px;
  position: sticky;
  top: 0;
  background-color: #2A2A2A;
  z-index: 10;
}

.results-table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 15px;
  position: relative;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid #444444;
  min-width: 100%;
}

.results-table thead {
  z-index: 5;
}

.results-table th {
  background-color: #333333;
  color: #FFFFFF;
  padding: 12px 8px;
  text-align: center;
  font-weight: bold;
  border-bottom: 2px solid #555555;
}

.results-table td {
  padding: 12px 8px;
  border-bottom: 1px solid #444444;
  vertical-align: middle;
  text-align: center;
}

.results-table tr:hover {
  background-color: #383838;
}

.results-table tr:nth-child(even) {
  background-color: #252525;
}

.results-table tr:nth-child(even):hover {
  background-color: #383838;
}

.player-row.top-position {
  font-weight: bold;
}

.player-row.position-1 {
  background-color: rgba(255, 215, 0, 0.15) !important;
}

.player-row.position-2 {
  background-color: rgba(192, 192, 192, 0.15) !important;
}

.player-row.position-3 {
  background-color: rgba(205, 127, 50, 0.15) !important;
}

.match-row .match-winner {
  font-weight: bold;
  color: #FFFFFF;
}

/* Bracket Styles */
.bracket-container {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  gap: 30px;
  margin: 20px 0;
  overflow-x: auto;
  padding-bottom: 20px;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  position: relative;
  /* Prevent page scrolling when scrolling the bracket */
  scroll-behavior: smooth;
}

.bracket-round {
  display: flex;
  flex-direction: column;
  position: relative;
  min-width: 220px;
  flex-shrink: 0;
}

.bracket-round:nth-child(2) {
  padding-top: 40px;
}

.bracket-round:nth-child(3) {
  padding-top: 120px;
}

.bracket-title {
  text-align: center;
  margin-bottom: 15px;
  font-weight: bold;
  color: #FFFFFF;
}

.bracket-match {
  background-color: #333333;
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 30px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  position: relative;
  z-index: 2;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: 1px solid #555555;
  width: 100%;
  box-sizing: border-box;
  overflow: visible;
  display: block;
}

.bracket-match:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Removing connecting lines between match boxes */
/*
.bracket-match::after {
  content: '';
  position: absolute;
  width: 30px;
  height: 2px;
  background-color: #444;
  right: -30px;
  top: 50%;
  z-index: 1;
}

.bracket-match.final-match::after {
  display: none;
}
*/

.bracket-player {
  padding: 5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  width: 100%;
  box-sizing: border-box;
}

/* Style for player avatars in brackets */
.bracket-player-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid #555555;
  margin-right: 6px;
  flex-shrink: 0;
  background-color: #2A2A2A;
}

/* Style for placeholder icon when no player picture is available */
.bracket-player-avatar-icon {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: #333333;
  border-radius: 50%;
  border: 1px solid #555555;
  margin-right: 6px;
  flex-shrink: 0;
  text-align: center; /* Ensure icon is centered inside */
}

.bracket-player-avatar-icon i {
  font-size: 14px;
  color: #888888;
  display: inline-block; /* Ensure proper display */
  width: 100%; /* Take full width of container */
  text-align: center; /* Center the icon */
}

/* Player name styles */
.bracket-player-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bracket-player.winner {
  font-weight: bold;
  color: #66BB6A; /* Lighter green color for winners */
}

.bracket-player.winner .bracket-player-avatar,
.bracket-player.winner .bracket-player-avatar-icon {
  border-color: #66BB6A;
}

.bracket-player:not(.winner) {
  color: #EF9A9A; /* Lighter red color for losers */
}

.bracket-player:not(.winner) .bracket-player-avatar,
.bracket-player:not(.winner) .bracket-player-avatar-icon {
  border-color: #EF9A9A;
}

.bracket-player:first-child {
  border-bottom: 1px dotted #555555;
}

.bracket-score {
  font-weight: bold;
  min-width: 25px;
  text-align: center;
  color: #FFFFFF;
  flex-shrink: 0;
}

/* Media queries for responsive brackets */
@media screen and (max-width: 480px) {
  .bracket-player-avatar,
  .bracket-player-avatar-icon {
    width: 20px;
    height: 20px;
    margin-right: 4px;
  }
  
  .bracket-player-avatar-icon {
    font-size: 12px;
  }
  
  .bracket-player {
    padding: 3px;
    font-size: 13px;
  }
}

/* Removing connector elements since we're not showing connecting lines */
/*
.bracket-connector {
  position: absolute;
  right: -30px;
  height: 60px;
  width: 30px;
  top: 0;
  border-right: 2px solid #444;
  border-bottom: 2px solid #444;
}
*/

.bracket-third-place {
  margin-top: 60px;
  border-top: 2px dashed #555555;
  padding-top: 15px;
}

.bracket-third-place-title {
  text-align: center;
  margin-bottom: 10px;
  font-size: 0.9em;
  color: #BBBBBB;
}

/* Improved Mobile Responsiveness */
@media screen and (max-width: 768px) {
  .tournament-winners, .tournament-results {
    padding: 15px;
    margin-left: 0;
    margin-right: 0;
    border-radius: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  
  /* Fix news display */
  .news-detail .tournament-winners,
  .news-detail .tournament-results {
    margin-left: -15px;
    margin-right: -15px;
    width: calc(100% + 30px);
  }
  
  .results-table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .results-table {
    font-size: 14px;
    width: 100%;
    min-width: 100%;
    max-width: none;
    box-sizing: border-box;
    margin: 0;
  }
  
  .results-table th, .results-table td {
    padding: 8px 4px;
  }

  /* Ensure text doesn't wrap in tables */
  .results-table th, .results-table td {
    white-space: nowrap;
  }
  
  .winners-list {
    flex-direction: column;
  }

  .bracket-container {
    gap: 15px;
    padding-bottom: 15px;
    /* Ensure horizontal scrolling works properly on mobile */
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    width: 100%;
  }

  .bracket-round {
    min-width: 180px;
  }

  /* Add horizontal scroll indicator for mobile users */
  .tournament-results:has(.bracket-container) {
    position: relative;
  }
  
  .tournament-results:has(.bracket-container)::after {
    content: "⟷ Scroll horizontally";
    position: absolute;
    bottom: 5px;
    right: 15px;
    font-size: 12px;
    color: #999;
    background-color: rgba(42, 42, 42, 0.8);
    padding: 2px 8px;
    border-radius: 4px;
  }
}

@media screen and (max-width: 480px) {
  .tournament-winners h2, .tournament-results h2 {
    font-size: 1.2rem;
  }
  
  /* Ensure news content on mobile uses full width */
  .news-detail .news-content {
    padding: 0;
  }
  
  .news-detail .tournament-winners,
  .news-detail .tournament-results {
    margin-left: -15px;
    margin-right: -15px;
    border-radius: 0;
    width: calc(100% + 30px);
    box-sizing: border-box;
  }
  
  .results-table {
    font-size: 12px;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
  }

  .bracket-round {
    min-width: 150px;
  }
  
  .medal-icon {
    font-size: 1.5em;
  }

  .bracket-match {
    padding: 8px;
    width: 100%;
    box-sizing: border-box;
  }
  
  .bracket-player {
    padding: 4px;
    font-size: 13px;
    width: 100%;
    display: flex;
  }
  
  /* Fix player names that could be cut off */
  .bracket-player-name {
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .winner-item {
    flex: none;
    width: 100%;
  }
}

/* Add styles for player avatars in tables */
.results-table .player-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #555555;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  background-color: #2A2A2A;
}

/* Style for placeholder icon when no player picture is available */
.player-avatar-icon {
  width: 40px;
  height: 40px;
  font-size: 24px;
  color: #888888;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #333333;
  border-radius: 50%;
  border: 2px solid #555555;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  margin: 0 auto; /* Center the icon horizontally in the table cell */
}

.position-1 .player-avatar,
.position-1 .player-avatar-icon {
  border-color: #FFD700;
}

.position-2 .player-avatar,
.position-2 .player-avatar-icon {
  border-color: #C0C0C0;
}

.position-3 .player-avatar,
.position-3 .player-avatar-icon {
  border-color: #CD7F32;
}

/* Make table icons more visible */
.results-table th i {
  font-size: 1.2em;
  color: #FFFFFF;
  display: block;
  text-align: center;
  margin: 0 auto;
}

/* Left-align only player name icon */
.results-table th:nth-child(3) i {
  text-align: left;
  margin: 0;
}

.results-table th[title="Wygrane mecze"] i {
  color: #4CAF50;
}

.results-table th[title="Przegrane mecze"] i {
  color: #F44336;
}

/* Make the image column width fixed and ensure content is centered */
.results-table th:first-child {
  width: 60px;
  text-align: center;
}

.results-table td:first-child {
  text-align: center;
  vertical-align: middle;
}

/* Table header styles */
.results-table th {
  background-color: #333333;
  color: #FFFFFF;
  padding: 12px 8px;
  text-align: center;
  font-weight: bold;
  border-bottom: 2px solid #555555;
}

/* Only player name column header is left-aligned */
.results-table th:nth-child(3) {
  text-align: left;
}

/* Table cell styles */
.results-table td {
  padding: 12px 8px;
  border-bottom: 1px solid #444444;
  vertical-align: middle;
  text-align: center;
}

/* Ensure player name is left-aligned */
.results-table td:nth-child(3) {
  text-align: left;
}

/* Align match columns with their headers */
.results-table .matches-won {
  text-align: center;
  color: #4CAF50;
  font-weight: bold;
}

.results-table .matches-lost {
  text-align: center;
  color: #F44336;
  font-weight: bold;
}

/* Responsive adjustments for player avatars */
@media screen and (max-width: 480px) {
  .results-table .player-avatar,
  .player-avatar-icon {
    width: 30px;
    height: 30px;
    border-width: 1px;
  }
  
  .player-avatar-icon {
    font-size: 18px;
  }
  
  .results-table th:first-child {
    width: 40px;
  }
} 