/**
 * Modern UI Enhancement - Dynasty
 * Interface utilisateur moderne et fluide
 * Auteur: GitHub Copilot
 * Date: 29 décembre 2025
 */

/* ==========================================================================
   Variables CSS - Palette de couleurs moderne
   ========================================================================== */
:root {
  /* Couleurs principales */
  --primary-color: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  
  /* Couleurs secondaires */
  --secondary-color: #64748b;
  --secondary-hover: #475569;
  --secondary-light: #f1f5f9;
  
  /* Couleurs d'accent */
  --success-color: #10b981;
  --success-light: #d1fae5;
  --warning-color: #f59e0b;
  --warning-light: #fef3c7;
  --danger-color: #ef4444;
  --danger-light: #fee2e2;
  --info-color: #3b82f6;
  --info-light: #dbeafe;
  
  /* Couleurs de fond */
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-dark: #1e293b;
  --bg-sidebar: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  
  /* Couleurs de texte */
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --text-light: #ffffff;
  
  /* Bordures et ombres */
  --border-color: #e2e8f0;
  --border-radius-sm: 0.375rem;
  --border-radius: 0.5rem;
  --border-radius-lg: 0.75rem;
  --border-radius-xl: 1rem;
  --border-radius-full: 9999px;
  
  /* Ombres */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 350ms ease;
  
  /* Typographie */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  --font-family-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
}

/* ==========================================================================
   Reset et Base
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ==========================================================================
   Typographie
   ========================================================================== */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-hover);
}

/* ==========================================================================
   Sidebar - Navigation latérale moderne
   ========================================================================== */
.main-sidebar {
  background: var(--bg-sidebar) !important;
  border-right: none !important;
  box-shadow: var(--shadow-xl);
  transition: all var(--transition-normal);
}

.main-sidebar .sidebar {
  padding: 0.5rem;
}

/* Logo et profil utilisateur */
.main-sidebar .brand-link {
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
  padding: 1rem !important;
  transition: all var(--transition-fast);
}

.main-sidebar .brand-link:hover {
  background: rgba(255, 255, 255, 0.1);
}

.main-sidebar .brand-link .brand-image {
  background: var(--primary-gradient) !important;
  font-weight: 600 !important;
  font-size: 0.875rem !important;
  box-shadow: var(--shadow-md);
  border: 2px solid rgba(255, 255, 255, 0.2) !important;
}

.main-sidebar .brand-link .brand-text {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-light) !important;
}

/* Navigation items */
.nav-sidebar .nav-item {
  margin-bottom: 0.25rem;
}

.nav-sidebar .nav-link {
  color: rgba(255, 255, 255, 0.7) !important;
  border-radius: var(--border-radius) !important;
  padding: 0.75rem 1rem !important;
  margin: 0 0.5rem;
  transition: all var(--transition-fast);
  font-weight: 500;
  font-size: 0.875rem;
}

.nav-sidebar .nav-link:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  color: var(--text-light) !important;
  transform: translateX(3px);
}

.nav-sidebar .nav-link.active {
  background: var(--primary-gradient) !important;
  color: var(--text-light) !important;
  box-shadow: var(--shadow-md);
}

.nav-sidebar .nav-link .nav-icon {
  font-size: 1rem;
  width: 1.5rem;
  margin-right: 0.75rem;
  transition: all var(--transition-fast);
}

.nav-sidebar .nav-link:hover .nav-icon {
  transform: scale(1.1);
}

/* Sous-menus */
.nav-treeview {
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--border-radius);
  margin: 0.25rem 0.5rem;
  padding: 0.5rem 0;
}

.nav-treeview .nav-link {
  padding: 0.5rem 1rem 0.5rem 2.5rem !important;
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.85) !important;
}

.nav-treeview .nav-link:hover {
  color: var(--text-light) !important;
  background: rgba(255, 255, 255, 0.1) !important;
}

.nav-treeview .nav-link .nav-icon {
  font-size: 0.625rem;
}

/* Couleurs des icônes et textes dans le sidebar - visibilité améliorée */
.nav-sidebar .text-primary,
.nav-treeview .text-primary {
  color: #818cf8 !important;
}

.nav-sidebar .text-success,
.nav-treeview .text-success {
  color: #4ade80 !important;
}

.nav-sidebar .text-warning,
.nav-treeview .text-warning {
  color: #fbbf24 !important;
}

.nav-sidebar .text-danger,
.nav-treeview .text-danger {
  color: #f87171 !important;
}

.nav-sidebar .text-info,
.nav-treeview .text-info {
  color: #38bdf8 !important;
}

.nav-sidebar .text-white,
.nav-treeview .text-white {
  color: #ffffff !important;
}

/* Texte des paragraphes dans les liens nav */
.nav-treeview .nav-link p,
.nav-sidebar .nav-link p {
  color: inherit !important;
}

/* Flèche dropdown */
.nav-sidebar .nav-link p .right {
  transition: transform var(--transition-fast);
}

.nav-sidebar .nav-item.menu-open > .nav-link p .right {
  transform: rotate(-90deg);
}

/* ==========================================================================
   Header / Topbar
   ========================================================================== */
.main-header.navbar {
  background: var(--bg-secondary) !important;
  border: none !important;
  box-shadow: var(--shadow);
  padding: 0.5rem 1rem;
  min-height: 60px;
}

.main-header .nav-link {
  color: var(--text-primary) !important;
  padding: 0.5rem 0.75rem !important;
  border-radius: var(--border-radius);
  transition: all var(--transition-fast);
}

.main-header .nav-link:hover {
  background: var(--bg-primary);
  color: var(--primary-color) !important;
}

.main-header .nav-link i {
  font-size: 1.125rem;
}

/* Bouton menu hamburger */
.main-header [data-widget="pushmenu"] {
  background: var(--primary-light);
  color: var(--primary-color) !important;
  border-radius: var(--border-radius);
  padding: 0.5rem 0.75rem !important;
}

.main-header [data-widget="pushmenu"]:hover {
  background: var(--primary-color);
  color: var(--text-light) !important;
}

/* Titre dans le header */
.main-header .nav-link.text-white {
  color: var(--text-primary) !important;
  font-weight: 600;
  font-size: 1.125rem;
}

/* ==========================================================================
   Content Wrapper
   ========================================================================== */
.content-wrapper {
  background: var(--bg-primary) !important;
  min-height: calc(100vh - 60px);
}

/* Content Header */
.content-header {
  padding: 1rem 1.5rem;
  background: var(--bg-secondary);
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.content-header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.content-header hr {
  display: none;
}

/* Section content */
section.content {
  padding: 0 1.5rem 1.5rem;
}

/* ==========================================================================
   Cards - Cartes modernes
   ========================================================================== */
.card {
  border: none !important;
  border-radius: var(--border-radius-lg) !important;
  box-shadow: var(--shadow) !important;
  transition: all var(--transition-normal);
  overflow: hidden;
  background: var(--bg-secondary);
}

.card:hover {
  box-shadow: var(--shadow-lg) !important;
  transform: translateY(-2px);
}

.card-header {
  background: var(--bg-secondary) !important;
  border-bottom: 1px solid var(--border-color) !important;
  padding: 1rem 1.25rem !important;
  font-weight: 600;
}

.card-header .card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.card-body {
  padding: 1.25rem !important;
}

.card-footer {
  background: var(--bg-primary) !important;
  border-top: 1px solid var(--border-color) !important;
  padding: 1rem 1.25rem !important;
}

/* Card avec bordure colorée */
.card-outline {
  border-top: 3px solid var(--primary-color) !important;
}

.card-outline.card-primary {
  border-top-color: var(--primary-color) !important;
}

.card-outline.card-success {
  border-top-color: var(--success-color) !important;
}

.card-outline.card-warning {
  border-top-color: var(--warning-color) !important;
}

.card-outline.card-danger {
  border-top-color: var(--danger-color) !important;
}

.card-outline.card-info {
  border-top-color: var(--info-color) !important;
}

/* Card tools */
.card-tools .btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  border-radius: var(--border-radius);
  transition: all var(--transition-fast);
}

.card-tools .btn-tool {
  color: var(--text-secondary);
  background: transparent;
}

.card-tools .btn-tool:hover {
  color: var(--primary-color);
  background: var(--primary-light);
}

/* ==========================================================================
   Boutons - Design moderne
   ========================================================================== */
.btn {
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius);
  transition: all var(--transition-fast);
  border: none;
  font-size: 0.875rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn:active {
  transform: translateY(0);
}

.btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.3);
}

/* Bouton Primary */
.btn-primary {
  background: var(--primary-gradient) !important;
  border: none !important;
  color: var(--text-light) !important;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%) !important;
  color: var(--text-light) !important;
}

/* Bouton Success */
.btn-success {
  background: var(--success-color) !important;
  border: none !important;
}

.btn-success:hover {
  background: #059669 !important;
}

