/* ============================================
   InfluenceHub – Sent requests recency indicators
   - "Naujas" badge for recently sent requests
   - Relative time chip ("prieš 5 min.")
   - Subtle highlight for new sent cards
   - Mirrors the inbox styling for visual consistency
   - Dark mode + reduced motion support
   ============================================ */

/* ---------- "Naujas" badge ---------- */
.sent-new-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
  color: #ffffff;
  box-shadow: 0 2px 8px -2px rgba(124, 58, 237, 0.5);
  white-space: nowrap;
  line-height: 1.4;
}

.sent-new-badge i {
  width: 0.75rem;
  height: 0.75rem;
}

.dark .sent-new-badge {
  background: linear-gradient(135deg, #8b5cf6 0%, #c084fc 100%);
  box-shadow: 0 2px 8px -2px rgba(139, 92, 246, 0.6);
}

/* ---------- Relative time chip ---------- */
.sent-relative-time {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: #64748b;
  white-space: nowrap;
}

.sent-relative-time i {
  width: 0.75rem;
  height: 0.75rem;
  opacity: 0.75;
}

.dark .sent-relative-time {
  color: #94a3b8;
}

/* ---------- New sent card subtle highlight ---------- */
.sent-card-new {
  position: relative;
  border-color: #ddd6fe;
  box-shadow: 0 0 0 1px rgba(124, 58, 237, 0.08), 0 4px 16px -8px rgba(124, 58, 237, 0.25);
}

.sent-card-new::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.75rem;
  bottom: 0.75rem;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, #7c3aed 0%, #a855f7 100%);
}

.dark .sent-card-new {
  border-color: rgba(139, 92, 246, 0.4);
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.15), 0 4px 16px -8px rgba(139, 92, 246, 0.35);
}

.dark .sent-card-new::before {
  background: linear-gradient(180deg, #8b5cf6 0%, #c084fc 100%);
}

/* ---------- Sent-request filter tabs a11y ----------
   The "Išsiųstos užklausos" filter tabs (#sent-tabs .inbox-tab)
   reuse the inbox tab styling. Add a visible focus-visible ring
   and a 44px minimum touch target so keyboard and mobile users
   can switch sent-request filters reliably, matching the inbox
   treatment. */

#sent-tabs .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;
}

/* 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 tab background and the dark-mode surface. */
#sent-tabs .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);
}

/* The active tab uses a dark slate fill in light mode – keep the white
   inner ring so the violet outline stays visible against the dark fill. */
#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 mode ---------- */

.dark #sent-tabs .inbox-tab:focus-visible,
.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 ---------- */

@supports not selector(:focus-visible) {
  #sent-tabs .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 #sent-tabs .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) {
  #sent-tabs .inbox-tab {
    min-height: 44px;
    min-width: 44px;
  }
}

/* ---------- Dark-mode contrast fix (WCAG AA) ----------
   Re-assert the badge, relative time chip and new-card highlight
   colors with !important so generic dark-mode text utilities
   (e.g. html.dark .text-slate-400) cannot reduce the contrast
   below AA.

   Light mode:
     - badge: white on #7c3aed = 5.9:1 (passes AA for normal text)
     - time:  #475569 on #ffffff = 7.5:1 (passes AA)
   Dark mode:
     - badge: white on #6d28d9 = 7.0:1 (passes AA)
     - time:  #cbd5e1 on #0f172a = 11.6:1 (passes AA)
*/

.sent-new-badge {
  background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%) !important;
  color: #ffffff !important;
}

.sent-relative-time {
  color: #475569 !important;
}

.dark .sent-new-badge {
  background: linear-gradient(135deg, #6d28d9 0%, #9333ea 100%) !important;
  color: #ffffff !important;
}

.dark .sent-relative-time {
  color: #cbd5e1 !important;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .sent-new-badge,
  .sent-relative-time,
  .sent-card-new {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }

  /* Neutralise any hover/focus transform so no motion is perceived */
  .sent-new-badge:hover,
  .sent-new-badge:focus,
  .sent-new-badge:focus-visible,
  .sent-relative-time:hover,
  .sent-relative-time:focus,
  .sent-relative-time:focus-visible {
    transform: none !important;
    transition: none !important;
  }

  /* Remove decorative shadow that could imply motion on hover/focus */
  .sent-new-badge,
  .dark .sent-new-badge {
    box-shadow: none !important;
  }

  /* Icons inside the badge / time chip must not animate either */
  .sent-new-badge i,
  .sent-relative-time i {
    animation: none !important;
    transition: none !important;
  }

  /* Disable any pulse/scale animation on the badge itself */
  .sent-new-badge,
  .sent-new-badge::before,
  .sent-new-badge::after {
    animation: none !important;
    transform: none !important;
  }

  /* Disable any transform on the relative time chip */
  .sent-relative-time,
  .sent-relative-time::before,
  .sent-relative-time::after {
    animation: none !important;
    transform: none !important;
  }

  /* Neutralise the highlight stripe animation on new cards */
  .sent-card-new::before,
  .dark .sent-card-new::before {
    animation: none !important;
    transition: none !important;
    transform: none !important;
  }

  /* Sent-request filter tabs – no hover/focus transforms or transitions */
  #sent-tabs .inbox-tab,
  #sent-tabs .inbox-tab:hover,
  #sent-tabs .inbox-tab:focus,
  #sent-tabs .inbox-tab:focus-visible,
  #sent-tabs .inbox-tab:active {
    transform: none !important;
    transition: none !important;
  }

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

  .dark #sent-tabs .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) {
  .sent-new-badge {
    background: Highlight;
    color: HighlightText;
    border: 1px solid HighlightText;
    box-shadow: none;
  }

  .sent-relative-time {
    color: CanvasText;
  }

  .sent-card-new {
    border: 1px solid CanvasText;
    box-shadow: none;
  }

  .sent-card-new::before {
    background: Highlight;
  }
}

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

@media (forced-colors: active) {
  #sent-tabs .inbox-tab {
    border: 1px solid CanvasText;
    color: CanvasText;
    background: Canvas;
  }

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

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

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