/* The ArenaCapacity Bag Policy Index — sortable, filterable, mobile-friendly table. */

/* Page-level spacing — give the H1 proper breathing room above and below.
   Target the page-id class so this only applies to the Index page. */
.page-id-11112 main {
  padding-top: var(--space-8);
}

.page-id-11112 .wp-block-post-title {
  margin-top: 0;
  margin-bottom: var(--space-6);
  line-height: 1.15;
}

.ac-bpi {
  --bpi-border:    var(--color-border);
  --bpi-bg-alt:    var(--color-surface-alt);
  --bpi-text-mute: var(--color-text-muted);
  margin: 0 0 var(--space-6);
  font-size: var(--text-base);
  line-height: 1.5;
}

.ac-bpi__header {
  margin-bottom: var(--space-4);
}

.ac-bpi__meta {
  margin: 0;
  color: var(--bpi-text-mute);
  font-size: var(--text-sm);
}

.ac-bpi__download {
  font-weight: 600;
  text-decoration: none;
}

.ac-bpi__download:hover {
  text-decoration: underline;
}

/* Stats row — explicit column count avoids awkward wrapping */
.ac-bpi__stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-3);
  margin: var(--space-4) 0 var(--space-6);
  padding: var(--space-4);
  background: var(--bpi-bg-alt);
  border-radius: var(--radius-md);
  border: 1px solid var(--bpi-border);
}

@media (max-width: 1024px) {
  .ac-bpi__stats {
    grid-template-columns: repeat(3, 1fr);
  }
}

.ac-bpi__stat {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  text-align: center;
}

.ac-bpi__stat-num {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.1;
}

.ac-bpi__stat-label {
  font-size: var(--text-xs);
  color: var(--bpi-text-mute);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Controls bar */
.ac-bpi__controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  align-items: stretch;
}

.ac-bpi__search,
.ac-bpi__filter,
.ac-bpi__reset {
  font-size: var(--text-sm);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--bpi-border);
  border-radius: var(--radius-md);
  background: #fff;
  color: var(--color-text);
  font-family: inherit;
}

.ac-bpi__search {
  flex: 1 1 220px;
  min-width: 160px;
}

.ac-bpi__filter {
  flex: 0 0 auto;
  min-width: 140px;
  cursor: pointer;
}

.ac-bpi__reset {
  flex: 0 0 auto;
  background: var(--bpi-bg-alt);
  cursor: pointer;
  font-weight: 600;
}

.ac-bpi__reset:hover {
  background: var(--color-border);
}

/* Table wrapper — horizontal scroll on tablet, card collapse on phone */
.ac-bpi__table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--bpi-border);
  border-radius: var(--radius-md);
}

.ac-bpi__table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.ac-bpi__table th,
.ac-bpi__table td {
  padding: var(--space-3) var(--space-3);
  text-align: left;
  border-bottom: 1px solid var(--bpi-border);
  vertical-align: middle;
  white-space: nowrap;
}

.ac-bpi__table th {
  background: var(--bpi-bg-alt);
  font-weight: 700;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-primary);
  cursor: pointer;
  position: sticky;
  top: 0;
  z-index: 2;
  user-select: none;
}

.ac-bpi__table th:hover {
  background: var(--color-border);
}

.ac-bpi__table th[data-sort-active="asc"]::after  { content: " ▲"; font-size: 0.8em; }
.ac-bpi__table th[data-sort-active="desc"]::after { content: " ▼"; font-size: 0.8em; }

.ac-bpi__table tbody tr:hover {
  background: var(--bpi-bg-alt);
}

.ac-bpi__table tbody tr.ac-bpi__row--hidden {
  display: none;
}

.ac-bpi__venue a {
  font-weight: 600;
  text-decoration: none;
  color: var(--color-primary);
}

.ac-bpi__venue a:hover {
  text-decoration: underline;
}

/* Badges — color-coded for at-a-glance scanning */
.ac-bpi__badge {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  border: 1px solid transparent;
}

