/**
 * Text Visibility Fixes for Material Dashboard
 * Ensures proper text contrast on various backgrounds
 */

/* Fix text color in tables */
.table td .text-xs,
.table td .text-sm,
.table td .font-weight-bold,
.table td span:not(.badge) {
    color: #344767 !important; /* Dark gray text */
}

/* Secondary text should be lighter but still visible */
.table td .text-secondary {
    color: #7b809a !important; /* Medium gray */
}

/* Fix text in cards */
.card-body .text-xs,
.card-body .text-sm,
.card-body .font-weight-bold:not(.text-white) {
    color: #344767 !important;
}

/* Fix migration status cards */
.migration-status-card .text-xs,
.migration-status-card .text-sm {
    color: #344767 !important;
}

/* Ensure badges keep their colors */
.badge {
    color: white !important;
}

/* Fix text in dropdowns */
.dropdown-item {
    color: #344767 !important;
}

.dropdown-item:hover {
    color: #344767 !important;
    background-color: #f0f2f5;
}

/* Fix text in form labels */
.form-label,
.input-group-static label {
    color: #344767 !important;
}

/* Fix progress text */
.progress + span,
.text-center h4 {
    color: #344767 !important;
}

/* Ensure white text only appears where intended */
.bg-gradient-primary .text-white,
.bg-gradient-success .text-white,
.bg-gradient-info .text-white,
.bg-gradient-warning .text-white,
.bg-gradient-danger .text-white,
.navbar .text-white,
.card-header.bg-gradient-primary,
.card-header.bg-gradient-success,
.card-header.bg-gradient-info {
    color: white !important;
}

/* Fix specific Material Dashboard overrides */
.material-icons {
    color: inherit !important;
}

/* Fix text in alerts */
.alert {
    color: #344767 !important;
}

.alert-success {
    color: #0f5132 !important;
}

.alert-danger {
    color: #842029 !important;
}

.alert-warning {
    color: #664d03 !important;
}

.alert-info {
    color: #055160 !important;
}

/* Fix pagination text */
.page-link {
    color: #344767 !important;
}

.page-item.active .page-link {
    color: white !important;
}

/* Fix any remaining white text issues */
body:not(.dark-version) .text-white:not(.btn):not(.badge):not([class*="bg-gradient"]) {
    color: #344767 !important;
}

/* Ensure proper contrast for step numbers and titles */
.step-number-cell .badge {
    color: white !important;
    background-color: #0078d4;
}

.step-title {
    color: #344767 !important;
}

/* Fix breadcrumb text */
.breadcrumb-item,
.breadcrumb-item a {
    color: #344767 !important;
}

.breadcrumb-item.active {
    color: #7b809a !important;
}

/* Specific fixes for migration pages */
.table tbody tr td {
    color: #344767 !important;
}

.table tbody tr td .text-xs,
.table tbody tr td .text-sm {
    color: #344767 !important;
}

/* Override any inherited white text */
.table tbody tr td * {
    color: inherit !important;
}

/* Keep badge colors */
.table tbody tr td .badge,
.table tbody tr td .badge * {
    color: white !important;
}

/* Fix integration names specifically */
.table tbody tr td .font-weight-bold {
    color: #344767 !important;
    font-weight: 600 !important;
}

/* Material icons in tables should be visible */
.table tbody tr td .material-icons {
    color: #7b809a !important;
}

/* Dropdown items in tables */
.table tbody tr td .dropdown-item {
    color: #344767 !important;
}

/* Fix any spans that might have white text */
span:not(.badge):not(.navbar-brand):not([class*="bg-gradient"]) {
    color: inherit !important;
}

/* Ensure text is visible in all card bodies */
.card-body p,
.card-body span:not(.badge),
.card-body div {
    color: #344767 !important;
}

/* Fix headers specifically - more aggressive rules */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    color: #344767 !important;
}

/* Ensure headers in cards are visible */
.card h1, .card h2, .card h3, .card h4, .card h5, .card h6,
.card-header h1, .card-header h2, .card-header h3, .card-header h4, .card-header h5, .card-header h6,
.card-body h1, .card-body h2, .card-body h3, .card-body h4, .card-body h5, .card-body h6,
.container-fluid h1, .container-fluid h2, .container-fluid h3, .container-fluid h4, .container-fluid h5, .container-fluid h6 {
    color: #344767 !important;
}

/* Override any text-white class on headers unless in colored backgrounds */
h1.text-white:not(.bg-gradient-primary h1):not(.bg-gradient-success h1):not(.bg-gradient-info h1):not(.bg-gradient-warning h1):not(.bg-gradient-danger h1),
h2.text-white:not(.bg-gradient-primary h2):not(.bg-gradient-success h2):not(.bg-gradient-info h2):not(.bg-gradient-warning h2):not(.bg-gradient-danger h2),
h3.text-white:not(.bg-gradient-primary h3):not(.bg-gradient-success h3):not(.bg-gradient-info h3):not(.bg-gradient-warning h3):not(.bg-gradient-danger h3),
h4.text-white:not(.bg-gradient-primary h4):not(.bg-gradient-success h4):not(.bg-gradient-info h4):not(.bg-gradient-warning h4):not(.bg-gradient-danger h4),
h5.text-white:not(.bg-gradient-primary h5):not(.bg-gradient-success h5):not(.bg-gradient-info h5):not(.bg-gradient-warning h5):not(.bg-gradient-danger h5),
h6.text-white:not(.bg-gradient-primary h6):not(.bg-gradient-success h6):not(.bg-gradient-info h6):not(.bg-gradient-warning h6):not(.bg-gradient-danger h6) {
    color: #344767 !important;
}

