/* ===================================================================
   Shared responsive overrides for all tracker pages
   Loaded AFTER the inline <style> block so these rules take precedence.
   =================================================================== */

/* --- Base fixes (all viewports) --- */

/* Allow long bill titles to wrap on whitespace, but DON'T break individual words. */
.tracker-table td {
  overflow-wrap: anywhere;
  word-break: normal;
  hyphens: none;
}

/* Title column gets a generous min-width so it doesn't squeeze words letter-by-letter. */
.tracker-table td:nth-child(3),
.tracker-table th:nth-child(3) {
  min-width: 280px;
}

/* --- Mobile (up to 640px) --- */
@media (max-width: 640px) {
  /* Filters: full-width stacked */
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .filter-group {
    width: 100%;
  }
  .filter-group select {
    width: 100%;
    min-width: 0;
  }
  .filter-reset {
    align-self: stretch;
    text-align: center;
  }
  .filter-count {
    align-self: stretch;
    text-align: center;
    padding-bottom: 0;
  }

  /* On mobile: keep the table at its natural width and let the wrapper scroll horizontally.
     The user can swipe left/right to see all columns. This avoids cramping all 6 columns into 390px. */
  .tracker-table {
    font-size: .82rem;
    min-width: 760px;
  }
  .tracker-table th,
  .tracker-table td {
    padding: 10px 12px;
  }

  /* Make the scroll wrapper visible so users know they can scroll */
  .tracker-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    margin: 0 -16px;
    padding: 0 16px;
  }

  /* Category grid (data-center tracker) */
  .category-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Tracker links stack */
  .tracker-links {
    flex-direction: column;
  }
  .tracker-links a {
    justify-content: center;
  }
}

/* --- Tablet (641px – 1024px) --- */
@media (min-width: 641px) and (max-width: 1024px) {
  /* Filters: 2-column grid that wraps naturally */
  .filter-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    align-items: end;
  }
  .filter-group select {
    width: 100%;
    min-width: 0;
  }

  .tracker-table {
    font-size: .82rem;
  }
}

/* --- Desktop (1025px+) --- */
@media (min-width: 1025px) {
  /* Filters stay as a flex row (the default from inline styles) */
  .filter-bar {
    flex-wrap: wrap;
    align-items: flex-end;
  }
}
