/**
 * @file
 * VivaSport sport entity views — rendered as design-system cards.
 *
 * Ports the design-system token tree (base → semantic → component) + the card
 * components (Card, MatchCard, TeamCard, PlayerCard, CompetitionCard) so the
 * admin entity views look exactly like the frontend cards. Tokens are scoped to
 * `.vs-ds` so the dark card palette never leaks into the rest of the admin.
 * Source: design-system/src/styles/tokens.css + components/* .astro.
 */

.vs-ds {
  /* ── base ── */
  --base-gray-0: #fff;
  --base-gray-50: #f0f0f0;
  --base-gray-100: #ddd;
  --base-gray-200: #9b9b9b;
  --base-gray-400: #666;
  --base-amber-500: #ffab00;
  --base-amber-400: #ffc233;
  --base-font-family-heading: 'Titillium Web', system-ui, sans-serif;
  --base-font-family-body: 'Inter', system-ui, sans-serif;
  --base-font-family-score: 'Eurostile Extended', 'Titillium Web', system-ui, sans-serif;
  --base-font-weight-regular: 400;
  --base-font-weight-medium: 500;
  --base-font-weight-semibold: 600;
  --base-font-weight-bold: 700;
  /* ── semantic ── */
  --surface-ground: #0a0a0a;
  --surface-page: #1f1f1f;
  --surface-card: #141414;
  --surface-raised: #222;
  --surface-sunken: #333;
  --fg-default: #f0f0f0;
  --fg-emphasis: #fff;
  --fg-muted: #ddd;
  --fg-subtle: #9b9b9b;
  --fg-disabled: #666;
  --fg-on-accent: #0a0a0a;
  --accent-default: #ffab00;
  --border-default: #2d2d2d;
  --border-muted: rgba(255, 255, 255, .06);
  --border-emphasis: rgba(255, 255, 255, .16);
  --status-live: #ff1b6d;
  --status-ht: #fde272;
  --status-win: #abefc6;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  display: block;
  max-width: 100%;
  font-family: var(--base-font-family-body);
}

/* ── Card surface primitive ── */
.vs-ds .card {
  position: relative;
  display: flex;
  background: var(--surface-card);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-md);
  color: var(--fg-default);
  text-decoration: none;
  transition: border-color .1s ease;
}
.vs-ds .card[data-inline] { width: fit-content; max-width: 100%; }
.vs-ds a.card:hover { border-color: var(--border-emphasis); }

