﻿/* ================================================================
   leagues.css  »  Ballistic HUD Design System
   ================================================================ */

.leagues-shell {
  padding: 16px;
}

.leagues-layout {
  max-width: 1480px;
  margin: 0 auto;
}

.leagues-page .lob-panel {
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  overflow: hidden;
}

.leagues-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.leagues-toolbar-copy {
  min-width: 260px;
}

.leagues-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.08rem;
  font-weight: 800;
  color: var(--on-surface);
}

.leagues-subtitle {
  font-size: 0.82rem;
  color: var(--on-surface-var);
}

.leagues-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.leagues-filters {
  border-top: 1px solid rgba(255,255,255,0.06);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding: 4px 0;
  margin-bottom: 10px;
}

.leagues-filters .lob-tabs {
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 6px;
}

.leagues-filters .lob-tab {
  border-bottom: none;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.8rem;
}

.leagues-filters .lob-tab.active {
  color: var(--secondary);
  background: rgba(255,116,54,0.12);
  border: 1px solid rgba(255,116,54,0.3);
}

.leagues-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.leagues-kpi {
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 11px;
  background: linear-gradient(165deg, rgba(30,34,39,0.95), rgba(20,23,27,0.96));
  padding: 10px 12px;
}

.leagues-kpi-label {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--on-surface-var);
  font-weight: 700;
}

.leagues-kpi-value {
  display: block;
  margin-top: 6px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.35rem;
  color: var(--primary-container);
  line-height: 1;
}

/* ─── Leagues grid & cards ──────────────────────────────────────── */
.lg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  padding: 4px 0;
}

.lg-card {
  background: linear-gradient(165deg, rgba(30,34,39,0.95), rgba(22,25,30,0.96));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 16px;
  color: var(--on-surface, #f9f9fd);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lg-card:hover {
  border-color: rgba(202,253,0,0.25);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}

.lg-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.lg-card-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--on-surface, #f9f9fd);
  margin: 0 0 4px;
}

.lg-card-subtitle {
  font-size: 0.76rem;
  color: var(--on-surface-var);
}