/* Specific fix for card headers with pb-0 class */
.card-header.pb-0 h5,
.card-header.pb-0 h6,
.card-header.p-3 h5,
.card-header.p-3 h6 {
    color: #344767 !important;
}

/* Fix headers in tables */
.table thead th,
.table thead th * {
    color: #7b809a !important;
}

/* Keep intentional white text white */
.navbar .text-white,
.bg-gradient-primary .text-white,
.bg-gradient-success .text-white,
.bg-gradient-danger .text-white,
.bg-gradient-warning .text-white,
.bg-gradient-info .text-white,
.btn .text-white,
.bg-warning .text-white,
.bg-primary .text-white,
.bg-success .text-white,
.bg-danger .text-white,
.bg-info .text-white {
    color: white !important;
}

/* Ensure all content in gradient buttons is white */
.btn.bg-gradient-info,
.btn.bg-gradient-info *,
.btn.bg-gradient-primary,
.btn.bg-gradient-primary *,
.btn.bg-gradient-success,
.btn.bg-gradient-success *,
.btn.bg-gradient-danger,
.btn.bg-gradient-danger *,
.btn.bg-gradient-warning,
.btn.bg-gradient-warning * {
    color: white !important;
}

/* Specifically target Font Awesome icons in gradient buttons */
.btn.bg-gradient-info i[class*="fa-"],
.btn.bg-gradient-info i[class*="fas"],
.btn.bg-gradient-info i[class*="far"],
.btn.bg-gradient-info i[class*="fab"],
.btn.bg-gradient-info i.fa,
.btn.bg-gradient-info i.fas,
.btn.bg-gradient-info i.far,
.btn.bg-gradient-info i.fab,
.btn.bg-gradient-primary i[class*="fa-"],
.btn.bg-gradient-primary i[class*="fas"],
.btn.bg-gradient-primary i[class*="far"],
.btn.bg-gradient-primary i[class*="fab"],
.btn.bg-gradient-primary i.fa,
.btn.bg-gradient-primary i.fas,
.btn.bg-gradient-primary i.far,
.btn.bg-gradient-primary i.fab,
.btn.bg-gradient-success i[class*="fa-"],
.btn.bg-gradient-success i[class*="fas"],
.btn.bg-gradient-success i[class*="far"],
.btn.bg-gradient-success i[class*="fab"],
.btn.bg-gradient-success i.fa,
.btn.bg-gradient-success i.fas,
.btn.bg-gradient-success i.far,
.btn.bg-gradient-success i.fab,
.btn.bg-gradient-danger i[class*="fa-"],
.btn.bg-gradient-danger i[class*="fas"],
.btn.bg-gradient-danger i[class*="far"],
.btn.bg-gradient-danger i[class*="fab"],
.btn.bg-gradient-danger i.fa,
.btn.bg-gradient-danger i.fas,
.btn.bg-gradient-danger i.far,
.btn.bg-gradient-danger i.fab,
.btn.bg-gradient-warning i[class*="fa-"],
.btn.bg-gradient-warning i[class*="fas"],
.btn.bg-gradient-warning i[class*="far"],
.btn.bg-gradient-warning i[class*="fab"],
.btn.bg-gradient-warning i.fa,
.btn.bg-gradient-warning i.fas,
.btn.bg-gradient-warning i.far,
.btn.bg-gradient-warning i.fab {
    color: white !important;
}

/* More general rule for all icons in gradient buttons */
[class*="bg-gradient"] i[class*="fa"],
[class*="bg-gradient"] i.fa,
[class*="bg-gradient"] i.fas,
[class*="bg-gradient"] i.far,
[class*="bg-gradient"] i.fab,
[class*="bg-gradient"] i.fal,
[class*="bg-gradient"] i.fad {
    color: white !important;
}

/* Final override - ensure all headers without explicit colored backgrounds are dark */
body:not(.dark-version) h1:not([class*="bg-gradient"] h1):not(.navbar h1),
body:not(.dark-version) h2:not([class*="bg-gradient"] h2):not(.navbar h2),
body:not(.dark-version) h3:not([class*="bg-gradient"] h3):not(.navbar h3),
body:not(.dark-version) h4:not([class*="bg-gradient"] h4):not(.navbar h4),
body:not(.dark-version) h5:not([class*="bg-gradient"] h5):not(.navbar h5),
body:not(.dark-version) h6:not([class*="bg-gradient"] h6):not(.navbar h6) {
    color: #344767 !important;
}

/* Fix for Material Dashboard's default white text on headers */
.main-content h1, .main-content h2, .main-content h3, 
.main-content h4, .main-content h5, .main-content h6 {
    color: #344767 !important;
}