/* esea.css */
:root {

  /* Main wrapper (ESEA wrapper) ratios */
  --esea-wrapper-width: 85%;
  --sidebar-width: 15%;

  /* Match Info Box */
  --match-info-box-height: clamp(1.5rem, 2vw, 2rem);
  --match-info-box-width: 80%;

  /* Layout Ratios */
  --main-players-box-width: 85%;
  --sub-players-box-width: 15%;
  --team-avatar-width: auto;
  --team-avatar-height: 100%;
  --main-player-avatar-height: 40%;
  --score-box-width: 100px;
  --stage-logo-width: 38px;

  /* Match info team width */
  --match-info-team-width: 40%;
  --match-info-time-width: 20%;
  --match-score-width: 60px;

  /* Spacing & sizing */
  --gap-small: 5px;
  --border-radius-small: 3px;
}

/* === ESEA Content Wrapper === */
.esea-page-wrapper {
  display: flex;
  flex-direction: row;
  justify-content: center;
  width: 100%;
  min-height: 100vh;
  background-color: var(--background);
  color: var(--foreground);
}

.esea-wrapper {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  width: var(--esea-wrapper-width);
  margin: 0 auto;
  background-color: var(--background);
  padding: 20px;
}

.sidebar {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  width: var(--sidebar-width);
}

/* === Todays Matches sidebar === */
.todays-matches {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  height: max-content;
  margin: 10px;
  width: 100%;

  background-color: var(--card-bg);
  border: 1px solid var(--border);
}

.todays-matches-division {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: auto;

  border-bottom: 1px solid var(--primary)
}

.todays-matches-header {
  display: flex;
  width: 100%;
  justify-content: center;
  align-items: center;
  background-color: var(--card-bg-highlight);

  /* font-size: clamp(.6rem, 1rem, 1.5rem); */
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  font-weight: bold;
}
.todays-matches-content {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  width: 100%;
  gap: 10px;
  padding: 5px;
}

.todays-match-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: auto;
  padding: 5px;
  background-color: var(--card-bg-secondary);
  border: 1px solid var(--border);

  /* Make the whole box clickable without looking like a link */
  color: inherit;
  text-decoration: none;
}
.todays-match-box:hover {
  background-color: var(--card-bg-highlight);
  cursor: pointer;
  transition: background-color 0.3s ease;
  color: inherit;
  text-decoration: none;
}

.team {
  display: flex;
  align-items: center;
  width: 100%;
  font-weight: bold;
  padding-inline: 5px;

  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: clamp(0.8rem, 1.2vw, 1rem);
  color: var(--form-text);
  transition: color 0.3s ease;
}
.team.team-left {
  justify-content: flex-start;
}
.team.team-right {
  justify-content: flex-end;
}
.highlight-text {
  color: orange;
}

/* === ESEA Season navbar === */
.season-nav {
  display: flex;
  flex-direction: row;
  justify-content: center;
  margin-top: 20px;
  padding-inline: 10px;}

/* === Division Separator Line === */
.division-separator {
  display: flex;
  flex-direction: row;
  justify-content: between;
  border-bottom: 2px solid var(--secondary);
  /* padding-bottom: 10px; */
  margin-bottom: 20px;
  width: 100%;
}

/* === Team Card Styles === */
.team-card {
  display: flex;
  flex-direction: column;
  
  width: 100%;
  max-width: 1500px;

  height: auto;
  position: relative;
  margin: 1rem auto;
  padding: .5vw;
  background-color: var(--card-bg);
  color: var(--foreground);
  border: var(--border) 1px solid;
}

.team-card-visible {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 150px;
}

.team-card-body {
  display: flex;
  height: 100%;
  width: 100%;
  flex-direction: row;
  align-items: stretch;
  gap: .5rem;
}

.team-card .team-card-body .team-avatar {
  display: flex;
  align-items: center;
  height: 100%;
}

.team-card .team-card-body .team-avatar img {
  width: var(--team-avatar-width);
  height: var(--team-avatar-height);
  aspect-ratio: 1 / 1;
  border-radius: 3px;
  object-fit: cover;
}


/* === Middle box team card === */
.team-card-middle {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  overflow: hidden;
  text-align: center;
  gap: 10px;
}

/* Team name styles */
.team-card-name {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary);

  /* border: green 3px solid; */
}

h3, h4, .team-link {
  font-size: 1.5rem;
}

.team-link {
  text-decoration: none;
  color: var(--primary);
  transition: color 0.3s ease;
}
.team-link:hover {
  text-decoration: underline;
  color: var(--accent);
}


/* === Team Players === */
.team-card-players {
  display: flex;
  flex-direction: row;

  width: 100%;
  height: 100%;
  overflow: hidden;

  /* border: 3px solid white; */
}

.main-players-box {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  width: var(--main-players-box-width);
  height: 100%;
  min-height: 0;
  overflow: hidden;
  box-sizing: border-box;

  /* border: yellow 2px solid; */
}

.main-player {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.main-player-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: var(--main-player-avatar-height);
  min-height: 0;
  overflow: hidden;

  margin-top: 5px;

  position: relative;  /* to enable absolute positioning if needed */

  /* border: 1px solid red; */
}
.main-player-avatar img {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  height: 100%;
  width: auto;  /* maintain aspect ratio */
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  object-fit: cover;
  max-width: 100%;
}

