/* ═══════════════════════════════════════
   GLOBAL COLOR CONTRAST FIXES
   Ensures readable text EVERYWHERE
   ═══════════════════════════════════════ */

/* ============================================
   SECTION 1: WHITE BACKGROUNDS
   ============================================ */

/* FIX: bg-white class - Pure white backgrounds need dark text */
.bg-white,
.bg-white * {
    color: #1f2937 !important;
}

.bg-white {
    background-color: #ffffff !important;
}

.bg-white h1,
.bg-white h2,
.bg-white h3,
.bg-white h4,
.bg-white h5,
.bg-white h6 {
    color: #111827 !important;
}

.bg-white .text-muted,
.bg-white .small {
    color: #6b7280 !important;
}

/* ============================================
   SECTION 2: LIGHT BACKGROUNDS (Dark Theme Override)
   ============================================ */

/* FIX: bg-light class - Override Bootstrap's light bg for dark theme */
.bg-light {
    background-color: rgba(255, 255, 255, 0.05) !important;
    color: var(--aurora-text) !important;
    border: 1px solid var(--aurora-card-border) !important;
    backdrop-filter: blur(10px);
}

.bg-light h1,
.bg-light h2,
.bg-light h3,
.bg-light h4,
.bg-light h5,
.bg-light h6 {
    color: #ffffff !important;
}

.bg-light .text-muted {
    color: #94a3b8 !important;
}

/* ============================================
   SECTION 3: INLINE STYLES - WHITE/LIGHT BACKGROUNDS
   ============================================ */

/* FIX: Catch ALL white background inline styles */
[style*="background:#fff"],
[style*="background: #fff"],
[style*="background:white"],
[style*="background: white"],
[style*="background:#ffffff"],
[style*="background: #ffffff"],
[style*="background-color:#fff"],
[style*="background-color: #fff"],
[style*="background-color:white"],
[style*="background-color: white"],
[style*="background-color:#ffffff"],
[style*="background-color: #ffffff"],
[style*="background:rgb(255,255,255)"],
[style*="background: rgb(255,255,255)"],
[style*="background:rgb(255, 255, 255)"],
[style*="background: rgb(255, 255, 255)"],
[style*="background-color:rgb(255,255,255)"],
[style*="background-color: rgb(255,255,255)"],
[style*="background-color:rgb(255, 255, 255)"],
[style*="background-color: rgb(255, 255, 255)"] {
    color: #1f2937 !important;
}

/* Force dark text for ALL children of white backgrounds */
[style*="background:#fff"] *,
[style*="background: #fff"] *,
[style*="background:white"] *,
[style*="background: white"] *,
[style*="background:#ffffff"] *,
[style*="background: #ffffff"] *,
[style*="background-color:#fff"] *,
[style*="background-color: #fff"] *,
[style*="background-color:white"] *,
[style*="background-color: white"] *,
[style*="background-color:#ffffff"] *,
[style*="background-color: #ffffff"] *,
[style*="background:rgb(255,255,255)"] *,
[style*="background: rgb(255,255,255)"] *,
[style*="background:rgb(255, 255, 255)"] *,
[style*="background: rgb(255, 255, 255)"] *,
[style*="background-color:rgb(255,255,255)"] *,
[style*="background-color: rgb(255,255,255)"] *,
[style*="background-color:rgb(255, 255, 255)"] *,
[style*="background-color: rgb(255, 255, 255)"] * {
    color: #1f2937 !important;
}

/* ============================================
   SECTION 4: LIGHT GRAY BACKGROUNDS
   ============================================ */

/* FIX: Light gray backgrounds (#f*, #e*) - Common for cards */
[style*="background:#f"],
[style*="background: #f"],
[style*="background:#e"],
[style*="background: #e"],
[style*="background-color:#f"],
[style*="background-color: #f"],
[style*="background-color:#e"],
[style*="background-color: #e"] {
    color: #1f2937 !important;
}

