/* Historical Data table — page-scoped styles, kept separate from the
   shared (minified) styles.css so this feature never has to touch it. */

.broadcast-history-section .archive-intro {
    margin-bottom: 24px;
}

.broadcast-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

/* Direct-child combinators only — the county/team fields are now the
   reusable .county-search-wrap widget (see below), which styles its own
   nested input; these generic rules must not also apply to it. */
.broadcast-filters > input,
.broadcast-filters > select,
.bh-date-field input {
    font-family: var(--font-main);
    font-size: 0.85rem;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    height: 40px;
}

.broadcast-filters > input::placeholder {
    color: var(--color-text-muted);
}

.broadcast-filters > select {
    flex: 0 0 auto;
}

/* Native date inputs ignore the placeholder attribute and, depending on
   browser/width, can render with no visible hint at all — so each date
   field gets an explicit "From"/"To" label instead of relying on that.
   The pair is grouped in .bh-date-range so, if the filter row runs out of
   width, From and To wrap onto the next line together instead of splitting
   apart mid-pair. */
.bh-date-range {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    flex: 0 0 auto;
}

.bh-date-field {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.bh-date-label {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.bh-date-field input {
    color-scheme: dark;
}

/* County/team autocomplete widgets (.county-search-wrap is the shared,
   globally-styled component also used on individual map pages) — sized to
   sit compactly in this filter row instead of its default full-width /
   standalone spacing. */
.broadcast-filters .bh-autocomplete-wrap {
    flex: 1 1 200px;
    min-width: 160px;
    margin-bottom: 0;
}

.broadcast-filters .bh-autocomplete-wrap .county-search-box {
    /* Match the plain <select>/<input> fields beside it exactly — the
       shared .county-search-box (styles.css) otherwise uses a lighter
       surface color, a larger pill-like border radius, and (via its icon
       + gap) a slightly different natural height. */
    padding: 9px 12px;
    background: var(--color-surface);
    border-radius: var(--radius-sm);
    height: 40px;
}

.broadcast-filters .bh-autocomplete-wrap .county-search-input {
    font-size: 0.85rem;
}

.broadcast-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}

.broadcast-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    white-space: nowrap;
}

.broadcast-table th,
.broadcast-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.broadcast-table thead th {
    background: var(--color-surface);
    color: var(--color-text-muted);
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    user-select: none;
    position: sticky;
    top: 0;
}

.broadcast-table thead th:hover {
    color: var(--color-text);
}

.broadcast-table thead th .sort-arrow {
    display: inline-block;
    margin-left: 4px;
    opacity: 0.4;
}

.broadcast-table thead th.is-sorted .sort-arrow {
    opacity: 1;
    color: var(--color-primary);
}

.broadcast-table tbody tr:hover {
    background: var(--color-surface);
}

.broadcast-table tbody td a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
}

.broadcast-table tbody td a:hover {
    text-decoration: underline;
}

.broadcast-table-empty td,
.broadcast-table-loading td {
    text-align: center;
    color: var(--color-text-muted);
    padding: 32px 14px;
}

.broadcast-pagination {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.broadcast-pagination button {
    height: 40px;
    padding: 0 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 100px;
    font-family: var(--font-main);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    transition: background var(--transition), border-color var(--transition);
}

.broadcast-pagination button:hover:not(:disabled) {
    border-color: var(--color-primary);
}

.broadcast-pagination button:disabled {
    opacity: 0.4;
    cursor: default;
}

.broadcast-pagination-count {
    font-size: 0.82rem;
    color: var(--color-text-muted);
}

@media (max-width: 640px) {
    .broadcast-filters > input,
    .broadcast-filters > select,
    .broadcast-filters .bh-autocomplete-wrap,
    .bh-date-range {
        flex: 1 1 100%;
    }

    .bh-date-field {
        flex: 1 1 100%;
    }

    .bh-date-field input {
        flex: 1 1 auto;
        min-width: 0;
    }

    /* Stacked-card table — a horizontally-scrolling table of 6-7 columns is
       unusable on a phone, so below this width each row becomes its own
       card with label/value pairs instead. The head-only-visible-on-desktop
       swap means sort-by-column (a header click/tap) isn't available on
       mobile; default sort (newest date first) covers the common case. */
    .broadcast-table-wrap {
        overflow-x: visible;
        border: none;
        border-radius: 0;
    }

    .broadcast-table {
        white-space: normal;
    }

    .broadcast-table thead {
        display: none;
    }

    .broadcast-table,
    .broadcast-table tbody {
        display: block;
        width: 100%;
    }

    .broadcast-table tbody tr {
        display: block;
        background: var(--color-surface);
        border: 1px solid var(--color-border);
        border-radius: var(--radius-md);
        padding: 4px 14px;
        margin-bottom: 12px;
    }

    .broadcast-table tbody tr:hover {
        background: var(--color-surface);
    }

    .broadcast-table tbody tr.broadcast-table-empty,
    .broadcast-table tbody tr.broadcast-table-loading {
        background: transparent;
        border: none;
        padding: 0;
    }

    .broadcast-table td {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: 16px;
        padding: 10px 0;
        border-bottom: 1px solid var(--color-border);
        text-align: right;
    }

    .broadcast-table tr > td:last-of-type {
        border-bottom: none;
    }

    .broadcast-table td::before {
        content: attr(data-label);
        color: var(--color-text-muted);
        font-weight: 700;
        font-size: 0.72rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        text-align: left;
        flex: 0 0 auto;
    }

    /* "View Map" — a full-width link row instead of a label/value pair */
    .broadcast-table td.broadcast-table-maplink {
        justify-content: center;
        padding: 12px 0;
    }

    .broadcast-table td.broadcast-table-maplink::before {
        content: none;
    }

    .broadcast-table td.broadcast-table-maplink a {
        font-size: 0.85rem;
    }

    .broadcast-table-empty td,
    .broadcast-table-loading td {
        display: block;
        text-align: center;
        padding: 32px 14px;
    }

    .broadcast-table-empty td::before,
    .broadcast-table-loading td::before {
        content: none;
    }
}