/* Bouton Warning */
.btn-warning {
  background: var(--warning-color) !important;
  border: none !important;
  color: var(--text-light) !important;
}

.btn-warning:hover {
  background: #d97706 !important;
}

/* Bouton Danger */
.btn-danger {
  background: var(--danger-color) !important;
  border: none !important;
}

.btn-danger:hover {
  background: #dc2626 !important;
}

/* Bouton Info */
.btn-info {
  background: var(--info-color) !important;
  border: none !important;
  color: var(--text-light) !important;
}

.btn-info:hover {
  background: #2563eb !important;
}

/* Bouton Secondary */
.btn-secondary {
  background: var(--secondary-color) !important;
  border: none !important;
}

.btn-secondary:hover {
  background: var(--secondary-hover) !important;
}

/* Bouton Outline */
.btn-outline-primary {
  border: 2px solid var(--primary-color) !important;
  color: var(--primary-color) !important;
  background: transparent !important;
}

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

/* Boutons gradients */
.bg-gradient-primary {
  background: var(--primary-gradient) !important;
  border: none !important;
}

.bg-gradient-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
}

.bg-gradient-warning {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
}

.bg-gradient-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
}

/* Tailles de boutons */
.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
}

.btn-block {
  width: 100%;
}

/* ==========================================================================
   Formulaires - Design moderne
   ========================================================================== */
.form-control {
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  transition: all var(--transition-fast);
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
  outline: none;
}

.form-control::placeholder {
  color: var(--text-muted);
}

/* Input groups */
.input-group {
  border-radius: var(--border-radius);
}

.input-group .form-control {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.input-group-append .btn,
.input-group-prepend .btn {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.input-group-text {
  background: var(--bg-primary);
  border: 2px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* Labels */
.form-group label,
.control-label {
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

/* Select */
select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.75rem center;
  background-repeat: no-repeat;
  background-size: 1.25rem;
  padding-right: 2.5rem;
}

/* Select2 custom styling */
.select2-container--default .select2-selection--single {
  border: 2px solid var(--border-color) !important;
  border-radius: var(--border-radius) !important;
  height: 42px !important;
  padding: 0.375rem 0.75rem !important;
}

.select2-container--default .select2-selection--single:focus {
  border-color: var(--primary-color) !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 26px !important;
  color: var(--text-primary) !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 40px !important;
}

.select2-dropdown {
  border: 2px solid var(--border-color) !important;
  border-radius: var(--border-radius) !important;
  box-shadow: var(--shadow-lg) !important;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
  background: var(--primary-color) !important;
}

/* Checkbox et Radio */
.icheck-primary > input:first-child:checked + label::before,
.icheck-primary > input:first-child:checked + input[type="hidden"] + label::before {
  background-color: var(--primary-color) !important;
  border-color: var(--primary-color) !important;
}

/* ==========================================================================
   Tables - Design moderne
   ========================================================================== */
.table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  position: relative;
  z-index: 1;
}

.table thead th {
  background: var(--bg-primary);
  border: none !important;
  padding: 1rem !important;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  position: relative;
  z-index: 1;
}

.table tbody td {
  padding: 1rem !important;
  border-bottom: 1px solid var(--border-color) !important;
  vertical-align: middle;
  color: var(--text-primary);
  position: relative;
  z-index: 1;
}

/* Dropdown dans les tables - z-index prioritaire */
.table .dropdown,
.table .dropdown-menu,
.table td .dropdown-menu {
  z-index: 9999 !important;
}

.table tbody tr .dropdown.show .dropdown-menu {
  z-index: 9999 !important;
  position: absolute !important;
}

.table tbody tr {
  /* Pas de transition pour éviter les troubles visuels */
  transition: none;
}

.table tbody tr:hover {
  /* Fond légèrement plus clair au survol - sans animation */
  background-color: #f1f5f9 !important;
}

.table-striped tbody tr:nth-of-type(odd) {
  background-color: #f8fafc !important;
}

.table-striped tbody tr:nth-of-type(even) {
  background-color: #ffffff !important;
}

.table-striped tbody tr:hover {
  background-color: #e2e8f0 !important;
}

/* DataTables */
.dataTables_wrapper {
  padding: 1rem 0;
}

.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
}

.dataTables_wrapper .dataTables_filter input:focus {
  border-color: var(--primary-color);
  outline: none;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: var(--border-radius) !important;
  margin: 0 0.125rem;
  padding: 0.5rem 0.875rem !important;
  border: none !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--primary-gradient) !important;
  color: var(--text-light) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--primary-light) !important;
  color: var(--primary-color) !important;
}

/* ==========================================================================
   Modals - Design moderne
   ========================================================================== */
.modal-content {
  border: none;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}

.modal-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 1.25rem 1.5rem;
}

.modal-header .modal-title {
  font-weight: 600;
  font-size: 1.125rem;
  color: var(--text-primary);
}

.modal-header .close {
  opacity: 0.5;
  transition: opacity var(--transition-fast);
  font-size: 1.5rem;
  padding: 0.5rem;
  margin: -0.5rem;
}

.modal-header .close:hover {
  opacity: 1;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color);
  padding: 1rem 1.5rem;
  gap: 0.5rem;
}

.modal-backdrop {
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
}

/* Animation d'entrée du modal */
.modal.fade .modal-dialog {
  transform: scale(0.95) translateY(-20px);
  transition: transform var(--transition-normal);
}

.modal.show .modal-dialog {
  transform: scale(1) translateY(0);
}

/* ==========================================================================
   Dropdowns - Design moderne
   ========================================================================== */
.dropdown-menu {
  border: none;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 0.5rem;
  min-width: 12rem;
  animation: dropdownFadeIn var(--transition-fast);
  z-index: 9999 !important;
  position: absolute !important;
  background: var(--bg-secondary) !important;
}

@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dropdown-item {
  padding: 0.625rem 1rem;
  border-radius: var(--border-radius);
  font-size: 0.875rem;
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.dropdown-item:hover {
  background: var(--primary-light);
  color: var(--primary-color);
}

.dropdown-item:active {
  background: var(--primary-color);
  color: var(--text-light);
}

.dropdown-divider {
  border-color: var(--border-color);
  margin: 0.5rem 0;
}

/* ==========================================================================
   Badges et Labels
   ========================================================================== */
.badge {
  font-weight: 500;
  padding: 0.375rem 0.75rem;
  border-radius: var(--border-radius-full);
  font-size: 0.75rem;
  letter-spacing: 0.025em;
}

.badge-primary {
  background: var(--primary-light);
  color: var(--primary-color);
}

.badge-success {
  background: var(--success-light);
  color: var(--success-color);
}

.badge-warning {
  background: var(--warning-light);
  color: #92400e;
}

.badge-danger {
  background: var(--danger-light);
  color: var(--danger-color);
}

.badge-info {
  background: var(--info-light);
  color: var(--info-color);
}

/* ==========================================================================
   Alertes
   ========================================================================== */
.alert {
  border: none;
  border-radius: var(--border-radius);
  padding: 1rem 1.25rem;
  border-left: 4px solid;
}

.alert-primary {
  background: var(--primary-light);
  border-left-color: var(--primary-color);
  color: var(--primary-color);
}

.alert-success {
  background: var(--success-light);
  border-left-color: var(--success-color);
  color: #065f46;
}

.alert-warning {
  background: var(--warning-light);
  border-left-color: var(--warning-color);
  color: #92400e;
}

.alert-danger {
  background: var(--danger-light);
  border-left-color: var(--danger-color);
  color: #991b1b;
}

.alert-info {
  background: var(--info-light);
  border-left-color: var(--info-color);
  color: #1e40af;
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */
.toast {
  border: none;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-xl);
  backdrop-filter: blur(10px);
  animation: slideInRight var(--transition-normal);
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast-body {
  padding: 1rem 1.25rem;
  font-weight: 500;
}

/* Toastr customization */
.toast-success {
  background: var(--success-color) !important;
}

.toast-error {
  background: var(--danger-color) !important;
}

.toast-warning {
  background: var(--warning-color) !important;
}

.toast-info {
  background: var(--info-color) !important;
}

/* ==========================================================================
   Preloader amélioré
   ========================================================================== */
#preloader, #preloader2 {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(5px);
}

#preloader:before, #preloader2:before {
  border: 4px solid var(--primary-light);
  border-top-color: var(--primary-color);
  width: 50px;
  height: 50px;
  animation: preloaderSpin 0.8s linear infinite;
}

@keyframes preloaderSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ==========================================================================
   Animations et Transitions
   ========================================================================== */
/* Animation de fade in */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.fade-in {
  animation: fadeIn var(--transition-normal);
}

/* Animation de slide up */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.slide-up {
  animation: slideUp var(--transition-normal);
}

/* Animation pour les cards */
.card {
  animation: slideUp var(--transition-slow);
}

/* Effet de pulse pour les icônes */
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.pulse {
  animation: pulse 2s ease-in-out infinite;
}

