/* ============================================================
   Task #1369064: Site-Wide Contrast Fixes
   WCAG AA Compliance - All Buttons, Badges, Pills, Chips

   Rules Applied:
   - Dark/emerald backgrounds (#00B37D, #1F2A37, navy, slate) → white text (#FFFFFF)
   - White/light backgrounds (#FFFFFF, #F3F4F6, #F9FAFB) → dark text (#0A0A0A, #1F2A37)
   - Ensures 4.5:1 contrast ratio for normal text
   - Ensures 3:1 contrast ratio for large text
   ============================================================ */

/* ── Button & CTA Contrast Overrides ────────────────────── */

/* Primary buttons with dark/accent backgrounds */
.btn-primary,
.btn-emerald,
.btn-dark,
.btn-navy,
.btn-cta,
.cta-button,
.cta-primary,
.action-button,
.primary-cta,
[class*="btn-primary"],
[class*="cta-primary"],
button[type="submit"],
a.btn-primary {
  color: #FFFFFF !important;
  fill: #FFFFFF !important;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
  color: #FFFFFF !important;
}

/* ── Pills & Chips ──────────────────────────────────────── */

/* Dark/accent pill styles */
.pill,
.chip,
.badge,
.pill-dark,
.pill-emerald,
.chip-dark,
.chip-accent,
.badge-dark,
.badge-status,
.badge-trending,
.badge-featured,
.badge-no-proof,
.badge-filing-fast,
.badge-hot,
.badge-urgent,
.tag,
.tag-primary,
.category-tag,
.status-badge {
  color: #FFFFFF !important;
}

/* Light pill/chip styles */
.pill-light,
.pill-white,
.pill-ghost,
.chip-light,
.chip-white,
.badge-light,
.badge-ghost,
.tag-light,
.tag-white,
.category-tag-light {
  color: #1F2A37 !important;
}

/* ── Nav Items ─────────────────────────────────────────── */

/* Header navigation - dark backgrounds */
.nav-item[style*="background"],
.nav-link[style*="background"],
.header-nav-item[style*="background"],
.footer-nav-item[style*="background"],
.nav-primary,
.nav-dark {
  color: #FFFFFF !important;
}

.nav-item:hover,
.nav-link:hover {
  color: #FFFFFF !important;
}

/* ── Countdown & Deadline Elements ──────────────────────── */

/* Countdown chips and timers */
.countdown-chip,
.timer-badge,
.closing-soon-badge,
.deadline-timer,
.urgency-chip,
.urgency-badge,
.doom-clock,
[class*="closing"],
[class*="countdown"] {
  color: #FFFFFF !important;
}

/* ── FOMO Ticker & Activity Bar ────────────────────────── */

.fomo-ticker,
.activity-bar,
.live-ticker,
.ticker-item,
.ticker-activity,
.social-proof-ticker {
  color: #FFFFFF !important;
}

.ticker-item {
  background-color: var(--color-primary) !important;
  color: #FFFFFF !important;
}

/* ── Modals & Overlays ─────────────────────────────────── */

.modal-header,
.modal-title,
.dialog-header,
.popup-header {
  color: #FFFFFF !important;
}

.modal-header[style*="background"],
.dialog-header[style*="background"],
.popup-header[style*="background"] {
  color: #FFFFFF !important;
}

/* ── Tooltips ──────────────────────────────────────────── */

.tooltip,
.tooltip-dark,
.tooltip-primary,
.popover,
.popover-header {
  color: #FFFFFF !important;
}

/* ── Pricing Cards & CTAs ──────────────────────────────── */

.pricing-cta,
.plan-cta,
.plan-button,
.upgrade-cta,
.upsell-cta {
  color: #FFFFFF !important;
}

.pricing-card.featured .cta,
.plan-card.highlight .button {
  color: #FFFFFF !important;
}

/* ── Settlement Cards ──────────────────────────────────── */

.settlement-card-cta,
.settlement-cta,
.claim-cta,
.file-button,
.view-settlement {
  color: #FFFFFF !important;
}

/* ── Badge Types (Specific) ────────────────────────────── */

/* Trending badge */
.badge-trending::before,
.badge-trending {
  color: #FFFFFF !important;
  background-color: var(--color-error) !important;
}

