/* ============================================================
   WC26 Hub — Squads page styles.
   Every rule scoped under .page-squads.
   ============================================================ */

.page-squads { animation: sqFadeIn .28s ease; }
@keyframes sqFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ---------------- browser: toolbar ---------------- */

.page-squads .sq-toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  margin-bottom: 20px;
}
.page-squads .sq-toolbar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.page-squads .sq-search {
  flex: 1;
  min-width: 200px;
}
.page-squads .sq-group-select { min-width: 130px; }
.page-squads .sq-random { white-space: nowrap; }
.page-squads .sq-random:hover { border-color: var(--gold); color: var(--gold); }

.page-squads .sq-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.page-squads .sq-pill-n {
  font-size: .72rem;
  font-weight: 800;
  opacity: .65;
}
.page-squads .sq-count { letter-spacing: .3px; }

/* ---------------- browser: team grid ---------------- */

.page-squads .sq-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(172px, 1fr));
}
.page-squads .sq-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 12px 16px;
  text-align: center;
  text-decoration: none;
  color: var(--text);
}
.page-squads .sq-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--gradient-hosts);
  opacity: 0;
  transition: opacity .18s;
}
.page-squads .sq-card:hover::before { opacity: 1; }
.page-squads .sq-card-flag {
  font-size: 1.4rem; /* sizes the emoji fallback too */
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.page-squads .sq-card-flag .flag-img {
  height: 2.7em;
  transition: transform .18s ease;
}
.page-squads .sq-card:hover .flag-img { transform: scale(1.08) rotate(-1.5deg); }
.page-squads .sq-card-name {
  font-weight: 700;
  line-height: 1.25;
  min-height: 2.5em;
  display: flex;
  align-items: center;
}
.page-squads .sq-card-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}
.page-squads .sq-card-sub {
  font-size: .78rem;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.page-squads .sq-card-stars {
  font-size: .72rem;
  letter-spacing: 2px;
  min-height: 1.1em;
  line-height: 1.1;
  filter: drop-shadow(0 0 5px rgba(255, 201, 77, .4));
}
.page-squads .sq-empty { grid-column: 1 / -1; }
.page-squads .sq-empty .btn { margin-top: 10px; }

/* ---------------- team view: hero ---------------- */

.page-squads .sq-hero {
  position: relative;
  display: flex;
  align-items: center;
  gap: 26px;
  padding: 28px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
  overflow: hidden;
}
.page-squads .sq-hero::after {
  content: '⚽';
  position: absolute;
  right: -22px;
  bottom: -38px;
  font-size: 10rem;
  opacity: .05;
  pointer-events: none;
  transform: rotate(-12deg);
}
.page-squads .sq-hero-flag {
  font-size: 3.6rem; /* emoji fallback size */
  line-height: 1;
  flex-shrink: 0;
}
.page-squads .sq-hero-flag .flag-img {
  height: 5em;
  border-radius: 10px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .5), 0 0 0 1px rgba(255, 255, 255, .12);
}
.page-squads .sq-hero-body { min-width: 0; }
.page-squads .sq-hero-top {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.page-squads .sq-hero-name {
  margin: 0;
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: -.5px;
  line-height: 1.15;
}
.page-squads .sq-hero-stars {
  font-size: .95rem;
  letter-spacing: 2px;
  filter: drop-shadow(0 0 6px rgba(255, 201, 77, .45));
}
.page-squads .sq-hero-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.page-squads .sq-group-chip {
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, box-shadow .15s;
}
.page-squads .sq-group-chip:hover {
  background: rgba(255, 201, 77, .3);
  box-shadow: 0 0 0 1px var(--gold) inset;
}
.page-squads .sq-hero-coach {
  margin-top: 12px;
  font-size: .92rem;
}

.page-squads .sq-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

/* ---------------- team view: players ---------------- */

.page-squads .sq-players {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
}
.page-squads .sq-player {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  transition: border-color .15s, background .15s, transform .15s;
}
.page-squads .sq-player:hover {
  border-color: var(--line-2);
  background: var(--surface-2);
  transform: translateX(3px);
}
/* Photo slot: same 38px round box whether it holds the initials avatar
   or a hydrated Wikipedia thumbnail — no layout shift on swap. */
.page-squads .sq-photo {
  display: inline-flex;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}
.page-squads .player-photo {
  display: block;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-3);
  box-shadow: 0 0 0 1px var(--line-2), 0 2px 6px rgba(0, 0, 0, .35);
}
.page-squads .sq-num {
  min-width: 30px;
  height: 22px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-3);
  border-radius: 6px;
  font-size: .76rem;
  font-weight: 800;
  color: var(--text-dim);
  flex-shrink: 0;
}
.page-squads .sq-num::before {
  content: '#';
  opacity: .55;
  margin-right: 1px;
  font-weight: 600;
}
.page-squads .sq-player-id {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  line-height: 1.3;
}
.page-squads .sq-player-name {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.page-squads .sq-name-txt {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.page-squads .sq-role {
  flex-shrink: 0;
  font-size: .6rem;
  font-weight: 800;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--text-faint);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 2px 6px;
  cursor: default;
}
.page-squads .sq-player-club {
  font-size: .8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.page-squads .sq-player-age {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.05;
  flex-shrink: 0;
}
.page-squads .sq-player-age b { font-size: 1rem; }
.page-squads .sq-player-age i {
  font-style: normal;
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-faint);
}

.page-squads .sq-unavailable { margin-top: 16px; }

/* ---------------- FC 26 rating pills ---------------- */

.page-squads .fc-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-width: 27px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 800;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  cursor: default;
}
.page-squads .fc-gold {
  background: var(--gradient-gold);
  color: #0a0e1a;
  box-shadow: 0 0 10px rgba(255, 201, 77, .35);
}
.page-squads .fc-green {
  background: rgba(25, 195, 125, .14);
  color: var(--green);
  box-shadow: inset 0 0 0 1px rgba(25, 195, 125, .35);
}
.page-squads .fc-blue {
  background: rgba(63, 142, 252, .12);
  color: var(--blue);
  box-shadow: inset 0 0 0 1px rgba(63, 142, 252, .3);
}
.page-squads .fc-dim {
  background: var(--surface-3);
  color: var(--text-faint);
  box-shadow: inset 0 0 0 1px var(--line);
}