.main-player-name {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  text-align: center;

  /* border: 1px solid blue; */
}
.main-player-name strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  font-size: clamp(0.75rem, 1.5vw, 1rem);

}
.main-player-name img {
  width: clamp(14px, 2vw, 18px);
  height: clamp(10px, 1.5vw, 12px);
  object-fit: contain;
}


/* === Sub player box === */
.sub-players-box {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  align-items: flex-start;
  justify-content: flex-start;
  min-width: 0;
  overflow: hidden;
  height: 100%;
  width: calc(100% - var(--main-players-box-width));
  border-left: 1px solid var(--secondary);
  margin-left: 20px;
  padding-left: 10px;
  box-sizing: border-box;

  /* border: purple 2px solid; */
}

.sub-player {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  flex-grow: 0;
  height: 20px;
  margin-bottom: 2px;
  gap: 5px;

  /* border: orange 1px solid; */
}
.sub-player span {
  flex-shrink: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: clamp(0.6rem, 1.2vw, 1rem);
}
.sub-player img {
  width: clamp(14px, 2vw, 18px);
  height: clamp(10px, 1.5vw, 12px);
  object-fit: contain;
}


/* Score box */
.score-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;

  /* width: var(--score-box-width); */
}

.stage-box {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  
  width: var(--score-box-width);

  border: 2px solid var(--secondary);
  border-radius: 8px;
  gap: 10px;

  z-index: 10;
  cursor: pointer;
  background-color: transparent;
  color: var(--foreground);
  transition: background-color 0.3s ease;
}
.stage-logo {
  display: flex;
  align-items: center;
  justify-content: center;
}
.stage-logo img {
  width: var(--stage-logo-width);
  height: auto;
  object-fit: contain;

  filter: var(--score-logo-filter);
}

.stage-score {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--foreground);

  width: calc(100% - var(--stage-logo-width));
  height: 100%;

  gap: 2px;
}



/* === Team Details Collapsible Area === */
.collapse-body {
  text-align: center;
  border-top: 2px solid var(--secondary);
  display: flex;
  margin-left: 0;
  margin-right: 0;
  margin-top: 10px;
}

/* === Details box === */
.details-box {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding: 10px;
  /* debugging */
}

.details-box-header {
  display: flex;
  flex-direction: row;
  width: 100%;
  justify-content: center;
  align-items: center;

  color: var(--form-text);
  background-color: var(--card-bg-highlight);
  font-size: 1.2rem;
  font-weight: bold;

  border-bottom: 2px solid var(--secondary);

}

/* === Match box general styling */
.matches-box{
  display: flex;
  flex-direction: column;
  width: 100%;
  justify-content: center;
  align-items: center;

  color: var(--form-text);
  background-color: var(--card-bg-secondary);
  font-size: 1rem;
}

.match-info-box {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-evenly;
  gap: 8px;
  margin-top: 2px;
  margin-bottom: 2px;
  border: 1px solid var(--foreground);  
  border-radius: 2px;
  padding: 2px;           
  width: var(--match-info-box-width);
  height: var(--match-info-box-height);
  background-color: var(--btn-bg);

  text-decoration: none;
  color: var(--btn-text);
}
.match-info-box:hover {
  background-color: var(--btn-hover-bg);
  color: var(--btn-text);

  cursor: pointer;
}
.highlight-border {
  border: 2px solid orange;
}

.match-info-team {
  display: flex;
  position: relative;
  align-items: center;
  flex-direction: row;

  width: var(--match-info-team-width);
  height: 100%;

  gap: 5px;
}
.match-info-team.opponent {
  justify-content: flex-end;
}

.match-info-team img {
  width: auto;
  height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 3px;
  flex-shrink: 0;
}

.match-info-name {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - (var(--match-info-box-height) + 10px));
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: bold;
}

/* === Recent Matches ===  */
.match-score {
  display: flex;
  justify-content: center;
  align-items: center;

  height: 100%;
  width: var(--match-score-width);
  font-size: 1rem;
  font-weight: bold;

  overflow: visible;
  flex-wrap: nowrap;
}

/* === Upcoming matches === */
.match-time {
  display: flex;
  justify-content: center;
  align-items: center;

  height: 100%;
  width: 100%;
  font-size: .8rem;
  font-weight: bold;

  overflow: visible;
  flex-wrap: nowrap;
}
.match-time.upcoming {
  width: var(--match-info-time-width);
}


/* === Team statistics === */
.matches-box{
  display: flex;
  flex-direction: column;
  width: 100%;
  justify-content: center;
  align-items: center;

  color: var(--form-text);
  background-color: var(--card-bg-secondary);
  font-size: 1rem;
}
.stats-box.maps {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  width: 100%;

  color: var(--form-text);
  background-color: var(--card-bg-secondary);
  font-size: 1rem;
}
.stats-box.unavailable {
  display: flex;
  justify-content: center;
  width: 100%;
  color: var(--form-text);
  background-color: var(--card-bg-secondary);
}

.stats-box.maps .map-stat-box {
  border: 1px solid #ccc;  /* border around each box */
  padding: 10px;
  box-sizing: border-box;
  text-align: center;      /* center content horizontally */
}

.map-stat-box img {
  width: 30px;
  height: 30px;
  border-radius: 3px;
  object-fit: cover;
  margin-bottom: 5px; /* space between image and text */
}