/* Hover effect pour les liens */
.hover-lift {
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.hover-lift:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */
@media (max-width: 991.98px) {
  .main-sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition-normal);
  }

  .sidebar-open .main-sidebar {
    transform: translateX(0);
  }

  .content-wrapper {
    margin-left: 0 !important;
  }

  .content-header {
    padding: 1rem;
  }

  section.content {
    padding: 0 1rem 1rem;
  }
}

@media (max-width: 767.98px) {
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }
  h3 { font-size: 1.125rem; }

  .card-body {
    padding: 1rem !important;
  }

  .table thead th,
  .table tbody td {
    padding: 0.75rem !important;
    font-size: 0.8125rem;
  }

  .btn {
    padding: 0.5rem 0.875rem;
    font-size: 0.8125rem;
  }

  .modal-dialog {
    margin: 0.5rem;
  }
}

@media (max-width: 575.98px) {
  .content-header h1 {
    font-size: 1.25rem;
  }

  .card {
    border-radius: var(--border-radius) !important;
  }

  .d-flex.justify-content-center {
    flex-direction: column;
    gap: 0.5rem;
  }

  .input-group {
    flex-wrap: wrap;
  }

  .input-group .form-control {
    border-radius: var(--border-radius) !important;
    margin-bottom: 0.5rem;
  }

  .input-group .btn {
    border-radius: var(--border-radius) !important;
    width: 100%;
  }
}

/* ==========================================================================
   Accessibilité
   ========================================================================== */
/* Focus visible pour la navigation au clavier */
:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Contraste amélioré pour les textes */
.text-muted {
  color: var(--text-secondary) !important;
}

/* Skip to content link */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  background: var(--primary-color);
  color: var(--text-light);
  padding: 0.75rem 1.5rem;
  z-index: 9999;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: 0;
}

/* Réduction des mouvements pour les utilisateurs qui le préfèrent */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Mode contraste élevé */
@media (prefers-contrast: high) {
  :root {
    --border-color: #000;
    --text-secondary: #333;
  }

  .btn {
    border: 2px solid currentColor !important;
  }

  .card {
    border: 2px solid var(--border-color) !important;
  }
}

/* ==========================================================================
   Utilitaires personnalisés
   ========================================================================== */
/* Espacement */
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }
.gap-4 { gap: 1.5rem; }

/* Couleurs de texte */
.text-primary { color: var(--primary-color) !important; }
.text-success { color: var(--success-color) !important; }
.text-warning { color: var(--warning-color) !important; }
.text-danger { color: var(--danger-color) !important; }
.text-info { color: var(--info-color) !important; }

/* Couleurs de fond */
.bg-primary-light { background: var(--primary-light) !important; }
.bg-success-light { background: var(--success-light) !important; }
.bg-warning-light { background: var(--warning-light) !important; }
.bg-danger-light { background: var(--danger-light) !important; }
.bg-info-light { background: var(--info-light) !important; }

/* Border radius */
.rounded-sm { border-radius: var(--border-radius-sm) !important; }
.rounded { border-radius: var(--border-radius) !important; }
.rounded-lg { border-radius: var(--border-radius-lg) !important; }
.rounded-xl { border-radius: var(--border-radius-xl) !important; }
.rounded-full { border-radius: var(--border-radius-full) !important; }

/* Shadows */
.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow { box-shadow: var(--shadow) !important; }
.shadow-md { box-shadow: var(--shadow-md) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }
.shadow-xl { box-shadow: var(--shadow-xl) !important; }

/* ==========================================================================
   Scrollbar personnalisée
   ========================================================================== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--secondary-color);
  border-radius: var(--border-radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--secondary-hover);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--secondary-color) var(--bg-primary);
}

/* ==========================================================================
   Login page specific styles
   ========================================================================== */
.login-page,
.register-page {
  background: var(--primary-gradient);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-box,
.register-box {
  background: var(--bg-secondary);
  border-radius: var(--border-radius-xl);
  box-shadow: var(--shadow-xl);
  padding: 2rem;
  width: 100%;
  max-width: 400px;
}

.login-logo,
.register-logo {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 1.5rem;
  text-align: center;
}

/* ==========================================================================
   Print styles
   ========================================================================== */
@media print {
  .main-sidebar,
  .main-header,
  .btn,
  .no-print {
    display: none !important;
  }

  .content-wrapper {
    margin-left: 0 !important;
    background: white !important;
  }

  .card {
    box-shadow: none !important;
    border: 1px solid #ddd !important;
  }
}

/* ==========================================================================
   Styles spécifiques Dynasty Transport
   ========================================================================== */

/* Navigation icons in topbar */
.nav-link-icon {
  width: 40px;
  height: 40px;
  display: flex !important;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius) !important;
  transition: all var(--transition-fast);
}

.nav-link-icon:hover {
  background: var(--primary-light) !important;
  color: var(--primary-color) !important;
}

.nav-link-icon i {
  font-size: 1.125rem;
}

/* Nav divider in topbar */
.nav-divider {
  width: 1px;
  height: 24px;
  background: var(--border-color);
  margin: 0 0.5rem;
  align-self: center;
}

/* Brand title in topbar */
.brand-title {
  font-size: 1rem !important;
}

.brand-title i {
  font-size: 1.25rem !important;
}

/* Survey items / Cards in home */
.survey-item .card {
  height: 100%;
  transition: all var(--transition-normal);
}

.survey-item .card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-xl) !important;
}

/* Search box in home */
.input-group.input-group-sm .form-control {
  border-radius: var(--border-radius) 0 0 var(--border-radius) !important;
  padding: 0.625rem 1rem !important;
  font-size: 0.875rem;
}

.input-group.input-group-sm .btn {
  border-radius: 0 var(--border-radius) var(--border-radius) 0 !important;
  padding: 0.625rem 1.25rem !important;
}

/* Statistics table in cards */
.card .table-striped {
  margin-bottom: 0;
}

.card .table-striped td {
  border: none !important;
  padding: 0.5rem !important;
  font-size: 0.8125rem;
}

.card .table-striped tr:last-child td {
  padding-bottom: 0 !important;
}

/* Montants et valeurs */
.text-right {
  font-family: var(--font-family-mono);
  font-weight: 500;
}

/* Horizontal rule in content header */
hr.border-primary {
  border: none;
  height: 2px;
  background: var(--primary-gradient);
  border-radius: var(--border-radius-full);
  opacity: 0.5;
}

/* Card outline styles enhancement */
.card.card-outline {
  border-top-width: 4px !important;
}

/* Modal enhancements */
.modal-full-height {
  min-height: calc(100vh - 1rem);
  margin: 0.5rem auto;
}

.modal-full-height .modal-content {
  min-height: calc(100vh - 1rem);
}

/* Select2 enhancements */
.select2-container--default .select2-selection--multiple {
  border: 2px solid var(--border-color) !important;
  border-radius: var(--border-radius) !important;
  min-height: 42px !important;
  padding: 0.25rem 0.5rem !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
  background: var(--primary-light) !important;
  border: none !important;
  color: var(--primary-color) !important;
  border-radius: var(--border-radius-sm) !important;
  padding: 0.25rem 0.5rem !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
  color: var(--primary-color) !important;
}

/* DataTable buttons */
.dt-buttons .btn {
  margin-right: 0.25rem;
}

.dt-buttons .btn-secondary {
  background: var(--secondary-light) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color) !important;
}

.dt-buttons .btn-secondary:hover {
  background: var(--secondary-color) !important;
  color: var(--text-light) !important;
}

/* SweetAlert2 customization */
.swal2-popup {
  border-radius: var(--border-radius-lg) !important;
  padding: 1.5rem !important;
}

.swal2-title {
  font-size: 1.25rem !important;
  font-weight: 600 !important;
  color: var(--text-primary) !important;
}

.swal2-html-container {
  color: var(--text-secondary) !important;
}

.swal2-confirm {
  background: var(--primary-gradient) !important;
  border-radius: var(--border-radius) !important;
  padding: 0.625rem 1.5rem !important;
}

.swal2-cancel {
  background: var(--secondary-light) !important;
  color: var(--text-primary) !important;
  border-radius: var(--border-radius) !important;
  padding: 0.625rem 1.5rem !important;
}

/* Toastr customization */
#toast-container > div {
  border-radius: var(--border-radius-lg) !important;
  box-shadow: var(--shadow-lg) !important;
  padding: 1rem 1rem 1rem 3.5rem !important;
  opacity: 1 !important;
}

#toast-container > .toast-success {
  background-color: var(--success-color) !important;
}

#toast-container > .toast-error {
  background-color: var(--danger-color) !important;
}

#toast-container > .toast-info {
  background-color: var(--info-color) !important;
}

#toast-container > .toast-warning {
  background-color: var(--warning-color) !important;
}

/* Status badges */
.badge.badge-pill {
  padding: 0.5rem 1rem;
}

/* Action buttons group */
.btn-group .btn {
  border-radius: 0 !important;
}

