/* ===== VARIABLES CSS - DESIGN SYSTEM ===== */
:root {
  /* Light Mode Palette */
  --bg-main: #FFFFFF;
  --bg-secondary: #F8F9FA;
  --text-main: #000000;
  --text-secondary: #6C757D;
  --accent-blue: #0057B7;
  --accent-red: #DC3545;
  --accent-green: #28A745;
  --accent-violet: #6F42C1;

  /* Typographie */
  --font-primary: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
  
  /* Espacements */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;
  
  /* Border radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  
  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.2s ease;
  --transition-slow: 0.3s ease;
  --transition-bounce: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== THEME SOMBRE COMPLET ===== */
:root[data-theme='dark'] {
  /* Dark Mode Palette */
  --bg-main: #121212;
  --bg-secondary: #1E1E1E;
  --bg-tertiary: #2a2a2a;
  --text-main: #FFFFFF;
  --text-secondary: #A0A0A0;
  --accent-blue: #00A8E8;
  --accent-red: #FF2E4D;
  --accent-green: #28A745;
  --accent-violet: #8A2BE2;

  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.25);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.35);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.40);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.45);
}

/* Application du thème sombre à tout le système */
body[data-theme='dark'], 
:root[data-theme='dark'] body {
  background: var(--bg-main);
  color: var(--text-main);
}

/* ===== MOBILE-FIRST NAVIGATION ===== */