/* No Proof badge */
.badge-no-proof,
[class*="no-proof"],
.no-proof-badge {
  color: #FFFFFF !important;
  background-color: var(--color-success) !important;
}

/* Filing Fast badge */
.badge-filing-fast,
[class*="filing-fast"],
.filing-fast-badge {
  color: #FFFFFF !important;
  background-color: var(--color-warning) !important;
}

/* Pro badge */
.badge-pro,
.pro-badge,
.premium-badge,
.pro-label {
  color: #FFFFFF !important;
  background-color: var(--color-primary) !important;
}

/* Hot/Trending badge */
.badge-hot,
.trending-badge,
.hot-badge,
.popular-badge {
  color: #FFFFFF !important;
  background-color: #DC2626 !important;
}

/* ── Filter Pills & Active States ──────────────────────── */

.filter-pill.active,
.filter-chip.active,
.sort-pill.active,
.category-filter.active {
  color: #FFFFFF !important;
  background-color: var(--color-primary) !important;
}

.filter-pill,
.filter-chip,
.sort-pill,
.category-filter {
  color: #1F2A37 !important;
  background-color: #F3F4F6 !important;
}

/* ── Hover States ──────────────────────────────────────── */

/* Ensure hover states maintain contrast */
.btn:hover,
.btn:focus,
.cta:hover,
.cta:focus,
.pill:hover,
.chip:hover,
.badge:hover {
  color: inherit !important;
}

/* ── Verified/Trust Badges ──────────────────────────────── */

.verified-badge,
.verified-seal,
.trust-badge,
.certified-badge,
.court-verified {
  color: #FFFFFF !important;
}

/* ── Social Proof Elements ──────────────────────────────── */

.social-proof-badge,
.social-proof-chip,
.wins-badge,
.celebration-badge,
.milestone-badge {
  color: #FFFFFF !important;
}

/* ── Call-to-Action Bars ───────────────────────────────── */

.sticky-cta,
.sticky-bar,
.sticky-urgency,
.action-bar,
.exit-intent-banner,
[class*="sticky"] {
  color: #FFFFFF !important;
}

.sticky-cta-button,
.sticky-cta-link {
  color: #FFFFFF !important;
}

/* ── Accessibility: Ensure Focus States Meet Contrast ──– */

*:focus,
*:focus-visible {
  outline-color: var(--color-primary-dark) !important;
  color: inherit !important;
}

button:focus,
a:focus,
input:focus {
  outline: 2px solid var(--color-primary-dark) !important;
  outline-offset: 2px !important;
  color: inherit !important;
}

/* ── Inline Text on Colored Backgrounds ────────────────– */

[style*="background:#00B37D"],
[style*="background: #00B37D"],
[style*="background-color: #00B37D"],
[style*="background: rgb(0, 179, 125)"],
[style*="background-color: rgb(0, 179, 125)"] {
  color: #FFFFFF !important;
}

[style*="background:#1F2A37"],
[style*="background: #1F2A37"],
[style*="background-color: #1F2A37"],
[style*="background:#2d3748"],
[style*="background: #2d3748"],
[style*="background:#374151"],
[style*="background: #374151"],
[style*="background:#1e3a93"],
[style*="background: #1e3a93"],
[style*="background: #1F3A93"],
[style*="background-color: #1F3A93"] {
  color: #FFFFFF !important;
}

/* Light backgrounds - dark text */
[style*="background:#ffffff"],
[style*="background: #ffffff"],
[style*="background-color: #ffffff"],
[style*="background:#f3f4f6"],
[style*="background: #f3f4f6"],
[style*="background:#f9fafb"],
[style*="background: #f9fafb"],
[style*="background:#e5e7eb"],
[style*="background: #e5e7eb"] {
  color: #0A0A0A !important;
}

/* ── Emergency Contrast Rescue (Last Resort) ────────────– */
/* If an element still has poor contrast, this catches it */

.button,
.btn,
.cta,
.link-button,
.action {
  color: inherit !important;
}

/* Ensure text is readable on any dark background */
[style*="background-color"][class*="dark"],
[class*="dark-bg"],
[class*="dark-button"],
[class*="dark-pill"] {
  color: #FFFFFF !important;
}
