/* ============================================
   InfluenceHub – Inbox filter chips a11y
   - WCAG AA contrast for .inbox-tab and
     .inbox-tab-active in both light and dark mode.
   - prefers-reduced-motion guard: disables the
     hover lift, transitions and any pulse/scale
     animation on the chips so users who prefer
     reduced motion are not exposed to motion.
   - 44px minimum touch target (WCAG 2.5.5) for
     mobile users on every inbox filter chip.
   - Focus-visible ring for keyboard users.
   - Forced-colors (Windows High Contrast) support.
   ============================================ */

/* ---------- Base chip (WCAG AA contrast) ----------
   Light mode:
     - chip surface: #ffffff
     - chip text: #334155 on #ffffff = 10.9:1 (passes AA)
     - chip border: #e2e8f0 (visible against white)
   Dark mode:
     - chip surface: #0f172a
     - chip text: #e2e8f0 on #0f172a = 12.4:1 (passes AA)
     - chip border: #334155 (visible against slate-900)
*/

.inbox-tab {
  color: #334155 !important;
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
}

.inbox-tab:hover {
  color: #6d28d9 !important;
  border-color: #c4b5fd !important;
}

.dark .inbox-tab {
  color: #e2e8f0 !important;
  background-color: #0f172a !important;
  border-color: #334155 !important;
}

.dark .inbox-tab:hover {
  color: #c4b5fd !important;
  border-color: #8b5cf6 !important;
}

/* ---------- Active chip (WCAG AA contrast) ----------
   Light mode:
     - chip surface: #7c3aed (brand-600)
     - chip text: #ffffff on #7c3aed = 5.9:1 (passes AA)
   Dark mode:
     - chip surface: #a78bfa (brand-400)
     - chip text: #1e1b4b on #a78bfa = 8.1:1 (passes AA)
*/

.inbox-tab-active {
  color: #ffffff !important;
  background-color: #7c3aed !important;
  border-color: #7c3aed !important;
}

.inbox-tab-active:hover {
  color: #ffffff !important;
  background-color: #6d28d9 !important;
  border-color: #6d28d9 !important;
}

.dark .inbox-tab-active {
  color: #1e1b4b !important;
  background-color: #a78bfa !important;
  border-color: #a78bfa !important;
}

.dark .inbox-tab-active:hover {
  color: #1e1b4b !important;
  background-color: #c4b5fd !important;
  border-color: #c4b5fd !important;
}

/* ---------- Count badges inside the chips ----------
   Keep the count legible on both the inactive and active chip
   surfaces. The active chip inverts the badge so it stays visible
   on the violet gradient. */

.inbox-tab .inbox-tab-count {
  color: #475569 !important;
  background-color: #f1f5f9 !important;
}

.inbox-tab-active .inbox-tab-count {
  color: #ffffff !important;
  background-color: rgba(255, 255, 255, 0.28) !important;
}

.dark .inbox-tab .inbox-tab-count {
  color: #cbd5e1 !important;
  background-color: #1e293b !important;
}

.dark .inbox-tab-active .inbox-tab-count {
  color: #1e1b4b !important;
  background-color: rgba(30, 27, 75, 0.25) !important;
}

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

.inbox-tab {
  /* 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) ---------- */

.inbox-tab: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 .inbox-tab: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) {
  .inbox-tab:focus {
    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 .inbox-tab:focus {
    outline-color: #c4b5fd;
    box-shadow:
      0 0 0 2px #0f172a,
      0 0 0 6px rgba(196, 181, 253, 0.45);
  }
}

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

@media (max-width: 480px) {
  .inbox-tab {
    min-height: 44px;
    min-width: 44px;
  }
}

/* ---------- prefers-reduced-motion guard ----------
   The chips may animate on hover (lift/scale) and on state change
   (background/color transitions). Users who prefer reduced motion
   should see state changes instantly, with no motion. */

@media (prefers-reduced-motion: reduce) {
  .inbox-tab,
  .inbox-tab-active {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }

  /* Neutralise any hover/focus/active transform on the chips */
  .inbox-tab:hover,
  .inbox-tab:focus,
  .inbox-tab:focus-visible,
  .inbox-tab:active,
  .inbox-tab-active:hover,
  .inbox-tab-active:focus,
  .inbox-tab-active:focus-visible,
  .inbox-tab-active:active {
    transform: none !important;
    transition: none !important;
  }

  /* Icons inside the chips must not animate either */
  .inbox-tab i,
  .inbox-tab svg,
  .inbox-tab-active i,
  .inbox-tab-active svg {
    animation: none !important;
    transition: none !important;
    transform: none !important;
  }

  /* Disable any pulse/scale animation on the chips */
  .inbox-tab,
  .inbox-tab::before,
  .inbox-tab::after,
  .inbox-tab-active,
  .inbox-tab-active::before,
  .inbox-tab-active::after {
    animation: none !important;
    transform: none !important;
  }

  /* Count badges must not pulse or scale */
  .inbox-tab .inbox-tab-count,
  .inbox-tab-active .inbox-tab-count {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }

  /* Keep the focus ring visible but static (no animated halo) */
  .inbox-tab:focus-visible {
    box-shadow:
      0 0 0 2px #ffffff,
      0 0 0 6px rgba(124, 58, 237, 0.35) !important;
  }

  .dark .inbox-tab: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) {
  .inbox-tab {
    background: Canvas !important;
    color: CanvasText !important;
    border: 1px solid CanvasText !important;
  }

  .inbox-tab:hover {
    background: Highlight !important;
    color: HighlightText !important;
  }

  .inbox-tab-active {
    background: Highlight !important;
    color: HighlightText !important;
    border: 1px solid HighlightText !important;
  }

  .inbox-tab .inbox-tab-count,
  .inbox-tab-active .inbox-tab-count {
    background: Highlight !important;
    color: HighlightText !important;
    border: 1px solid HighlightText !important;
  }

  .inbox-tab:focus-visible,
  .inbox-tab:focus {
    outline: 2px solid Highlight;
    outline-offset: 2px;
    box-shadow: none !important;
  }
}