.btn-group .btn:first-child {
  border-radius: var(--border-radius) 0 0 var(--border-radius) !important;
}

.btn-group .btn:last-child {
  border-radius: 0 var(--border-radius) var(--border-radius) 0 !important;
}

/* ==========================================================================
   BOUTON ACTION - Style moderne
   ========================================================================== */

/* Bouton Action principal */
.btn-action {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 8px !important;
  padding: 8px 16px !important;
  font-weight: 500 !important;
  font-size: 13px !important;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3) !important;
  transition: all 0.2s ease !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
}

.btn-action:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4) !important;
  color: #ffffff !important;
}

.btn-action:focus {
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3) !important;
}

.btn-action::after {
  margin-left: 4px !important;
}

/* Menu dropdown pour Action */
.dropdown-menu-action {
  background: #ffffff !important;
  border: none !important;
  border-radius: 12px !important;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15) !important;
  padding: 8px !important;
  min-width: 180px !important;
  z-index: 999999 !important;
}

.dropdown-menu-action .dropdown-item {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 10px 14px !important;
  color: #1e293b !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  border-radius: 8px !important;
  transition: all 0.15s ease !important;
}

.dropdown-menu-action .dropdown-item i {
  width: 18px !important;
  text-align: center !important;
  font-size: 14px !important;
}

.dropdown-menu-action .dropdown-item:hover {
  background: #f1f5f9 !important;
  color: #4f46e5 !important;
  transform: translateX(4px) !important;
}

/* Item Modifier */
.dropdown-menu-action .dropdown-item-edit:hover {
  background: #dbeafe !important;
  color: #2563eb !important;
}

.dropdown-menu-action .dropdown-item-edit i {
  color: #3b82f6 !important;
}

/* Item Supprimer */
.dropdown-menu-action .dropdown-item-delete {
  color: #ef4444 !important;
}

.dropdown-menu-action .dropdown-item-delete:hover {
  background: #fee2e2 !important;
  color: #dc2626 !important;
  transform: translateX(4px) !important;
}

.dropdown-menu-action .dropdown-item-delete i {
  color: #ef4444 !important;
}

/* Item Voir/Détails */
.dropdown-menu-action .dropdown-item-view:hover {
  background: #d1fae5 !important;
  color: #059669 !important;
}

.dropdown-menu-action .dropdown-item-view i {
  color: #10b981 !important;
}

/* Item Imprimer */
.dropdown-menu-action .dropdown-item-print:hover {
  background: #fef3c7 !important;
  color: #d97706 !important;
}

.dropdown-menu-action .dropdown-item-print i {
  color: #f59e0b !important;
}

/* Divider dans menu action */
.dropdown-menu-action .dropdown-divider {
  margin: 6px 8px !important;
  border-top: 1px solid #e2e8f0 !important;
}

/* Pagination styling */
.pagination {
  gap: 0.25rem;
}

.page-link {
  border: none !important;
  border-radius: var(--border-radius) !important;
  color: var(--text-secondary);
  padding: 0.5rem 0.875rem;
  transition: all var(--transition-fast);
}

.page-link:hover {
  background: var(--primary-light);
  color: var(--primary-color);
}

.page-item.active .page-link {
  background: var(--primary-gradient);
  color: var(--text-light);
}

.page-item.disabled .page-link {
  background: var(--secondary-light);
  color: var(--text-muted);
}

/* Progress bars */
.progress {
  border-radius: var(--border-radius-full);
  height: 8px;
  background: var(--secondary-light);
  overflow: hidden;
}

.progress-bar {
  background: var(--primary-gradient);
  border-radius: var(--border-radius-full);
  transition: width 0.6s ease;
}

/* Info boxes / Stat cards */
.info-box {
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow);
  min-height: auto;
  padding: 1rem;
}

