/* Game History Grid Styles */
#game-history-grid {
  padding: 1rem;
}

/* Grid layout - same columns for header and rows */
.gh-grid-header,
.gh-grid-row {
  display: grid;
  grid-template-columns: 150px 1fr 140px 90px 90px 90px;
  gap: 1rem;
  align-items: center;
  padding: 0.75rem 1rem;
}

.gh-grid-header {
  border-bottom: 2px solid var(--border);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.gh-grid-row {
  border-bottom: 1px solid rgba(31, 82, 31, 0.3);
  transition: background 0.15s;
}

.gh-grid-row:hover {
  background: rgba(31, 82, 31, 0.1);
}

/* Cell base styles */
.gh-cell {
  display: flex;
  align-items: center;
}

/* Gameweek cell */
.gh-cell-gameweek {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
}

.gh-gameweek-number {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary);
  text-shadow: var(--text-glow);
}

.gh-gameweek-date {
  font-size: 0.7rem;
  color: var(--muted);
}

/* Matchup cell - nested grid for perfect centering */
.gh-cell-matchup {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.5rem;
  align-items: center;
}

.gh-team-name {
  font-size: 1rem;
  font-weight: 600;
  color: #ffffff;
}

.gh-team-name:first-child {
  justify-self: end;
  text-align: right;
}

.gh-team-name:last-child {
  justify-self: start;
  text-align: left;
}

.gh-match-center {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: center;
}

.gh-team-logo {
  width: 20px;
  height: 20px;
  object-fit: contain;
  flex-shrink: 0;
}

