/* 
 * Text Visibility Override CSS
 * Aggressive fixes for white text on white background issues
 */

/* Global white text fixes for light theme */
.light-theme .text-white,
.light-theme [class*="text-white"],
.light-theme .text-light,
.light-theme [class*="text-light"] {
    color: var(--text-primary) !important;
}

/* Background and content fixes */
.light-theme .bg-white,
.light-theme [class*="bg-white"],
.light-theme .bg-light,
.light-theme [class*="bg-light"] {
    background-color: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
}

/* Ensure all children of white backgrounds have proper text color */
.light-theme .bg-white *:not(.btn):not(.badge):not(.alert),
.light-theme .bg-light *:not(.btn):not(.badge):not(.alert),
.light-theme [class*="bg-white"] *:not(.btn):not(.badge):not(.alert),
.light-theme [class*="bg-light"] *:not(.btn):not(.badge):not(.alert) {
    color: var(--text-primary) !important;
}

/* Fix inline styles with white text - EXCEPT for buttons */
.light-theme [style*="color: white"]:not(.btn):not(.btn-primary),
.light-theme [style*="color:#ffffff"]:not(.btn):not(.btn-primary), 
.light-theme [style*="color: #ffffff"]:not(.btn):not(.btn-primary),
.light-theme [style*="color:#fff"]:not(.btn):not(.btn-primary),
.light-theme [style*="color: #fff"]:not(.btn):not(.btn-primary),
.light-theme [style*="color:white"]:not(.btn):not(.btn-primary) {
    color: var(--text-primary) !important;
}

/* Fix Bootstrap utility classes */
.light-theme .text-white-50 {
    color: var(--text-secondary) !important;
}

/* Force email body preview background color */
.email-body-preview,
.light-theme .email-body-preview,
.dark-theme .email-body-preview {
    background-color: white !important;
    color: black !important;
}

/* Fix card elements specifically - white cards only */
.light-theme .card.bg-white .card-title,
.light-theme .card.bg-white .card-text,
.light-theme .card.bg-white .card-header,
.light-theme .card.bg-white .card-body,
.light-theme .card.bg-white .card-footer {
    color: var(--text-primary) !important;
}

/* Light Theme Card Styling - Override blue backgrounds with light colors */
.light-theme .card {
    background-color: white !important;
    border: 1px solid #e5e7eb !important;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06) !important;
}

.light-theme .card .card-title {
    color: #1f2937 !important;
    font-weight: 600 !important;
}

.light-theme .card .card-text,
.light-theme .card .card-body {
    color: #374151 !important;
}

.light-theme .card .card-header {
    background-color: #f8fafc !important;
    border-bottom: 1px solid #e5e7eb !important;
    color: #1f2937 !important;
}

/* Light Theme Body and Background */
.light-theme {
    background-color: #f8fafc !important;
}

.light-theme body {
    background-color: #f8fafc !important;
    color: #1f2937 !important;
}

/* Light Theme Navigation */
.light-theme .navbar {
    background-color: white !important;
    border-bottom: 1px solid #e5e7eb !important;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1) !important;
}

.light-theme .sidebar {
    background-color: white !important;
    border-right: 1px solid #e5e7eb !important;
}

.light-theme .nav-link {
    color: #374151 !important;
}

.light-theme .nav-link:hover {
    color: #1f2937 !important;
    background-color: #f3f4f6 !important;
}

.light-theme .nav-link.active {
    color: #3b82f6 !important;
    background-color: #eff6ff !important;
}

/* Dashboard Overview Header Card - Consistent styling for both themes */
.brand-header.card {
    border: none !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
    border-radius: 0.75rem !important;
}