.ac-bpi__badge--required { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.ac-bpi__badge--rec      { background: #fef3c7; color: #854d0e; border-color: #fde68a; }
.ac-bpi__badge--not      { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }
.ac-bpi__badge--allowed  { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.ac-bpi__badge--neutral  { background: #f1f5f9; color: #64748b; border-color: #e2e8f0; }

.ac-bpi__check { color: #16a34a; font-weight: 700; }
.ac-bpi__x     { color: #94a3b8; font-weight: 700; }

.ac-bpi__empty {
  text-align: center;
  padding: var(--space-6);
  color: var(--bpi-text-mute);
}

/* Methodology */
.ac-bpi__methodology {
  margin-top: var(--space-8);
  padding: var(--space-5);
  background: var(--bpi-bg-alt);
  border-radius: var(--radius-md);
  border: 1px solid var(--bpi-border);
}

.ac-bpi__methodology h2 {
  margin: 0 0 var(--space-3);
  font-size: var(--text-xl);
  color: var(--color-primary);
}

.ac-bpi__methodology p {
  margin: 0 0 var(--space-3);
  font-size: var(--text-sm);
  line-height: 1.6;
}

.ac-bpi__methodology p:last-child {
  margin-bottom: 0;
}

/* Footer cross-link block on individual bag policy posts */
.ac-bpi-cross-link {
  margin: var(--space-6) 0;
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface-alt);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius-md);
}

.ac-bpi-cross-link p {
  margin: 0;
  font-size: var(--text-sm);
  line-height: 1.6;
}

/* League-scoped callout on bag policy category archives */
.ac-bpi-league-callout {
  margin: 0 0 var(--space-6);
  padding: var(--space-5) var(--space-6);
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  border-left: 4px solid var(--color-primary);
}

.ac-bpi-league-callout__header {
  margin-bottom: var(--space-4);
}

.ac-bpi-league-callout__title {
  margin: 0 0 var(--space-2);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.2;
}

.ac-bpi-league-callout__sub {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.5;
}

.ac-bpi-league-callout__stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  padding: var(--space-3);
  background: var(--color-surface-alt);
  border-radius: var(--radius-md);
}

.ac-bpi-league-callout__stat {
  display: flex;
  flex-direction: column;
  text-align: center;
  gap: var(--space-1);
}

.ac-bpi-league-callout__num {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.1;
}

.ac-bpi-league-callout__label {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ac-bpi-league-callout__cta {
  display: inline-block;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-primary);
  text-decoration: none;
}

.ac-bpi-league-callout__cta:hover {
  text-decoration: underline;
}

@media (max-width: 768px) {
  .ac-bpi-league-callout__stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile — table collapses to cards */
@media (max-width: 768px) {
  .ac-bpi__stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .ac-bpi__controls {
    gap: var(--space-2);
  }

  .ac-bpi__search,
  .ac-bpi__filter,
  .ac-bpi__reset {
    flex: 1 1 100%;
  }

  .ac-bpi__table-wrap {
    overflow: visible;
    border: none;
  }

  .ac-bpi__table thead {
    display: none;
  }

  .ac-bpi__table,
  .ac-bpi__table tbody,
  .ac-bpi__table tr,
  .ac-bpi__table td {
    display: block;
    width: 100%;
  }

  .ac-bpi__table tr {
    margin-bottom: var(--space-3);
    border: 1px solid var(--bpi-border);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    background: #fff;
  }

  .ac-bpi__table td {
    border-bottom: none;
    padding: var(--space-1) 0;
    white-space: normal;
    display: flex;
    justify-content: space-between;
    gap: var(--space-3);
    align-items: center;
  }

  .ac-bpi__table td::before {
    content: attr(data-label);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--bpi-text-mute);
    font-weight: 700;
    flex: 0 0 auto;
  }

  .ac-bpi__venue {
    border-bottom: 1px solid var(--bpi-border) !important;
    padding-bottom: var(--space-2) !important;
    margin-bottom: var(--space-2);
  }

  .ac-bpi__venue::before {
    display: none;
  }

  .ac-bpi__venue a {
    font-size: var(--text-base);
  }
}
