/**
 * Team Detail Page - Premium Design
 * Hero, tabs, squad, fixtures, results, stats.
 */

/* ========== HERO ========== */
.team-hero {
  position: relative;
  padding: var(--space-8) var(--space-4);
  margin-bottom: var(--space-6);
  overflow: hidden;
}

.team-hero__bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(66, 133, 244, 0.25) 0%,
    rgba(26, 35, 50, 0.95) 50%,
    var(--bg-primary) 100%
  );
  z-index: 0;
}

.team-hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    var(--bg-primary) 100%
  );
  z-index: 1;
}

.team-hero__content {
  position: relative;
  z-index: 2;
  max-width: 1400px;
  margin: 0 auto;
}

.team-hero__main {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  flex-wrap: wrap;
  margin-bottom: var(--space-6);
}

.team-hero__logo-wrap {
  flex-shrink: 0;
}

.team-hero__logo {
  width: 120px;
  height: 120px;
  object-fit: contain;
}

.team-hero__logo-placeholder {
  width: 120px;
  height: 120px;
  border-radius: var(--radius-lg);
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  color: var(--text-secondary);
}

.team-hero__info {
  flex: 1;
  min-width: 200px;
}

.team-hero__name {
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  margin: 0 0 var(--space-2);
  line-height: 1.2;
}

.team-hero__league {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  margin: 0 0 var(--space-3);
}

.team-hero__season-wrap {
  margin-top: var(--space-3);
}

.team-hero__season-select {
  background: var(--bg-tertiary);
  border: 1px solid var(--bg-elevated);
  color: var(--text-primary);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  cursor: pointer;
  transition: border-color var(--transition-fast);
}

.team-hero__season-select:hover,
.team-hero__season-select:focus {
  border-color: var(--accent-primary);
  outline: none;
}

.team-hero__stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.team-hero__stat {
  text-align: center;
}

.team-hero__stat-value {
  display: block;
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
}

.team-hero__stat-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ========== TABS ========== */
.team-tabs-wrap {
  margin-bottom: var(--space-6);
}

.team-tabs--sticky {
  position: sticky;
  top: 60px;
  z-index: 100;
  background: var(--bg-primary);
  padding: var(--space-2) 0;
}

.team-content {
  max-width: 1400px;
  margin: 0 auto;
}

.team-tab-content {
  animation: teamTabFadeIn 0.2s ease;
}

.team-tab-content[hidden] {
  display: none !important;
}

@keyframes teamTabFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ========== OVERVIEW ========== */
.team-overview-card {
  height: 100%;
}

.team-form-row {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.team-form-badge {
  display: inline-flex;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: var(--font-bold);
  color: white;
  text-decoration: none;
  transition: transform var(--transition-fast);
}

.team-form-badge:hover {
  transform: scale(1.05);
  color: white;
}

.team-form-badge--w {
  background: var(--form-w);
}

.team-form-badge--d {
  background: var(--form-d);
}

.team-form-badge--l {
  background: var(--form-l);
}

.team-form-detail {
  font-size: var(--text-xs);
}

.team-upcoming-match {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) 0;
}

.team-upcoming-match a:first-of-type:hover {
  color: var(--accent-primary);
}

.team-upcoming-date {
  display: block;
  font-weight: var(--font-semibold);
  font-size: var(--text-base);
}

.team-upcoming-time {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.team-upcoming-teams {
  margin: var(--space-2) 0;
}

.team-upcoming-vs {
  font-weight: var(--font-medium);
}

.team-upcoming-comp {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.team-standings-mini {
  font-size: var(--text-sm);
}

.team-standings-mini__row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--bg-tertiary);
}

.team-standings-mini__row:last-child {
  border-bottom: none;
}

.team-standings-mini__row--highlight {
  background: var(--accent-muted);
  margin: 0 calc(-1 * var(--space-4));
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
}

.team-standings-mini__pos {
  width: 1.5rem;
  font-weight: var(--font-semibold);
  color: var(--text-secondary);
}

.team-standings-mini__name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-standings-mini__pts {
  font-weight: var(--font-bold);
}

.team-leaders-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.team-leaders-list__item {
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--bg-tertiary);
}

.team-leaders-list__item:last-child {
  border-bottom: none;
}

.team-leaders-photo {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  object-fit: cover;
}