/* Editorial entity embeds inserted from CKEditor. */
.vs-ds .vs-embed-card {
  display: inline-flex;
  align-items: center;
  max-width: min(100%, 360px);
  min-width: 220px;
  gap: 12px;
  padding: 10px 12px;
  vertical-align: middle;
  background: var(--surface-card);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-md);
  color: var(--fg-default);
}
.vs-ds .vs-embed-card__media {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  overflow: hidden;
  border-radius: var(--radius-full);
  background: var(--base-gray-0);
}
.vs-ds .vs-embed-card__media[data-empty] {
  background: var(--surface-raised);
}
.vs-ds .vs-embed-card__media img {
  width: 30px;
  height: 30px;
  object-fit: contain;
}
.vs-ds .vs-embed-card__initials {
  font-family: var(--base-font-family-heading);
  font-weight: var(--base-font-weight-bold);
  font-size: 16px;
  line-height: 1;
  color: var(--fg-subtle);
}
.vs-ds .vs-embed-card__body {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}
.vs-ds .vs-embed-card__kicker {
  font-family: var(--base-font-family-heading);
  font-weight: var(--base-font-weight-bold);
  font-size: 10px;
  line-height: 1.2;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--fg-subtle);
}
.vs-ds .vs-embed-card__title {
  overflow: hidden;
  color: var(--fg-emphasis);
  font-family: var(--base-font-family-heading);
  font-size: 15px;
  font-weight: var(--base-font-weight-semibold);
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vs-ds .vs-embed-card__meta {
  overflow: hidden;
  color: var(--fg-subtle);
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vs-ds .match-chip--embed {
  width: min(100vw - 48px, 300px);
}

/* ── Crest / team label (inlined atoms) ── */
.vs-ds .vs-crest {
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; border-radius: var(--radius-full);
  background: var(--base-gray-0); overflow: hidden;
}
.vs-ds .vs-crest img { width: 100%; height: 100%; object-fit: contain; }
.vs-ds .vs-team { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.vs-ds .vs-team__name {
  font-family: var(--base-font-family-heading);
  font-weight: var(--base-font-weight-semibold);
  color: var(--fg-emphasis);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.vs-ds .vs-team[data-result='false'] .vs-team__name { color: var(--fg-disabled); }

/* ── MatchCard (event) ── */
.vs-ds .match-chip {
  position: relative; display: flex; flex-direction: column;
  width: 240px; padding: 16px; overflow: hidden; border-radius: var(--radius-md);
}
.vs-ds .match-chip__live-bar {
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--status-live); border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.vs-ds .match-chip__header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 10px;
}
.vs-ds .match-chip__comp-name {
  font-family: var(--base-font-family-heading); font-weight: var(--base-font-weight-medium);
  font-size: 11px; line-height: 1.3; letter-spacing: .5px; text-transform: uppercase;
  color: var(--fg-subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.vs-ds .match-chip__status {
  font-family: var(--base-font-family-heading); font-weight: var(--base-font-weight-bold);
  font-size: 11px; letter-spacing: .5px; text-transform: uppercase; color: var(--fg-subtle); flex-shrink: 0;
}
.vs-ds .match-chip__status[data-live] { color: var(--status-live); }
.vs-ds .match-chip__status[data-ht] { color: var(--status-ht); }
.vs-ds .match-chip__row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.vs-ds .match-chip__row .vs-crest { width: 18px; height: 18px; }
.vs-ds .match-chip__row .vs-team__name { font-size: 13px; }
.vs-ds .match-chip__row + .match-chip__row { margin-top: 6px; }
.vs-ds .match-chip__score {
  flex-shrink: 0; font-family: var(--base-font-family-score); font-weight: var(--base-font-weight-bold);
  font-size: 13px; line-height: 1.2; color: var(--fg-emphasis); font-variant-numeric: tabular-nums;
}
.vs-ds .match-chip__score[data-result='false'] { color: var(--fg-disabled); }
.vs-ds .match-chip__footer {
  margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border-default);
}
.vs-ds .match-chip__context {
  font-family: var(--base-font-family-body); font-weight: var(--base-font-weight-regular);
  font-size: 10px; line-height: 1.3; color: var(--fg-subtle);
}

/* ── BadgeTile (team + competition) ── */
.vs-ds .badge-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; width: 148px; height: 168px; padding: 18px 37px 23px 40px;
}
.vs-ds .badge-tile__badge {
  display: flex; align-items: center; justify-content: center;
  width: 74px; height: 74px; flex-shrink: 0;
  border-radius: var(--radius-full); background: var(--base-gray-0); overflow: hidden;
}
.vs-ds .badge-tile__badge img { width: 50px; height: 50px; object-fit: contain; }
.vs-ds .badge-tile__name {
  font-family: var(--base-font-family-heading); font-weight: var(--base-font-weight-bold);
  font-size: 20px; line-height: 24px; color: var(--fg-emphasis); text-align: center;
  display: flex; align-items: center; justify-content: center;
}

/* ── PlayerCard (individual) ── */
.vs-ds .player-card {
  display: flex; flex-direction: column; width: 303px; border-radius: inherit; overflow: hidden;
}
.vs-ds .player-card__header { position: relative; aspect-ratio: 384 / 256; width: 100%; flex-shrink: 0; }
.vs-ds .player-card__number {
  position: absolute; top: 11px; left: 12px; z-index: 2; width: 64px; height: 64px;
  border-radius: var(--radius-full); background: var(--surface-page);
  display: flex; align-items: center; justify-content: center;
}
.vs-ds .player-card__number span {
  font-family: var(--base-font-family-heading); font-weight: var(--base-font-weight-bold);
  font-size: 40px; line-height: 1; color: var(--fg-emphasis);
}
.vs-ds .player-card__photo {
  position: absolute; top: 44px; left: 50%; transform: translateX(-50%);
  width: 135px; height: 135px; border-radius: var(--radius-full); overflow: hidden;
  display: flex; align-items: center; justify-content: center; background: var(--base-gray-0);
}
.vs-ds .player-card__photo[data-empty] { background: var(--surface-raised); }
.vs-ds .player-card__photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vs-ds .player-card__initials {
  font-family: var(--base-font-family-heading); font-weight: var(--base-font-weight-bold);
  font-size: 44px; color: var(--fg-subtle);
}
.vs-ds .player-card__content {
  display: flex; flex-direction: column; gap: 12px; padding: 24px; flex: 1; background: var(--surface-sunken);
}
.vs-ds .player-card__name {
  font-family: var(--base-font-family-heading); font-weight: var(--base-font-weight-bold);
  font-size: 19px; line-height: 28px; color: var(--fg-emphasis); margin: 0;
}
.vs-ds .player-card__meta {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--base-font-family-heading); font-weight: var(--base-font-weight-bold);
  font-size: 13px; line-height: 18px; color: var(--fg-disabled);
}
.vs-ds .player-card__stats { display: flex; gap: 24px; }
.vs-ds .player-card__stat { display: flex; flex-direction: column; }
.vs-ds .player-card__stat-value {
  font-family: var(--base-font-family-heading); font-weight: var(--base-font-weight-bold);
  font-size: 19px; line-height: 28px; color: var(--fg-emphasis);
}
.vs-ds .player-card__stat-label {
  font-family: var(--base-font-family-heading); font-weight: var(--base-font-weight-bold);
  font-size: 13px; line-height: 18px; color: var(--fg-disabled);
}

/* ── MatchTable (single event — full view) ── */
.vs-ds .match-table {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  overflow: hidden;
  background: var(--surface-card);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-md);
}
.vs-ds .match-table__band {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  background: var(--status-live);
}
.vs-ds .match-table__head {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-default);
}
.vs-ds .match-table__title {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}
.vs-ds .match-table__comp-badge {
  width: 20px;
  height: 20px;
}
.vs-ds .match-table__title-text {
  overflow: hidden;
  color: var(--fg-muted);
  font-family: var(--base-font-family-heading);
  font-size: 13px;
  font-weight: var(--base-font-weight-semibold);
  letter-spacing: .3px;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}