/* ---------------- team view: insights ---------------- */

/* 6 stat tiles + clubs tile (spans 2) = two tidy rows of four. */
.page-squads .sq-insights {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, 1fr);
}
.page-squads .sq-tile-clubs { grid-column: span 2; }
.page-squads .sq-tile {
  padding: 14px 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
}
.page-squads .sq-tile-num {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.page-squads .sq-tile-pos {
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex-wrap: wrap;
}
.page-squads .sq-tile-pos i {
  font-style: normal;
  color: var(--text-faint);
  font-weight: 400;
}
.page-squads .sq-tile-label {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--text-dim);
}
.page-squads .sq-tile-clubs {
  text-align: left;
  justify-content: flex-start;
  gap: 6px;
}
.page-squads .sq-club-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: .88rem;
  padding: 3px 0;
  border-bottom: 1px dashed var(--line);
}
.page-squads .sq-club-row:last-child { border-bottom: none; }
.page-squads .sq-club-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.page-squads .sq-club-n {
  color: var(--gold);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* ---------------- team view: fixtures ---------------- */

.page-squads .sq-fixtures {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, 1fr);
}
.page-squads .sq-fix {
  display: block;
  padding: 14px 16px;
  text-decoration: none;
  color: var(--text);
}
.page-squads .sq-fix-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.page-squads .sq-fix-teams {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}
.page-squads .sq-fix-team { min-width: 0; }
.page-squads .sq-fix-team.away { justify-self: end; }
.page-squads .sq-fix-team .team-label { font-size: .95rem; }
.page-squads .sq-fix-team.me .team-label > span:last-child { color: var(--gold); }
.page-squads .sq-fix-mid {
  font-size: .82rem;
  font-weight: 700;
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 9px;
  white-space: nowrap;
}
.page-squads .sq-fix-score {
  color: var(--gold);
  border-color: rgba(255, 201, 77, .4);
}
.page-squads .sq-fix-venue {
  margin-top: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------------- responsive ---------------- */

@media (max-width: 1000px) {
  .page-squads .sq-insights { grid-template-columns: repeat(2, 1fr); }
  .page-squads .sq-tile-clubs { grid-column: 1 / -1; }
  .page-squads .sq-fixtures { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .page-squads .sq-grid { grid-template-columns: repeat(2, 1fr); }
  .page-squads .sq-toolbar-row { align-items: stretch; flex-direction: column; }
  .page-squads .sq-search { min-width: 0; }
  .page-squads .sq-hero {
    flex-direction: column;
    text-align: center;
    gap: 16px;
    padding: 24px 16px;
  }
  .page-squads .sq-hero-top,
  .page-squads .sq-hero-meta { justify-content: center; }
  .page-squads .sq-hero-name { font-size: 1.7rem; }
  .page-squads .sq-players { grid-template-columns: 1fr; }
  .page-squads .sq-insights { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 380px) {
  .page-squads .sq-grid { grid-template-columns: 1fr; }
}

/* ---------------- team view: market CTA ---------------- */

/* Collapse the slot entirely when WC.Markets is missing or rendered nothing,
   so no stray margin appears at the bottom of the team view. */
.page-squads .sq-mkt:empty { display: none; }