.team-leaders-placeholder {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: var(--font-bold);
  color: var(--text-secondary);
}

.team-leaders-stat {
  margin-left: auto;
  font-weight: var(--font-semibold);
  color: var(--text-secondary);
}

/* ========== FIXTURES / RESULTS ========== */
.team-fixture-row,
.team-result-row {
  display: grid;
  grid-template-columns: 1fr auto 2fr 1fr auto;
  align-items: center;
  gap: var(--space-4);
}

.team-fixture-row__date,
.team-fixture-row__day {
  display: block;
}

.team-fixture-row__day {
  font-weight: var(--font-medium);
}

.team-fixture-row__time {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.team-fixture-row__ha-badge {
  display: inline-flex;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: var(--font-bold);
}

.team-fixture-row__ha-badge--home {
  background: var(--success-bg);
  color: var(--success);
}

.team-fixture-row__ha-badge--away {
  background: var(--info-bg);
  color: var(--info);
}

.team-fixture-row__comp {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.team-fixture-row__avail .lu-avail__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.team-fixture-row__avail .lu-avail__dot--lineups { background: var(--success); }
.team-fixture-row__avail .lu-avail__dot--stats { background: var(--warning); }
.team-fixture-row__avail .lu-avail__dot--none { background: var(--text-muted); }

.team-result-row {
  grid-template-columns: 1fr 2fr auto 1fr;
}

.team-result-row__score {
  font-weight: var(--font-bold);
  font-size: var(--text-base);
}

.team-result-row__score-our {
  color: var(--text-primary);
}

.team-result-row__score-opp {
  color: var(--text-secondary);
}

/* ========== COACH (Squad tab) ========== */
.team-coach-section {
  padding: var(--space-4);
}

.team-coach-section__inner {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.team-coach-section__photo-wrap {
  width: 80px;
  height: 80px;
  flex-shrink: 0;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.team-coach-section__photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.team-coach-section__photo-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: var(--font-bold);
  color: var(--text-muted);
}

.team-coach-section__body {
  flex: 1;
}

.team-coach-section__label {
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 var(--space-1);
}

.team-coach-section__name {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.team-coach-section__meta {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.team-coach-section__nat,
.team-coach-section__age,
.team-coach-section__formation,
.team-coach-section__empty {
  margin-right: var(--space-2);
}

/* ========== SQUAD ========== */
.team-squad-group {
  margin-bottom: var(--space-8);
}

.team-squad-group__title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin: 0 0 var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: 2px solid var(--bg-tertiary);
}

.team-squad-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-4);
}

.team-squad-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.team-squad-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  color: inherit;
}

.team-squad-card__photo-wrap {
  position: relative;
  aspect-ratio: 1;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.team-squad-card__photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.team-squad-card__photo-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  font-weight: var(--font-bold);
  color: var(--text-muted);
}

.team-squad-card__number {
  position: absolute;
  bottom: var(--space-1);
  right: var(--space-1);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-weight: var(--font-bold);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.team-squad-card__body {
  padding: var(--space-3);
}

.team-squad-card__name {
  font-weight: var(--font-semibold);
  font-size: var(--text-base);
  margin-bottom: var(--space-1);
}

.team-squad-card__meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}

.team-squad-card__pos,
.team-squad-card__nat,
.team-squad-card__age {
  margin-right: var(--space-2);
}

.team-squad-card__stats {
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.team-squad-card__stats span {
  margin-right: var(--space-2);
}

/* ========== STATS ========== */
.team-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-4);
}

.team-stat-card {
  min-height: 100px;
}

.team-stats-bars {
  max-width: 400px;
}

.team-stats-bars__title {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-4);
}

.team-stats-bar-row {
  display: grid;
  grid-template-columns: 1fr 2fr auto;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.team-stats-bar-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.team-stats-bar-value {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  min-width: 3rem;
  text-align: right;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .team-hero__main {
    flex-direction: column;
    text-align: center;
  }

  .team-hero__info {
    align-items: center;
  }

  .team-hero__stats {
    justify-content: center;
  }

  .team-fixture-row,
  .team-result-row {
    grid-template-columns: 1fr 1fr auto;
    gap: var(--space-2);
  }

  .team-fixture-row__comp,
  .team-result-row__comp {
    grid-column: 1 / -1;
  }

  .team-squad-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}