.info-box .info-box-icon {
  border-radius: var(--border-radius);
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.info-box .info-box-content {
  padding: 0.5rem 0.5rem 0.5rem 1rem;
}

.info-box .info-box-text {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.info-box .info-box-number {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Small boxes */
.small-box {
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.small-box > .inner {
  padding: 1.25rem;
}

.small-box h3 {
  font-size: 2rem;
  font-weight: 700;
}

.small-box .icon {
  opacity: 0.2;
}

.small-box .small-box-footer {
  padding: 0.75rem 1rem;
  font-size: 0.8125rem;
}

/* Summernote editor */
.note-editor.note-frame {
  border: 2px solid var(--border-color) !important;
  border-radius: var(--border-radius-lg) !important;
  overflow: hidden;
}

.note-toolbar {
  background: var(--bg-primary) !important;
  border-bottom: 1px solid var(--border-color) !important;
  padding: 0.5rem !important;
}

.note-btn {
  border-radius: var(--border-radius-sm) !important;
}

/* Loading overlay */
.overlay {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(4px);
}

.overlay i {
  color: var(--primary-color);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state h4 {
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

/* Callout boxes */
.callout {
  border-radius: var(--border-radius);
  border-left-width: 4px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

.callout.callout-info {
  background: var(--info-light);
  border-color: var(--info-color);
}

.callout.callout-warning {
  background: var(--warning-light);
  border-color: var(--warning-color);
}

.callout.callout-danger {
  background: var(--danger-light);
  border-color: var(--danger-color);
}

.callout.callout-success {
  background: var(--success-light);
  border-color: var(--success-color);
}

/* Timeline */
.timeline {
  position: relative;
  padding-left: 2rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0.5rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border-color);
}

.timeline-item {
  position: relative;
  padding-bottom: 1.5rem;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.625rem;
  top: 0.25rem;
  width: 12px;
  height: 12px;
  background: var(--primary-color);
  border-radius: 50%;
  border: 2px solid var(--bg-secondary);
}

/* Invoice / Print styles */
.invoice {
  background: var(--bg-secondary);
  border-radius: var(--border-radius-lg);
  padding: 2rem;
}

.invoice-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.invoice-details {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* Quick actions floating button */
.quick-actions {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1000;
}

.quick-actions .btn {
  width: 56px;
  height: 56px;
  border-radius: 50% !important;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.quick-actions .btn i {
  font-size: 1.25rem;
}

/* File upload zone */
.upload-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 2rem;
  text-align: center;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--primary-color);
  background: var(--primary-light);
}

.upload-zone i {
  font-size: 3rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

/* Custom checkbox and radio */
.custom-control-input:checked ~ .custom-control-label::before {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

.custom-control-input:focus ~ .custom-control-label::before {
  box-shadow: 0 0 0 0.2rem rgba(79, 70, 229, 0.25);
}

/* Responsive tweaks for specific elements */
@media (max-width: 767.98px) {
  .survey-item {
    margin-bottom: 1rem;
  }
  
  .info-box .info-box-icon {
    width: 50px;
    height: 50px;
  }
  
  .small-box h3 {
    font-size: 1.5rem;
  }
  
  .invoice {
    padding: 1rem;
  }
}

/* ==========================================================================
   CORRECTIONS CRITIQUES - Dropdowns et Z-Index
   ========================================================================== */

/* Force z-index pour tous les menus déroulants */
.dropdown {
  position: relative;
}

.dropdown-menu.show {
  z-index: 9999 !important;
  display: block !important;
}

/* Correction pour les boutons Action dans les tableaux */
.table td .dropdown-menu,
.table td .dropdown-menu.show,
.dataTables_wrapper .dropdown-menu,
.card-body .dropdown-menu,
td .dropdown-menu {
  z-index: 9999 !important;
  position: absolute !important;
  background: #ffffff !important;
  border: 1px solid var(--border-color) !important;
  box-shadow: var(--shadow-xl) !important;
}

/* Fixer le conteneur de table pour permettre overflow */
.table-responsive {
  overflow: visible !important;
}

.card-body {
  overflow: visible !important;
}

.dataTables_wrapper {
  overflow: visible !important;
}

/* DataTables - permettre le débordement des menus */
table.dataTable {
  overflow: visible !important;
}

table.dataTable tbody {
  overflow: visible !important;
}

table.dataTable tbody tr {
  overflow: visible !important;
}

table.dataTable tbody td {
  overflow: visible !important;
}

/* ==========================================================================
   CORRECTIONS DE CONTRASTE - Couleurs de texte
   ========================================================================== */

/* Améliorer le contraste des labels dans les formulaires */
label,
.control-label,
.form-group label {
  color: var(--text-primary) !important;
  font-weight: 500;
}

/* Texte dans les inputs */
.form-control,
input.form-control,
textarea.form-control,
select.form-control {
  color: var(--text-primary) !important;
}

/* Texte dans les cards et tableaux */
.card-title,
.card-header .card-title {
  color: var(--text-primary) !important;
}

/* Texte dans les tableaux */
.table td,
.table th,
.table tbody td,
.table thead th {
  color: var(--text-primary) !important;
}

/* Liens dans les tableaux */
.table a {
  color: var(--primary-color) !important;
}

.table a:hover {
  color: var(--primary-hover) !important;
}

/* Correction DataTables info et filtres */
.dataTables_info,
.dataTables_length label,
.dataTables_filter label {
  color: var(--text-primary) !important;
}

/* Select et input dans DataTables */
.dataTables_length select,
.dataTables_filter input {
  color: var(--text-primary) !important;
  background: var(--bg-secondary) !important;
}

/* Pagination */
.paginate_button {
  color: var(--text-primary) !important;
}

/* Boutons dropdown dans les tableaux */
.btn-group .dropdown-toggle,
.table .btn {
  z-index: auto !important;
}

/* Dropdown items */
.dropdown-menu .dropdown-item {
  color: var(--text-primary) !important;
}

.dropdown-menu .dropdown-item:hover {
  background: var(--primary-light) !important;
  color: var(--primary-color) !important;
}

/* ==========================================================================
   CORRECTIONS SIDEBAR - Icônes et textes visibles
   ========================================================================== */

/* Tous les icônes dans le sidebar doivent être visibles */
.main-sidebar .nav-icon {
  opacity: 1 !important;
}

/* Cercles/points colorés dans le sidebar */
.nav-treeview .nav-icon.fa-circle {
  font-size: 0.5rem !important;
}

/* Labels du menu principal */
.nav-sidebar > .nav-item > .nav-link > p {
  color: rgba(255, 255, 255, 0.9) !important;
}

/* Texte du sous-menu visible */
.nav-treeview .nav-item .nav-link p {
  color: rgba(255, 255, 255, 0.85) !important;
}

.nav-treeview .nav-item .nav-link:hover p {
  color: #ffffff !important;
}

/* ==========================================================================
   CORRECTIONS FORMULAIRES
   ========================================================================== */

/* Placeholder visible */
.form-control::placeholder {
  color: var(--text-muted) !important;
  opacity: 1;
}

/* Select2 texte visible */
.select2-container--default .select2-selection--single .select2-selection__rendered {
  color: var(--text-primary) !important;
}

.select2-results__option {
  color: var(--text-primary) !important;
}

/* Input group addon */
.input-group-text {
  color: var(--text-primary) !important;
  background: var(--bg-primary) !important;
}

/* ==========================================================================
   CORRECTIONS MODALS
   ========================================================================== */

/* Modal header et body texte */
.modal-title {
  color: var(--text-primary) !important;
}

.modal-body {
  color: var(--text-primary) !important;
}

.modal-body label {
  color: var(--text-primary) !important;
}

/* ==========================================================================
   CORRECTIONS ALERTS ET BADGES
   ========================================================================== */

/* Badges avec bon contraste */
.badge-primary,
.bg-primary {
  color: #ffffff !important;
}

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

.badge-warning,
.bg-warning {
  color: #1e293b !important;
}

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

.badge-info,
.bg-info {
  color: #ffffff !important;
}

.badge-secondary,
.bg-secondary {
  color: #ffffff !important;
}

/* ==========================================================================
   FIX POUR LE BOUTON ACTION SPECIFIQUEMENT
   ========================================================================== */

/* Style spécifique pour les boutons "Action" avec dropdown */
.btn-group {
  position: relative;
}

.btn-group > .dropdown-menu {
  z-index: 9999 !important;
}

/* Quand le dropdown est ouvert */
.btn-group.show > .dropdown-menu,
.dropdown.show > .dropdown-menu {
  z-index: 9999 !important;
  display: block;
}

/* Assurer que le parent ne coupe pas le dropdown */
tr, td, th {
  position: relative;
}

/* Fix spécifique AdminLTE */
.content-wrapper {
  overflow: visible !important;
}

.content {
  overflow: visible !important;
}

.container-fluid {
  overflow: visible !important;
}

.row {
  overflow: visible !important;
}

.col-lg-12, .col-md-12, .col-sm-12, .col-12,
[class*="col-"] {
  overflow: visible !important;
}

/* Card ne doit pas couper le dropdown */
.card {
  overflow: visible !important;
}

.card-body {
  overflow: visible !important;
}

/* ==========================================================================
   CORRECTIONS TABLEAU - TEXTE BIEN VISIBLE
   ========================================================================== */

/* Forcer le texte foncé dans toutes les cellules du tableau */
.table td,
.table th,
.table tbody td,
.table tbody th,
.table thead td,
.table thead th,
table td,
table th,
table tbody td,
table tbody th {
  color: #1e293b !important;
}

/* Texte en gras dans les cellules */
.table td b,
.table td strong,
.table th b,
.table th strong,
table td b,
table td strong {
  color: #1e293b !important;
  font-weight: 600;
}

/* Liens dans les cellules */
.table td a,
.table th a,
table td a {
  color: #4f46e5 !important;
}

.table td a:hover,
table td a:hover {
  color: #4338ca !important;
  text-decoration: underline;
}

/* Bouton Action dans le tableau */
.table .btn-default,
.table .btn-secondary,
table .btn-default,
td .btn-default {
  background: #f8fafc !important;
  color: #1e293b !important;
  border: 1px solid #e2e8f0 !important;
  font-weight: 500;
  padding: 0.375rem 0.75rem;
  border-radius: 0.375rem;
}

.table .btn-default:hover,
.table .btn-secondary:hover,
table .btn-default:hover,
td .btn-default:hover {
  background: #eef2ff !important;
  color: #4f46e5 !important;
  border-color: #4f46e5 !important;
}

/* Dropdown toggle avec la flèche */
.table .dropdown-toggle::after,
td .dropdown-toggle::after {
  margin-left: 0.5rem;
  color: inherit;
}

/* Menu dropdown dans le tableau */
.table .dropdown-menu,
td .dropdown-menu {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15) !important;
  border-radius: 0.5rem !important;
  padding: 0.5rem !important;
  min-width: 140px;
  z-index: 99999 !important;
}

/* Items du dropdown */
.table .dropdown-item,
td .dropdown-item,
.dropdown-menu .dropdown-item {
  color: #1e293b !important;
  padding: 0.5rem 1rem !important;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  transition: all 0.15s ease;
}

.table .dropdown-item:hover,
td .dropdown-item:hover,
.dropdown-menu .dropdown-item:hover {
  background: #eef2ff !important;
  color: #4f46e5 !important;
}

/* Supprimer en rouge */
.table .dropdown-item.delete_categories_depenses,
.table .dropdown-item[class*="delete"],
td .dropdown-item[class*="delete"],
.dropdown-item.text-danger {
  color: #ef4444 !important;
}

.table .dropdown-item.delete_categories_depenses:hover,
.table .dropdown-item[class*="delete"]:hover,
td .dropdown-item[class*="delete"]:hover {
  background: #fee2e2 !important;
  color: #dc2626 !important;
}

/* Divider dans le dropdown */
.table .dropdown-divider,
td .dropdown-divider,
.dropdown-menu .dropdown-divider {
  border-color: #e2e8f0 !important;
  margin: 0.25rem 0 !important;
}

/* Header du tableau sombre */
.table thead.btn-dark th,
.table thead.bg-dark th,
thead.btn-dark th,
thead.bg-dark th {
  background: #1e293b !important;
  color: #ffffff !important;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  padding: 1rem !important;
  border: none !important;
}

/* Numérotation des lignes */
.table tbody th.text-center,
table tbody th.text-center {
  color: #64748b !important;
  font-weight: 600;
  background: #f8fafc;
}

/* Lignes alternées */
.table-bordered tbody tr:nth-child(even) {
  background: #f8fafc;
}

.table-bordered tbody tr:hover {
  background: #eef2ff !important;
}

/* Bordures du tableau */
.table-bordered,
.table-bordered td,
.table-bordered th {
  border-color: #e2e8f0 !important;
}

/* ==========================================================================
   CORRECTIONS INPUT ET SELECT DANS DATATABLES
   ========================================================================== */

/* Afficher X entrées */
.dataTables_length label {
  color: #1e293b !important;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dataTables_length select {
  color: #1e293b !important;
  background: #ffffff !important;
  border: 2px solid #e2e8f0 !important;
  border-radius: 0.375rem !important;
  padding: 0.375rem 0.75rem !important;
  min-width: 80px;
}

/* Recherche */
.dataTables_filter label {
  color: #1e293b !important;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 11px !important;
}

.dataTables_filter input {
  color: #1e293b !important;
  background: #ffffff !important;
  border: 2px solid #e2e8f0 !important;
  border-radius: 0.375rem !important;
  padding: 0.35rem 0.5rem !important;
  min-width: 100px !important;
  max-width: 120px !important;
  font-size: 11px !important;
}

.dataTables_filter input:focus {
  border-color: #4f46e5 !important;
  outline: none;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Info en bas du tableau */
.dataTables_info {
  color: #64748b !important;
  font-size: 0.75rem;
}

/* Pagination */
.dataTables_paginate .paginate_button {
  color: #1e293b !important;
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 0.375rem !important;
  padding: 0.375rem 0.75rem !important;
  margin: 0 0.125rem;
}

.dataTables_paginate .paginate_button:hover {
  background: #eef2ff !important;
  color: #4f46e5 !important;
  border-color: #4f46e5 !important;
}

.dataTables_paginate .paginate_button.current {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  color: #ffffff !important;
  border: none !important;
}

/* ==========================================================================
   FIX DROPDOWN STABILITÉ - EMPÊCHER FERMETURE RAPIDE
   ========================================================================== */

/* Dropdown container */
.dropdown {
  position: relative !important;
  display: inline-block;
  z-index: 100;
}

/* Menu dropdown - état par défaut */
.dropdown-menu {
  display: none;
  position: absolute !important;
  z-index: 999999 !important;
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 0.5rem !important;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2) !important;
  padding: 0.5rem !important;
  min-width: 160px;
  margin-top: 2px;
  top: 100% !important;
  right: 0 !important;
  left: auto !important;
}

/* Menu dropdown - état ouvert */
.dropdown-menu.show,
.dropdown.show > .dropdown-menu,
.show > .dropdown-menu,
.dropdown-menu[style*="display: block"] {
  display: block !important;
  z-index: 999999 !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: all !important;
}

/* Garder le menu visible au survol */
.dropdown:hover > .dropdown-menu,
.dropdown-menu:hover {
  display: block;
}

/* Items du dropdown avec zone de clic plus grande */
.dropdown-menu .dropdown-item {
  display: block !important;
  width: 100% !important;
  padding: 0.625rem 1rem !important;
  color: #1e293b !important;
  background: transparent;
  border: none;
  border-radius: 0.375rem;
  text-decoration: none;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.dropdown-menu .dropdown-item:hover,
.dropdown-menu .dropdown-item:focus {
  background: #eef2ff !important;
  color: #4f46e5 !important;
  outline: none;
}

.dropdown-menu .dropdown-item:active {
  background: #4f46e5 !important;
  color: #ffffff !important;
}

/* Item Supprimer en rouge */
.dropdown-item.delete_categories_depenses,
.dropdown-item.delete_user,
.dropdown-item.delete_client,
.dropdown-item.delete_voyage,
.dropdown-item.delete_depenses,
.dropdown-item[class*="delete"] {
  color: #ef4444 !important;
}

.dropdown-item.delete_categories_depenses:hover,
.dropdown-item.delete_user:hover,
.dropdown-item.delete_client:hover,
.dropdown-item.delete_voyage:hover,
.dropdown-item.delete_depenses:hover,
.dropdown-item[class*="delete"]:hover {
  background: #fee2e2 !important;
  color: #dc2626 !important;
}

/* Divider */
.dropdown-menu .dropdown-divider {
  height: 1px;
  margin: 0.375rem 0;
  background: #e2e8f0;
  border: none;
}

/* Bouton toggle du dropdown */
.dropdown-toggle {
  cursor: pointer;
}

.dropdown-toggle::after {
  display: inline-block;
  margin-left: 0.5rem;
  vertical-align: middle;
  content: "";
  border-top: 0.3em solid;
  border-right: 0.3em solid transparent;
  border-bottom: 0;
  border-left: 0.3em solid transparent;
}

/* Empêcher le texte de sélection pendant le clic */
.dropdown-toggle,
.dropdown-item {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
}

/* Fix pour les tableaux - empêcher le clipping */
table {
  overflow: visible !important;
}

table tbody tr {
  position: relative;
  z-index: 1;
}

/* Quand dropdown est ouvert, la ligne doit avoir un z-index plus élevé */
table tbody tr:has(.dropdown.show),
table tbody tr:has(.dropdown-menu.show) {
  z-index: 9999 !important;
}

table tbody td {
  position: relative;
  overflow: visible !important;
}

/* Cellule contenant le dropdown doit avoir z-index élevé */
table tbody td .dropdown {
  position: relative;
  z-index: 100;
}

table tbody td .dropdown.show {
  z-index: 99999 !important;
}

/* Animation d'ouverture du menu */
@keyframes dropdownOpen {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dropdown-menu.show {
  animation: dropdownOpen 0.15s ease forwards;
}

/* ==========================================================================
   FIX FORCE DROPDOWN AU PREMIER PLAN
   ========================================================================== */

/* Force TOUS les dropdowns au premier plan */
.dropdown-menu[x-placement],
.dropdown-menu[data-popper-placement],
.dropdown-menu.show {
  z-index: 999999 !important;
  position: absolute !important;
  transform: none !important;
  top: 100% !important;
  left: auto !important;
  right: 0 !important;
}

/* Conteneurs parents - empêcher le masquage */
.table-responsive,
.dataTables_wrapper,
.card-body,
.card,
.content-wrapper,
.content {
  overflow: visible !important;
}

/* Assurer que le dropdown reste visible */
.dropdown.show {
  z-index: 99999 !important;
  position: relative !important;
}

/* Menu ouvert - forcer l'affichage */
.dropdown.show > .dropdown-menu {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  z-index: 999999 !important;
}

/* Supprimer tout transform qui pourrait créer un stacking context */
.table-responsive {
  transform: none !important;
  will-change: unset !important;
}

/* DataTables wrapper */
div.dataTables_wrapper {
  position: relative;
  overflow: visible !important;
}

/* Fix pour card avec overflow */
.card {
  overflow: visible !important;
}

.card-body {
  overflow: visible !important;
}

/* Ligne du tableau avec dropdown ouvert */
tr:focus-within,
tr:has(.show) {
  z-index: 9999 !important;
  position: relative !important;
}
/* ==========================================================================
   FIX GLOBAL CONTRASTE DE TEXTE - VISIBILITÉ GARANTIE
   ========================================================================== */

/* Forcer le texte sombre sur fond clair partout */
body,
.wrapper,
.content-wrapper,
.content,
.container,
.container-fluid,
.row,
.col,
[class*="col-"] {
  color: #1e293b !important;
}

/* Tables - texte toujours visible */
.table,
.table th,
.table td,
.table tr,
.table thead th,
.table tbody td,
.table-striped tbody tr td,
.table-striped tbody tr:nth-of-type(odd) td,
.table-striped tbody tr:nth-of-type(even) td,
.table-bordered td,
.table-bordered th,
.table-hover tbody tr td {
  color: #1e293b !important;
  background-color: #ffffff !important;
}

/* Lignes alternées avec bon contraste */
.table-striped tbody tr:nth-of-type(odd) {
  background-color: #f8fafc !important;
}

.table-striped tbody tr:nth-of-type(odd) td {
  background-color: transparent !important;
  color: #1e293b !important;
}

.table-striped tbody tr:nth-of-type(even) {
  background-color: #ffffff !important;
}

.table-striped tbody tr:nth-of-type(even) td {
  background-color: transparent !important;
  color: #1e293b !important;
}

/* Hover sur les lignes */
.table tbody tr:hover,
.table-striped tbody tr:hover,
.table-hover tbody tr:hover {
  background-color: #eef2ff !important;
}

.table tbody tr:hover td,
.table-striped tbody tr:hover td,
.table-hover tbody tr:hover td {
  background-color: transparent !important;
  color: #1e293b !important;
}

/* Headers de table */
.table thead th,
.table > thead > tr > th {
  background-color: #f1f5f9 !important;
  color: #1e293b !important;
  font-weight: 600 !important;
  border-bottom: 2px solid #e2e8f0 !important;
}

/* Cards */
.card,
.card-body,
.card-header,
.card-footer,
.card-title,
.card-text {
  background-color: #ffffff !important;
  color: #1e293b !important;
}

.card-header {
  background-color: #f8fafc !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

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

/* Card outline - garder les bordures colorées */
.card.card-primary,
.card.card-outline.card-primary {
  border-top: 3px solid #4f46e5 !important;
}

.card.card-success,
.card.card-outline.card-success {
  border-top: 3px solid #10b981 !important;
}

.card.card-warning,
.card.card-outline.card-warning {
  border-top: 3px solid #f59e0b !important;
}

.card.card-danger,
.card.card-outline.card-danger {
  border-top: 3px solid #ef4444 !important;
}

.card.card-info,
.card.card-outline.card-info {
  border-top: 3px solid #3b82f6 !important;
}

/* Texte dans les cards */
.card td,
.card th,
.card p,
.card span,
.card label,
.card div,
.card a:not(.btn) {
  color: #1e293b !important;
}

/* Text-right et autres alignements */
.text-right,
.text-left,
.text-center {
  color: #1e293b !important;
}

/* Classes de texte spécifiques - garder les couleurs */
.text-danger {
  color: #ef4444 !important;
}

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

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

.text-info {
  color: #3b82f6 !important;
}

.text-primary {
  color: #4f46e5 !important;
}

.text-secondary {
  color: #64748b !important;
}

.text-muted {
  color: #64748b !important;
}

/* Labels et inputs */
label,
.form-label,
.control-label {
  color: #1e293b !important;
  font-weight: 500 !important;
}

.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
textarea,
select {
  color: #1e293b !important;
  background-color: #ffffff !important;
}

.form-control::placeholder,
input::placeholder,
textarea::placeholder {
  color: #94a3b8 !important;
}

/* Select2 */
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
  background-color: #ffffff !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
  color: #1e293b !important;
}

.select2-results__option {
  color: #1e293b !important;
  background-color: #ffffff !important;
}

.select2-results__option--highlighted {
  background-color: #4f46e5 !important;
  color: #ffffff !important;
}

/* DataTables */
.dataTables_wrapper,
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
  color: #1e293b !important;
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  color: #1e293b !important;
  background-color: #ffffff !important;
}

/* Pagination DataTables */
.dataTables_wrapper .dataTables_paginate .paginate_button {
  color: #1e293b !important;
  background-color: #ffffff !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  color: #4f46e5 !important;
  background-color: #eef2ff !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  color: #ffffff !important;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
}

/* Modals */
.modal-content,
.modal-header,
.modal-body,
.modal-footer {
  background-color: #ffffff !important;
  color: #1e293b !important;
}

.modal-title {
  color: #1e293b !important;
}

.modal-body p,
.modal-body span,
.modal-body div,
.modal-body label {
  color: #1e293b !important;
}

/* Alertes et badges */
.alert {
  color: #1e293b !important;
}

.alert-primary {
  background-color: #eef2ff !important;
  border-color: #c7d2fe !important;
  color: #4338ca !important;
}

.alert-success {
  background-color: #d1fae5 !important;
  border-color: #a7f3d0 !important;
  color: #065f46 !important;
}

.alert-warning {
  background-color: #fef3c7 !important;
  border-color: #fde68a !important;
  color: #92400e !important;
}

.alert-danger {
  background-color: #fee2e2 !important;
  border-color: #fecaca !important;
  color: #991b1b !important;
}

.alert-info {
  background-color: #dbeafe !important;
  border-color: #bfdbfe !important;
  color: #1e40af !important;
}

/* Badges */
.badge-primary,
.bg-primary {
  background-color: #4f46e5 !important;
  color: #ffffff !important;
}

.badge-success,
.bg-success {
  background-color: #10b981 !important;
  color: #ffffff !important;
}

.badge-warning,
.bg-warning {
  background-color: #f59e0b !important;
  color: #ffffff !important;
}

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

.badge-info,
.bg-info {
  background-color: #3b82f6 !important;
  color: #ffffff !important;
}

.badge-secondary,
.bg-secondary {
  background-color: #64748b !important;
  color: #ffffff !important;
}

/* Info-box et small-box */
.info-box,
.small-box {
  background-color: #ffffff !important;
}

.info-box-content,
.info-box-text,
.info-box-number {
  color: #1e293b !important;
}

.small-box h3,
.small-box p {
  color: #ffffff !important;
}

/* Content header */
.content-header,
.content-header h1,
.content-header .breadcrumb {
  color: #1e293b !important;
}

.breadcrumb-item,
.breadcrumb-item a {
  color: #64748b !important;
}

.breadcrumb-item.active {
  color: #1e293b !important;
}

/* Topbar / Navbar */
.main-header.navbar-white .nav-link {
  color: #1e293b !important;
}

/* Liste groupe */
.list-group-item {
  background-color: #ffffff !important;
  color: #1e293b !important;
  border-color: #e2e8f0 !important;
}

.list-group-item:hover {
  background-color: #f8fafc !important;
}

/* Tabs */
.nav-tabs .nav-link {
  color: #64748b !important;
}

.nav-tabs .nav-link.active {
  color: #4f46e5 !important;
  background-color: #ffffff !important;
}

/* Pills */
.nav-pills .nav-link {
  color: #64748b !important;
}

.nav-pills .nav-link.active {
  color: #ffffff !important;
  background-color: #4f46e5 !important;
}

/* Progress bars */
.progress {
  background-color: #e2e8f0 !important;
}

/* Dropdown dans les tables */
.dropdown-menu {
  background-color: #ffffff !important;
}

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

.dropdown-item:hover {
  background-color: #f8fafc !important;
  color: #4f46e5 !important;
}

/* Texte bold */
b, strong {
  color: inherit !important;
  font-weight: 600 !important;
}

/* Liens dans les cellules */
td a:not(.btn),
th a:not(.btn) {
  color: #4f46e5 !important;
}

td a:not(.btn):hover,
th a:not(.btn):hover {
  color: #4338ca !important;
  text-decoration: underline !important;
}

/* Fix pour container dans card */
.card .container,
.card-body .container {
  background-color: transparent !important;
}

/* Table dans les cards */
.card .table,
.card-body .table {
  background-color: #ffffff !important;
}

.card .table td,
.card .table th,
.card-body .table td,
.card-body .table th {
  color: #1e293b !important;
}

/* Montants et nombres */
.text-right,
td.text-right,
th.text-right {
  color: #1e293b !important;
}

/* Spécifique - assurer que tous les éléments de texte sont visibles */
td *,
th * {
  color: inherit;
}

/* Forcer couleur sur les td sans classe */
table tr td {
  color: #1e293b !important;
}

/* Fix pour les cartes de la page home */
.survey-item .card,
.survey-item .card-body,
.survey-item .table,
.survey-item .table td,
.survey-item .table tr {
  background-color: #ffffff !important;
  color: #1e293b !important;
}

.survey-item .card-header {
  background-color: #f8fafc !important;
  color: #1e293b !important;
}

.survey-item .card-title {
  color: #1e293b !important;
}

/* Conteneur mt-1 dans les cards */
.container.mt-1,
.container.mt-1 .table,
.container.mt-1 .table td {
  background-color: transparent !important;
  color: #1e293b !important;
}

/* ==========================================================================
   DÉSACTIVATION DES ANIMATIONS DÉRANGEANTES
   ========================================================================== */

/* Désactiver toutes les transitions/animations sur les tableaux */
.table,
.table *,
.table tbody,
.table tbody tr,
.table tbody td,
.table thead,
.table thead th,
.dataTable,
.dataTable *,
.dataTables_wrapper * {
  transition: none !important;
  animation: none !important;
  transform: none !important;
}

/* Exceptions - garder uniquement pour les dropdowns */
.dropdown-menu,
.dropdown-menu.show {
  transition: opacity 0.1s ease !important;
}

/* Désactiver les effets 3D et de mouvement */
.card {
  transform: none !important;
  transition: box-shadow 0.2s ease !important;
}

.card:hover {
  transform: none !important;
}

/* ==========================================================================
   COULEURS DE FOND STABLES POUR LES TABLEAUX
   ========================================================================== */

/* Fond par défaut des tableaux - BLANC */
.table {
  background-color: #ffffff !important;
}

.table thead {
  background-color: #f1f5f9 !important;
}

.table thead th {
  background-color: #f1f5f9 !important;
  color: #1e293b !important;
  border-bottom: 2px solid #e2e8f0 !important;
}

.table tbody tr {
  background-color: #ffffff !important;
}

.table tbody tr:nth-child(odd) {
  background-color: #f8fafc !important;
}

.table tbody tr:nth-child(even) {
  background-color: #ffffff !important;
}

/* Survol simple - changement de couleur sans animation */
.table tbody tr:hover,
.table tbody tr:nth-child(odd):hover,
.table tbody tr:nth-child(even):hover {
  background-color: #e2e8f0 !important;
}

/* Texte toujours visible - NOIR/GRIS FONCÉ */
.table tbody td,
.table tbody th {
  color: #1e293b !important;
}

.table tbody td *,
.table tbody th * {
  color: #1e293b !important;
}

/* DataTables spécifique */
table.dataTable tbody tr {
  background-color: #ffffff !important;
}

table.dataTable tbody tr:nth-child(odd) {
  background-color: #f8fafc !important;
}

table.dataTable tbody tr:hover {
  background-color: #e2e8f0 !important;
}

table.dataTable tbody td {
  color: #1e293b !important;
}

/* Cards de la page Home avec tableaux */
.card .table-responsive,
.card-body .table-responsive {
  background-color: #ffffff !important;
}

/* Fix global - tous les textes dans les tableaux */
td, th, tr, table {
  color: #1e293b !important;
}

/* ==========================================================================
   FIX INPUTS ET TEXTES DANS LES TABLEAUX - VISIBILITÉ GARANTIE
   ========================================================================== */

/* Inputs dans les tableaux */
table input,
table input[type="text"],
table input[type="number"],
table input[type="email"],
table input[type="tel"],
table input[type="date"],
table textarea,
table select,
.table input,
.table input[type="text"],
.table input[type="number"],
.table textarea,
.table select,
#list input,
#list input[type="text"],
#list input[type="number"],
#list textarea,
#list select {
  color: #1e293b !important;
  background-color: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 0.25rem;
  padding: 0.25rem 0.5rem;
}

/* Focus sur les inputs dans les tableaux */
table input:focus,
table select:focus,
table textarea:focus,
#list input:focus,
#list select:focus {
  border-color: #4f46e5 !important;
  outline: none;
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}

/* Paragraphes dans les tableaux */
table p,
table span,
table b,
table strong,
table label,
.table p,
.table span,
.table b,
.table strong,
#list p,
#list span,
#list b,
#list strong,
#list .pname,
#list .pname b,
#list .amount,
#list .price,
#list .poids {
  color: #1e293b !important;
}

/* Classes spécifiques de valeurs */
.text-right,
.text-center,
.text-left,
.tamount,
.total_poids {
  color: #1e293b !important;
}

/* Item row - ligne d'article */
.item-row td,
.item-row input,
.item-row p,
.item-row b,
.item-row span,
tr.item-row td,
tr.item-row input,
tr.item-row p,
tr.item-row b {
  color: #1e293b !important;
}

/* Fond blanc pour les cellules de tableau avec inputs */
table td,
.table td,
#list td {
  background-color: #ffffff !important;
}

/* Tableau #list spécifique (receptions_colis) */
#list,
#list tbody,
#list tbody tr,
#list tbody tr td {
  background-color: #ffffff !important;
  color: #1e293b !important;
}

#list tfoot,
#list tfoot tr,
#list tfoot th {
  background-color: #f8fafc !important;
  color: #1e293b !important;
}

#list tfoot .tamount,
#list tfoot .total_poids {
  color: #1e293b !important;
  font-weight: bold;
}

/* Text danger doit rester rouge */
.text-danger,
input.text-danger,
p.text-danger,
span.text-danger {
  color: #dc2626 !important;
}

/* Text primary doit rester bleu */
.text-primary,
input.text-primary,
p.text-primary,
span.text-primary,
.total_poids.text-primary {
  color: #4f46e5 !important;
}

/* Text success doit rester vert */
.text-success,
input.text-success,
p.text-success {
  color: #16a34a !important;
}

/* Text warning doit rester orange */
.text-warning,
input.text-warning,
p.text-warning {
  color: #d97706 !important;
}

/* Inputs readonly */
input[readonly],
input:read-only {
  background-color: #f1f5f9 !important;
  color: #1e293b !important;
}

/* Select2 dans les tableaux */
table .select2-container,
table .select2-selection,
table .select2-selection__rendered {
  color: #1e293b !important;
  background-color: #ffffff !important;
}

/* Montants et totaux */
.amount,
.tamount,
.total_poids,
tfoot th,
tfoot td {
  color: #1e293b !important;
  font-weight: 600;
}

/* ==========================================================================
   FIX ULTIME - VISIBILITÉ GARANTIE PARTOUT
   ========================================================================== */

/* Table striped - lignes alternées avec fond BLANC */
.table-striped tbody tr:nth-of-type(odd),
.table-striped > tbody > tr:nth-of-type(odd),
table.table-striped tbody tr:nth-of-type(odd) {
  background-color: #f8fafc !important;
}

.table-striped tbody tr:nth-of-type(even),
.table-striped > tbody > tr:nth-of-type(even),
table.table-striped tbody tr:nth-of-type(even) {
  background-color: #ffffff !important;
}

/* TOUS les textes dans les tableaux - NOIR */
.table-striped td,
.table-striped th,
.table-striped tr td,
.table-striped tr th,
.table-striped tbody td,
.table-striped tbody th {
  color: #1e293b !important;
}

/* Cards page home - tableaux dans les cards */
.card .table-striped td,
.card .table-striped tr,
.card-body .table-striped td,
.card-body .table-striped tr,
.survey-item .table-striped td,
.survey-item .table-striped tr {
  background-color: #ffffff !important;
  color: #1e293b !important;
}

/* Container dans card */
.card .container .table td,
.card .container .table tr,
.card-body .container .table td,
.card-body .container .table tr {
  background-color: #ffffff !important;
  color: #1e293b !important;
}

/* Survol des lignes dans les cards */
.card .table tr:hover td,
.card-body .table tr:hover td,
.survey-item .table tr:hover td {
  background-color: #e2e8f0 !important;
  color: #1e293b !important;
}

/* Forcer couleur texte sur TOUT */
.card td,
.card th,
.card tr,
.card-body td,
.card-body th,
.card-body tr,
.container td,
.container th,
.container tr,
div td,
div th,
div tr {
  color: #1e293b !important;
}

/* Tableaux sans DataTables (simples) */
table:not(.dataTable) td,
table:not(.dataTable) th,
table:not(.dataTable) tr {
  color: #1e293b !important;
}

table:not(.dataTable) tbody tr {
  background-color: #ffffff !important;
}

table:not(.dataTable) tbody tr:nth-child(odd) {
  background-color: #f8fafc !important;
}

/* Fix pour les lignes invisibles */
tr[style],
td[style],
tr[style] td,
td[style] * {
  color: #1e293b !important;
}

/* Fix formulaires dans les cards vertes/colorées */
.btn-success,
.bg-success,
.bg-primary,
.bg-info,
.bg-warning,
.bg-danger {
  color: #ffffff !important;
}

.btn-success input,
.btn-success select,
.btn-success .select2-selection,
.bg-success input,
.bg-success select {
  color: #1e293b !important;
  background-color: #ffffff !important;
}

/* Labels sur fond coloré */
.btn-success label,
.bg-success label,
.row.btn-success label {
  color: #ffffff !important;
}

/* Select2 sur fond coloré - texte dans le dropdown */
.btn-success .select2-selection__rendered,
.bg-success .select2-selection__rendered,
.row.btn-success .select2-selection__rendered {
  color: #1e293b !important;
}

/* Reset complet pour la table #list */
#list,
#list *,
#list tbody,
#list tbody tr,
#list tbody td,
#list tfoot,
#list tfoot tr,
#list tfoot th {
  color: #1e293b !important;
}