.brand-header .card-body {
    background: linear-gradient(135deg, #003366 0%, #002244 100%) !important;
    color: white !important;
    padding: 2rem !important;
    border-radius: 0.75rem !important;
}

.brand-header .card-title,
.brand-header .card-title i,
.brand-header .card-text {
    color: white !important;
}

/* Ensure consistent styling across both themes */
.light-theme .brand-header.card .card-body,
.dark-theme .brand-header.card .card-body {
    background: linear-gradient(135deg, #003366 0%, #002244 100%) !important;
    color: white !important;
}

.light-theme .brand-header .card-title,
.light-theme .brand-header .card-title i,
.light-theme .brand-header .card-text,
.dark-theme .brand-header .card-title,
.dark-theme .brand-header .card-title i,
.dark-theme .brand-header .card-text {
    color: white !important;
}

/* Light Theme Badge Visibility Fixes */
.light-theme .badge.bg-secondary {
    background-color: #6b7280 !important;
    color: white !important;
}

.light-theme .badge.bg-primary {
    background-color: transparent !important;
    color: #374151 !important;
    border: 1px solid #d1d5db !important;
}

.light-theme .badge.bg-info {
    background-color: transparent !important;
    color: #374151 !important;
    border: 1px solid #d1d5db !important;
}

.light-theme .badge.bg-outline {
    background-color: transparent !important;
    color: #374151 !important;
    border: 1px solid #d1d5db !important;
}

.light-theme .badge.bg-success {
    background-color: #86efac !important;
    color: #065f46 !important;
}

/* Dark theme navy blue color updates */
.dark-theme .badge.bg-success,
.badge.bg-success {
    background-color: #003366 !important;
    color: white !important;
}

.dark-theme .stats-card-accent,
.stats-card-accent {
    background: linear-gradient(135deg, #003366 0%, #002244 100%) !important;
}

/* Cyan 900 dark teal monochromatic theme text visibility fixes */
.dark-theme {
    background-color: #164e63 !important;
    color: #ffffff !important;
}

.dark-theme .card,
.dark-theme .stats-card {
    background-color: #0891b2 !important;
    color: #ffffff !important;
    border-color: #0e7490 !important;
}

.dark-theme .navbar,
.dark-theme .sidebar {
    background-color: #155e75 !important;
    color: #ffffff !important;
}

.dark-theme .navbar a,
.dark-theme .sidebar a {
    color: #ffffff !important;
}

.dark-theme .navbar a:hover,
.dark-theme .sidebar a:hover {
    color: #a7f3d0 !important;
}

.dark-theme .table {
    color: #ffffff !important;
    background-color: #0891b2 !important;
}

.dark-theme .table thead th {
    background-color: #155e75 !important;
    color: #ffffff !important;
    border-color: #164e63 !important;
}

.dark-theme .table tbody tr {
    border-color: #0e7490 !important;
    color: #ffffff !important;
}

.dark-theme .table tbody tr:hover {
    background-color: #06b6d4 !important;
    color: #ffffff !important;
}

.dark-theme .btn {
    color: #ffffff !important;
}

.dark-theme .btn-primary {
    background-color: #003366 !important;
    border-color: #003366 !important;
    color: white !important;
}

.dark-theme h1, .dark-theme h2, .dark-theme h3, .dark-theme h4, .dark-theme h5, .dark-theme h6 {
    color: #ffffff !important;
}

.dark-theme p, .dark-theme span, .dark-theme div, .dark-theme small, .dark-theme label {
    color: #ffffff !important;
}

.dark-theme .text-muted {
    color: #a7f3d0 !important;
}

.dark-theme .breadcrumb-item a {
    color: #ffffff !important;
}

.dark-theme .breadcrumb-item.active {
    color: #a7f3d0 !important;
}

/* Form elements text visibility improvements */
.dark-theme .form-label {
    color: #ffffff !important;
}

.dark-theme .form-control {
    color: #ffffff !important;
    background-color: #0891b2 !important;
    border-color: #0e7490 !important;
}

.dark-theme .form-control:focus {
    color: #ffffff !important;
    background-color: #0891b2 !important;
    border-color: #a7f3d0 !important;
    box-shadow: 0 0 0 0.25rem rgba(167, 243, 208, 0.25) !important;
}

.dark-theme .form-select {
    color: #ffffff !important;
    background-color: #0891b2 !important;
    border-color: #0e7490 !important;
}

.dark-theme .form-select:focus {
    color: #ffffff !important;
    background-color: #0891b2 !important;
    border-color: #a7f3d0 !important;
    box-shadow: 0 0 0 0.25rem rgba(167, 243, 208, 0.25) !important;
}

.dark-theme textarea.form-control {
    color: #ffffff !important;
    background-color: #0891b2 !important;
    border-color: #0e7490 !important;
}

.dark-theme textarea.form-control:focus {
    color: #ffffff !important;
    background-color: #0891b2 !important;
    border-color: #a7f3d0 !important;
}

.dark-theme .form-check-label {
    color: #ffffff !important;
}

.dark-theme .input-group-text {
    color: #ffffff !important;
    background-color: #155e75 !important;
    border-color: #0e7490 !important;
}

.dark-theme .card-body {
    color: #ffffff !important;
}

.dark-theme .modal-body {
    color: #ffffff !important;
    background-color: #164e63 !important;
}

.dark-theme .modal-header {
    color: #ffffff !important;
    background-color: #155e75 !important;
    border-bottom-color: #0e7490 !important;
}

.dark-theme .modal-footer {
    background-color: #155e75 !important;
    border-top-color: #0e7490 !important;
}

.dark-theme .modal-title {
    color: #ffffff !important;
}

.dark-theme .email-body-preview {
    background-color: #0891b2 !important;
    border-color: #0e7490 !important;
    color: #ffffff !important;
}

.dark-theme .personalization-variable {
    background-color: rgba(167, 243, 208, 0.2) !important;
    border-color: #a7f3d0 !important;
    color: #ffffff !important;
}

/* Chart text visibility fixes for light theme */
.light-theme canvas,
.dark-theme canvas {
    color: #374151 !important;
}

.light-theme .chart-legend {
    color: #374151 !important;
}

.light-theme .chart-axis-label {
    color: #374151 !important;
}

/* Breadcrumb text visibility fixes */
.light-theme .breadcrumb-item a {
    color: #6b7280 !important;
    text-decoration: none !important;
}

.light-theme .breadcrumb-item a:hover {
    color: #374151 !important;
    text-decoration: underline !important;
}

.light-theme .breadcrumb-item.active {
    color: #374151 !important;
}

.light-theme .badge.bg-warning {
    background-color: #f59e0b !important;
    color: white !important;
}

.light-theme .badge {
    font-weight: 500 !important;
}

/* Light Theme Stats Cards - Override blue styling */
.light-theme .stats-card {
    background-color: white !important;
    border: 1px solid #e5e7eb !important;
}

.light-theme .stats-card .card-body {
    background-color: white !important;
}

.light-theme .stats-card .metric-label {
    color: #6b7280 !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
}

.light-theme .stats-card .metric-number {
    color: #1f2937 !important;
    font-size: 1.875rem !important;
    font-weight: 700 !important;
}

.light-theme .stats-card .card-icon {
    color: #3b82f6 !important;
}

/* Fix navbar elements */
.light-theme .navbar-light .navbar-text,
.light-theme .navbar-light .navbar-nav .nav-link {
    color: var(--text-secondary) !important;
}

.light-theme .navbar-light .navbar-nav .nav-link:hover,
.light-theme .navbar-light .navbar-nav .nav-link:focus {
    color: var(--text-primary) !important;
}

/* Fix form elements */
.light-theme .form-control:not([readonly]):not([disabled]),
.light-theme .form-select:not([readonly]):not([disabled]) {
    color: var(--text-primary) !important;
    background-color: var(--bg-tertiary) !important;
}

.light-theme .form-control::placeholder,
.light-theme .form-select::placeholder {
    color: var(--text-muted) !important;
}

/* Fix table elements */
.light-theme .table,
.light-theme .table th,
.light-theme .table td {
    color: var(--text-primary) !important;
}

.light-theme .table-light th,
.light-theme .table-light td {
    background-color: var(--bg-hover) !important;
    color: var(--text-primary) !important;
}

/* Fix list elements */
.light-theme .list-group-item {
    color: var(--text-primary) !important;
    background-color: var(--bg-tertiary) !important;
}

/* Fix dropdown elements */
.light-theme .dropdown-menu {
    background-color: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
}

.light-theme .dropdown-item {
    color: var(--text-secondary) !important;
}

.light-theme .dropdown-item:hover,
.light-theme .dropdown-item:focus {
    color: var(--text-primary) !important;
    background-color: var(--bg-hover) !important;
}

/* Fix button elements */
.light-theme .btn-light {
    color: var(--text-primary) !important;
    background-color: var(--bg-hover) !important;
    border-color: var(--border-color) !important;
}

.light-theme .btn-outline-light {
    color: var(--text-secondary) !important;
    border-color: var(--border-color) !important;
}

.light-theme .btn-outline-light:hover {
    color: var(--text-primary) !important;
    background-color: var(--bg-hover) !important;
}

/* Fix alert elements */
.light-theme .alert-light {
    color: var(--text-primary) !important;
    background-color: var(--bg-hover) !important;
    border-color: var(--border-color) !important;
}

/* Fix badge elements */
.light-theme .badge.bg-light {
    color: var(--text-primary) !important;
    background-color: var(--bg-hover) !important;
}

/* Fix modal elements */
.light-theme .modal-content {
    background-color: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
}

/* Fix popover and tooltip elements */
.light-theme .popover {
    background-color: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
}

.light-theme .tooltip-inner {
    background-color: var(--text-primary) !important;
    color: var(--bg-primary) !important;
}

/* Fix dashboard specific elements */
.light-theme .metric-label {
    color: var(--text-secondary) !important;
}

.light-theme .metric-number {
    color: var(--text-primary) !important;
}

.light-theme .stats-card .card-icon {
    color: var(--navy-blue) !important;
}

/* Fix specific section headers and card titles */
.light-theme h1:not(.card.bg-primary h1):not(.card.bg-info h1), 
.light-theme h2:not(.card.bg-primary h2):not(.card.bg-info h2), 
.light-theme h3:not(.card.bg-primary h3):not(.card.bg-info h3), 
.light-theme h4:not(.card.bg-primary h4):not(.card.bg-info h4), 
.light-theme h5:not(.card.bg-primary h5):not(.card.bg-info h5), 
.light-theme h6:not(.card.bg-primary h6):not(.card.bg-info h6),
.light-theme .card:not(.bg-primary):not(.bg-info) .card-title,
.light-theme .section-title {
    color: var(--text-primary) !important;
}

/* Fix card headers specifically */
.light-theme .card-header:not(.bg-primary):not(.bg-info),
.light-theme .card-header:not(.bg-primary):not(.bg-info) h1,
.light-theme .card-header:not(.bg-primary):not(.bg-info) h2,
.light-theme .card-header:not(.bg-primary):not(.bg-info) h3,
.light-theme .card-header:not(.bg-primary):not(.bg-info) h4,
.light-theme .card-header:not(.bg-primary):not(.bg-info) h5,
.light-theme .card-header:not(.bg-primary):not(.bg-info) h6 {
    color: var(--text-primary) !important;
    background-color: var(--bg-secondary) !important;
}

/* Force card titles to be visible unless on blue backgrounds */
.light-theme .card-title {
    color: var(--text-primary) !important;
}

.light-theme .card.bg-primary .card-title,
.light-theme .card.bg-info .card-title {
    color: white !important;
}

/* Fix analytics section headers */
.light-theme .analytics-header,
.light-theme .performance-header,
.light-theme .activity-header {
    color: var(--text-primary) !important;
}

/* Fix all headers with light/faded appearance */
.light-theme [class*="header"],
.light-theme [class*="title"],
.light-theme .h1, .light-theme .h2, .light-theme .h3, 
.light-theme .h4, .light-theme .h5, .light-theme .h6 {
    color: var(--text-primary) !important;
}

/* Fix progress indicators and labels */
.light-theme .progress-label,
.light-theme .setup-progress-label {
    color: var(--text-secondary) !important;
}

/* Fix any remaining white text */
.light-theme span[style*="color: white"],
.light-theme div[style*="color: white"],
.light-theme p[style*="color: white"],
.light-theme h1[style*="color: white"],
.light-theme h2[style*="color: white"],
.light-theme h3[style*="color: white"],
.light-theme h4[style*="color: white"],
.light-theme h5[style*="color: white"],
.light-theme h6[style*="color: white"] {
    color: var(--text-primary) !important;
}

/* Force visibility for any hidden text */
.light-theme [style*="color: transparent"],
.light-theme [style*="visibility: hidden"] {
    color: var(--text-primary) !important;
    visibility: visible !important;
}

/* Targeted fix for invisible text only - preserve card colors */
.light-theme .text-white:not(.btn):not(.badge):not(.alert):not(.card .card-title):not(.card .card-text):not(.card .card-header),
.light-theme .text-light:not(.btn):not(.badge):not(.alert):not(.card .card-title):not(.card .card-text):not(.card .card-header) {
    color: var(--text-primary) !important;
}

/* Restore specific element colors */
.light-theme .btn-primary,
.light-theme .btn-primary *,
.light-theme .btn-primary i,
.btn-primary,
.btn-primary *,
.btn-primary i {
    color: white !important;
}

.light-theme .btn-success {
    color: white !important;
}

.light-theme .btn-danger {
    color: white !important;
}

.light-theme .btn-warning {
    color: white !important;
}

.light-theme .btn-info {
    color: white !important;
}

.light-theme .btn-dark {
    color: white !important;
}

.light-theme .bg-primary {
    color: white !important;
}

.light-theme .bg-success {
    color: white !important;
}

.light-theme .bg-danger {
    color: white !important;
}

.light-theme .bg-warning {
    color: white !important;
}

.light-theme .bg-info {
    color: white !important;
}

.light-theme .bg-dark {
    color: white !important;
}

.light-theme .text-muted {
    color: var(--text-muted) !important;
}

.light-theme .text-secondary {
    color: var(--text-secondary) !important;
}

.light-theme .card-icon {
    color: var(--navy-blue) !important;
}

.light-theme .metric-number {
    color: var(--navy-blue) !important;
}