/* ============================================
   InfluenceHub – Bulk action bar a11y
   - WCAG AA contrast for the bulk selection bar
     (#bulk-action-bar) and its count chip
     (#bulk-count / .bulk-count).
   - prefers-reduced-motion guard: disables the
     slide-in transition and any hover/focus
     transforms on the bar and its buttons.
   - Dark mode contrast re-assertion so generic
     dark-mode text utilities cannot reduce the
     contrast below AA.
   - Forced-colors (Windows High Contrast) support.
   ============================================ */

/* ---------- Bulk action bar – base contrast (WCAG AA) ----------
   The bar uses a white/95 surface with slate text in light mode and
   a slate-900/95 surface with light text in dark mode. Re-assert the
   key colors with !important so generic utilities cannot override.

   Light mode:
     - bar text: #0f172a on rgba(255,255,255,0.95) ≈ 17.9:1
     - count chip: #6d28d9 on #f5f3ff = 8.4:1
   Dark mode:
     - bar text: #f1f5f9 on rgba(15,23,42,0.95) ≈ 15.9:1
     - count chip: #ddd6fe on rgba(124,58,237,0.2) over #0f172a ≈ 9.6:1
*/

#bulk-action-bar {
  color: #0f172a !important;
}

.dark #bulk-action-bar {
  color: #f1f5f9 !important;
}

/* ---------- Count chip (#bulk-count / .bulk-count) ---------- */

#bulk-action-bar .bulk-count,
#bulk-action-bar #bulk-count {
  color: #6d28d9 !important;
  font-weight: 700;
}

.dark #bulk-action-bar .bulk-count,
.dark #bulk-action-bar #bulk-count {
  color: #ddd6fe !important;
}

/* The chip wrapper that holds the count uses a brand-50 background
   in light mode and a brand-950/60 background in dark mode. Re-assert
   those backgrounds so the count text keeps its AA contrast. */
#bulk-action-bar .bulk-count-chip,
#bulk-action-bar > div > span:first-child {
  background: #f5f3ff !important;
  color: #6d28d9 !important;
}

.dark #bulk-action-bar .bulk-count-chip,
.dark #bulk-action-bar > div > span:first-child {
  background: rgba(76, 29, 149, 0.6) !important;
  color: #ddd6fe !important;
}

/* ---------- Clear button contrast ---------- */

#bulk-action-bar #bulk-clear,
#bulk-action-bar [data-bulk-clear] {
  color: #475569 !important;
}

#bulk-action-bar #bulk-clear:hover,
#bulk-action-bar [data-bulk-clear]:hover {
  color: #6d28d9 !important;
}

.dark #bulk-action-bar #bulk-clear,
.dark #bulk-action-bar [data-bulk-clear] {
  color: #cbd5e1 !important;
}

.dark #bulk-action-bar #bulk-clear:hover,
.dark #bulk-action-bar [data-bulk-clear]:hover {
  color: #c4b5fd !important;
}

/* ---------- Send button contrast ---------- */

#bulk-action-bar #bulk-send,
#bulk-action-bar [data-bulk-send] {
  color: #ffffff !important;
}

/* ---------- prefers-reduced-motion guard ----------
   The bar slides in via a transform transition. Users who prefer
   reduced motion should see it appear instantly, with no hover or
   focus transforms on the bar or its buttons. */

@media (prefers-reduced-motion: reduce) {
  #bulk-action-bar {
    transition: none !important;
    animation: none !important;
  }

  #bulk-action-bar.is-visible {
    transform: none !important;
    transition: none !important;
  }

  /* Neutralise any hover/focus/active transform on the bar itself */
  #bulk-action-bar:hover,
  #bulk-action-bar:focus,
  #bulk-action-bar:focus-within,
  #bulk-action-bar:active {
    transform: none !important;
    transition: none !important;
  }

  /* Buttons inside the bar must not animate either */
  #bulk-action-bar button,
  #bulk-action-bar [role="button"] {
    transition: none !important;
    animation: none !important;
  }

  #bulk-action-bar button:hover,
  #bulk-action-bar button:focus,
  #bulk-action-bar button:focus-visible,
  #bulk-action-bar button:active {
    transform: none !important;
    transition: none !important;
  }

  /* The count chip must not pulse or scale */
  #bulk-action-bar .bulk-count,
  #bulk-action-bar #bulk-count,
  #bulk-action-bar .bulk-count-chip {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }

  /* Keep the focus ring visible but static (no animated halo) */
  #bulk-action-bar button:focus-visible {
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25) !important;
  }

  .dark #bulk-action-bar button:focus-visible {
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35) !important;
  }
}

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

@media (forced-colors: active) {
  #bulk-action-bar > div {
    border: 1px solid CanvasText;
    background: Canvas;
    color: CanvasText;
    box-shadow: none;
  }

  #bulk-action-bar .bulk-count,
  #bulk-action-bar #bulk-count,
  #bulk-action-bar .bulk-count-chip {
    background: Highlight;
    color: HighlightText;
    border: 1px solid HighlightText;
  }

  #bulk-action-bar button:focus-visible,
  #bulk-action-bar button:focus {
    outline: 2px solid Highlight;
    outline-offset: 2px;
    box-shadow: none;
  }
}