/* Menu hamburger - Style amélioré */
.hamburger-menu {
    display: none; /* Caché par défaut, affiché sur mobile */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    background: var(--bg-secondary, #f8f9fa);
    border: 2px solid var(--border-color, rgba(0, 0, 0, 0.1));
    border-radius: 10px;
    cursor: pointer;
    padding: 10px 8px;
    z-index: 1001;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    gap: 5px;
    position: relative;
}

.hamburger-menu:hover {
    background: var(--accent-blue, #0057B7);
    border-color: var(--accent-blue, #0057B7);
    box-shadow: 0 4px 12px rgba(0, 87, 183, 0.3);
    transform: translateY(-2px);
}

.hamburger-menu:hover span {
    background: white;
}

.hamburger-menu.active {
    background: var(--accent-blue, #0057B7);
    border-color: var(--accent-blue, #0057B7);
    box-shadow: 0 4px 16px rgba(0, 87, 183, 0.4);
}

.hamburger-menu span {
    width: 100%;
    height: 3px;
    background: var(--text-main, #333);
    border-radius: 3px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
    display: block;
}

.hamburger-menu.active span {
    background: white;
}

.hamburger-menu.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger-menu.active span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.hamburger-menu.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Navigation mobile - Style amélioré */
.nav-mobile {
    position: fixed;
    top: 0;
    left: -100%;
    width: 100%;
    max-width: 320px;
    height: 100vh;
    background: var(--bg-main, #ffffff);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 70px 0 20px 0;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.nav-mobile.active {
    left: 0;
}

.nav-mobile-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: linear-gradient(135deg, var(--accent-blue, #0057B7), #004a9e);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    color: white;
    box-shadow: 0 2px 8px rgba(0, 87, 183, 0.3);
    z-index: 10;
}

.nav-mobile-header h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.nav-mobile-close {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    width: 36px;
    height: 36px;
}

.nav-mobile-close:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.nav-mobile ul {
    list-style: none;
    padding: 12px;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-mobile ul li {
    width: 100%;
    margin: 0;
}

.nav-mobile ul li a {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    color: var(--text-main, #333);
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    font-size: 0.9rem;
    width: 100%;
    background: var(--bg-main, #ffffff);
    border: 1px solid var(--border-color, rgba(0, 0, 0, 0.08));
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    margin-bottom: 0;
    position: relative;
    overflow: hidden;
}

.nav-mobile ul li a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: var(--accent-blue, #0057B7);
    transform: scaleY(0);
    transition: transform 0.25s ease;
    border-radius: 0 4px 4px 0;
}

.nav-mobile ul li a i {
    width: 20px;
    margin-right: 12px;
    font-size: 1rem;
    text-align: center;
    flex-shrink: 0;
    color: var(--accent-blue, #0057B7);
    transition: all 0.25s ease;
}

.nav-mobile ul li a:hover,
.nav-mobile ul li a:focus {
    background: var(--bg-secondary, #f8f9fa);
    color: var(--accent-blue, #0057B7);
    border-color: var(--accent-blue, #0057B7);
    box-shadow: 0 4px 12px rgba(0, 87, 183, 0.15);
    transform: translateX(4px);
}

.nav-mobile ul li a:hover::before,
.nav-mobile ul li a:focus::before {
    transform: scaleY(1);
}

.nav-mobile ul li a:hover i,
.nav-mobile ul li a:focus i {
    transform: scale(1.15);
    color: var(--accent-blue, #0057B7);
}

.nav-mobile ul li a.active {
    background: linear-gradient(135deg, var(--accent-blue, #0057B7), #004a9e);
    color: white;
    border-color: var(--accent-blue, #0057B7);
    box-shadow: 0 4px 16px rgba(0, 87, 183, 0.3);
    transform: translateX(4px);
}

.nav-mobile ul li a.active::before {
    background: rgba(255, 255, 255, 0.3);
    transform: scaleY(1);
}

.nav-mobile ul li a.active i {
    color: white;
    transform: scale(1.1);
}

/* Overlay pour fermer le menu - Style amélioré */
.nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Header et navigation */
body[data-theme='dark'] header,
body[data-theme='dark'] nav {
    background: var(--bg-secondary);
    color: var(--text-main);
    border-bottom: 1px solid var(--bg-secondary);
}

body[data-theme='dark'] nav ul li a {
    color: var(--text-secondary);
}

body[data-theme='dark'] nav ul li a:hover,
body[data-theme='dark'] nav ul li a:focus {
    background: var(--bg-main);
    color: var(--text-main);
}

body[data-theme='dark'] nav ul li a.active {
    background: var(--accent-blue);
    color: var(--text-main);
}

body[data-theme='dark'] .logo h1 {
    color: var(--text-main);
}

body[data-theme='dark'] .logo-image {
    filter: brightness(0.9);
}

/* Dark mode pour navigation mobile */
body[data-theme='dark'] .hamburger-menu {
    background: var(--bg-secondary, #1E1E1E);
    border-color: var(--border-color, rgba(255, 255, 255, 0.1));
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body[data-theme='dark'] .hamburger-menu:hover {
    background: var(--accent-blue, #00a8e8);
    box-shadow: 0 4px 12px rgba(0, 168, 232, 0.3);
}

body[data-theme='dark'] .hamburger-menu span {
    background: var(--text-main, #ffffff);
}

body[data-theme='dark'] .nav-mobile {
    background: var(--bg-secondary, #1E1E1E);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

body[data-theme='dark'] .nav-mobile ul li a {
    background: var(--bg-main, #121212);
    border-color: var(--border-color, rgba(255, 255, 255, 0.08));
    color: var(--text-main, #ffffff);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

body[data-theme='dark'] .nav-mobile ul li a:hover,
body[data-theme='dark'] .nav-mobile ul li a:focus {
    background: var(--bg-tertiary, #2a2a2a);
    border-color: var(--accent-blue, #00a8e8);
    box-shadow: 0 4px 12px rgba(0, 168, 232, 0.2);
}

body[data-theme='dark'] .nav-mobile ul li a.active {
    background: linear-gradient(135deg, var(--accent-blue, #00a8e8), #0088cc);
    box-shadow: 0 4px 16px rgba(0, 168, 232, 0.4);
}

body[data-theme='dark'] .nav-overlay {
    background: rgba(0, 0, 0, 0.75);
}

/* Container principal */
body[data-theme='dark'] .container {
  background: var(--bg-main);
}

/* Main content */
body[data-theme='dark'] main {
  background: var(--bg-main);
}

/* Cartes et sections */
body[data-theme='dark'] .stat-card,
body[data-theme='dark'] .chart-card,
body[data-theme='dark'] .form-container,
body[data-theme='dark'] .alerts-section {
  background: var(--bg-secondary);
  color: var(--text-main);
  border-color: var(--bg-secondary);
  box-shadow: var(--shadow-md);
}

/* Alertes section */
.alerts-section {
    margin-top: 30px;
    margin-bottom: 30px;
}

/* Actions rapides supprimées - non utilisées (tout le code CSS des actions rapides a été retiré) */

/* Dashboard alerts utilise déjà les variables CSS dans les autres règles */

body[data-theme='dark'] .alerts-section {
    background: var(--bg-secondary, #2d2d2d);
    border-color: var(--border-color, #404040);
}

body[data-theme='dark'] .no-alerts {
    background: rgba(40, 167, 69, 0.1);
    color: var(--accent-green, #28a745);
    border-color: var(--accent-green, #28a745);
}

body[data-theme='dark'] .test-section,
body[data-theme='dark'] .empty-state {
  background: var(--bg-secondary);
  color: var(--text-main);
  border-color: var(--bg-secondary);
  box-shadow: var(--shadow-md);
}

/* Titres */
body[data-theme='dark'] h1,
body[data-theme='dark'] h2,
body[data-theme='dark'] h3,
body[data-theme='dark'] h4,
body[data-theme='dark'] h5,
body[data-theme='dark'] h6 {
  color: var(--text-main);
}

/* Boutons */
body[data-theme='dark'] .btn {
  color: var(--text-main);
}

body[data-theme='dark'] .btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-main);
  border-color: var(--bg-secondary);
}

body[data-theme='dark'] .btn-secondary:hover {
  background: var(--bg-main);
  color: var(--text-main);
}

/* Barre de recherche */
body[data-theme='dark'] .search-container {
  background: var(--bg-secondary);
  border-bottom-color: var(--bg-secondary);
}

body[data-theme='dark'] .search-input {
  background: var(--bg-main);
  color: var(--text-main);
  border-color: var(--bg-secondary);
}

body[data-theme='dark'] .search-input:focus {
  background: var(--bg-main);
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px rgba(0, 168, 232, 0.2);
}

body[data-theme='dark'] .search-suggestions {
  background: var(--bg-secondary);
  color: var(--text-main);
  border-color: var(--bg-secondary);
  box-shadow: var(--shadow-lg);
}

body[data-theme='dark'] .search-suggestion-item {
  color: var(--text-main);
  border-bottom-color: var(--bg-secondary);
}

body[data-theme='dark'] .search-suggestion-item:hover,
body[data-theme='dark'] .search-suggestion-item.active {
  background: var(--accent-blue);
  color: var(--text-main);
}

/* Formulaires */
body[data-theme='dark'] .form-control {
  background: var(--bg-secondary);
  color: var(--text-main);
  border-color: var(--bg-secondary);
}

body[data-theme='dark'] .form-control:focus {
  background: var(--bg-main);
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px rgba(0, 168, 232, 0.2);
}

body[data-theme='dark'] .form-control::placeholder {
  color: var(--text-secondary);
}

/* Tableaux */
body[data-theme='dark'] table {
  background: var(--bg-secondary);
  color: var(--text-main);
}

body[data-theme='dark'] table th {
  background: var(--bg-main);
  color: var(--text-main);
  border-color: var(--bg-secondary);
}

body[data-theme='dark'] table td {
  border-color: var(--bg-secondary);
}

body[data-theme='dark'] table tr:hover {
  background: var(--bg-main);
}

/* Alertes */
body[data-theme='dark'] .alert {
  background: var(--bg-secondary);
  color: var(--text-main);
  border-color: var(--bg-secondary);
}

body[data-theme='dark'] .alert-success {
  background: rgba(40, 167, 69, 0.1);
  border-color: var(--accent-green);
  color: var(--accent-green);
}

body[data-theme='dark'] .alert-danger {
  background: rgba(255, 46, 77, 0.1);
  border-color: var(--accent-red);
  color: var(--accent-red);
}

body[data-theme='dark'] .alert-warning {
  background: rgba(245, 158, 66, 0.1);
  border-color: var(--warning-orange);
  color: var(--warning-orange);
}

body[data-theme='dark'] .alert-info {
  background: rgba(0, 168, 232, 0.1);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}



/* Alertes dashboard */
body[data-theme='dark'] .alert-item {
  background: var(--bg-secondary);
  color: var(--text-main);
  border-left-color: var(--accent-red);
}

body[data-theme='dark'] .alert-item:hover {
  background: var(--bg-main);
}

/* Page header */
body[data-theme='dark'] .page-header h1,
body[data-theme='dark'] .dashboard-title h1 {
  color: var(--text-main);
}

body[data-theme='dark'] .dashboard-title p {
  color: var(--text-secondary);
}

/* Test sections */
body[data-theme='dark'] .test-section h2 {
  color: var(--text-main);
}

body[data-theme='dark'] .test-section h2 i {
  color: var(--accent-blue);
}

/* ===== RESET ET BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ===== LAYOUT PRINCIPAL ===== */
html {
    height: 100%;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-main);
    min-height: 100vh;
    color: var(--text-main);
    line-height: 1.6;
    padding-top: 70px; /* Espace pour le header fixe sur toutes les pages */
    display: flex;
    flex-direction: column;
    margin: 0;
}

.container {
    max-width: 1440px;
    width: 100%;
    margin: 0 auto;
    padding: 0;
    background: var(--bg-secondary);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.dashboard-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 20px;
}

/* ===== HEADER ET NAVIGATION ===== */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1000;
    background: var(--bg-secondary);
    color: var(--text-main);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid var(--border-color, rgba(0, 0, 0, 0.1));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    flex-shrink: 0;
}

.header-container {
    max-width: 1440px;
    width: 100%;
    margin: 0 auto;
    padding: 12px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 30px;
    flex: 1;
    min-width: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

.header-nav {
    display: flex;
    align-items: center;
}

.header-nav ul {
    gap: 8px;
}

.user-nav {
    display: flex;
    align-items: center;
}

.user-nav ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 1rem;
}

.user-nav ul li {
    position: relative;
}

.user-nav ul li a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
    padding: 0.5rem 0.75rem;
    border-radius: 0.4rem;
}

.user-nav ul li a:hover {
    background-color: var(--bg-secondary);
    color: var(--primary-color);
}

/* Dropdown styles */
.user-nav .dropdown {
    position: relative;
}

.user-nav .dropdown-toggle {
    cursor: pointer;
}

.user-nav .dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-main, #ffffff);
    border: 1px solid var(--border-color, rgba(0, 0, 0, 0.1));
    border-radius: 0.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    min-width: 220px;
    margin-top: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 10000;
    padding: 0.5rem 0;
    list-style: none;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.user-nav .dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-nav .dropdown-menu li {
    margin: 0;
}

.user-nav .dropdown-menu li a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-main, #000000);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background-color 0.2s;
    border-radius: 0;
}

.user-nav .dropdown-menu li a:hover,
.user-nav .dropdown-menu li a.active {
    background-color: var(--bg-secondary, #f8f9fa);
    color: var(--accent-blue, #0057B7);
    font-weight: 600;
}

.user-nav .dropdown-menu li a i {
    width: 20px;
    text-align: center;
    color: var(--text-secondary, #6C757D);
}

/* Dark mode pour les dropdowns */
body[data-theme='dark'] .user-nav .dropdown-menu {
    background: var(--bg-secondary, #1E1E1E);
    border-color: var(--border-color, rgba(255, 255, 255, 0.1));
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

body[data-theme='dark'] .user-nav .dropdown-menu li a {
    color: var(--text-main, #FFFFFF);
}

body[data-theme='dark'] .user-nav .dropdown-menu li a:hover,
body[data-theme='dark'] .user-nav .dropdown-menu li a.active {
    background-color: var(--bg-tertiary, #2a2a2a);
    color: var(--accent-blue, #00a8e8);
}

body[data-theme='dark'] .user-nav .dropdown-menu li a i {
    color: var(--text-secondary, #a0a0a0);
}

/* Notification badge */
.notification-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background-color: var(--danger-color);
    color: white;
    border-radius: 9px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
    line-height: 1;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

body[data-theme='dark'] header {
    background: var(--bg-secondary, #2d2d2d);
    border-bottom-color: var(--border-color, #404040);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.logo {
    flex-shrink: 0;
}

.logo h1 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--accent-blue);
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-text {
    white-space: nowrap;
}

.logo-image {
    height: 28px;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 8px;
    margin: 0;
    padding: 0;
    align-items: center;
    flex-wrap: wrap;
}

.header-nav ul {
    gap: 4px;
}

nav ul li a {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    padding: 8px 14px;
    border-radius: var(--radius-md);
    transition: var(--transition-normal);
    position: relative;
    font-size: 14px;
    white-space: nowrap;
}

.header-nav ul li a {
    padding: 6px 12px;
    font-size: 13px;
}

nav ul li a:hover {
    background: var(--bg-main);
    color: var(--text-main);
    transform: translateY(-1px);
}

nav ul li a.active {
    background: var(--accent-blue);
    color: var(--bg-main);
    box-shadow: var(--shadow-sm);
}

/* Barre de recherche globale */
.search-container {
    width: 100%;
    background: var(--bg-secondary, #f8f9fa);
    border-bottom: 1px solid var(--border-color, rgba(0, 0, 0, 0.1));
    padding: 15px 30px;
    margin-bottom: 0;
}

.global-search {
    display: flex;
    gap: 10px;
    align-items: center;
    max-width: 600px;
    margin: 0 auto;
}

.search-input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 8px;
    background: var(--bg-main, white);
    color: var(--text-main, #333);
    font-size: 14px;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-blue, #007bff);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

.search-btn {
    padding: 10px 20px;
    background: var(--accent-blue, #007bff);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-btn:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

/* ===== MAIN CONTENT ===== */
main {
    padding: 30px;
    margin-top: 0;
    padding-top: 30px;
    flex: 1;
    transition: padding-right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    /* Utiliser tout l'espace disponible dans le container */
    min-width: 0; /* Permet au flex de réduire si nécessaire */
}

/* Assurer que les titres de page sont bien visibles sous la navbar fixe */
/* Si le premier enfant est un .page-header, .dashboard-header ou .form-container */
main > .page-header:first-child,
main > .dashboard-header:first-child,
main > .form-container:first-child {
    margin-top: 0;
    padding-top: 0;
}

/* Si le premier enfant est .flashes, le suivant doit avoir margin-top: 0 */
main > .flashes + .page-header,
main > .flashes + .dashboard-header,
main > .flashes + .form-container {
    margin-top: 0;
    padding-top: 0;
}

/* Si le premier enfant est autre chose, on veut quand même que les titres suivants soient bien positionnés */
main > .page-header,
main > .dashboard-header {
    scroll-margin-top: 70px;
}

/* Dashboard utilise la même largeur max que les autres pages (1440px via .container) */
/* Assurer que le dashboard a exactement la même largeur que la page clients */
.dashboard-header,
.dashboard-modern,
body.dashboard-page main {
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}

/* Assurer que les contenus dans main utilisent 100% de l'espace disponible dans le container */
main > * {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.page-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 30px;
    margin-top: 0;
    padding-top: 0;
    padding-bottom: 20px;
    border-bottom: 2px solid #e9ecef;
    position: relative;
    z-index: 1;
}

.page-header h1 {
    margin: 0;
    color: var(--text-main);
    font-size: 28px;
    font-weight: 600;
}

.page-header .actions {
    display: flex;
    gap: 15px;
}

/* ===== BOUTONS ===== */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-size: 14px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-blue), #0057B7);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 87, 183, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, var(--accent-green), #28a745);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(40, 167, 69, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, var(--accent-red), #dc3545);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(220, 53, 69, 0.3);
}

.btn-warning {
    background: linear-gradient(135deg, #ffc107, #e0a800);
    color: #212529;
}

.btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 193, 7, 0.3);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    transition: all 0.2s;
}

.btn-view {
    background: linear-gradient(135deg, #007bff, #00c6ff);
    color: white;
    border: none;
}
.btn-view:hover {
    background: linear-gradient(135deg, #0056b3, #00aaff);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 16px rgba(0,123,255,0.18);
}

.btn-edit {
    background: linear-gradient(135deg, #ffc107, #ffe082);
    color: #212529;
    border: none;
}
.btn-edit:hover {
    background: linear-gradient(135deg, #e0a800, #ffd54f);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 16px rgba(255,193,7,0.18);
}

.btn-delete {
    background: linear-gradient(135deg, #dc3545, #ff6f61);
    color: white;
    border: none;
}
.btn-delete:hover {
    background: linear-gradient(135deg, #c82333, #ff8a80);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 16px rgba(220,53,69,0.18);
}

/* ===== CARTES ET STATISTIQUES ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-main);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-blue), #0057B7);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

.stat-card h3 {
    margin: 0 0 15px 0;
    color: var(--text-secondary);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--accent-blue);
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.stat-card.revenue .stat-value {
    color: #28a745;
}

.stat-card.unpaid .stat-value {
    color: #dc3545;
}

.stat-card.clients .stat-value {
    color: #17a2b8;
}

.stat-card.invoices .stat-value {
    color: #ffc107;
}

/* ===== Dashboard polish (harmonized sizing & spacing) ===== */
.dashboard-page .dashboard-header {
    gap: 18px;
    margin-bottom: 20px;
}

.dashboard-page .dashboard-title h1 {
    font-size: 28px;
    line-height: 1.2;
}

.dashboard-page .dashboard-title p {
    font-size: 14px;
    color: var(--text-secondary);
}

.dashboard-page .alerts-section {
    padding: 18px;
    border-radius: 14px;
    border: 1px solid var(--border-color, rgba(0, 0, 0, 0.08));
    background: var(--bg-main);
}

body[data-theme='dark'] .dashboard-page .alerts-section {
    background: var(--bg-secondary, #1E1E1E);
    border-color: var(--border-color, #404040);
}

.dashboard-page .alerts-header h3 {
    font-size: 16px;
    letter-spacing: 0.3px;
}

.dashboard-page .alerts-count {
    font-size: 12px;
    padding: 2px 8px;
}

.dashboard-page .stats-grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 18px;
}

.dashboard-page .stat-card {
    grid-column: span 4;
    padding: 20px 22px;
    text-align: left;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
}

.dashboard-page .stat-card.revenue,
.dashboard-page .stat-card.unpaid {
    grid-column: span 6;
}

.dashboard-page .stat-card .stat-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(0, 87, 183, 0.08);
    color: var(--accent-blue, #0057B7);
    font-size: 18px;
    flex-shrink: 0;
}

body[data-theme='dark'] .dashboard-page .stat-card .stat-icon {
    background: rgba(0, 168, 232, 0.12);
    color: var(--accent-blue, #00A8E8);
}

.dashboard-page .stat-card h3 {
    font-size: 12px;
    letter-spacing: 0.6px;
    margin-bottom: 8px;
}

.dashboard-page .stat-value {
    font-size: 28px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    margin-bottom: 6px;
}

.dashboard-page .stat-trend {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.dashboard-page .charts-grid,
.dashboard-page .charts-grid-secondary {
    gap: 18px;
}

.dashboard-page .chart-card {
    padding: 22px;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
}

.dashboard-page .chart-header {
    gap: 12px;
    align-items: center;
}

.dashboard-page .chart-header h3 {
    font-size: 17px;
}

.dashboard-page .chart-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.dashboard-page .chart-actions .btn {
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
}

@media (max-width: 1200px) {
    .dashboard-page .stat-card {
        grid-column: span 6;
    }
}

@media (max-width: 900px) {
    .dashboard-page .stats-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .dashboard-page .stat-card.revenue,
    .dashboard-page .stat-card.unpaid {
        grid-column: span 6;
    }
}

@media (max-width: 640px) {
    .dashboard-page .stats-grid {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }

    .dashboard-page .stat-card {
        grid-column: span 1;
    }
}

/* ===== GRAPHIQUES ===== */
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 25px;
    margin-bottom: 30px;
}

.chart-card {
    background: var(--bg-main);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color, rgba(0, 0, 0, 0.05));
    transition: all 0.3s ease;
}

.chart-card:hover {
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color, rgba(0, 0, 0, 0.1));
}

.chart-header h3 {
    margin: 0;
    color: var(--text-main);
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

.chart-header h3 i {
    color: var(--accent-blue, #007bff);
    font-size: 22px;
}

.chart-header h3::after {
    content: '';
    position: absolute;
    bottom: -17px;
    left: 0;
    width: 50px;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-blue, #007bff), #0057B7);
    border-radius: 2px;
}

.chart-legend {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.chart-legend .legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary, #666);
    font-weight: 500;
}

.chart-legend .legend-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

body[data-theme='dark'] .chart-card {
    background: var(--bg-secondary, #2d2d2d);
    border-color: var(--border-color, #404040);
}

body[data-theme='dark'] .chart-card:hover {
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.3);
}

body[data-theme='dark'] .chart-header {
    border-bottom-color: var(--border-color, #404040);
}

body[data-theme='dark'] .chart-header h3 {
    color: var(--text-main, #ffffff);
}

body[data-theme='dark'] .chart-header h3 i {
    color: var(--accent-blue, #00a8e8);
}

body[data-theme='dark'] .chart-header h3::after {
    background: linear-gradient(90deg, #00a8e8, #007bff);
}

body[data-theme='dark'] .chart-legend .legend-item {
    color: var(--text-secondary, #999);
}

/* ===== UI HARMONIZATION (pages & lists) ===== */
.page-header {
    gap: 16px;
    align-items: center;
}

.page-header h1 {
    font-size: 26px;
    font-weight: 650;
}

.page-header-actions,
.page-header .actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.form-container {
    padding: 32px;
    border-radius: 16px;
    border: 1px solid var(--border-color, #e9ecef);
    box-shadow: var(--shadow-md);
}

body[data-theme='dark'] .form-container {
    border-color: var(--border-color, #404040);
    background: var(--bg-secondary, #1E1E1E);
}

.table-container {
    border-radius: 16px;
    border: 1px solid var(--border-color, #e9ecef);
    box-shadow: var(--shadow-md);
}

body[data-theme='dark'] .table-container {
    background: var(--bg-secondary, #1E1E1E);
    border-color: var(--border-color, #404040);
}

table th,
table td {
    padding: 14px 16px;
}

table th {
    font-size: 11px;
    letter-spacing: 0.8px;
}

table tr:hover {
    background: rgba(0, 0, 0, 0.03);
}

body[data-theme='dark'] table tr:hover {
    background: rgba(255, 255, 255, 0.04);
}

.btn {
    border-radius: 10px;
}

.btn.btn-sm {
    padding: 6px 12px;
    border-radius: 999px;
    font-weight: 600;
}

/* Harmonize page headers and actions */
.page-header {
    justify-content: space-between;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border-color, #e9ecef);
}

.page-header h1 i {
    color: var(--accent-blue);
    margin-right: 8px;
}

body[data-theme='dark'] .page-header {
    border-bottom-color: var(--border-color, #404040);
}

/* Harmonize tables across templates */
.data-table,
.invoices-table,
.users-table,
.rates-table,
.details-table,
.profit-table table,
.articles-table,
.payments-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-main);
}

.data-table th,
.data-table td,
.invoices-table th,
.invoices-table td,
.users-table th,
.users-table td,
.rates-table th,
.rates-table td,
.details-table th,
.details-table td,
.profit-table table th,
.profit-table table td,
.articles-table .table-row > div,
.articles-table .table-header .table-row > div {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color, #e9ecef);
}

.data-table th,
.invoices-table th,
.users-table th,
.rates-table th,
.details-table th,
.profit-table table th,
.articles-table .table-header .table-row > div {
    background: linear-gradient(135deg, #f8f9fa, #eef1f3);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-size: 11px;
    color: var(--text-secondary);
}

.data-table tbody tr:hover,
.invoices-table tbody tr:hover,
.users-table tbody tr:hover,
.rates-table tbody tr:hover,
.details-table tbody tr:hover,
.profit-table table tbody tr:hover,
.articles-table .table-row:hover {
    background: rgba(0, 0, 0, 0.03);
}

body[data-theme='dark'] .data-table,
body[data-theme='dark'] .invoices-table,
body[data-theme='dark'] .users-table,
body[data-theme='dark'] .rates-table,
body[data-theme='dark'] .details-table,
body[data-theme='dark'] .profit-table table,
body[data-theme='dark'] .articles-table {
    background: var(--bg-secondary, #1E1E1E);
}

body[data-theme='dark'] .data-table th,
body[data-theme='dark'] .data-table td,
body[data-theme='dark'] .invoices-table th,
body[data-theme='dark'] .invoices-table td,
body[data-theme='dark'] .users-table th,
body[data-theme='dark'] .users-table td,
body[data-theme='dark'] .rates-table th,
body[data-theme='dark'] .rates-table td,
body[data-theme='dark'] .details-table th,
body[data-theme='dark'] .details-table td,
body[data-theme='dark'] .profit-table table th,
body[data-theme='dark'] .profit-table table td,
body[data-theme='dark'] .articles-table .table-row > div,
body[data-theme='dark'] .articles-table .table-header .table-row > div {
    border-bottom-color: var(--border-color, #404040);
}

body[data-theme='dark'] .data-table th,
body[data-theme='dark'] .invoices-table th,
body[data-theme='dark'] .users-table th,
body[data-theme='dark'] .rates-table th,
body[data-theme='dark'] .details-table th,
body[data-theme='dark'] .profit-table table th,
body[data-theme='dark'] .articles-table .table-header .table-row > div {
    background: linear-gradient(135deg, #242424, #1c1c1c);
    color: var(--text-secondary, #A0A0A0);
}

body[data-theme='dark'] .data-table tbody tr:hover,
body[data-theme='dark'] .invoices-table tbody tr:hover,
body[data-theme='dark'] .users-table tbody tr:hover,
body[data-theme='dark'] .rates-table tbody tr:hover,
body[data-theme='dark'] .details-table tbody tr:hover,
body[data-theme='dark'] .profit-table table tbody tr:hover,
body[data-theme='dark'] .articles-table .table-row:hover {
    background: rgba(255, 255, 255, 0.04);
}

/* Harmonize cards and sections */
.info-section,
.stat-card,
.form-section,
.panel,
.card,
.content-card {
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color, #e9ecef);
}

body[data-theme='dark'] .info-section,
body[data-theme='dark'] .stat-card,
body[data-theme='dark'] .form-section,
body[data-theme='dark'] .panel,
body[data-theme='dark'] .card,
body[data-theme='dark'] .content-card {
    border-color: var(--border-color, #404040);
}

/* ===== Template harmonization (override inline quirks) ===== */
.page-header,
.page-header-actions,
.page-header .actions {
    gap: 12px !important;
}

.page-header .btn,
.page-header-actions .btn {
    border-radius: 10px !important;
    padding: 10px 18px !important;
    font-weight: 600;
}

.page-header-actions .btn.btn-outline-secondary,
.page-header-actions .btn.btn-secondary {
    background: var(--bg-secondary, #f8f9fa);
    color: var(--text-main);
    border: 1px solid var(--border-color, #e0e0e0);
}

body[data-theme='dark'] .page-header-actions .btn.btn-outline-secondary,
body[data-theme='dark'] .page-header-actions .btn.btn-secondary {
    background: var(--bg-tertiary, #2a2a2a);
    color: var(--text-main);
    border-color: var(--border-color, #404040);
}

.form-container,
.table-container,
.stat-card,
.chart-card,
.info-section,
.form-section {
    border-radius: 16px !important;
}

.table-container table th,
.table-container table td {
    padding: 14px 16px !important;
}

.table-container table th {
    font-size: 11px !important;
    letter-spacing: 0.8px !important;
}

/* ===== FORMULAIRES ===== */
.form-container {
    background: var(--bg-main);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.08);
    margin-bottom: 30px;
    border: 1px solid #f0f0f0;
    max-width: 900px;
    margin: 0 auto;
}

.form-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 2px solid #f8f9fa;
}

.form-header h1 {
    color: var(--text-main);
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.form-header h1 i {
    color: var(--accent-blue);
    font-size: 32px;
}

.form-header p {
    color: var(--text-secondary);
    font-size: 16px;
    margin: 0;
}

.modern-form {
    max-width: 800px;
    margin: 0 auto;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin-bottom: 25px;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--text-main);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group label i {
    color: var(--accent-blue);
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.required {
    color: #dc3545;
    font-weight: 700;
}

.form-control {
    width: 100%;
    padding: 15px 18px;
    border: 2px solid var(--bg-secondary);
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: var(--bg-main);
    color: var(--text-main);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 4px rgba(0, 87, 183, 0.1);
    background: var(--bg-main);
    transform: translateY(-2px);
}

.form-control:invalid {
    border-color: var(--accent-red);
    box-shadow: 0 0 0 4px rgba(220, 53, 69, 0.1);
}

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

textarea.form-control {
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
}

.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #f8f9fa;
    gap: 20px;
}

.form-actions .btn {
    padding: 15px 30px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 12px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 180px;
    justify-content: center;
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d, #5a6268);
    color: white;
    border: none;
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #5a6268, #495057);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(108, 117, 125, 0.4);
}

/* ===== TABLEAUX ===== */
.table-container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin-bottom: 30px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

table th,
table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

table th {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    font-weight: 600;
    color: #333;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 1px;
}

table tr:hover {
    background: #f8f9fa;
    transition: background 0.3s ease;
}

/* ===== MESSAGES FLASH ===== */
.flashes {
    margin-bottom: 30px;
}

.alert {
    padding: 16px 20px;
    margin-bottom: 15px;
    border-radius: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    animation: slideInDown 0.3s ease-out;
}

.alert i {
    font-size: 18px;
    flex-shrink: 0;
}

.alert-success {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    color: #155724;
    border-color: #28a745;
}

.alert-danger {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    color: #721c24;
    border-color: #dc3545;
}

.alert-warning {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    color: #856404;
    border-color: #ffc107;
}

.alert-info {
    background: linear-gradient(135deg, #d1ecf1, #bee5eb);
    color: #0c5460;
    border-color: #17a2b8;
}

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

.flashes li.danger {
    background: #f8d7da;
    color: #721c24;
    border-left-color: #dc3545;
}

.flashes li.warning {
    background: #fff3cd;
    color: #856404;
    border-left-color: #ffc107;
}

.flashes li.info {
    background: #d1ecf1;
    color: #0c5460;
    border-left-color: #17a2b8;
}

/* ===== FOOTER ===== */
footer {
    width: 100%;
    background: var(--bg-secondary, #f8f9fa);
    padding: 20px 30px;
    text-align: center;
    color: var(--text-secondary, #666);
    border-top: 1px solid var(--border-color, #e9ecef);
    margin-top: auto;
    flex-shrink: 0;
    box-sizing: border-box;
    position: relative;
    z-index: 100;
}

footer p {
    margin: 0;
    color: var(--text-secondary, #666);
    font-size: 14px;
}

body[data-theme='dark'] footer {
    background: var(--bg-secondary, #2d2d2d);
    color: var(--text-secondary, #999);
    border-top-color: var(--border-color, #404040);
}

body[data-theme='dark'] footer p {
    color: var(--text-secondary, #999);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .container {
        margin: 10px;
        border-radius: 10px;
    }
    
    header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        background: var(--bg-main, #ffffff);
        border-bottom: 1px solid var(--border-color, rgba(0, 0, 0, 0.1));
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    
    body[data-theme='dark'] header {
        background: var(--bg-secondary, #1E1E1E);
        border-bottom-color: var(--border-color, rgba(255, 255, 255, 0.1));
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
    
    .header-container {
        padding: 8px 12px;
        gap: 8px;
        min-height: 60px;
        flex-wrap: nowrap;
        align-items: center;
    }
    
    .header-left {
        flex: 1 1 auto;
        min-width: 0;
        display: flex;
        align-items: center;
        gap: 10px;
    }
    
    .header-right {
        flex: 0 0 auto;
        display: flex;
        align-items: center;
        gap: 8px;
    }
    
    .logo {
        flex-shrink: 0;
    }
    
    .logo h1 {
        font-size: 16px;
        margin: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: flex;
        align-items: center;
        gap: 6px;
    }
    
    .logo-text {
        display: none; /* Masquer le texte sur mobile très petit */
    }
    
    @media (min-width: 480px) {
        .logo-text {
            display: inline; /* Afficher le texte sur écrans plus grands */
        }
    }
    
    .logo-image {
        height: 28px;
        width: 28px;
        flex-shrink: 0;
    }
    
    .header-nav {
        display: none !important; /* Navigation desktop cachée sur mobile */
    }
    
    .user-nav {
        display: none !important; /* Menu utilisateur caché sur mobile */
    }
    
    .hamburger-menu {
        display: flex !important; /* Afficher le menu hamburger sur mobile */
    }
    
    .nav-mobile {
        display: block !important; /* Navigation mobile visible */
    }
    
    /* Cacher le bouton de rafraîchissement sur mobile */
    .refresh-stats-btn {
        display: none !important;
    }
    
    /* Adapter les actions du dashboard-header */
    .dashboard-actions {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
    
    .dashboard-actions .btn {
        width: 100%;
        justify-content: center;
        padding: 10px 16px;
        font-size: 14px;
    }
    
    /* Header actions (thème, connexion) plus compacts sur mobile */
    .header-actions {
        gap: 6px;
    }
    
    .theme-toggle,
    .connection-status {
        width: 36px;
        height: 36px;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 16px;
    }
    
    .hamburger-menu {
        width: 36px;
        height: 36px;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    nav ul {
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 8px;
    }
    
    nav ul li a {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    main {
        margin-top: 0;
        padding: 20px 15px;
    }
    
    body {
        padding-top: 0;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .page-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        padding-bottom: 15px;
        margin-bottom: 20px;
    }
    
    .page-header h1 {
        font-size: 20px !important;
        font-weight: 600;
        margin: 0;
    }
    
    .page-header .actions {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .page-header .actions .btn {
        width: 100%;
        margin-bottom: 8px;
    }
    
    /* Réduire la taille des titres sur mobile */
    .dashboard-title h1 {
        font-size: 18px !important;
    }
    
    .form-header h1 {
        font-size: 20px !important;
    }
    
    /* Dashboard responsive mobile */
    .dashboard-header {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }
    
    .dashboard-title {
        text-align: center;
    }
    
    .dashboard-title h1 {
        font-size: 20px;
    }
    
    .dashboard-title p {
        font-size: 12px;
    }
    
    /* Menu mobile - éléments alignés verticalement, un par ligne, taille réduite */
    .nav-mobile {
        width: 100%;
        max-width: 280px;
        padding-top: 65px;
    }
    
    .nav-mobile ul {
        padding: 10px;
        gap: 6px;
    }
    
    .nav-mobile ul li a {
        padding: 12px 14px;
        font-size: 0.85rem;
        border-radius: 8px;
    }
    
    .nav-mobile ul li a i {
        width: 18px;
        font-size: 0.9rem;
        margin-right: 10px;
    }
    
    .nav-mobile-header {
        height: 65px;
        padding: 0 15px;
    }
    
    .nav-mobile-header h2 {
        font-size: 1rem;
    }
    
    .nav-mobile-close {
        width: 32px;
        height: 32px;
        font-size: 1rem;
        padding: 6px 8px;
    }
    
    .hamburger-menu {
        width: 40px;
        height: 40px;
        padding: 8px 6px;
    }
    
    /* Tableaux responsive - Transformation en cartes sur mobile */
    .table-container {
        overflow: visible;
    }
    
    .table-container table,
    table {
        border-collapse: separate;
        border-spacing: 0;
    }
    
    .table-container table thead,
    table thead {
        display: none; /* Cacher les en-têtes sur mobile */
    }
    
    .table-container table tbody tr,
    table tbody tr {
        display: block;
        background: var(--bg-main, #ffffff);
        border: 1px solid var(--border-color, #e9ecef);
        border-radius: 12px;
        margin-bottom: 16px;
        padding: 16px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
        transition: all 0.3s ease;
    }
    
    .table-container table tbody tr:hover,
    table tbody tr:hover {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
        transform: translateY(-2px);
    }
    
    .table-container table tbody tr td,
    table tbody tr td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        padding: 12px 0;
        border-bottom: 1px solid var(--bg-secondary, #f8f9fa);
        border-left: none;
        border-right: none;
        text-align: right;
        position: relative;
        padding-left: 0;
        flex-wrap: wrap;
    }
    
    .table-container table tbody tr td:before,
    table tbody tr td:before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-secondary, #6c757d);
        text-align: left;
        flex: 0 0 45%;
        font-size: 0.8rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-right: 8px;
    }
    
    /* Si data-label n'est pas défini, masquer le label */
    .table-container table tbody tr td:not([data-label]):before,
    table tbody tr td:not([data-label]):before {
        display: none;
    }
    
    /* Pour les cellules sans label (comme les actions), afficher à droite */
    .table-container table tbody tr td:not([data-label]),
    table tbody tr td:not([data-label]) {
        justify-content: flex-end;
    }
    
    .table-container table tbody tr td:last-child,
    table tbody tr td:last-child {
        border-bottom: none;
        padding-top: 16px;
        padding-bottom: 0;
        justify-content: flex-end;
    }
    
    /* Actions dans les cartes */
    .table-container table tbody tr td .action-buttons,
    table tbody tr td .action-buttons {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
        width: 100%;
        justify-content: flex-end;
        margin-top: 8px;
    }
    
    .table-container table tbody tr td .action-buttons .btn,
    table tbody tr td .action-buttons .btn {
        flex: 1 1 auto;
        min-width: 80px;
        font-size: 0.8rem;
        padding: 8px 12px;
    }
    
    .table-container table tbody tr td .btn,
    table tbody tr td .btn {
        white-space: nowrap;
    }
    
    /* Dark mode pour les cartes */
    body[data-theme='dark'] .table-container table tbody tr,
    body[data-theme='dark'] table tbody tr {
        background: var(--bg-secondary, #1E1E1E);
        border-color: var(--border-color, rgba(255, 255, 255, 0.1));
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
    
    body[data-theme='dark'] .table-container table tbody tr:hover,
    body[data-theme='dark'] table tbody tr:hover {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    }
    
    body[data-theme='dark'] .table-container table tbody tr td,
    body[data-theme='dark'] table tbody tr td {
        border-bottom-color: var(--bg-main, #121212);
    }
    
    /* Responsive pour les formulaires */
    .form-container {
        padding: 25px 20px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 15px;
    }
    
    .form-actions .btn {
        width: 100%;
    }
    
    .form-header h1 {
        font-size: 24px;
        flex-direction: column;
        gap: 10px;
    }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* ===== UTILITAIRES ===== */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mb-20 {
    margin-bottom: 20px;
}

.mt-20 {
    margin-top: 20px;
}

.d-flex {
    display: flex;
}

.justify-between {
    justify-content: space-between;
}

.align-center {
    align-items: center;
}

.gap-10 {
    gap: 10px;
}

.gap-15 {
    gap: 15px;
}

.gap-20 {
    gap: 20px;
}

/* ===== DASHBOARD SPÉCIFIQUE ===== */
.chart-image {
    width: 100%;
    height: 250px;
    object-fit: contain;
    border-radius: 8px;
    margin-bottom: 10px;
    max-width: 100%;
    overflow: hidden;
}

.chart-container {
    width: 100%;
    height: 250px;
    overflow: hidden;
    border-radius: 8px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.alert-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 15px;
    border-left: 4px solid #dc3545;
    transition: all 0.3s ease;
}

.alert-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.alert-info {
    flex: 1;
}

.alert-client {
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    font-size: 16px;
}

.alert-details {
    color: #666;
    font-size: 14px;
    margin-bottom: 8px;
}

.alert-amount {
    font-weight: 700;
    color: #dc3545;
    font-size: 18px;
}

.no-alerts {
    text-align: center;
    color: #28a745;
    padding: 30px;
    font-style: italic;
    background: #d4edda;
    border-radius: 10px;
    border: 1px solid #c3e6cb;
}

.forecast-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.forecast-section h3 {
    margin: 0 0 20px 0;
    font-size: 20px;
    font-weight: 600;
}

.forecast-value {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 15px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.forecast-trend {
    display: flex;
    align-items: center;
    gap: 12px;
}

.trend-icon {
    font-size: 24px;
}

.trend-up {
    color: #28a745;
}

.trend-down {
    color: #dc3545;
}

.trend-stable {
    color: #ffc107;
}


/* ===== BADGES DE STATUT ===== */
.status-badges {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
}

.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-paid {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-unpaid {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.status-draft {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.status-partially-paid {
    background: var(--warning-orange);
    color: white;
    border: 1px solid var(--warning-orange);
}

/* ===== BOUTONS INFO ===== */
.btn-info {
    background: linear-gradient(135deg, #17a2b8, #138496);
    color: white;
}

.btn-info:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(23, 162, 184, 0.3);
}

/* ===== BOUTONS SPÉCIAUX ===== */
.btn-users {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
}

.btn-users:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(220, 53, 69, 0.3);
}

.btn-pdf {
    background: linear-gradient(135deg, #6c63ff, #5a52d5);
    color: white;
}

.btn-pdf:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(108, 99, 255, 0.3);
}

.btn-excel {
    background: linear-gradient(135deg, #28a745, #1e7e34);
    color: white;
}

.btn-excel:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(40, 167, 69, 0.3);
}

/* ===== DÉTAILS DES STATISTIQUES ===== */
.stat-details {
    margin-top: 15px;
    font-size: 14px;
    color: #666;
    text-align: center;
}

/* ===== STATISTIQUES DÉTAILLÉES CLIENT ===== */
.client-stats-detailed {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.client-stats-detailed .stat-card {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.client-stats-detailed .stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.client-stats-detailed .stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    font-size: 24px;
    color: white;
}

.client-stats-detailed .stat-icon.paid {
    background: linear-gradient(135deg, var(--success-green), #059669);
}

.client-stats-detailed .stat-icon.partially-paid {
    background: linear-gradient(135deg, var(--warning-orange), #D97706);
}

.client-stats-detailed .stat-icon.unpaid {
    background: linear-gradient(135deg, var(--error-red), #DC2626);
}

.client-stats-detailed .stat-content h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.client-stats-detailed .stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a1a;
}

/* ===== MESSAGES D'ERREUR ===== */
.no-data-message {
    text-align: center;
    color: #666;
    padding: 40px;
    font-style: italic;
}

/* ===== SECTION ALERTES ===== */
.alerts-section {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.alerts-section h3 {
    margin: 0 0 25px 0;
    color: #333;
    font-size: 20px;
    font-weight: 600;
    border-bottom: 3px solid #dc3545;
    padding-bottom: 15px;
    position: relative;
}

.alerts-section h3::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 50px;
    height: 3px;
    background: linear-gradient(90deg, #dc3545, #c82333);
}

.alert-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 15px;
    border-left: 4px solid #dc3545;
    transition: all 0.3s ease;
}

.alert-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* ===== OPTIONS TVA ===== */
.tva-options {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    border: 1px solid #e9ecef;
}

.tva-toggle {
    margin-bottom: 10px;
}

.tva-toggle label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
}

.tva-toggle input[type="checkbox"] {
    width: auto;
    margin: 0;
    cursor: pointer;
}

.tva-rate-input {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tva-rate-input label {
    font-weight: 600;
    color: #333;
    margin: 0;
    min-width: 80px;
}

.tva-rate-input input {
    width: 100px;
    padding: 8px 12px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.tva-rate-input input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.tva-rate-input input:disabled {
    background: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
}

/* ===== IMPORTATION ===== */
.import-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

.import-card {
    background: var(--bg-secondary, white);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 2px solid var(--border-color, transparent);
    position: relative;
    overflow: hidden;
}

.import-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #007bff, #0056b3);
}

body[data-theme='dark'] .import-card::before {
    background: linear-gradient(90deg, #00a8e8, #007bff);
}

.import-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
    border-color: #007bff;
}

body[data-theme='dark'] .import-card:hover {
    border-color: #00a8e8;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

.import-card h3 {
    color: var(--text-main, #2c3e50);
    font-size: 24px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.import-card h3 i {
    color: #007bff;
    font-size: 28px;
}

body[data-theme='dark'] .import-card h3 i {
    color: #00a8e8;
}

.import-card p {
    color: var(--text-secondary, #6c757d);
    margin-bottom: 25px;
    line-height: 1.6;
    font-size: 15px;
}

.import-features {
    list-style: none;
    padding: 0;
    margin-bottom: 25px;
}

.import-features li {
    padding: 10px 0;
    color: var(--text-main, #495057);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.import-features li::before {
    content: "✓";
    color: #28a745;
    font-weight: bold;
    font-size: 16px;
    background: rgba(40, 167, 69, 0.2);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

body[data-theme='dark'] .import-features li::before {
    color: #4ade80;
    background: rgba(40, 167, 69, 0.3);
}

.import-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.import-actions .btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.3s ease;
    text-decoration: none;
    border: none;
    cursor: pointer;
}

.btn-outline {
    background: transparent;
    color: #007bff;
    border: 2px solid #007bff !important;
}

body[data-theme='dark'] .btn-outline {
    color: #00a8e8;
    border-color: #00a8e8 !important;
}

.btn-outline:hover {
    background: #007bff;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
}

body[data-theme='dark'] .btn-outline:hover {
    background: #00a8e8;
    box-shadow: 0 4px 15px rgba(0, 168, 232, 0.3);
}

.supported-formats {
    background: var(--bg-secondary, #f8f9fa);
    border-radius: 12px;
    padding: 25px;
    margin-top: 30px;
    border: 1px solid var(--border-color, #e9ecef);
}

.supported-formats h4 {
    color: var(--text-main, #2c3e50);
    margin-bottom: 20px;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.supported-formats h4 i {
    color: #007bff;
}

body[data-theme='dark'] .supported-formats h4 i {
    color: #00a8e8;
}

.format-list {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.format-badge {
    background: var(--bg-main, #e9ecef);
    color: var(--text-main, #495057);
    padding: 10px 18px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid var(--border-color, #dee2e6);
}

.format-badge.excel {
    background: rgba(40, 167, 69, 0.2);
    color: #28a745;
    border-color: rgba(40, 167, 69, 0.3);
}

body[data-theme='dark'] .format-badge.excel {
    background: rgba(40, 167, 69, 0.3);
    color: #4ade80;
    border-color: rgba(40, 167, 69, 0.5);
}

.format-badge.csv {
    background: rgba(23, 162, 184, 0.2);
    color: #17a2b8;
    border-color: rgba(23, 162, 184, 0.3);
}

body[data-theme='dark'] .format-badge.csv {
    background: rgba(23, 162, 184, 0.3);
    color: #4dd0e1;
    border-color: rgba(23, 162, 184, 0.5);
}

.tips-section {
    background: rgba(255, 193, 7, 0.2);
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: 12px;
    padding: 25px;
    margin-top: 30px;
}

body[data-theme='dark'] .tips-section {
    background: rgba(255, 193, 7, 0.15);
    border-color: rgba(255, 193, 7, 0.4);
}

.tips-section h4 {
    color: #856404;
    margin-bottom: 20px;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

body[data-theme='dark'] .tips-section h4 {
    color: #fbbf24;
}

.tips-section h4 i {
    color: #ffc107;
}

body[data-theme='dark'] .tips-section h4 i {
    color: #fbbf24;
}

.tips-list {
    list-style: none;
    padding: 0;
}

.tips-list li {
    padding: 8px 0;
    color: #856404;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
    line-height: 1.5;
}

body[data-theme='dark'] .tips-list li {
    color: #fbbf24;
}

.tips-list li::before {
    content: "💡";
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 2px;
}

/* Styles spécifiques pour le dark mode */
body[data-theme='dark'] .import-card {
    background: var(--bg-secondary, #2d2d2d);
    border-color: var(--border-color, #404040);
}

body[data-theme='dark'] .supported-formats {
    background: var(--bg-secondary, #2d2d2d);
    border-color: var(--border-color, #404040);
}

/* Responsive pour l'importation */
@media (max-width: 768px) {
    .import-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .import-card {
        padding: 25px 20px;
    }
    
    .import-actions {
        flex-direction: column;
    }
    
    .import-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    .format-list {
        flex-direction: column;
    }
    
    .format-badge {
        text-align: center;
    }
}

/* ===== NOTIFICATIONS TOAST ===== */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

.notification {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-200);
    overflow: hidden;
    transform: translateX(100%);
    opacity: 0;
    transition: all var(--transition-bounce);
    position: relative;
}

.notification.show {
    transform: translateX(0);
    opacity: 1;
}

.notification.dismissing {
    transform: translateX(100%);
    opacity: 0;
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    position: relative;
}

.notification i:first-child {
    font-size: 20px;
    flex-shrink: 0;
}

.notification-message {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
    line-height: 1.4;
}

.notification-close {
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.notification-close:hover {
    background: var(--gray-100);
    color: var(--gray-600);
}

.notification-progress {
    height: 3px;
    background: var(--gray-200);
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    transform: scaleX(0);
    transform-origin: left;
    animation: notification-progress 5s linear forwards;
}

/* Types de notifications */
.notification-success {
    border-left: 4px solid var(--success-green);
}

.notification-success i:first-child {
    color: var(--success-green);
}

.notification-success .notification-progress {
    background: var(--success-green);
}

.notification-error {
    border-left: 4px solid var(--error-red);
}

.notification-error i:first-child {
    color: var(--error-red);
}

.notification-error .notification-progress {
    background: var(--error-red);
}

.notification-warning {
    border-left: 4px solid var(--warning-orange);
}

.notification-warning i:first-child {
    color: var(--warning-orange);
}

.notification-warning .notification-progress {
    background: var(--warning-orange);
}

.notification-info {
    border-left: 4px solid var(--primary-light);
}

.notification-info i:first-child {
    color: var(--primary-light);
}

.notification-info .notification-progress {
    background: var(--primary-light);
}

@keyframes notification-progress {
    from {
        transform: scaleX(1);
    }
    to {
        transform: scaleX(0);
    }
}

/* Responsive pour les notifications */
@media (max-width: 768px) {
    .notification-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .notification {
        transform: translateY(-100%);
    }
}

/* ===== TEMPLATE POLISH OVERRIDES ===== */
body[data-theme='dark'] .bg-white,
body[data-theme='dark'] .card-header.bg-white,
body[data-theme='dark'] .table-light {
    background: var(--bg-secondary) !important;
    color: var(--text-main) !important;
    border-color: var(--border-color, rgba(255, 255, 255, 0.08)) !important;
}

body[data-theme='dark'] .card,
body[data-theme='dark'] .card-header,
body[data-theme='dark'] .card-body {
    background: var(--bg-secondary);
    color: var(--text-main);
    border-color: var(--border-color, rgba(255, 255, 255, 0.08));
}

body[data-theme='dark'] .card {
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-lg);
}

body[data-theme='dark'] .list-group,
body[data-theme='dark'] .list-group-item {
    background: var(--bg-secondary);
    color: var(--text-main);
    border-color: var(--border-color, rgba(255, 255, 255, 0.08));
}

body[data-theme='dark'] .table,
body[data-theme='dark'] .table thead th,
body[data-theme='dark'] .table tbody td {
    background: var(--bg-secondary);
    color: var(--text-main);
    border-color: var(--border-color, rgba(255, 255, 255, 0.08));
}

body[data-theme='dark'] .table tbody tr:hover {
    background: var(--bg-tertiary, #2a2a2a);
}

body[data-theme='dark'] .filters-bar {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
}

body[data-theme='dark'] .filters-bar label {
    color: var(--text-secondary);
}

body[data-theme='dark'] .filters-bar input,
body[data-theme='dark'] .filters-bar select {
    background: var(--bg-main);
    color: var(--text-main);
    border-color: var(--border-color, rgba(255, 255, 255, 0.12));
}

body[data-theme='dark'] .active-filters {
    color: var(--accent-blue);
}

body[data-theme='dark'] .active-filters span {
    background: var(--bg-tertiary, #2a2a2a);
    color: var(--text-main);
}

body[data-theme='dark'] [style*="background: white"],
body[data-theme='dark'] [style*="background: #fff"],
body[data-theme='dark'] [style*="background:#fff"],
body[data-theme='dark'] [style*="background-color: white"],
body[data-theme='dark'] [style*="background-color: #fff"],
body[data-theme='dark'] [style*="background-color:#fff"],
body[data-theme='dark'] [style*="background: #f8f9fa"],
body[data-theme='dark'] [style*="background:#f8f9fa"],
body[data-theme='dark'] [style*="background-color: #f8f9fa"],
body[data-theme='dark'] [style*="background-color:#f8f9fa"],
body[data-theme='dark'] [style*="background: #f9fafb"],
body[data-theme='dark'] [style*="background:#f9fafb"],
body[data-theme='dark'] [style*="background-color: #f9fafb"],
body[data-theme='dark'] [style*="background-color:#f9fafb"] {
    background: var(--bg-secondary) !important;
    color: var(--text-main) !important;
    border-color: var(--border-color, rgba(255, 255, 255, 0.08)) !important;
}
