/* ============================================
   InfluenceHub – Sent requests birthday count badge
   - Enhances the "Gimtadieniai" filter chip in the
     sent-requests tabs with a live count badge.
   - The chip is hidden entirely when the client has
     zero birthday requests.
   - Badge pulses subtly when the count increases
     (respects prefers-reduced-motion).
   - Dark mode, 44px touch targets, focus-visible
     rings, forced-colors support.
   ============================================ */

/* ---------- Chip base (extends .sent-tab-birthday) ---------- */

.sent-tab-birthday {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

/* Hidden state – chip is only shown when the client has birthday requests */
.sent-tab-birthday.hidden {
  display: none !important;
}

/* ---------- Count badge ---------- */

.sent-birthday-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.375rem;
  height: 1.375rem;
  padding: 0 0.4rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.01em;
  /* WCAG AA: white on #7c3aed = 5.9:1 */
  background: #7c3aed;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(124, 58, 237, 0.35);
  transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  flex-shrink: 0;
}

/* When the chip is active, invert the badge so it stays legible on the
   violet gradient background. */
.sent-tab-birthday.inbox-tab-active .sent-birthday-count-badge {
  background: rgba(255, 255, 255, 0.28);
  color: #ffffff;
  box-shadow: none;
}

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

.dark .sent-birthday-count-badge {
  background: #a78bfa;
  color: #1e1b4b;
  box-shadow: 0 1px 3px rgba(167, 139, 250, 0.45);
}

.dark .sent-tab-birthday.inbox-tab-active .sent-birthday-count-badge {
  background: rgba(255, 255, 255, 0.3);
  color: #ffffff;
  box-shadow: none;
}

/* ---------- Pulse animation on count increase ---------- */

.sent-birthday-count-badge.is-bumped {
  animation: sent-birthday-count-bump 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes sent-birthday-count-bump {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.55);
  }
  40% {
    transform: scale(1.18);
    box-shadow: 0 0 0 6px rgba(124, 58, 237, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(124, 58, 237, 0);
  }
}

/* ---------- 44px touch target for the chip ---------- */

#sent-tabs .sent-tab-birthday {
  min-height: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- 44px touch target for ALL sent filter tabs ---------- */

/* WCAG 2.5.5 – every sent-requests filter button (Visos, Laukiama,
   Priimtos, Atmestos, Gimtadieniai) must be at least 44x44px so
   keyboard and mobile users can switch filters reliably. */
#sent-tabs .inbox-tab {
  min-height: 44px;
  min-width: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  z-index: 1;
}

/* ---------- Focus-visible ring for ALL sent filter tabs ---------- */

/* 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 chip background and the active violet gradient. */
#sent-tabs .inbox-tab:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
}

/* Active chip uses a violet gradient – add a white inner ring so the
   violet outline stays visible against the gradient background. */
#sent-tabs .inbox-tab.inbox-tab-active: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 #sent-tabs .inbox-tab:focus-visible {
  outline-color: #c4b5fd;
  box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
}

.dark #sent-tabs .inbox-tab.inbox-tab-active: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 support */
@supports not selector(:focus-visible) {
  #sent-tabs .inbox-tab:focus {
    outline: 2px solid #7c3aed;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
  }

  #sent-tabs .inbox-tab.inbox-tab-active:focus {
    box-shadow:
      0 0 0 2px #ffffff,
      0 0 0 6px rgba(124, 58, 237, 0.35);
  }

  .dark #sent-tabs .inbox-tab:focus {
    outline-color: #c4b5fd;
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
  }

  .dark #sent-tabs .inbox-tab.inbox-tab-active:focus {
    box-shadow:
      0 0 0 2px #0f172a,
      0 0 0 6px rgba(196, 181, 253, 0.45);
  }
}

/* ---------- Focus-visible ring for the birthday chip ---------- */

#sent-tabs .sent-tab-birthday:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
}

.dark #sent-tabs .sent-tab-birthday:focus-visible {
  outline-color: #c4b5fd;
  box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
}

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

@media (prefers-reduced-motion: reduce) {
  .sent-birthday-count-badge {
    transition: none !important;
  }

  .sent-birthday-count-badge.is-bumped {
    animation: none !important;
  }

  #sent-tabs .inbox-tab {
    transition: none !important;
  }
}

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

@media (forced-colors: active) {
  .sent-birthday-count-badge {
    background: Highlight;
    color: HighlightText;
    border: 1px solid HighlightText;
    box-shadow: none;
  }

  .sent-tab-birthday.inbox-tab-active .sent-birthday-count-badge {
    background: HighlightText;
    color: Highlight;
    border-color: Highlight;
  }

  #sent-tabs .inbox-tab {
    border: 1px solid CanvasText;
  }

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

  #sent-tabs .inbox-tab.inbox-tab-active {
    background: Highlight;
    color: HighlightText;
    border-color: HighlightText;
  }
}
