/* ========================================
   CORRECTIONS DE CONTRASTE CSS - VERSION RENFORCÉE
   Corrige TOUS les problèmes de lisibilité
   ======================================== */

/* RESET ET BASE */
body, html {
    color: #1a202c !important;
    font-weight: 400 !important;
}

/* CONTENEURS PRINCIPAUX */
.main-content,
.container,
.content,
.page-content {
    background: white !important;
    color: #1a202c !important;
}

/* CORRECTIONS POUR LES FORMULAIRES */
.form-group label,
label {
    color: #2d3748 !important;
    font-weight: 600 !important;
    margin-bottom: 0.5rem !important;
}

.form-group input,
.form-group select,
.form-group textarea,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
select,
textarea {
    color: #2d3748 !important;
    background: white !important;
    border: 2px solid #e2e8f0 !important;
    padding: 0.75rem !important;
    border-radius: 0.5rem !important;
    font-size: 1rem !important;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
input:focus,
select:focus,
textarea:focus {
    border-color: #3182ce !important;
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1) !important;
    outline: none !important;
}

.form-group input::placeholder,
input::placeholder,
textarea::placeholder {
    color: #718096 !important;
    opacity: 1 !important;
}

/* CORRECTIONS POUR LES TABLEAUX */
.table,
table {
    background: white !important;
    color: #2d3748 !important;
}

.table th,
table th,
th {
    background: #f7fafc !important;
    color: #2d3748 !important;
    font-weight: 700 !important;
    padding: 1rem !important;
    border-bottom: 2px solid #e2e8f0 !important;
}

.table td,
table td,
td {
    color: #4a5568 !important;
    padding: 0.75rem 1rem !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

.table-row-alt,
.table tr:nth-child(even) {
    background: #f7fafc !important;
}

/* CORRECTIONS POUR LES CARDS */
.stat-card,
.project-card,
.card,
.message-card {
    background: white !important;
    color: #2d3748 !important;
    border: 1px solid #e2e8f0 !important;
    padding: 1.5rem !important;
    border-radius: 0.75rem !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
}

/* CORRECTIONS SPÉCIFIQUES POUR STAT-CONTENT - VERSION AMÉLIORÉE */
.stat-content {
    background: rgba(255, 255, 255, 0.9) !important;
    color: #1a202c !important;
    padding: 0.5rem !important;
    border-radius: 0.375rem !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
}

.stat-content h3 {
    color: #91b0ee !important;
    font-weight: 700 !important;
    font-size: 2rem !important;
    margin: 0 !important;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8) !important;
}

.stat-content p {
    color: #2d3748 !important;
    font-weight: 500 !important;
    margin: 0 !important;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.6) !important;
}

.stat-number,
.card-number {
    color: #2d3748 !important;
    font-weight: 700 !important;
    font-size: 2rem !important;
}

.stat-label,
.card-label {
    color: #4a5568 !important;
    font-weight: 500 !important;
}

.project-card h3,
.card h3,
h3 {
    color: #2d3748 !important;
    font-weight: 600 !important;
    margin-bottom: 0.5rem !important;
}

.project-card p,
.card p {
    color: #4a5568 !important;
    line-height: 1.5 !important;
}

/* CORRECTIONS POUR LES STATUS BADGES */
.status-actif,
.badge-actif,
.status.actif {
    background: #c6f6d5 !important;
    color: #1a365d !important;
    font-weight: 600 !important;
    padding: 0.25rem 0.75rem !important;
    border-radius: 1rem !important;
}

.status-suspendu,
.badge-suspendu,
.status.suspendu {
    background: #fef5e7 !important;
    color: #744210 !important;
    font-weight: 600 !important;
    padding: 0.25rem 0.75rem !important;
    border-radius: 1rem !important;
}

.status-termine,
.badge-termine,
.status.termine {
    background: #e2e8f0 !important;
    color: #2d3748 !important;
    font-weight: 600 !important;
    padding: 0.25rem 0.75rem !important;
    border-radius: 1rem !important;
}

.status-archive,
.badge-archive,
.status.archive {
    background: #fed7d7 !important;
    color: #742a2a !important;
    font-weight: 600 !important;
    padding: 0.25rem 0.75rem !important;
    border-radius: 1rem !important;
}

