/* 
 * B.E.A.T. Comprehensive Contrast Fixes
 * Ensures ALL text is visible on ALL backgrounds throughout the application
 * Dark text on light backgrounds, Light text on dark backgrounds
 */

/* GLOBAL DARK BACKGROUND ELEMENTS - Ensure LIGHT text */
.bg-primary, .bg-secondary, .bg-success, .bg-danger, .bg-warning.text-dark, 
.bg-info, .bg-dark, .bg-black, .navbar-dark, .header-section,
.transparency-section, .ecosystem-upsell, .donation-hero, .support-hero,
.success-hero, .mobile-hero {
    color: #ffffff !important;
}

.bg-primary *, .bg-secondary *, .bg-success *, .bg-danger *, 
.bg-info *, .bg-dark *, .bg-black *, .navbar-dark *,
.header-section *, .transparency-section *, .ecosystem-upsell *,
.donation-hero *, .support-hero *, .success-hero *, .mobile-hero * {
    color: #ffffff !important;
}

/* GLOBAL LIGHT BACKGROUND ELEMENTS - Ensure DARK text */
.bg-light, .bg-white, .card, .card-body, .modal-content, 
.form-control, .input-group, .list-group-item, .table,
.alert-light, .alert-info, .alert-success, .alert-warning,
.donation-option-card, .features-card, .support-card, 
.next-steps-card, .feature-card, .impact-breakdown,
.transparency-card, .bundle-card, .addon-card {
    color: #212529 !important;
}

.bg-light *, .bg-white *, .card *, .card-body *, .modal-content *, 
.form-control *, .input-group *, .list-group-item *, .table *,
.alert-light *, .alert-info *, .alert-success *, .alert-warning *,
.donation-option-card *, .features-card *, .support-card *, 
.next-steps-card *, .feature-card *, .impact-breakdown *,
.transparency-card *, .bundle-card *, .addon-card * {
    color: #212529 !important;
}

/* FORM ELEMENTS - Ensure proper contrast */
.form-label, .form-text, .form-check-label, 
.input-group-text, .form-select, .form-control,
textarea, input[type="text"], input[type="email"], 
input[type="password"], input[type="number"] {
    color: #212529 !important;
    background-color: #ffffff !important;
    border-color: #ced4da !important;
}

.form-control:focus, .form-select:focus {
    color: #212529 !important;
    background-color: #ffffff !important;
    border-color: #86b7fe !important;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25) !important;
}

/* BUTTONS - Ensure proper contrast based on background */
.btn-primary {
    background-color: #0d6efd !important;
    border-color: #0d6efd !important;
    color: #ffffff !important;
}

.btn-secondary {
    background-color: #6c757d !important;
    border-color: #6c757d !important;
    color: #ffffff !important;
}

.btn-success {
    background-color: #198754 !important;
    border-color: #198754 !important;
    color: #ffffff !important;
}

.btn-danger {
    background-color: #dc3545 !important;
    border-color: #dc3545 !important;
    color: #ffffff !important;
}

.btn-warning {
    background-color: #ffc107 !important;
    border-color: #ffc107 !important;
    color: #000000 !important;
}

.btn-info {
    background-color: #0dcaf0 !important;
    border-color: #0dcaf0 !important;
    color: #000000 !important;
}

.btn-light {
    background-color: #f8f9fa !important;
    border-color: #f8f9fa !important;
    color: #000000 !important;
}

.btn-dark {
    background-color: #212529 !important;
    border-color: #212529 !important;
    color: #ffffff !important;
}

/* OUTLINE BUTTONS - Ensure proper text color */
.btn-outline-primary {
    color: #0d6efd !important;
    border-color: #0d6efd !important;
}

.btn-outline-primary:hover {
    background-color: #0d6efd !important;
    border-color: #0d6efd !important;
    color: #ffffff !important;
}

.btn-outline-secondary {
    color: #6c757d !important;
    border-color: #6c757d !important;
}

.btn-outline-secondary:hover {
    background-color: #6c757d !important;
    border-color: #6c757d !important;
    color: #ffffff !important;
}

.btn-outline-success {
    color: #198754 !important;
    border-color: #198754 !important;
}

.btn-outline-success:hover {
    background-color: #198754 !important;
    border-color: #198754 !important;
    color: #ffffff !important;
}

.btn-outline-danger {
    color: #dc3545 !important;
    border-color: #dc3545 !important;
}

.btn-outline-danger:hover {
    background-color: #dc3545 !important;
    border-color: #dc3545 !important;
    color: #ffffff !important;
}

.btn-outline-light {
    color: #f8f9fa !important;
    border-color: #f8f9fa !important;
}

.btn-outline-light:hover {
    background-color: #f8f9fa !important;
    border-color: #f8f9fa !important;
    color: #000000 !important;
}

/* ALERTS - Proper contrast for alert messages */
.alert-primary {
    background-color: #cfe2ff !important;
    border-color: #b6d4fe !important;
    color: #084298 !important;
}

.alert-secondary {
    background-color: #e2e3e5 !important;
    border-color: #d3d6d8 !important;
    color: #41464b !important;
}

.alert-success {
    background-color: #d1e7dd !important;
    border-color: #badbcc !important;
    color: #0f5132 !important;
}