.vs-ds .match-table__meta {
  flex-shrink: 0;
  color: var(--fg-subtle);
  font-family: var(--base-font-family-body);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}
.vs-ds .match-row {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 12px;
  padding: 18px 16px;
}
.vs-ds .match-row__teams {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 12px;
}
.vs-ds .match-row__teams .vs-crest {
  width: 26px;
  height: 26px;
}
.vs-ds .team-label {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}
.vs-ds .team-label__name {
  overflow: hidden;
  color: var(--fg-emphasis);
  font-family: var(--base-font-family-heading);
  font-size: 16px;
  font-weight: var(--base-font-weight-regular);
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vs-ds .team-label__name[data-result='true'] {
  font-weight: var(--base-font-weight-semibold);
}
.vs-ds .team-label__name[data-result='false'] {
  color: var(--fg-disabled);
}
.vs-ds .match-row__when {
  display: flex;
  flex-shrink: 0;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}
.vs-ds .match-row__time {
  color: var(--fg-subtle);
  font-family: var(--base-font-family-body);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  font-weight: var(--base-font-weight-medium);
  line-height: 1.3;
}
.vs-ds .match-row__date {
  color: var(--fg-disabled);
  font-family: var(--base-font-family-body);
  font-size: 12px;
  line-height: 1.3;
}
.vs-ds .match-row__result {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 16px;
}
.vs-ds .match-row__status {
  display: flex;
  min-width: 30px;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
.vs-ds .score--stacked {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  line-height: 1.2;
}
.vs-ds .score {
  color: var(--fg-emphasis);
  font-family: var(--base-font-family-score);
  font-variant-numeric: tabular-nums;
  font-weight: var(--base-font-weight-bold);
}
.vs-ds .score--lg .score__n {
  font-size: 21px;
}
.vs-ds .score__n[data-result='false'] {
  color: var(--fg-disabled);
}
.vs-ds .match-status {
  color: var(--fg-subtle);
  font-family: var(--base-font-family-body);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: var(--base-font-weight-semibold);
  line-height: 1.3;
  text-transform: uppercase;
  white-space: nowrap;
}
.vs-ds .match-status[data-status='live'],
.vs-ds .match-status[data-status='et'] {
  color: var(--status-live);
  font-weight: var(--base-font-weight-bold);
}
.vs-ds .match-status[data-status='ht'],
.vs-ds .match-status[data-status='bt'] {
  color: var(--status-ht);
  font-weight: var(--base-font-weight-bold);
}
.vs-ds .match-status[data-status='pen'] {
  color: var(--fg-emphasis);
  font-weight: var(--base-font-weight-bold);
}
.vs-ds .match-table__foot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  color: var(--fg-subtle);
  border-top: 1px solid var(--border-default);
  font-family: var(--base-font-family-body);
  font-size: 12px;
  line-height: 1.3;
}
.vs-ds .mt-venue {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.vs-ds .mt-foot-sep {
  color: var(--fg-disabled);
}
