/* ترتيب الأندية (لقطة من الجدول) — متناسق مع match-board */

.match-league-rank-block .section-title {
  margin-bottom: 10px;
}

.match-league-rank-card {
  padding: 10px 12px 12px;
  border-radius: var(--mb-radius, 8px);
  background: var(--mb-row-bg, #191d2d);
  border: 1px solid var(--mb-row-line, rgba(255, 255, 255, 0.05));
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.match-league-rank-table {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.match-league-rank-row {
  display: grid;
  grid-template-columns: 30px minmax(130px, 1.4fr) repeat(7, minmax(30px, 0.55fr));
  gap: 4px 6px;
  align-items: center;
  padding: 0 4px;
}

.match-league-rank-row--head {
  padding: 0 4px 6px;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--mb-row-line, rgba(255, 255, 255, 0.06));
}

.match-league-rank-row--head .mlr-col {
  font-size: 11px;
  font-weight: 700;
  color: var(--mb-text-dim, #8b93ad);
  text-align: center;
  line-height: 1.2;
  white-space: nowrap;
}

.match-league-rank-row--head .mlr-col--team {
  text-align: start;
}

.match-league-rank-row:not(.match-league-rank-row--head) {
  min-height: 46px;
  padding: 8px 8px 8px 4px;
  border-radius: var(--mb-radius-sm, 6px);
  background: var(--mb-panel-bg, #151825);
  border: 1px solid var(--mb-row-line, rgba(255, 255, 255, 0.04));
}

.mlr-col {
  font-size: 12px;
  font-weight: 700;
  color: var(--mb-text-muted, #b8bfd4);
  text-align: center;
  line-height: 1.2;
}

.mlr-col--team {
  text-align: start;
  min-width: 0;
}

.mlr-pos {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: var(--mb-radius-xs, 5px);
  font-size: 11px;
  font-weight: 800;
  color: var(--mb-text-strong, #fff);
  background: var(--mb-center-line, #252a3d);
}

.mlr-team {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

a.mlr-team:hover .mlr-team__name {
  color: var(--mb-accent, #39dbbf);
}

.mlr-team__logo {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border-radius: var(--mb-radius-xs, 5px);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.mlr-team__logo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.mlr-team__name {
  font-size: 13px;
  font-weight: 800;
  color: var(--mb-text-strong, #fff);
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.mlr-col--diff.is-pos {
  color: var(--mb-accent, #39dbbf);
}

.mlr-col--diff.is-neg {
  color: #fc6b6b;
}

.mlr-col--pts .mlr-pts {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  color: var(--mb-accent, #39dbbf);
  background: rgba(57, 219, 191, 0.12);
}

/* Light mode */
html.light:not(.dark) .match-league-rank-card {
  background: #f8f9fc;
  border-color: #e3e5f0;
}

html.light:not(.dark) .match-league-rank-row:not(.match-league-rank-row--head) {
  background: #fff;
  border-color: #e8ebf3;
}

html.light:not(.dark) .match-league-rank-row--head {
  border-bottom-color: #e3e5f0;
}

html.light:not(.dark) .match-league-rank-row--head .mlr-col {
  color: #7a8299;
}

html.light:not(.dark) .mlr-col {
  color: #5c6478;
}

html.light:not(.dark) .mlr-pos {
  color: #1a1f33;
  background: #eef1f7;
}

html.light:not(.dark) .mlr-team__name {
  color: #1a1f33;
}

html.light:not(.dark) a.mlr-team:hover .mlr-team__name {
  color: #10816e;
}

html.light:not(.dark) .mlr-col--diff.is-pos {
  color: #10816e;
}

html.light:not(.dark) .mlr-col--diff.is-neg {
  color: #d64545;
}

html.light:not(.dark) .mlr-col--pts .mlr-pts {
  color: #10816e;
  background: rgba(22, 174, 148, 0.12);
}

@media (max-width: 575px) {
  .match-league-rank-table {
    min-width: 520px;
  }

  .match-league-rank-row {
    grid-template-columns: 26px minmax(110px, 1.2fr) repeat(7, minmax(26px, 0.5fr));
    gap: 3px 4px;
  }

  .match-league-rank-row:not(.match-league-rank-row--head) {
    min-height: 42px;
    padding: 6px;
  }

  .mlr-team__logo {
    flex-basis: 24px;
    width: 24px;
    height: 24px;
  }

  .mlr-team__name {
    font-size: 12px;
  }
}
