/* Desktop filter chips — central column row above the match list. Only
   rendered on `.has-desktop-shell` at ≥1200px. Chips are centered in
   the row and dispatch the same window events the mobile live-today /
   header-menu controllers emit (see `desktop_filter_chips_controller`).
   Pattern matches the Feeberse-Home-Remix mockup. */

@layer components {
  .desktop-filter-chips {
    display: none;
  }

  @media (width >= 1200px) {
    .has-desktop-shell .desktop-filter-chips {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 12px 0;
    }

    .has-desktop-shell .desktop-filter-chip {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 7px 14px;
      border-radius: 9999px;
      background: rgb(255 255 255 / 5%);
      color: var(--color-text);
      border: 1px solid rgb(255 255 255 / 8%);
      font-family: var(--font-body);
      font-size: 12px;
      font-weight: 600;
      cursor: pointer;
      transition:
        background 0.15s ease,
        color 0.15s ease,
        border-color 0.15s ease;
      flex-shrink: 0;
    }

    /* Icon-only variant — square padding, tooltip via title/aria-label.
       Used for the sort + expand/collapse buttons in the filter bar. */
    .has-desktop-shell .desktop-filter-chip--icon {
      padding: 0;
      width: 36px;
      height: 32px;
      justify-content: center;
      color: var(--color-text-muted);
    }

    .has-desktop-shell .desktop-filter-chip--icon:hover {
      color: var(--color-text);
    }

    .has-desktop-shell .desktop-filter-chip--accent.desktop-filter-chip--icon {
      color: var(--color-accent);
    }

    /* Collapse chip flips the chevron when state == collapsed. */
    .has-desktop-shell .desktop-filter-chip--collapsed .desktop-filter-chip__icon-chevron {
      transform: rotate(180deg);
    }

    /* Search input wraps in a pill matching the chip aesthetic, but
       flex-grows to fill the empty space between the toggle group and
       the icon-only buttons. */
    .has-desktop-shell .desktop-filter-chips__search {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 0 14px;
      background: rgb(255 255 255 / 5%);
      border: 1px solid rgb(255 255 255 / 8%);
      border-radius: 9999px;
      height: 32px;
      flex: 1 1 auto;
      min-width: 0;
      transition:
        background 0.15s ease,
        border-color 0.15s ease;
    }

    .has-desktop-shell .desktop-filter-chips__search:focus-within {
      background: rgb(255 255 255 / 8%);
      border-color: rgb(255 255 255 / 14%);
    }

    .has-desktop-shell .desktop-filter-chips__search-icon {
      color: var(--color-text-muted);
      flex-shrink: 0;
    }

    .has-desktop-shell .desktop-filter-chips__search-input {
      flex: 1 1 auto;
      min-width: 0;
      background: transparent;
      border: 0;
      outline: 0;
      color: var(--color-text);
      font-family: var(--font-body);
      font-size: 13px;
      padding: 0;
    }

    .has-desktop-shell .desktop-filter-chips__search-input::placeholder {
      color: var(--color-text-muted);
    }

    .has-desktop-shell .desktop-filter-chip:hover {
      background: rgb(255 255 255 / 8%);
      border-color: rgb(255 255 255 / 14%);
    }

    /* Accent state — green pill for sort=time and following=on. */
    .has-desktop-shell .desktop-filter-chip--accent {
      background: rgb(0 255 135 / 12%);
      color: var(--color-accent);
      border-color: transparent;
    }

    .has-desktop-shell .desktop-filter-chip--accent:hover {
      background: rgb(0 255 135 / 18%);
      border-color: transparent;
    }

    /* LIVE chip — red text + pulsing dot when active. Inactive state
       hides the dot via the chip variant rule. */
    .has-desktop-shell .desktop-filter-chip--live .desktop-filter-chip__dot {
      display: inline-block;
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background: var(--color-text-muted);
      transition: background 0.15s ease;
    }

    .has-desktop-shell .desktop-filter-chip--live-active {
      color: var(--color-live);
    }

    .has-desktop-shell .desktop-filter-chip--live-active .desktop-filter-chip__dot {
      background: var(--color-live);
      animation: desktop-filter-chip-pulse 1.4s ease-in-out infinite;
      box-shadow: 0 0 0 0 var(--color-live);
    }

    @keyframes desktop-filter-chip-pulse {
      0%,
      100% {
        opacity: 1;
      }

      50% {
        opacity: 0.4;
      }
    }

    @media (prefers-reduced-motion: reduce) {
      .has-desktop-shell .desktop-filter-chip--live-active .desktop-filter-chip__dot {
        animation: none;
      }
    }

    /* Live count badge — N partidos en directo en today. Misma fuente
       que el resto del chip (Oswald 600 / mono tabular para el número),
       fondo accent live discreto, padding compacto para no romper la
       altura del chip. Hidden cuando no hay live o filter activo. */
    .has-desktop-shell .desktop-filter-chip__count {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-width: 18px;
      height: 16px;
      padding: 0 5px;
      margin-left: 4px;
      border-radius: 8px;
      background: var(--color-live);
      color: var(--color-on-accent, #fff);
      font-family: var(--font-body);
      font-size: 10px;
      font-weight: 700;
      letter-spacing: 0;
      font-variant-numeric: tabular-nums;
      line-height: 1;
    }

    .has-desktop-shell .desktop-filter-chip__count[hidden] {
      display: none;
    }
  }
}
