/* ============================================
   InfluenceHub – Catalog empty state action buttons a11y
   - Visible :focus-visible ring for #empty-clear-filters
     and #empty-show-all so keyboard users can see which
     recovery action is focused after a zero-result search.
   - 44px minimum touch target (WCAG 2.5.5) for mobile users.
   - Dark mode, prefers-reduced-motion and forced-colors support.
   ============================================ */

/* ---------- Base: 44px touch targets ---------- */

#empty-clear-filters,
#empty-show-all {
  /* WCAG 2.5.5 – minimum 44x44px touch target for mobile users */
  min-height: 44px;
  min-width: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  z-index: 1;
}

/* ---------- Focus-visible ring (keyboard) ---------- */

/* High-contrast, always-visible ring for keyboard users. The ring is
   drawn with both an outline and a box-shadow halo so it stays visible
   against the light button background and the dark-mode surface. */
#empty-clear-filters:focus-visible,
#empty-show-all:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
}

/* The primary "Išvalyti filtrus" button uses a dark slate background
   in light mode – add a white inner ring so the violet outline stays
   visible against the dark fill. */
#empty-clear-filters:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
  box-shadow:
    0 0 0 2px #ffffff,
    0 0 0 6px rgba(124, 58, 237, 0.35);
}

/* ---------- Dark mode ---------- */

.dark #empty-clear-filters:focus-visible,
.dark #empty-show-all:focus-visible {
  outline-color: #c4b5fd;
  box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
}

/* In dark mode the primary button uses the brand violet fill – add a
   dark inner ring so the light violet outline stays visible. */
.dark #empty-clear-filters:focus-visible {
  outline-color: #c4b5fd;
  box-shadow:
    0 0 0 2px #0f172a,
    0 0 0 6px rgba(196, 181, 253, 0.45);
}

/* ---------- Fallback for browsers without :focus-visible ---------- */

@supports not selector(:focus-visible) {
  #empty-clear-filters:focus,
  #empty-show-all:focus {
    outline: 2px solid #7c3aed;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
  }

  #empty-clear-filters:focus {
    box-shadow:
      0 0 0 2px #ffffff,
      0 0 0 6px rgba(124, 58, 237, 0.35);
  }

  .dark #empty-clear-filters:focus,
  .dark #empty-show-all:focus {
    outline-color: #c4b5fd;
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
  }

  .dark #empty-clear-filters:focus {
    box-shadow:
      0 0 0 2px #0f172a,
      0 0 0 6px rgba(196, 181, 253, 0.45);
  }
}

/* ---------- Small screens: keep the 44px target when stacked ---------- */

@media (max-width: 480px) {
  #empty-clear-filters,
  #empty-show-all {
    min-height: 44px;
    min-width: 44px;
  }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  #empty-clear-filters,
  #empty-show-all {
    transition: none !important;
    animation: none !important;
  }

  /* Keep the focus ring visible but static (no animated halo) */
  #empty-clear-filters:focus-visible,
  #empty-show-all:focus-visible {
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25) !important;
  }

  #empty-clear-filters:focus-visible {
    box-shadow:
      0 0 0 2px #ffffff,
      0 0 0 6px rgba(124, 58, 237, 0.35) !important;
  }

  .dark #empty-clear-filters:focus-visible,
  .dark #empty-show-all:focus-visible {
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35) !important;
  }

  .dark #empty-clear-filters:focus-visible {
    box-shadow:
      0 0 0 2px #0f172a,
      0 0 0 6px rgba(196, 181, 253, 0.45) !important;
  }
}

/* ---------- Forced colors (Windows High Contrast) ---------- */

@media (forced-colors: active) {
  #empty-clear-filters,
  #empty-show-all {
    border: 1px solid CanvasText;
  }

  #empty-clear-filters:focus-visible,
  #empty-show-all:focus-visible,
  #empty-clear-filters:focus,
  #empty-show-all:focus {
    outline: 2px solid Highlight;
    outline-offset: 2px;
    box-shadow: none;
  }
}