.lg-dates {
  font-size: 0.8rem;
  color: var(--on-surface-var, #aaabaf);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.lg-dates i { color: var(--secondary, #ff7436); }

.lg-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.lg-stat {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.76rem;
  color: var(--on-surface-var, #aaabaf);
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.03);
}

.lg-stat i { color: var(--primary, #cafd00); font-size: 0.75rem; }

/* Status badges */
.lg-status {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.lg-status-upcoming  { background: rgba(251,191,36,0.12); color: var(--warning, #fbbf24); border: 1px solid rgba(251,191,36,0.25); }
.lg-status-active    { background: rgba(74,222,128,0.12);  color: var(--success, #4ade80); border: 1px solid rgba(74,222,128,0.25); }
.lg-status-finished  { background: rgba(170,171,175,0.1);  color: var(--on-surface-var, #aaabaf); border: 1px solid rgba(170,171,175,0.15); }
.lg-status-cancelled { background: rgba(248,113,113,0.12); color: var(--danger, #f87171); border: 1px solid rgba(248,113,113,0.25); }

.lg-desc {
  font-size: 0.84rem;
  color: var(--on-surface-var);
  line-height: 1.45;
}

.lg-actions {
  margin-top: auto;
  padding-top: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.lg-founder {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--on-surface-var);
}

.lg-actions-buttons {
  display: inline-flex;
  gap: 6px;
}

.btn-delete {
  border: 1px solid rgba(248,113,113,0.35);
  background: rgba(248,113,113,0.12);
  color: var(--danger);
  border-radius: 8px;
  width: 34px;
  height: 30px;
}

.btn-delete:hover {
  background: rgba(248,113,113,0.2);
}

.search-results {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  background: rgba(255,255,255,0.02);
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  cursor: pointer;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: rgba(202,253,0,0.06);
}

.search-result-avatar,
.selected-participant-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.search-result-name {
  font-size: 0.86rem;
  color: var(--on-surface);
  font-weight: 600;
}

.selected-participants {
  min-height: 46px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  background: rgba(255,255,255,0.02);
}

.selected-participant {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(202,253,0,0.24);
  background: rgba(202,253,0,0.08);
  border-radius: 999px;
  padding: 4px 8px 4px 5px;
}

.selected-participant-name {
  font-size: 0.8rem;
  color: var(--on-surface);
  font-weight: 600;
}

.selected-participant-remove {
  border: none;
  background: transparent;
  color: var(--on-surface-var);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.selected-participant-remove:hover {
  background: rgba(255,255,255,0.12);
  color: var(--danger);
}

#leagues-list .lob-empty {
  grid-column: 1 / -1;
  min-height: 220px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* ─── Toast ─────────────────────────────────────────────────────── */
.lg-toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2000;
  padding: 12px 20px;
  border-radius: 10px;
  background: var(--surface-highest, #23262a);
  border: 1px solid var(--outline-var, #46484b);
  color: var(--on-surface, #f9f9fd);
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  animation: slideInRight 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 360px;
}

.lg-toast.success { border-left: 3px solid var(--success, #4ade80); }
.lg-toast.error   { border-left: 3px solid var(--danger, #f87171); }
.lg-toast.info    { border-left: 3px solid var(--primary, #cafd00); }

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ─── League details header ─────────────────────────────────────── */
.league-details-header {
  background: var(--surface-high, #1d2024);
  border: 1px solid var(--outline, #3a3d40);
  border-radius: 14px;
  padding: 24px;
  color: var(--on-surface, #f9f9fd);
  margin-bottom: 16px;
}

.league-details-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--on-surface, #f9f9fd);
  margin: 0 0 8px;
}

.league-details-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  font-size: 0.84rem;
  color: var(--on-surface-var, #aaabaf);
}

.league-details-meta i { color: var(--secondary, #ff7436); margin-right: 4px; }

/* ─── League details tabs ───────────────────────────────────────── */
.league-details-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--outline, #3a3d40);
  margin-bottom: 20px;
  overflow-x: auto;
  scrollbar-width: none;
}

.league-details-tabs::-webkit-scrollbar { display: none; }

.league-details-tabs .nav-link {
  padding: 10px 18px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--on-surface-var, #aaabaf);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
  border-radius: 0;
  text-decoration: none;
}

.league-details-tabs .nav-link:hover { color: var(--on-surface, #f9f9fd); }

.league-details-tabs .nav-link.active {
  color: var(--secondary, #ff7436);
  border-bottom-color: var(--secondary, #ff7436);
}

/* ─── Standings table ───────────────────────────────────────────── */
.standings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.standings-table thead th {
  background: var(--surface, #171a1d) !important;
  color: var(--secondary, #ff7436) !important;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 10px 12px;
  border-bottom: 1px solid var(--outline, #3a3d40);
  font-weight: 700;
}

.standings-table tbody tr {
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.12s;
}

.standings-table tbody tr:hover {
  background: rgba(202,253,0,0.03);
}

.standings-table tbody td {
  padding: 10px 12px;
  color: var(--on-surface, #f9f9fd);
}

.standings-table .rank-1 td:first-child { color: var(--primary, #cafd00); font-weight: 800; }
.standings-table .rank-2 td:first-child { color: var(--on-surface-var, #aaabaf); }
.standings-table .rank-3 td:first-child { color: var(--secondary, #ff7436); }

.standings-player {
  display: flex;
  align-items: center;
  gap: 8px;
}

.standings-player-avatar {
  width: 28px !important;
  height: 28px !important;
  min-width: 28px;
  max-width: 28px !important;
  max-height: 28px !important;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: var(--surface-highest, #23262a);
  flex-shrink: 0;
}

.match-player {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.match-player.right {
  justify-content: flex-end;
}

.match-player-avatar {
  width: 34px !important;
  height: 34px !important;
  min-width: 34px;
  max-width: 34px !important;
  max-height: 34px !important;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  flex-shrink: 0;
  background: var(--surface-highest, #23262a);
}

.match-player-info {
  min-width: 0;
}

.match-player-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Defensive cap for league detail avatars in any dynamic table/card render */
#leagueDetailsModal img.standings-player-avatar,
#leagueDetailsModal img.match-player-avatar,
#leagueDetailsModal img.participant-avatar {
  width: auto;
  max-width: 34px;
  max-height: 34px;
}

/* ─── Match card ─────────────────────────────────────────────────── */
.match-card {
  background: var(--surface-high, #1d2024);
  border: 1px solid var(--outline, #3a3d40);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  transition: all 0.15s;
  cursor: pointer;
}

.match-card:hover {
  border-color: var(--outline-var, #46484b);
  background: var(--surface-highest, #23262a);
}

.match-card.scheduled  { border-left: 3px solid var(--warning, #fbbf24); }
.match-card.in_progress { border-left: 3px solid var(--success, #4ade80); background: rgba(74,222,128,0.04); }
.match-card.completed  { border-left: 3px solid var(--outline, #3a3d40); }

.match-round {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--secondary, #ff7436);
  white-space: nowrap;
  min-width: 70px;
}

.match-header,
.match-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.match-date {
  font-size: 0.78rem;
  color: var(--on-surface-var, #aaabaf);
  white-space: nowrap;
}

.match-date i {
  color: var(--secondary, #ff7436);
  margin-right: 4px;
}

.match-players {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.match-player {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--on-surface, #f9f9fd);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.match-player.winner { color: var(--primary, #cafd00); font-weight: 800; }

.match-vs {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  padding: 5px 10px;
}

.match-vs-separator {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--secondary, #ff7436);
}

.match-score {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  font-weight: 800;
  color: var(--on-surface, #f9f9fd);
  white-space: nowrap;
}

.match-score.winner {
  color: var(--primary, #cafd00);
}

.match-status {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.match-status.scheduled {
  background: rgba(251,191,36,0.12);
  color: var(--warning, #fbbf24);
  border-color: rgba(251,191,36,0.28);
}

.match-status.in_progress {
  background: rgba(74,222,128,0.12);
  color: var(--success, #4ade80);
  border-color: rgba(74,222,128,0.28);
}

.match-status.completed {
  background: rgba(170,171,175,0.1);
  color: var(--on-surface-var, #aaabaf);
  border-color: rgba(170,171,175,0.2);
}

.match-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

#match-details-body {
  padding: 6px;
}

.match-preview-card {
  cursor: default;
}

.match-preview-card:hover {
  border-color: var(--outline, #3a3d40);
  background: var(--surface-high, #1d2024);
}

.match-preview-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  margin-top: 4px;
}

.match-preview-info-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--on-surface, #f9f9fd);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 8px 10px;
}

.match-preview-info-item i {
  color: var(--secondary, #ff7436);
}

.legs-history-title {
  margin: 6px 0 2px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--on-surface, #f9f9fd);
}

.legs-history-table-wrap {
  border: 1px solid var(--outline, #3a3d40);
  border-radius: 10px;
  overflow: auto;
}

.legs-history-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  background: rgba(0, 0, 0, 0.18);
}

.legs-history-table th,
.legs-history-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  white-space: nowrap;
}

.legs-history-table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--secondary, #ff7436);
  font-weight: 700;
  background: rgba(255, 255, 255, 0.03);
}

.legs-history-table td {
  font-size: 0.84rem;
  color: var(--on-surface, #f9f9fd);
}

.legs-history-table .text-center {
  text-align: center;
}

.match-status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}

.match-status-badge.scheduled  { background: rgba(251,191,36,0.12); color: var(--warning, #fbbf24); }
.match-status-badge.in_progress { background: rgba(74,222,128,0.12); color: var(--success, #4ade80); }
.match-status-badge.completed  { background: rgba(170,171,175,0.1);  color: var(--on-surface-var, #aaabaf); }

/* ─── Participant item ───────────────────────────────────────────── */
.participant-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--outline, #3a3d40);
  border-radius: 10px;
  margin-bottom: 6px;
  font-size: 0.88rem;
  color: var(--on-surface, #f9f9fd);
  transition: background 0.12s;
}

.participant-item:hover { background: rgba(255,255,255,0.06); }

.participant-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-highest, #23262a);
  flex-shrink: 0;
}

.participant-name { font-weight: 700; color: var(--on-surface, #f9f9fd); flex: 1; }
.participant-role { font-size: 0.72rem; color: var(--on-surface-var, #aaabaf); }
.participant-rank { font-family: 'Space Grotesk', sans-serif; font-weight: 800; color: var(--primary, #cafd00); font-size: 0.9rem; }

/* ─── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .leagues-shell {
    padding: 10px;
  }
  .leagues-layout {
    padding-left: 8px !important;
    padding-right: 8px !important;
  }
  .leagues-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .leagues-toolbar-actions {
    width: auto;
  }
  .lg-grid { grid-template-columns: 1fr; }
  .match-card { gap: 10px; }
  .match-player.right {
    justify-content: flex-start;
  }
  .match-players {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .match-vs {
    align-self: center;
  }
  .match-preview-info {
    grid-template-columns: 1fr;
  }
  .league-details-header { padding: 16px; }
  .league-details-title { font-size: 1.1rem; }
}
