/*
 * The upcoming-predictions catalogue (homepage section, /predictions/,
 * League/Team pages), its locked Premium rows, and the shared calendar
 * date filter (templates/components/filters/date_range_filter.html -
 * also used by the Today/Tomorrow pages and Results). Tokens only; no
 * new colours, spacing or radii.
 */

/* ============ Calendar date filter ============
   Hallmark · component: date-filter pill · theme: Chag Sports tokens
   states: default · hover · focus · active (pressed) · open · disabled n/a (always available) ·
   loading/error/success n/a here (the inline range error lives in the panel - .date-filter__error) */
.date-filter {
  position: relative;
  max-width: 100%;
}

/* The trigger has the exact outer geometry of a .filter-group (the Today/Tomorrow and view controls it sits
   beside), built from the same pieces: the group's 4 px inset padding plus an option's 8 px padding around the
   same inherited line height, the 1 px border, and the option's min-height as the floor - so the two are the same
   height by construction, whatever the font metrics. Same border colour, full pill radius and tinted fill. One
   line always: from 480 px it shows the full label, below that a compact one (the full label stays in the
   accessible name). */
.date-filter__toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-8);
  max-width: 100%;
  min-height: calc(var(--filter-option-height) + 2 * var(--space-4) + 2px);
  padding: calc(var(--space-4) + var(--space-8)) var(--space-16);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
  font-size: var(--font-size-control);
  font-weight: var(--font-weight-bold);
  white-space: nowrap;
  cursor: pointer;
  list-style: none;
  transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

.date-filter__toggle::-webkit-details-marker {
  display: none;
}

.date-filter__toggle:hover {
  border-color: var(--color-border-strong);
  background: var(--color-surface);
}

.date-filter__toggle:active {
  background: var(--color-bg-secondary);
}

.date-filter__toggle:focus-visible {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 2px;
}

.date-filter[open] > .date-filter__toggle {
  border-color: var(--color-primary);
  background: var(--color-surface);
}

.date-filter__icon,
.date-filter__chevron {
  flex: none;
}

.date-filter__chevron {
  transition: transform var(--transition-fast);
}

.date-filter[open] .date-filter__chevron {
  transform: rotate(180deg);
}

.date-filter__current {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.date-filter__label-short {
  display: none;
}

@media (max-width: 479px) {
  .date-filter__label-full {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .date-filter__label-short {
    display: inline;
  }
}

/* The panel's quick dates (All upcoming / Today / Tomorrow): separate pill chips that wrap as whole chips on a
   phone, the current choice marked like a selected .filter-option (and aria-current). */
.date-filter__quick {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-8);
}

.date-filter__quick .filter-option {
  border: 1px solid var(--color-border);
  background: var(--color-bg-secondary);
  white-space: nowrap;
}

.date-filter__quick .filter-option:hover:not(.is-active) {
  border-color: var(--color-border-strong);
  text-decoration: none;
}

.date-filter__quick .filter-option.is-active {
  border-color: var(--color-border-strong);
}

.date-filter__panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-12);
  margin-top: var(--space-8);
  padding: var(--space-16);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  background: var(--color-surface-elevated);
  box-shadow: var(--shadow-md);
}

.date-filter__form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-12);
}

.date-filter__field {
  min-width: 0;
}

.date-filter__hint,
.date-filter__error,
.date-filter__actions {
  grid-column: 1 / -1;
  margin: 0;
}

/* Secondary (not muted) text keeps small captions at WCAG AA on the elevated panel in both themes. */
.date-filter__hint {
  color: var(--color-text-secondary);
}

.date-filter__error {
  color: var(--color-error);
}

.date-filter__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-8);
}

@media (max-width: 479px) {
  .date-filter__form {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (min-width: 768px) {
  .date-filter__panel {
    position: absolute;
    z-index: 20;
    min-width: 22rem;
  }
}

/* The homepage section is a filter-link target (#upcoming-predictions): keep its heading clear of the sticky
   header after a jump - the same scroll-margin-top treatment football.css/league-detail.css already use. */
#upcoming-predictions {
  scroll-margin-top: var(--space-24);
}

/* ============ Toolbar (calendar + sport filter + active filter) ============
   The separate All upcoming/Today/Tomorrow pill row is gone (launch polish): the calendar pill is the one date
   control, its panel offers those three choices. */
.upcoming-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--space-12);
  margin-bottom: var(--space-16);
}

.upcoming-toolbar__status {
  margin: 0 0 var(--space-16);
  color: var(--color-text-secondary);
}

.upcoming-toolbar__status strong {
  color: var(--color-text-primary);
}

/* ============ Catalogue ============ */
.upcoming-catalogue {
  display: flex;
  flex-direction: column;
  gap: var(--space-32);
}

.upcoming-day__heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-8);
  margin: 0 0 var(--space-12);
}

.upcoming-day__relative {
  padding: 0 var(--space-8);
  border-radius: var(--radius-pill);
  background: var(--color-accent);
  color: var(--color-accent-contrast);
}

.upcoming-day__count {
  color: var(--color-text-secondary);
}

.upcoming-day__fixtures {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--grid-gap);
}

@media (min-width: 1280px) {
  .upcoming-day__fixtures {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.upcoming-fixture {
  display: flex;
  flex-direction: column;
  gap: var(--space-12);
  min-width: 0;
}

.upcoming-fixture__header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-12);
}

/* Kickoff line: secondary text, as on the prediction card's pick panel, so it stays at WCAG AA on the card surface
   in the dark theme. The team row (matchup_row.html) takes the full card width so it can stay on one line. */
.upcoming-fixture__meta {
  color: var(--color-text-secondary);
}

.upcoming-fixture__header .matchup-row {
  align-self: stretch;
}

.upcoming-fixture__markets {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ============ Locked Premium rows ============ */
/* Surface (not the secondary background) keeps the muted caption text at WCAG AA in the light theme; the dashed
   border and the lock label - never colour alone - mark the row as locked. */
.compact-prediction-row--locked {
  border-style: dashed;
  border-color: var(--color-border-strong);
}

.locked-prediction__title {
  display: inline-flex;
  align-items: center;
  gap: var(--space-8);
}

.locked-prediction__icon {
  flex: none;
}

/* ============ Match Detail locked primary panel ============ */
.locked-prediction-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-12);
}

/* ============ Fixture-list marker ============ */
.fixture-row__prediction-marker {
  align-self: flex-start;
  max-width: 100%;
  white-space: normal;
}