[style*="background:#f"] *,
[style*="background: #f"] *,
[style*="background:#e"] *,
[style*="background: #e"] *,
[style*="background-color:#f"] *,
[style*="background-color: #f"] *,
[style*="background-color:#e"] *,
[style*="background-color: #e"] * {
    color: #1f2937 !important;
}

/* ============================================
   SECTION 5: BOOTSTRAP COMPONENTS
   ============================================ */

/* FIX: Cards with proper theme colors */
.card {
    background-color: rgba(255, 255, 255, 0.04) !important;
    color: var(--aurora-text) !important;
    border-color: var(--aurora-card-border) !important;
}

.card-body {
    color: var(--aurora-text) !important;
}

.card-header,
.card-footer {
    background-color: rgba(255, 255, 255, 0.02) !important;
    border-color: var(--aurora-card-border) !important;
    color: var(--aurora-text-muted) !important;
}

/* FIX: List group items */
.list-group-item {
    background-color: rgba(255, 255, 255, 0.03) !important;
    color: var(--aurora-text) !important;
    border-color: var(--aurora-card-border) !important;
}

.list-group-item:hover {
    background-color: rgba(255, 255, 255, 0.06) !important;
}

/* FIX: Alert elements */
.alert-light {
    background-color: rgba(255, 255, 255, 0.08) !important;
    color: var(--aurora-text) !important;
    border-color: var(--aurora-card-border) !important;
}

/* ============================================
   SECTION 6: FORM ELEMENTS
   ============================================ */

/* FIX: Form controls on white backgrounds */
.bg-white .form-control,
.bg-white .form-select,
[style*="background:white"] .form-control,
[style*="background:#fff"] .form-control {
    color: #1f2937 !important;
    background-color: #f9fafb !important;
}

/* ============================================
   SECTION 7: UTILITIES
   ============================================ */

/* FIX: Text utilities */
.text-dark {
    color: #1f2937 !important;
}

.text-light {
    color: var(--aurora-text-muted) !important;
}

/* FIX: Border utilities match theme */
.border-primary {
    border-color: var(--aurora-blue) !important;
}

.border-success {
    border-color: var(--aurora-emerald) !important;
}

.border-warning {
    border-color: var(--aurora-amber) !important;
}

/* FIX: Breadcrumbs */
.breadcrumb-item+.breadcrumb-item::before {
    color: rgba(255, 255, 255, 0.4) !important;
}

/* ============================================
   SECTION 8: SPECIFIC PROBLEMATIC PATTERNS
   ============================================ */

/* FIX: Divs/Sections that might have light backgrounds */
div[style*="background:#f"] p,
div[style*="background:#e"] p,
div[style*="background:white"] p,
div[style*="background:#fff"] p,
section[style*="background:#f"] p,
section[style*="background:#e"] p,
section[style*="background:white"] p,
section[style*="background:#fff"] p {
    color: #374151 !important;
}

/* FIX: Headers in light sections */
div[style*="background:#f"] h1,
div[style*="background:#f"] h2,
div[style*="background:#f"] h3,
div[style*="background:#f"] h4,
div[style*="background:#f"] h5,
div[style*="background:#f"] h6,
div[style*="background:#e"] h1,
div[style*="background:#e"] h2,
div[style*="background:#e"] h3,
div[style*="background:white"] h1,
div[style*="background:white"] h2,
div[style*="background:white"] h3,
div[style*="background:#fff"] h1,
div[style*="background:#fff"] h2,
div[style*="background:#fff"] h3 {
    color: #111827 !important;
}

/* FIX: Small/muted text in light sections */
div[style*="background:#f"] small,
div[style*="background:#f"] .small,
div[style*="background:#e"] small,
div[style*="background:#e"] .small,
div[style*="background:white"] small,
div[style*="background:white"] .small,
div[style*="background:#fff"] small,
div[style*="background:#fff"] .small {
    color: #6b7280 !important;
}