.gh-team-logo-placeholder {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.gh-match-score {
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.95rem;
  min-width: 50px;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.gh-match-score.win {
  background: rgba(51, 255, 0, 0.15);
  color: var(--primary);
}

.gh-match-score.loss {
  background: rgba(255, 51, 51, 0.15);
  color: #ff6666;
}

.gh-match-score.draw {
  background: rgba(255, 176, 0, 0.15);
  color: var(--secondary);
}

/* Stat cells - centered content */
.gh-cell-min {
  display: grid;
  grid-template-columns: 90px 55px;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
}

.gh-cell-dec,
.gh-cell-aa,
.gh-cell-total {
  justify-content: center;
}

/* Badge styles */
.gh-badge {
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 1.05rem;
  font-weight: 700;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  /* No default color - let specific badge classes define colors */
}

.gh-minutes-badge {
  background: var(--status-starter-bg);
  color: var(--status-starter-text);
  padding: 0.25rem 0.4rem;
  font-size: 0.85rem;
  min-width: 50px;
  height: 28px;
  margin: 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  border-radius: 4px;
}

.gh-minutes-badge--not-in-squad,
.gh-minutes-badge--dnp {
  background: var(--status-dnp-bg) !important;
  color: var(--status-dnp-text) !important;
  min-width: auto;
  width: auto;
  padding: 0.35rem 0.5rem;
}

.gh-minutes-badge--sub {
  background: var(--status-sub-bg) !important;
  color: var(--status-sub-text);
}

.gh-starter-icon {
  width: 16px;
  height: 16px;
  object-fit: contain;
  flex-shrink: 0;
  filter: brightness(0) saturate(100%) invert(47%) sepia(98%) saturate(1234%)
    hue-rotate(188deg) brightness(98%) contrast(93%);
}

.gh-sub-icon {
  width: 16px;
  height: 16px;
  object-fit: contain;
  flex-shrink: 0;
  filter: brightness(0) saturate(100%) invert(65%) sepia(53%) saturate(1066%)
    hue-rotate(340deg) brightness(98%) contrast(92%);
}

.gh-not-in-squad-icon,
.gh-dnp-icon {
  width: 16px;
  height: 16px;
  object-fit: contain;
  flex-shrink: 0;
  filter: brightness(0) saturate(100%) invert(26%) sepia(96%) saturate(3318%)
    hue-rotate(356deg) brightness(95%) contrast(95%);
}

.gh-score-badge {
  background: #2a2a2a;
  color: #b0b0b0;
}

.gh-total-badge {
  color: #ffffff;
}

/* Total score color tiers */
.gh-total-badge.elite {
  background: #00a749;
}

.gh-total-badge.good {
  background: #24c792;
}

.gh-total-badge.decent {
  background: #b0c623;
}

.gh-total-badge.average {
  background: #f1ce18;
}

.gh-total-badge.poor {
  background: #f09b1b;
}

.gh-total-badge.terrible {
  background: #dc1a0f;
}

.gh-total-badge.dnp {
  background: #2a2a2a;
  color: #ffffff;
}

/* Events icons within mins cell - icon slot (left side) */
.gh-events-container {
  display: flex;
  gap: 0.25rem;
  flex-wrap: nowrap;
  justify-content: flex-end;
  align-items: center;
  overflow-x: auto;
}

.gh-event-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

.gh-event-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Minutes pill slot (right side) */
.gh-minutes-slot {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Responsive adjustments */
@media (max-width: 1100px) {
  .gh-grid-header,
  .gh-grid-row {
    grid-template-columns: 110px 1fr 120px 75px 75px 75px;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
  }

  .gh-team-name {
    font-size: 0.85rem;
  }

  .gh-match-score {
    font-size: 0.9rem;
    padding: 0.4rem 0.75rem;
    min-width: 60px;
  }

  .gh-badge {
    font-size: 0.8rem;
    padding: 0.35rem 0.5rem;
  }

  .gh-cell-min {
    grid-template-columns: 75px 45px;
    gap: 0.4rem;
  }

  .gh-event-icon {
    width: 18px;
    height: 18px;
  }

  .gh-minutes-badge {
    font-size: 0.8rem;
    min-width: 45px;
    height: 26px;
  }
}

@media (max-width: 768px) {
  #game-history-grid {
    padding: 0.75rem;
  }

  .gh-grid-header {
    display: none;
  }

  .gh-grid-row {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
    border: 1px solid var(--border);
    margin-bottom: 1rem;
    border-radius: 4px;
  }

  .gh-cell {
    justify-content: flex-start !important;
  }

  .gh-cell-gameweek {
    align-items: center;
    text-align: center;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(31, 82, 31, 0.3);
  }

  .gh-gameweek-number {
    font-size: 1rem;
  }

  .gh-gameweek-date {
    font-size: 0.75rem;
  }

  .gh-cell-matchup {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.5rem 0;
  }

  .gh-match-center {
    order: -1;
    width: 100%;
    justify-content: center;
  }

  .gh-match-score {
    font-size: 1.1rem;
    padding: 0.5rem 1rem;
    min-width: 70px;
  }

  .gh-team-name {
    font-size: 0.95rem;
    text-align: center !important;
    justify-self: center !important;
  }

  .gh-cell-min {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0.5rem 0;
    border-top: 1px solid rgba(31, 82, 31, 0.3);
  }

  .gh-events-container {
    justify-content: flex-start;
    flex: 1;
  }

  .gh-minutes-slot {
    flex: 0 0 auto;
  }

  .gh-minutes-badge {
    font-size: 0.9rem;
    min-width: 55px;
    height: 32px;
  }

  .gh-cell-dec,
  .gh-cell-aa,
  .gh-cell-total {
    justify-content: center;
    padding: 0.25rem 0;
  }

  .gh-badge {
    font-size: 1rem;
    padding: 0.5rem 0.75rem;
    min-width: 60px;
  }

  .gh-total-badge {
    font-size: 1.2rem;
    padding: 0.6rem 0.85rem;
  }
}

@media (max-width: 640px) {
  #game-history-grid {
    padding: 0.5rem;
  }

  .gh-grid-row {
    padding: 0.75rem;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
  }

  .gh-cell-gameweek {
    padding-bottom: 0.4rem;
  }

  .gh-gameweek-number {
    font-size: 0.9rem;
  }

  .gh-gameweek-date {
    font-size: 0.7rem;
  }

  .gh-cell-matchup {
    gap: 0.5rem;
    padding: 0.4rem 0;
  }

  .gh-team-logo {
    width: 18px;
    height: 18px;
  }

  .gh-team-name {
    font-size: 0.85rem;
  }

  .gh-match-score {
    font-size: 1rem;
    padding: 0.4rem 0.8rem;
    min-width: 60px;
  }

  .gh-cell-min {
    padding: 0.4rem 0;
  }

  .gh-event-icon {
    width: 18px;
    height: 18px;
  }

  .gh-minutes-badge {
    font-size: 0.85rem;
    min-width: 50px;
    height: 30px;
  }

  .gh-starter-icon,
  .gh-sub-icon,
  .gh-not-in-squad-icon,
  .gh-dnp-icon {
    width: 14px;
    height: 14px;
  }

  .gh-badge {
    font-size: 0.95rem;
    padding: 0.45rem 0.65rem;
    min-width: 55px;
  }

  .gh-total-badge {
    font-size: 1.1rem;
    padding: 0.55rem 0.75rem;
  }

  .gh-score-badge {
    font-size: 0.9rem;
  }
}
