/* ===== Standings Widget Theme Integration ===== */

.sw-widget {
  background: var(--surface);
  color: var(--text);
  border-radius: var(--card-radius);
}

/* Topbar */
.sw-topbar {
  padding: 10px;
  border-bottom: 1px solid var(--border);
}

/* Mode buttons */
.sw-mode {
  display: flex;
  gap: 6px;
}

.sw-mode-btn {
  background: var(--tab-bg);
  color: var(--text-soft);
  border: 1px solid var(--border);
  border-radius: var(--btn-radius);
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: 0.2s;
}

.sw-mode-btn:hover {
  background: var(--tab-hover);
}

.sw-mode-btn.active {
  background: var(--tab-active);
  color: var(--tab-active-text);
  border-color: var(--tab-active);
}

/* Card */
.sw-card {
  background: var(--surface-2);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-soft);
  
}

/* Table */
.sw-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
   
}

.sw-table th {
  background: var(--surface-3);
  color: var(--text-muted);
  font-weight: 600;
  padding: 10px;
  border-bottom: 1px solid var(--border);
}

.sw-table td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-soft);
}

/* Row hover */
.sw-table tbody tr:hover {
  background: var(--surface-3);
}

/* Highlight team */
.sw-table tr.is-highlight {
  background: var(--primary-soft);
}

/* Rank badges */
.sw-rank {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 12px;
}

.rank-top {
  background: var(--success);
  color: #fff;
}

.rank-euro {
  background: var(--primary);
  color: #fff;
}

.rank-conference {
  background: var(--warning);
  color: #fff;
}

.rank-plain {
  background: var(--surface-3);
  color: var(--text-soft);
}

/* Team */
.sw-team {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sw-team-logo {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.sw-team-name {
  color: var(--text);
  font-weight: 500;
}

/* Points */
.sw-pts {
  font-weight: 600;
  color: var(--text);
}

/* Form badges */
.sw-form {
  display: flex;
  gap: 4px;
}

.sw-form-badge {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: #fff;
}

/* Form colors */
.sw-form-badge.W {
  background: var(--success);
}

.sw-form-badge.D {
  background: var(--warning);
}

.sw-form-badge.L {
  background: var(--danger);
}

/* Empty state */
.sw-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
}

/* Scroll wrapper */
.sw-scroll {
  overflow-x: auto;
}

/* Align center */
.sw-center {
  text-align: center;
}


/* ===== Standings Widget ===== */

.sw-widget {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  background: var(--surface);
  color: var(--text);
  border-radius: var(--card-radius);
  overflow: hidden;
}

.sw-topbar {
  padding: 10px;
  border-bottom: 1px solid var(--border);
}

.sw-mode {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.sw-mode-btn {
  background: var(--tab-bg);
  color: var(--text-soft);
  border: 1px solid var(--border);
  border-radius: var(--btn-radius);
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: .2s ease;
}

.sw-mode-btn:hover {
  background: var(--tab-hover);
}

.sw-mode-btn.active {
  background: var(--tab-active);
  color: var(--tab-active-text);
  border-color: var(--tab-active);
}

.sw-card {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  background: var(--surface-2);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

/* only this area scrolls */
.sw-scroll {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

/* table must be wider than viewport so horizontal scroll happens inside .sw-scroll */
.sw-table {
  border-collapse: separate;
  border-spacing: 0;
  width: max-content;
  min-width: 760px;
  font-size: 13px;
}

/* fixed column widths */
.sw-table th:nth-child(1),
.sw-table td:nth-child(1) {
  width: 52px;
  min-width: 52px;
  max-width: 52px;
}

.sw-table th:nth-child(2),
.sw-table td:nth-child(2) {
  width: 170px;
  min-width: 170px;
  max-width: 170px;
}

/* remaining columns */
.sw-table th:nth-child(n+3),
.sw-table td:nth-child(n+3) {
  width: 64px;
  min-width: 64px;
  text-align: center;
}

.sw-table th:last-child,
.sw-table td:last-child {
  width: 120px;
  min-width: 120px;
  text-align: left;
}

.sw-table th,
.sw-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--surface-2);
  box-sizing: border-box;
}

.sw-table th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--surface-3);
  color: var(--text-muted);
  font-weight: 600;
}

/* sticky left columns */
.sw-table th:nth-child(1),
.sw-table td:nth-child(1) {
  position: sticky;
  left: 0;
  z-index: 4;
  box-shadow: 1px 0 0 var(--border);
}

.sw-table th:nth-child(2),
.sw-table td:nth-child(2) {
  position: sticky;
  left: 52px; /* must match first column width exactly */
  z-index: 4;
  box-shadow: 1px 0 0 var(--border);
}

/* header sticky cells above body */
.sw-table thead th:nth-child(1),
.sw-table thead th:nth-child(2) {
  z-index: 5;
}

.sw-table tbody tr:hover td {
  background: var(--surface-3);
}

.sw-table tbody tr:hover td:nth-child(1),
.sw-table tbody tr:hover td:nth-child(2) {
  background: var(--surface-3);
}

.sw-table tr.is-highlight td {
  background: var(--primary-soft);
}

.sw-table tr.is-highlight td:nth-child(1),
.sw-table tr.is-highlight td:nth-child(2) {
  background: var(--primary-soft);
}

.sw-center {
  text-align: center;
}

.sw-rank {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 12px;
}

.rank-top {
  background: var(--success);
  color: #fff;
}

.rank-euro {
  background: var(--primary);
  color: #fff;
}

.rank-conference {
  background: var(--warning);
  color: #fff;
}

.rank-plain {
  background: var(--surface-3);
  color: var(--text-soft);
}

.sw-team {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  width: 100%;
}

.sw-team-logo {
  width: 18px;
  height: 18px;
  object-fit: contain;
  flex: 0 0 auto;
}

.sw-team-name {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
  font-weight: 500;
}

.sw-pts {
  font-weight: 700;
  color: var(--text);
}

.sw-form {
  display: flex;
  gap: 4px;
}

.sw-form-badge {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
}

.sw-form-badge.W { background: var(--success); }
.sw-form-badge.D { background: var(--warning); }
.sw-form-badge.L { background: var(--danger); }

.sw-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .sw-widget,
  .sw-card,
  .sw-scroll {
    max-width: 100%;
    min-width: 0;
    
  }

  .sw-topbar {
    padding: 8px;
  }

  .sw-mode {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .sw-mode-btn {
    width: 100%;
    padding: 8px 10px;
    font-size: 12px;
  }

  .sw-table {
    min-width: 580px;
    font-size: 12px;
  }

  .sw-table th,
  .sw-table td {
    padding: 8px 6px;
  }

  .sw-table th:nth-child(1),
  .sw-table td:nth-child(1) {
    width: 48px;
    min-width: 48px;
    max-width: 48px;
    left: 0;
  }

  .sw-table th:nth-child(2),
  .sw-table td:nth-child(2) {
    width: 140px;
    min-width: 140px;
    max-width: 140px;
    left: 48px; /* must match first col width */
  }

  .sw-table th:nth-child(n+3),
  .sw-table td:nth-child(n+3) {
    width: 30px;
    min-width: 30px;
    font-weight:700;
  }

  .sw-table th:last-child,
  .sw-table td:last-child {
    width: 110px;
    min-width: 110px;
  }

  .sw-team-name {
    max-width: 95px;
  }

  .sw-form-badge {
    width: 18px;
    height: 18px;
    font-size: 10px;
  }
}