/* ========================================
   Substitutes, Sidelined & Transfers
   Collapsible sections for bench players,
   injuries, suspensions, and transfers.
   Extracted from _formation_tactics_board.html.erb
   ======================================== */

/* ---- Substitutes Section ---- */

.substitutes-section {
  width: 100%;
  margin-top: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  overflow: hidden;
}

/* Main header - clickable (green theme) */
.substitutes-main-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(74, 222, 128, 0.08) 0%, rgba(74, 222, 128, 0.02) 100%);
  border-bottom: 1px solid rgba(74, 222, 128, 0.15);
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}

.substitutes-main-header:hover {
  background: linear-gradient(135deg, rgba(74, 222, 128, 0.12) 0%, rgba(74, 222, 128, 0.04) 100%);
}

.substitutes-main-header__count {
  background: rgba(74, 222, 128, 0.15);
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.3);
  border-radius: 12px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  margin-left: auto;
  margin-inline-end: 8px;
}

.substitutes-main-header__chevron {
  flex-shrink: 0;
  color: #4ade80;
  opacity: 0.7;
  transition: transform 0.2s ease;
}

.substitutes-main-header__chevron--expanded,
.substitutes-main-header__chevron--open {
  transform: rotate(180deg);
}

/* Collapsible body */
.substitutes-main-body {
  transition: max-height 0.3s ease;
  overflow: hidden;
}

.substitutes-main-body--collapsed {
  max-height: 0;
}

.substitutes-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 12px;
}

.substitutes-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  overflow: hidden;
}

/* Team headers - static */
.substitutes-card__header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.85);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.substitutes-card__body {
  padding: 8px;
}

/* ---- Substitute Items ---- */

.substitute-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  margin-bottom: 4px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 6px;
  transition: background 0.15s ease;
}

.substitute-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.substitute-item__top-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.substitute-item__number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: linear-gradient(135deg, rgba(74, 222, 128, 0.15) 0%, rgba(74, 222, 128, 0.05) 100%);
  border: 1px solid rgba(74, 222, 128, 0.25);
  border-radius: 5px;
  color: #4ade80;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}

.substitute-item__name {
  color: rgba(255, 255, 255, 0.9);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.substitute-item__position {
  color: rgba(255, 255, 255, 0.5);
  font-size: 9px;
  font-weight: 500;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.substitute-item__stats {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding-left: 0;
}

/* Legacy classes */
.substitute-item__info {
  flex: 1;
  min-width: 0;
}

.substitute-item__name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

/* Avg stat display */
.stat-item-avg {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
  white-space: nowrap;
  margin-left: 6px;
}

/* Stat boxes for 1+ and 2+ percentages */
.substitute-item__stats .stat-box-container {
  margin: 0;
}

.substitute-item__stats .stat-value-box {
  width: 26px;
  height: 18px;
  font-size: 10px;
  border-radius: 4px;
  font-weight: 600;
}

/* Remove minute bar from percentage boxes */
.substitute-item__stats .stat-value-box::after {
  display: none;
}

/* ---- Sidelined Section Variants ---- */

.substitutes-section--sidelined .substitutes-main-header {
  background: linear-gradient(135deg, rgba(74, 222, 128, 0.08) 0%, rgba(74, 222, 128, 0.02) 100%);
  border-bottom-color: rgba(74, 222, 128, 0.15);
}

.substitutes-section--sidelined .substitutes-main-header:hover {
  background: linear-gradient(135deg, rgba(74, 222, 128, 0.12) 0%, rgba(74, 222, 128, 0.04) 100%);
}

.substitutes-section--sidelined .substitutes-main-header__count {
  background: rgba(74, 222, 128, 0.15);
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.3);
}

.substitutes-section--sidelined .substitutes-main-header__chevron {
  color: #4ade80;
}

/* ---- Transfers Section Variants ---- */

.substitutes-section--transfers .substitutes-main-header {
  background: linear-gradient(135deg, rgba(74, 222, 128, 0.08) 0%, rgba(74, 222, 128, 0.02) 100%);
  border-bottom-color: rgba(74, 222, 128, 0.15);
}

.substitutes-section--transfers .substitutes-main-header:hover {
  background: linear-gradient(135deg, rgba(74, 222, 128, 0.12) 0%, rgba(74, 222, 128, 0.04) 100%);
}

.substitutes-section--transfers .substitutes-main-header__count {
  background: rgba(74, 222, 128, 0.15);
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.3);
}

.substitutes-section--transfers .substitutes-main-header__chevron {
  color: #4ade80;
}

/* ---- Injury Items ---- */

.injury-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  margin-bottom: 4px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 6px;
}

.injury-item__player {
  display: flex;
  align-items: center;
  gap: 6px;
}

.injury-item__name {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
}

.injury-item__position {
  font-size: 9px;
  color: rgba(255, 255, 255, 0.5);
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
}

.injury-item__details {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
}

.injury-item__reason {
  font-weight: 500;
}

.injury-item__stat {
  color: rgba(255, 255, 255, 0.5);
}

.injury-item__stat-value {
  color: #fbbf24;
  font-weight: 600;
}

/* ---- Transfer Items ---- */

.transfer-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  margin-bottom: 4px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 5px;
  font-size: 10px;
}

.transfer-item__player {
  color: rgba(255, 255, 255, 0.9);
  font-weight: 600;
}

.transfer-item__direction {
  color: rgba(255, 255, 255, 0.4);
}

.transfer-item__team {
  color: rgba(255, 255, 255, 0.6);
}

.transfer-item__date {
  color: rgba(255, 255, 255, 0.4);
  font-size: 9px;
  padding: 1px 5px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}

.transfer-item__amount {
  margin-left: auto;
  font-size: 9px;
  font-weight: 600;
}

.transfer-item__amount--in {
  color: var(--glow);
}

.transfer-item__amount--out {
  color: #ef4444;
}

/* Transfer section labels */
.transfer-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  padding: 3px 8px;
  border-radius: 4px;
  display: inline-block;
}

.transfer-label--in {
  color: var(--glow);
  background: rgba(var(--glow-rgb), 0.1);
  border: 1px solid rgba(var(--glow-rgb), 0.2);
}

.transfer-label--out {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Injury section labels */
.injury-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  margin-bottom: 8px;
  padding: 4px 8px;
  border-radius: 4px;
}

.injury-label--out {
  color: #f87171;
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.2);
}

.injury-label--returned {
  color: #4ade80;
  background: rgba(74, 222, 128, 0.1);
  border: 1px solid rgba(74, 222, 128, 0.2);
}

/* Empty state */
.section-empty-state {
  text-align: center;
  padding: 16px 12px;
  color: rgba(255, 255, 255, 0.4);
  font-size: 11px;
}