.alert-danger {
    background-color: #f8d7da !important;
    border-color: #f5c2c7 !important;
    color: #842029 !important;
}

.alert-warning {
    background-color: #fff3cd !important;
    border-color: #ffecb5 !important;
    color: #664d03 !important;
}

.alert-info {
    background-color: #d1ecf1 !important;
    border-color: #bee5eb !important;
    color: #0c5460 !important;
}

/* NAVIGATION - Ensure proper visibility */
.navbar-nav .nav-link {
    color: #ffffff !important;
}

.navbar-nav .nav-link:hover {
    color: #f8f9fa !important;
}

.dropdown-menu {
    background-color: #ffffff !important;
    border: 1px solid #dee2e6 !important;
}

.dropdown-item {
    color: #212529 !important;
}

.dropdown-item:hover {
    background-color: #e9ecef !important;
    color: #212529 !important;
}

.dropdown-header {
    color: #6c757d !important;
}

/* TABLE ELEMENTS */
.table {
    color: #212529 !important;
}

.table th {
    color: #212529 !important;
    background-color: #f8f9fa !important;
    border-color: #dee2e6 !important;
}

.table td {
    color: #212529 !important;
    border-color: #dee2e6 !important;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.05) !important;
}

/* BADGES AND LABELS */
.badge.bg-primary {
    background-color: #0d6efd !important;
    color: #ffffff !important;
}

.badge.bg-secondary {
    background-color: #6c757d !important;
    color: #ffffff !important;
}

.badge.bg-success {
    background-color: #198754 !important;
    color: #ffffff !important;
}

.badge.bg-danger {
    background-color: #dc3545 !important;
    color: #ffffff !important;
}

.badge.bg-warning {
    background-color: #ffc107 !important;
    color: #000000 !important;
}

.badge.bg-info {
    background-color: #0dcaf0 !important;
    color: #000000 !important;
}

.badge.bg-light {
    background-color: #f8f9fa !important;
    color: #000000 !important;
}

.badge.bg-dark {
    background-color: #212529 !important;
    color: #ffffff !important;
}

/* CUSTOM AMOUNT BUTTONS AND DONATION ELEMENTS */
.amount-btn {
    background-color: #ffffff !important;
    color: #667eea !important;
    border: 2px solid #667eea !important;
}

.amount-btn:hover, .amount-btn.active {
    background-color: #667eea !important;
    color: #ffffff !important;
}

.share-tag {
    background-color: #e9ecef !important;
    color: #495057 !important;
}

.amount-badge {
    background-color: #f8f9fa !important;
    color: #495057 !important;
    border: 2px solid #007bff !important;
}

.amount-badge:hover {
    background-color: #007bff !important;
    color: #ffffff !important;
}

/* PRICING AND FEATURE CARDS */
.pricing-card, .pricing-card * {
    color: #212529 !important;
}

.pricing-card.featured {
    border-color: #007bff !important;
}

.popular-badge {
    background-color: #28a745 !important;
    color: #ffffff !important;
}

/* FOOTER */
.footer-section, .footer-section * {
    color: #ffffff !important;
}

/* MOBILE AND RESPONSIVE FIXES */
@media (max-width: 768px) {
    .card-body h1, .card-body h2, .card-body h3, .card-body h4, .card-body h5, .card-body h6 {
        color: #212529 !important;
    }
    
    .bg-primary h1, .bg-primary h2, .bg-primary h3, .bg-primary h4, .bg-primary h5, .bg-primary h6,
    .bg-secondary h1, .bg-secondary h2, .bg-secondary h3, .bg-secondary h4, .bg-secondary h5, .bg-secondary h6,
    .bg-dark h1, .bg-dark h2, .bg-dark h3, .bg-dark h4, .bg-dark h5, .bg-dark h6 {
        color: #ffffff !important;
    }
}

/* SPECIFIC CONTRAST OVERRIDES FOR PROBLEMATIC ELEMENTS */
.text-muted {
    color: #6c757d !important;
}

.text-primary {
    color: #0d6efd !important;
}

.text-secondary {
    color: #6c757d !important;
}

.text-success {
    color: #198754 !important;
}

.text-danger {
    color: #dc3545 !important;
}

.text-warning {
    color: #ffc107 !important;
}

.text-info {
    color: #0dcaf0 !important;
}

.text-light {
    color: #f8f9fa !important;
}

.text-dark {
    color: #212529 !important;
}

/* ENSURE ALL PARAGRAPHS AND TEXT HAVE PROPER CONTRAST */
body {
    color: #212529 !important;
    background-color: #ffffff !important;
}

p, span, div, h1, h2, h3, h4, h5, h6, li, td, th {
    /* Base text color - will be overridden by specific background contexts */
}

/* SPECIFIC OVERRIDES FOR CARDS ON GRADIENT BACKGROUNDS */
.transparency-section .transparency-card,
.transparency-section .transparency-card * {
    color: #333333 !important;
    background-color: rgba(255, 255, 255, 0.95) !important;
}

.ecosystem-upsell .bundle-card,
.ecosystem-upsell .bundle-card * {
    color: #333333 !important;
    background-color: rgba(255, 255, 255, 0.95) !important;
}

/* ENSURE FOCUS STATES ARE VISIBLE */
*:focus {
    outline: 2px solid #005fcc !important;
    outline-offset: 2px !important;
}