.status-en-cours,
.badge-en-cours {
    background: #dbeafe !important;
    color: #1e3a8a !important;
    font-weight: 600 !important;
    padding: 0.25rem 0.75rem !important;
    border-radius: 1rem !important;
}

/* CORRECTIONS POUR LES ALERTES */
.user-message,
.alert {
    padding: 1rem !important;
    border-radius: 0.5rem !important;
    margin: 1rem 0 !important;
    border-left: 4px solid !important;
}

.user-message.alert-info,
.alert-info {
    background: #ebf8ff !important;
    border-left-color: #3182ce !important;
    color: #1e3a8a !important;
}

.user-message.alert-success,
.alert-success {
    background: #f0fff4 !important;
    border-left-color: #38a169 !important;
    color: #1a365d !important;
}

.user-message.alert-warning,
.alert-warning {
    background: #fffbeb !important;
    border-left-color: #d69e2e !important;
    color: #744210 !important;
}

.user-message.alert-error,
.alert-error,
.alert-danger {
    background: #fed7d7 !important;
    border-left-color: #e53e3e !important;
    color: #742a2a !important;
}

/* SIDEBAR ET NAVIGATION */
.sidebar,
.nav-sidebar {
    background: #2d3748 !important;
    color: white !important;
}

.sidebar a,
.nav-sidebar a,
.sidebar .nav-link {
    color: #e2e8f0 !important;
    text-decoration: none !important;
    padding: 0.75rem 1rem !important;
    display: block !important;
    transition: all 0.2s !important;
}

.sidebar a:hover,
.nav-sidebar a:hover,
.sidebar .nav-link:hover {
    background: #4a5568 !important;
    color: white !important;
}

.sidebar a.active,
.nav-sidebar a.active,
.sidebar .nav-link.active {
    background: #3182ce !important;
    color: white !important;
}

