/* ============================================
   InfluenceHub – Bulk action bar buttons a11y
   - Visible :focus-visible ring for #bulk-clear and
     #bulk-send inside #bulk-action-bar so keyboard
     users can see which bulk action is focused.
   - 44px minimum touch target (WCAG 2.5.5) for
     mobile users on both buttons.
   - Dark mode, prefers-reduced-motion and forced-colors
     support.
   ============================================ */

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

#bulk-action-bar #bulk-clear,
#bulk-action-bar #bulk-send {
  /* 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;
  transition: background-color 0.15s ease, border-color 0.15s ease,
    color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

/* The bulk bar itself must never clip the focus ring of its buttons.
   The bar uses overflow-hidden in some layouts – override it so the
   outline + halo stay fully visible. */
#bulk-action-bar,
#bulk-action-bar > div {
  overflow: visible;
}

/* The "Išvalyti" button is a small text button – give it enough
   horizontal padding so the 44px height does not look cramped. */
#bulk-action-bar #bulk-clear {
  padding-left: 0.75rem;
  padding-right: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* The "Siųsti užklausas" button already has generous padding –
   keep it but guarantee the 44px height. */
#bulk-action-bar #bulk-send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ---------- 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 bar background and the dark-mode surface. */
#bulk-action-bar #bulk-clear:focus-visible,
#bulk-action-bar #bulk-send:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
}

/* The "Išvalyti" button is a transparent text button – give it a
   visible background tint while focused so the ring reads clearly
   against the white bar. */
#bulk-action-bar #bulk-clear:focus-visible {
  background: #f1f5f9;
  color: #0f172a;
}

/* The primary "Siųsti užklausas" button uses a dark slate fill in
   light mode – add a white inner ring so the violet outline stays
   visible against the dark fill. */
#bulk-action-bar #bulk-send: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 #bulk-action-bar #bulk-clear:focus-visible,
.dark #bulk-action-bar #bulk-send:focus-visible {
  outline-color: #c4b5fd;
  box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
}

/* Dark mode – focused "Išvalyti" gets a subtle slate tint so the
   light violet ring stays legible on the dark bar surface. */
.dark #bulk-action-bar #bulk-clear:focus-visible {
  background: #1e293b;
  color: #f1f5f9;
}

/* In dark mode the primary button uses the brand violet fill – add a
   dark inner ring so the light violet outline stays visible. */
.dark #bulk-action-bar #bulk-send: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) {
  #bulk-action-bar #bulk-clear:focus,
  #bulk-action-bar #bulk-send:focus {
    outline: 2px solid #7c3aed;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
  }

  #bulk-action-bar #bulk-clear:focus {
    background: #f1f5f9;
    color: #0f172a;
  }

  #bulk-action-bar #bulk-send:focus {
    box-shadow:
      0 0 0 2px #ffffff,
      0 0 0 6px rgba(124, 58, 237, 0.35);
  }

  .dark #bulk-action-bar #bulk-clear:focus,
  .dark #bulk-action-bar #bulk-send:focus {
    outline-color: #c4b5fd;
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
  }

  .dark #bulk-action-bar #bulk-clear:focus {
    background: #1e293b;
    color: #f1f5f9;
  }

  .dark #bulk-action-bar #bulk-send: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) {
  #bulk-action-bar #bulk-clear,
  #bulk-action-bar #bulk-send {
    min-height: 44px;
    min-width: 44px;
  }

  /* On very narrow viewports the bar wraps – let the primary action
     stretch so it remains easy to tap. */
  #bulk-action-bar #bulk-send {
    flex: 1 1 auto;
  }

  /* Keep the "Išvalyti" button at a comfortable tap size even when
     the bar wraps onto multiple rows. */
  #bulk-action-bar #bulk-clear {
    padding-left: 0.9rem;
    padding-right: 0.9rem;
  }
}

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

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

  /* Neutralise any hover/focus transform so no motion is perceived */
  #bulk-action-bar #bulk-clear:hover,
  #bulk-action-bar #bulk-clear:focus,
  #bulk-action-bar #bulk-clear:active,
  #bulk-action-bar #bulk-send:hover,
  #bulk-action-bar #bulk-send:focus,
  #bulk-action-bar #bulk-send:active {
    transform: none !important;
    transition: none !important;
  }

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

  #bulk-action-bar #bulk-send:focus-visible {
    box-shadow:
      0 0 0 2px #ffffff,
      0 0 0 6px rgba(124, 58, 237, 0.35) !important;
  }

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

  .dark #bulk-action-bar #bulk-send:focus-visible {
    box-shadow:
      0 0 0 2px #0f172a,
      0 0 0 6px rgba(196, 181, 253, 0.45) !important;
  }

  /* The focused "Išvalyti" background tint is a static colour change,
     not motion – keep it but drop any transition. */
  #bulk-action-bar #bulk-clear:focus-visible {
    background: #f1f5f9 !important;
    color: #0f172a !important;
  }

  .dark #bulk-action-bar #bulk-clear:focus-visible {
    background: #1e293b !important;
    color: #f1f5f9 !important;
  }
}

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

@media (forced-colors: active) {
  #bulk-action-bar #bulk-clear,
  #bulk-action-bar #bulk-send {
    border: 1px solid CanvasText;
    color: CanvasText;
    background: Canvas;
  }

  #bulk-action-bar #bulk-clear:hover,
  #bulk-action-bar #bulk-send:hover {
    background: Highlight;
    color: HighlightText;
  }

  #bulk-action-bar #bulk-clear:focus-visible,
  #bulk-action-bar #bulk-send:focus-visible,
  #bulk-action-bar #bulk-clear:focus,
  #bulk-action-bar #bulk-send:focus {
    outline: 2px solid Highlight;
    outline-offset: 2px;
    box-shadow: none;
    background: Highlight;
    color: HighlightText;
  }

  /* In forced-colors mode the outline is the only focus cue – make it
     thicker so it is unmistakable on the high-contrast palette. */
  #bulk-action-bar #bulk-clear:focus-visible,
  #bulk-action-bar #bulk-send:focus-visible {
    outline-width: 3px;
  }
}