#list tbody tr {
  background-color: #ffffff !important;
}

#list input {
  color: #1e293b !important;
  background-color: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
}

#list p,
#list b,
#list span,
#list .pname,
#list .amount {
  color: #1e293b !important;
}

/* Bouton de suppression reste rouge */
#list .btn-danger,
#list .btn-danger i {
  color: #ffffff !important;
  background-color: #ef4444 !important;
}

/* ==========================================================================
   FIX ULTIME - PRIORITÉ MAXIMALE - TOUTES TABLES
   ========================================================================== */

/* Force absolue sur tous les éléments du tableau #list */
table#list tbody tr.item-row,
table#list tbody tr.item-row td,
table#list tbody tr.item-row td *,
#list tbody tr.item-row,
#list tbody tr.item-row td,
#list tbody tr.item-row td * {
  color: #1e293b !important;
  background-color: #ffffff !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Inputs dans les lignes item-row */
table#list tbody tr.item-row td input,
table#list tbody tr.item-row td input[type="text"],
table#list tbody tr.item-row td input[type="number"],
#list tr.item-row td input,
#list tr.item-row td input[type="text"],
#list tr.item-row td input[type="number"],
.item-row input,
.item-row input[type="text"],
.item-row input[type="number"] {
  color: #1e293b !important;
  background-color: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Paragraphes dans les lignes item-row */
table#list tbody tr.item-row td p,
table#list tbody tr.item-row td p b,
table#list tbody tr.item-row td .pname,
table#list tbody tr.item-row td .pname b,
table#list tbody tr.item-row td .amount,
#list tr.item-row td p,
#list tr.item-row td p b,
#list tr.item-row td .pname,
#list tr.item-row td .pname b,
#list tr.item-row td .amount,
.item-row p,
.item-row p b,
.item-row .pname,
.item-row .pname b,
.item-row .amount {
  color: #1e293b !important;
  visibility: visible !important;
  opacity: 1 !important;
  display: block !important;
}

/* Bouton delete reste visible en rouge/blanc */
table#list .btn-danger,
#list .btn-danger,
.item-row .btn-danger {
  color: #ffffff !important;
  background-color: #ef4444 !important;
}

/* Assurer que le tbody est visible */
#list tbody {
  display: table-row-group !important;
  visibility: visible !important;
}

/* Chaque ligne doit être visible */
#list tbody tr {
  display: table-row !important;
  visibility: visible !important;
  background-color: #ffffff !important;
}

/* Chaque cellule doit être visible */
#list tbody tr td {
  display: table-cell !important;
  visibility: visible !important;
  background-color: #ffffff !important;
  color: #1e293b !important;
  padding: 0.5rem !important;
}

/* Texte rouge pour v_poids (poids calculé) */
#list tr td input[name="v_poids[]"],
.item-row input[name="v_poids[]"],
input[name="v_poids[]"] {
  color: #dc2626 !important;
  background-color: #fff1f2 !important;
}

/* Assurer que le clone template reste caché */
#tr_clone {
  display: none !important;
  position: absolute !important;
  left: -9999px !important;
}