/* HEADER ET TITRES */
.header,
.page-header {
    background: white !important;
    color: #2d3748 !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

h1, h2, h3, h4, h5, h6 {
    color: #2d3748 !important;
    font-weight: 600 !important;
}

.header h1,
.page-header h1 {
    color: #2d3748 !important;
}

/* BOUTONS - CORRECTION SPÉCIFIQUE */
.btn {
    font-weight: 500 !important;
    padding: 0.75rem 1.5rem !important;
    border-radius: 0.5rem !important;
    border: none !important;
    cursor: pointer !important;
    text-decoration: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.5rem !important;
    transition: all 0.2s ease !important;
}

.btn-primary {
    background: #3182ce !important;
    color: white !important;
}

.btn-primary:hover {
    background: #2c5aa0 !important;
}

.btn-secondary {
    background: #e2e8f0 !important;
    color: #2d3748 !important;
}

.btn-secondary:hover {
    background: #cbd5e0 !important;
}

.btn-success {
    background: #38a169 !important;
    color: white !important;
}

.btn-warning {
    background: #d69e2e !important;
    color: white !important;
}

.btn-danger,
.btn-delete {
    background: #e53e3e !important;
    color: white !important;
}

.btn-edit {
    background: #d69e2e !important;
    color: white !important;
}

/* LIENS */
a {
    color: #3182ce !important;
    text-decoration: none !important;
}

a:hover {
    color: #2c5aa0 !important;
    text-decoration: underline !important;
}

/* TEXTE GÉNÉRAL */
p {
    color: #4a5568 !important;
    line-height: 1.6 !important;
}

.text-muted,
.text-secondary {
    color: #718096 !important;
}

.text-primary {
    color: #3182ce !important;
}

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

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

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

/* PAGINATION */
.pagination {
    display: flex !important;
    gap: 0.25rem !important;
}

.pagination a,
.pagination span {
    padding: 0.5rem 0.75rem !important;
    background: white !important;
    color: #3182ce !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 0.25rem !important;
    text-decoration: none !important;
}

.pagination a:hover {
    background: #f7fafc !important;
}

.pagination .current {
    background: #3182ce !important;
    color: white !important;
}

/* MODALS ET OVERLAYS */
.modal,
.overlay {
    background: rgba(0, 0, 0, 0.5) !important;
}

.modal-content {
    background: white !important;
    color: #2d3748 !important;
    padding: 2rem !important;
    border-radius: 0.75rem !important;
}

/* TOOLTIPS */
.tooltip {
    background: #2d3748 !important;
    color: white !important;
    padding: 0.5rem !important;
    border-radius: 0.25rem !important;
    font-size: 0.875rem !important;
}

/* CORRECTIONS SPÉCIFIQUES POUR ÉLÉMENTS PROBLÉMATIQUES */
.login-container {
    background: white !important;
    color: #2d3748 !important;
}

.dashboard-grid {
    background: transparent !important;
}

.project-list {
    background: transparent !important;
}

/* CORRECTIONS POUR LES LISTES */
ul, ol {
    color: #4a5568 !important;
}

li {
    color: #4a5568 !important;
    margin-bottom: 0.25rem !important;
}

/* CORRECTIONS POUR LES ÉLÉMENTS INLINE */
span, strong, em, b, i {
    color: inherit !important;
}

/* RESPONSIVE - ASSURE LA LISIBILITÉ SUR MOBILE */
@media (max-width: 768px) {
    body {
        font-size: 16px !important;
    }
    
    .btn {
        padding: 1rem 1.25rem !important;
        font-size: 1rem !important;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px !important;
        padding: 1rem !important;
    }
}

/* DEBUG - À SUPPRIMER APRÈS TESTS */
.debug-contrast {
    border: 2px solid red !important;
    background: yellow !important;
    color: black !important;
}

.stat-label {
    color: #4a5568 !important;
}

.project-card {
    background: white !important;
    color: #2d3748 !important;
}

.project-card h3 {
    color: #2d3748 !important;
}

.project-card p {
    color: #4a5568 !important;
}

/* Corrections pour les status badges */
.status-actif {
    background: #c6f6d5 !important;
    color: #2f855a !important;
}

.status-suspendu {
    background: #fefcbf !important;
    color: #975a16 !important;
}

.status-termine {
    background: #e2e8f0 !important;
    color: #4a5568 !important;
}

.status-archive {
    background: #fed7d7 !important;
    color: #c53030 !important;
}

/* Corrections pour les alertes */
.user-message.alert-info {
    background: #ebf8ff !important;
    border: 1px solid #3182ce !important;
    color: #2c5282 !important;
}

.user-message.alert-success {
    background: #f0fff4 !important;
    border: 1px solid #38a169 !important;
    color: #2f855a !important;
}

.user-message.alert-warning {
    background: #fffbeb !important;
    border: 1px solid #ed8936 !important;
    color: #c05621 !important;
}

.user-message.alert-error {
    background: #fed7d7 !important;
    border: 1px solid #e53e3e !important;
    color: #c53030 !important;
}

/* Corrections pour la navigation sidebar */
.sidebar {
    background: #f7fafc !important;
    color: #2d3748 !important;
}

.nav-section h3 {
    color: #4a5568 !important;
}

.nav-link {
    color: #4a5568 !important;
}

.nav-link:hover {
    background: #edf2f7 !important;
    color: #2b6cb0 !important;
}

.nav-item.active .nav-link {
    background: #3182ce !important;
    color: white !important;
}

/* Corrections pour les modales */
.modal-content {
    background: white !important;
    color: #2d3748 !important;
}

.modal-header {
    color: #2d3748 !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

/* Corrections pour les notifications */
.notifications-list {
    background: white !important;
    color: #2d3748 !important;
}

.notification-item {
    border-bottom: 1px solid #e2e8f0 !important;
    color: #4a5568 !important;
}

.notification-item.unread {
    background: #f7fafc !important;
}

/* Corrections pour les messages */
.message-item {
    background: white !important;
    color: #2d3748 !important;
    border: 1px solid #e2e8f0 !important;
}

.message-sender {
    color: #2b6cb0 !important;
    font-weight: 600;
}

.message-date {
    color: #718096 !important;
}

.message-content {
    color: #4a5568 !important;
}

/* Corrections pour les liens généraux */
a {
    color: #3182ce !important;
}

a:hover {
    color: #2c5282 !important;
}

/* Corrections pour les breadcrumbs */
.breadcrumb {
    color: #4a5568 !important;
}

.breadcrumb a {
    color: #3182ce !important;
}

.breadcrumb .separator {
    color: #a0aec0 !important;
}

/* Corrections pour les tooltips */
.tooltip {
    background: #2d3748 !important;
    color: white !important;
}

/* Corrections pour les dropdowns */
.dropdown-menu {
    background: white !important;
    color: #2d3748 !important;
    border: 1px solid #e2e8f0 !important;
}

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

.dropdown-item:hover {
    background: #f7fafc !important;
    color: #2d3748 !important;
}

/* Corrections pour les progress bars */
.progress {
    background: #e2e8f0 !important;
}

.progress-bar {
    background: #3182ce !important;
    color: white !important;
}

/* Corrections pour les badges de rôle */
.role-badge {
    font-weight: 600;
}

.role-administrateur {
    background: #fed7d7 !important;
    color: #c53030 !important;
}

.role-chef_projet {
    background: #c6f6d5 !important;
    color: #2f855a !important;
}

.role-intervenant {
    background: #bee3f8 !important;
    color: #2c5282 !important;
}

.role-collaborateur {
    background: #e2e8f0 !important;
    color: #4a5568 !important;
}

/* Corrections pour les priorités de tâches */
.priority-critique {
    background: #fed7d7 !important;
    color: #c53030 !important;
}

.priority-haute {
    background: #fefcbf !important;
    color: #975a16 !important;
}

.priority-moyenne {
    background: #bee3f8 !important;
    color: #2c5282 !important;
}

.priority-basse {
    background: #c6f6d5 !important;
    color: #2f855a !important;
}

/* Force une couleur de texte sombre pour tous les conteneurs blancs */
.container,
.card,
.panel,
.section,
.content-area,
.form-container {
    color: #2d3748 !important;
}

/* Assure que les éléments cachés restent accessibles */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Media queries pour le contraste en mode sombre (si activé par l'utilisateur) */
@media (prefers-color-scheme: dark) {
    .main-content {
        background: #1a202c !important;
        color: #e2e8f0 !important;
    }
    
    .sidebar {
        background: #2d3748 !important;
        color: #e2e8f0 !important;
    }
    
    .stat-card,
    .project-card,
    .modal-content {
        background: #2d3748 !important;
        color: #e2e8f0 !important;
        border: 1px solid #4a5568 !important;
    }
}

/* NAVIGATION UNIFIÉE - CORRECTIONS SUPPLÉMENTAIRES */
.unified-layout {
    background: #f8fafc !important;
}

.unified-header {
    background: white !important;
    color: #2d3748 !important;
    border-bottom: 2px solid #e2e8f0 !important;
}

.unified-header .app-title {
    color: #2d3748 !important;
}

.unified-header .app-title i {
    color: #3182ce !important;
}

.unified-header .user-name {
    color: #2d3748 !important;
}

.unified-header .user-role {
    color: #4a5568 !important;
    background: #f7fafc !important;
}

.unified-header .logout-btn {
    color: #e53e3e !important;
}

.unified-header .logout-btn:hover {
    background: #fed7d7 !important;
    color: #c53030 !important;
}

.unified-sidebar {
    background: white !important;
    border-right: 2px solid #e2e8f0 !important;
}

.unified-sidebar .nav-section h3 {
    color: #4a5568 !important;
}

.unified-sidebar .nav-link {
    color: #4a5568 !important;
}

.unified-sidebar .nav-link:hover {
    background: #edf2f7 !important;
    color: #2d3748 !important;
}

.unified-sidebar .nav-link:hover i {
    color: #3182ce !important;
}

.unified-sidebar .nav-item.active .nav-link {
    background: #3182ce !important;
    color: white !important;
}

.unified-sidebar .nav-item.active .nav-link i {
    color: white !important;
}

.unified-main {
    background: #f8fafc !important;
    color: #2d3748 !important;
}

/* Corrections pour les pages harmonisées */
.page-header {
    background: white !important;
    color: #2d3748 !important;
    padding: 1.5rem !important;
    border-radius: 0.5rem !important;
    margin-bottom: 1.5rem !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
}

.page-header h1 {
    color: #2d3748 !important;
    margin: 0 !important;
}

.header-actions .btn {
    background: #3182ce !important;
    color: white !important;
}

.messages-container,
.profil-container {
    max-width: 1200px !important;
    margin: 0 auto !important;
    background: transparent !important;
}

/* S'assurer que tous les contenus sont lisibles */
.unified-main * {
    color: inherit !important;
}

.unified-main .alert {
    background: white !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 0.5rem !important;
}

.unified-main .alert-success {
    background: #f0fff4 !important;
    color: #1a365d !important;
    border-color: #9ae6b4 !important;
}

.unified-main .alert-error {
    background: #fed7d7 !important;
    color: #742a2a !important;
    border-color: #feb2b2 !important;
}
