/* ==============================================
   COMMON.CSS - Modern Minimalist Design 2024
   Version optimisée avec DARK MODE complet
   🎨 NOUVELLES NUANCES DE BLEU - 2024
   ✨ POLICE SATOSHI INTÉGRÉE
   ============================================== */

/* ============================================
   IMPORT POLICE SATOSHI
   ============================================ */

@import url('https://api.fontshare.com/v2/css?f[]=satoshi@900,700,500,400,300&display=swap');

/* ============================================
   VARIABLES CSS - MODE CLAIR
   ============================================ */

:root {
    /* 🎨 NOUVELLES COULEURS BLEUES 2024 */
    --primary-color: #1e5eeb;
    --primary-dark: #0d3d9f;
    --primary-light: #4c8aff;
    --primary-ultra-light: #e8f2ff;
    
    /* Gradients bleus */
    --gradient-blue-start: #1e5eeb;
    --gradient-blue-mid: #2d6bff;
    --gradient-blue-end: #4c8aff;
    
    --secondary-color: #64748b;
    --secondary-dark: #475569;
    --secondary-light: #94a3b8;
    
    /* Couleurs d'accent */
    --accent-color: #8b5cf6;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #1e5eeb;
    
    /* Couleurs neutres - MODE CLAIR */
    --background-primary: #ffffff;
    --background-secondary: #f8fafc;
    --background-tertiary: #f1f5f9;
    --background-overlay: rgba(0, 0, 0, 0.5);
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #94a3b8;
    --text-inverse: #ffffff;
    
    --border-color: #e2e8f0;
    --border-color-hover: #cbd5e1;
    --border-color-focus: #1e5eeb;
    
    /* Ombres modernes */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -1px rgb(0 0 0 / 0.06);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -2px rgb(0 0 0 / 0.05);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 10px 10px -5px rgb(0 0 0 / 0.04);
    --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
    
    /* GRAPHIQUES - MODE CLAIR */
    --chart-bg: #ffffff;
    --chart-grid-color: rgba(0, 0, 0, 0.1);
    --chart-text-color: #64748b;
    --chart-axis-color: #94a3b8;
    --chart-tooltip-bg: #ffffff;
    --chart-tooltip-text: #0f172a;
    --chart-tooltip-border: #e2e8f0;
    --chart-legend-text: #475569;
    
    /* CARTES - MODE CLAIR */
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --card-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --card-hover-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    
    /* Espacements harmonieux */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    
    /* Border radius cohérents */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    
    /* Transitions fluides */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Z-index hierarchy */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
}

/* ============================================
   DARK MODE - Variables complètes
   ============================================ */

body.dark-mode {
    /* 🎨 NOUVELLES COULEURS BLEUES - MODE SOMBRE */
    --primary-color: #4c8aff;
    --primary-dark: #1a4db8;
    --primary-light: #6da3ff;
    --primary-ultra-light: #0f2451;
    
    /* Gradients bleus - DARK MODE */
    --gradient-blue-start: #1a4db8;
    --gradient-blue-mid: #2d6bff;
    --gradient-blue-end: #4c8aff;
    
    --secondary-color: #94a3b8;
    --secondary-dark: #cbd5e1;
    --secondary-light: #64748b;
    
    /* Couleurs d'accent - MODE SOMBRE */
    --accent-color: #a78bfa;
    --success-color: #34d399;
    --danger-color: #f87171;
    --warning-color: #fbbf24;
    --info-color: #60a5fa;
    
    /* Couleurs neutres - MODE SOMBRE */
    --background-primary: #0f172a;
    --background-secondary: #1e293b;
    --background-tertiary: #334155;
    --background-overlay: rgba(0, 0, 0, 0.7);
    
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    --text-inverse: #0f172a;
    
    --border-color: rgba(255, 255, 255, 0.1);
    --border-color-hover: rgba(255, 255, 255, 0.2);
    --border-color-focus: #4c8aff;
    
    /* Ombres - MODE SOMBRE */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.6), 0 2px 4px -1px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.7), 0 4px 6px -2px rgba(0, 0, 0, 0.6);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.8), 0 10px 10px -5px rgba(0, 0, 0, 0.7);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    
    /* GRAPHIQUES - MODE SOMBRE */
    --chart-bg: #1e293b;
    --chart-grid-color: rgba(255, 255, 255, 0.1);
    --chart-text-color: #94a3b8;
    --chart-axis-color: #64748b;
    --chart-tooltip-bg: #1e293b;
    --chart-tooltip-text: #f8fafc;
    --chart-tooltip-border: rgba(255, 255, 255, 0.1);
    --chart-legend-text: #cbd5e1;
    
    /* CARTES - MODE SOMBRE */
    --card-bg: #1e293b;
    --card-border: rgba(255, 255, 255, 0.1);
    --card-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.5);
    --card-hover-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.6);
}

/* ============================================
   RESET MODERNE
   ============================================ */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', 'Roboto', 
                 'Helvetica Neue', Arial, sans-serif;
    background: var(--background-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    font-size: 0.9375rem;
    overflow-x: hidden;
    transition: background-color var(--transition-base), color var(--transition-base);
}

/* ============================================
   TYPOGRAPHY - Avec support dark mode
   ============================================ */

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    margin-block-start: 0;
    margin-block-end: 0;
    transition: color var(--transition-base);
}

h1 {
    font-size: clamp(1.875rem, 5vw, 2.25rem);
    font-weight: 700;
}

h2 {
    font-size: clamp(1.5rem, 4vw, 1.875rem);
}

h3 {
    font-size: clamp(1.25rem, 3vw, 1.5rem);
}

h4 {
    font-size: 1.25rem;
}

h5 {
    font-size: 1.125rem;
}

h6 {
    font-size: 1rem;
}

p {
    margin-bottom: var(--spacing-md);
    color: var(--text-secondary);
    transition: color var(--transition-base);
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-dark);
}

a:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

label,
.label {
    color: var(--text-primary);
    transition: color var(--transition-base);
}

small,
.small-text {
    color: var(--text-tertiary);
    transition: color var(--transition-base);
}

/* ============================================
   LAYOUT
   ============================================ */

.container {
    width: 100%;
    max-width: 1400px;
    margin-inline: auto;
    padding-inline: var(--spacing-lg);
}

.content {
    padding-block: var(--spacing-2xl);
}

/* ============================================
   CARDS - Adaptation dark mode
   ============================================ */

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    box-shadow: var(--card-shadow);
    transition: all var(--transition-base);
    container-type: inline-size;
}

.card:hover {
    box-shadow: var(--card-hover-shadow);
    border-color: var(--border-color-hover);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin: 0;
    transition: color var(--transition-base);
}

.card-title i {
    color: var(--primary-color);
    font-size: 1.1rem;
    transition: color var(--transition-base);
}

.card-body {
    color: var(--text-secondary);
    transition: color var(--transition-base);
}

.card-footer {
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--border-color);
}

.section {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
    box-shadow: var(--card-shadow);
    transition: all var(--transition-base);
}

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    transition: color var(--transition-base);
}

.section-title i {
    color: var(--primary-color);
    transition: color var(--transition-base);
}

/* ============================================
   BUTTONS - Design moderne
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 0.625rem 1.25rem;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
    text-decoration: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.btn:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--background-primary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--background-tertiary);
    border-color: var(--border-color-hover);
}

.btn-accent {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.btn-accent:hover:not(:disabled) {
    background: #7c3aed;
    border-color: #7c3aed;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-success {
    background: var(--success-color);
    color: white;
    border-color: var(--success-color);
}

.btn-success:hover:not(:disabled) {
    background: #059669;
    border-color: #059669;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
    border-color: var(--danger-color);
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
    border-color: #dc2626;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
    background: var(--background-tertiary);
    color: var(--text-primary);
}

.btn-sm {
    padding: 0.375rem 0.875rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

/* ============================================
   FORMS - Adaptation dark mode
   ============================================ */

.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
    transition: color var(--transition-base);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    color: var(--text-primary);
    background: var(--background-primary);
    transition: all var(--transition-base);
    font-family: inherit;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--border-color-focus);
    box-shadow: 0 0 0 3px rgba(30, 94, 235, 0.1);
}

body.dark-mode .form-input:focus,
body.dark-mode .form-select:focus,
body.dark-mode .form-textarea:focus {
    box-shadow: 0 0 0 3px rgba(76, 138, 255, 0.2);
}

.form-input::placeholder {
    color: var(--text-tertiary);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 12px;
    padding-right: 2.5rem;
    appearance: none;
}

body.dark-mode .form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

/* ============================================
   INFO BOX - Adaptation dark mode
   ============================================ */

.info-box {
    background: var(--background-tertiary);
    border-left: 3px solid var(--primary-color);
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-lg);
    transition: all var(--transition-base);
}

.info-box.success {
    border-left-color: var(--success-color);
    background: rgb(16 185 129 / 0.05);
}

body.dark-mode .info-box.success {
    background: rgb(52 211 153 / 0.1);
}

.info-box.warning {
    border-left-color: var(--warning-color);
    background: rgb(245 158 11 / 0.05);
}

body.dark-mode .info-box.warning {
    background: rgb(251 191 36 / 0.1);
}

.info-box.danger {
    border-left-color: var(--danger-color);
    background: rgb(239 68 68 / 0.05);
}

body.dark-mode .info-box.danger {
    background: rgb(248 113 113 / 0.1);
}

.info-box h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
}

.info-box p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0;
}

/* ============================================
   BADGES & CHIPS
   ============================================ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
    line-height: 1;
    transition: all var(--transition-base);
}

.badge-primary {
    background: rgba(30, 94, 235, 0.1);
    color: var(--primary-color);
}

body.dark-mode .badge-primary {
    background: rgba(76, 138, 255, 0.2);
    color: var(--primary-light);
}

.badge-success {
    background: rgb(16 185 129 / 0.1);
    color: var(--success-color);
}

body.dark-mode .badge-success {
    background: rgb(52 211 153 / 0.2);
}

.badge-danger {
    background: rgb(239 68 68 / 0.1);
    color: var(--danger-color);
}

body.dark-mode .badge-danger {
    background: rgb(248 113 113 / 0.2);
}

.badge-warning {
    background: rgb(245 158 11 / 0.1);
    color: var(--warning-color);
}

body.dark-mode .badge-warning {
    background: rgb(251 191 36 / 0.2);
}

.badge-secondary {
    background: var(--background-tertiary);
    color: var(--text-secondary);
}

/* ============================================
   HELP ICON
   ============================================ */

.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: var(--background-tertiary);
    color: var(--text-secondary);
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    border: 1px solid var(--border-color);
}

.help-icon:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: scale(1.1);
}

.help-icon:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ============================================
   MODALS - Dark mode support + BOUTON FERMETURE STYLISÉ
   ============================================ */

.modal {
    display: none;
    position: fixed;
    z-index: var(--z-modal);
    inset: 0;
    overflow: auto;
    background-color: var(--background-overlay);
    backdrop-filter: blur(4px);
    animation: fadeIn var(--transition-base);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl);
}

.modal-content {
    background: var(--background-primary);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: slideUp var(--transition-slow);
    border: 1px solid var(--border-color);
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-xl);
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

/* ✅ BOUTON DE FERMETURE STYLISÉ */
.modal-close,
.close-modal {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(239, 68, 68, 0.2);
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    font-size: 1.125rem;
    z-index: 10;
}

.modal-close:hover,
.close-modal:hover {
    background: var(--danger-color);
    color: white;
    border-color: var(--danger-color);
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.modal-close:active,
.close-modal:active {
    transform: scale(0.95) rotate(90deg);
}

.modal-close:focus-visible,
.close-modal:focus-visible {
    outline: 2px solid var(--danger-color);
    outline-offset: 2px;
}

.modal-body {
    padding: var(--spacing-xl);
}

.modal-footer {
    padding: var(--spacing-xl);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: var(--spacing-md);
    justify-content: flex-end;
}

/* ============================================
   TABLES - Dark mode support
   ============================================ */

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--background-primary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: background var(--transition-base);
}

thead {
    background: var(--background-secondary);
    transition: background var(--transition-base);
}

thead th {
    padding: var(--spacing-md);
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: color var(--transition-base);
}

tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: all var(--transition-base);
}

tbody tr:last-child {
    border-bottom: none;
}

tbody tr:hover {
    background: var(--background-tertiary);
}

tbody td {
    padding: var(--spacing-md);
    color: var(--text-secondary);
    transition: color var(--transition-base);
}

/* ============================================
   FOOTER
   ============================================ */

footer {
    background: var(--background-primary);
    border-top: 1px solid var(--border-color);
    padding: var(--spacing-xl) 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: auto;
    transition: all var(--transition-base);
}

/* ============================================
   CODE BLOCKS - Dark mode
   ============================================ */

code,
pre {
    background: var(--background-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.125rem 0.375rem;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.875em;
    transition: all var(--transition-base);
}

pre {
    padding: var(--spacing-md);
    overflow-x: auto;
}

pre code {
    border: none;
    padding: 0;
    background: transparent;
}

/* ============================================
   DARK MODE - Styles spécifiques additionnels
   ============================================ */

body.dark-mode {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.dark-mode .top-header {
    background: var(--background-primary);
    border-bottom: 1px solid var(--border-color);
}

body.dark-mode .stat-box,
body.dark-mode .stat-card,
body.dark-mode .metric-card {
    background: var(--background-secondary);
    border-color: var(--border-color);
}

body.dark-mode .search-input,
body.dark-mode input[type="search"] {
    background: var(--background-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

body.dark-mode .dropdown,
body.dark-mode .search-suggestions,
body.dark-mode .autocomplete-dropdown {
    background: var(--background-primary);
    border-color: var(--border-color);
    box-shadow: var(--shadow-lg);
}

body.dark-mode .dropdown-item:hover,
body.dark-mode .suggestion-item:hover {
    background: var(--background-secondary);
}

body.dark-mode ul li,
body.dark-mode ol li {
    color: var(--text-secondary);
}

hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: var(--spacing-lg) 0;
}

/* ============================================
   SCROLLBAR CUSTOM - Dark mode
   ============================================ */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--background-tertiary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color-hover);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

body.dark-mode::-webkit-scrollbar-track {
    background: var(--background-secondary);
}

body.dark-mode::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

body.dark-mode::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ============================================
   SKELETON LOADING
   ============================================ */

.skeleton {
    background: linear-gradient(
        90deg,
        var(--background-tertiary) 0%,
        var(--background-secondary) 50%,
        var(--background-tertiary) 100%
    );
    background-size: 200% 100%;
    animation: skeletonLoading 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeletonLoading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 1rem;
    margin-bottom: var(--spacing-sm);
}

.skeleton-title {
    height: 1.5rem;
    margin-bottom: var(--spacing-md);
    width: 60%;
}

.skeleton-box {
    height: 100px;
    margin-bottom: var(--spacing-md);
}

/* ============================================
   LOADING STATES
   ============================================ */

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.loading-lg {
    width: 40px;
    height: 40px;
    border-width: 3px;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-muted {
    color: var(--text-secondary) !important;
}

.text-primary {
    color: var(--primary-color) !important;
}

.text-success {
    color: var(--success-color) !important;
}

.text-danger {
    color: var(--danger-color) !important;
}

.text-warning {
    color: var(--warning-color) !important;
}

.font-bold {
    font-weight: 600;
}

.font-semibold {
    font-weight: 500;
}

.bg-primary {
    background-color: var(--background-primary) !important;
}

.bg-secondary {
    background-color: var(--background-secondary) !important;
}

.bg-tertiary {
    background-color: var(--background-tertiary) !important;
}

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--spacing-sm); }
.mt-2 { margin-top: var(--spacing-md); }
.mt-3 { margin-top: var(--spacing-lg); }
.mt-4 { margin-top: var(--spacing-xl); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--spacing-sm); }
.mb-2 { margin-bottom: var(--spacing-md); }
.mb-3 { margin-bottom: var(--spacing-lg); }
.mb-4 { margin-bottom: var(--spacing-xl); }

.gap-1 { gap: var(--spacing-sm); }
.gap-2 { gap: var(--spacing-md); }
.gap-3 { gap: var(--spacing-lg); }

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ============================================
   DARK MODE TOGGLE BUTTON
   ============================================ */

.dark-mode-toggle {
    background: var(--background-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.dark-mode-toggle:hover {
    background: var(--border-color-hover);
    transform: scale(1.05);
}

.dark-mode-toggle:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.dark-mode-toggle i {
    transition: transform var(--transition-base);
}

.dark-mode-toggle:active i {
    transform: rotate(20deg);
}

/* ═══════════════════════════════════════════════════════════════
   AJOUTS POUR LE MENU PROFIL - USER AUTHENTICATION
   ═══════════════════════════════════════════════════════════════ */

.nav-cta {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.nav-cta-logged-out {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.nav-cta-logged-in {
    display: none;
}

body.user-authenticated .nav-cta-logged-out {
    display: none;
}

body.user-authenticated .nav-cta-logged-in {
    display: flex;
}

.user-profile-menu {
    position: relative;
}

.user-profile-button {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.375rem 0.875rem 0.375rem 0.375rem;
    background: var(--background-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-base);
    min-height: 48px;
    font-family: inherit;
}

.user-profile-button:hover {
    background: var(--background-tertiary);
    border-color: var(--border-color-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.user-profile-button:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.user-profile-button[aria-expanded="true"] {
    background: var(--background-tertiary);
    border-color: var(--primary-color);
}

.user-profile-button[aria-expanded="true"] .user-dropdown-icon {
    transform: rotate(180deg);
}

.user-avatar-wrapper {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.user-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 2px solid var(--background-primary);
    border-radius: 50%;
    box-shadow: 0 0 0 2px var(--primary-color);
}

.user-status-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background: var(--success-color);
    border: 2px solid var(--background-primary);
    border-radius: 50%;
    animation: statusPulse 2s infinite;
}

@keyframes statusPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(16, 185, 129, 0);
    }
}

.user-info-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.125rem;
    max-width: 120px;
}

.user-display-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    transition: color var(--transition-base);
}

.user-plan-badge {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    transition: color var(--transition-base);
}

.user-dropdown-icon {
    color: var(--text-tertiary);
    font-size: 0.75rem;
    margin-left: 0.25rem;
    transition: transform var(--transition-base), color var(--transition-base);
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    width: 320px;
    background: var(--background-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-base);
    z-index: var(--z-dropdown);
    overflow: hidden;
}

.user-dropdown-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    padding: 1.25rem;
    background: linear-gradient(135deg, var(--gradient-blue-start) 0%, var(--gradient-blue-end) 100%);
    color: white;
}

.dropdown-user-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.dropdown-user-card img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}

.dropdown-user-text {
    flex: 1;
    min-width: 0;
}

.dropdown-user-text h4 {
    font-size: 1rem;
    font-weight: 600;
    color: white;
    margin: 0 0 0.25rem 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-user-text p {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-plan-info {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    backdrop-filter: blur(10px);
}

.dropdown-plan-info i {
    font-size: 0.875rem;
    color: #FCD34D;
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.5rem 0;
}

.dropdown-section {
    padding: 0.5rem;
}

.dropdown-link {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    color: var(--text-primary);
    border: 1px solid transparent;
    background: transparent;
    width: 100%;
    text-align: left;
    position: relative;
    font-family: inherit;
}

.dropdown-link:hover {
    background: var(--background-secondary);
    border-color: var(--border-color);
    transform: translateX(2px);
}

.dropdown-link:active {
    transform: translateX(0);
}

.dropdown-link:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: -2px;
}

.dropdown-link-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--background-secondary);
    border-radius: var(--radius-md);
    flex-shrink: 0;
    transition: all var(--transition-base);
}

.dropdown-link:hover .dropdown-link-icon {
    background: var(--primary-color);
    color: white;
    transform: scale(1.05);
}

.dropdown-link-icon i {
    font-size: 1rem;
    color: var(--primary-color);
    transition: color var(--transition-base);
}

.dropdown-link:hover .dropdown-link-icon i {
    color: white;
}

.dropdown-link-text {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    flex: 1;
    min-width: 0;
}

.dropdown-link-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color var(--transition-base);
}

.dropdown-link-desc {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color var(--transition-base);
}

.dropdown-notification-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 0.5rem;
    background: var(--primary-color);
    color: white;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.dropdown-link-danger {
    color: var(--danger-color);
}

.dropdown-link-danger .dropdown-link-icon {
    background: rgba(239, 68, 68, 0.1);
}

.dropdown-link-danger .dropdown-link-icon i {
    color: var(--danger-color);
}

.dropdown-link-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--danger-color);
}

.dropdown-link-danger:hover .dropdown-link-icon {
    background: var(--danger-color);
}

.dropdown-link-danger:hover .dropdown-link-icon i {
    color: white;
}

.dropdown-link-danger .dropdown-link-title {
    color: var(--danger-color);
}

.toast-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    min-width: 320px;
    max-width: 500px;
    padding: 1rem 1.25rem;
    background: var(--background-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    z-index: var(--z-tooltip);
    opacity: 0;
    transform: translateX(400px);
    transition: all var(--transition-slow);
    pointer-events: none;
}

.toast-notification.show {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.toast-notification-content {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    color: var(--text-primary);
}

.toast-notification-content i {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.toast-notification-content span {
    flex: 1;
    font-size: 0.9375rem;
    font-weight: 500;
}

.toast-notification.success {
    border-left: 4px solid var(--success-color);
}

.toast-notification.success .toast-notification-content i {
    color: var(--success-color);
}

.toast-notification.error {
    border-left: 4px solid var(--danger-color);
}

.toast-notification.error .toast-notification-content i {
    color: var(--danger-color);
}

.toast-notification.warning {
    border-left: 4px solid var(--warning-color);
}

.toast-notification.warning .toast-notification-content i {
    color: var(--warning-color);
}

.toast-notification.info {
    border-left: 4px solid var(--info-color);
}

.toast-notification.info .toast-notification-content i {
    color: var(--info-color);
}

body.dark-mode .user-profile-button {
    background: var(--background-secondary);
    border-color: var(--border-color);
}

body.dark-mode .user-profile-button:hover {
    background: var(--background-tertiary);
}

body.dark-mode .user-dropdown-menu {
    background: var(--background-secondary);
    border-color: var(--border-color);
}

body.dark-mode .dropdown-link:hover {
    background: var(--background-tertiary);
}

body.dark-mode .dropdown-link-icon {
    background: var(--background-tertiary);
}

body.dark-mode .dropdown-link:hover .dropdown-link-icon {
    background: var(--primary-color);
}

/* ============================================
   RESPONSIVE - Mobile First
   ============================================ */

@media (max-width: 768px) {
    html {
        font-size: 14px;
    }
    
    .container {
        padding-inline: var(--spacing-md);
    }
    
    .content {
        padding-block: var(--spacing-lg);
    }
    
    .card,
    .section {
        padding: var(--spacing-lg);
    }
    
    .modal-content {
        max-width: 100%;
        margin: var(--spacing-md);
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
    }

    .user-info-text {
        display: none;
    }

    .user-profile-button {
        padding: 0.375rem;
    }

    .user-dropdown-menu {
        width: 280px;
        right: -1rem;
    }

    .dropdown-header {
        padding: 1rem;
    }

    .dropdown-user-card {
        margin-bottom: 0.75rem;
    }

    .dropdown-user-card img {
        width: 48px;
        height: 48px;
    }

    .dropdown-user-text h4 {
        font-size: 0.875rem;
    }

    .dropdown-link {
        padding: 0.625rem;
    }

    .dropdown-link-icon {
        width: 36px;
        height: 36px;
    }

    .dropdown-link-icon i {
        font-size: 0.875rem;
    }

    .toast-notification {
        top: auto;
        bottom: 20px;
        left: 20px;
        right: 20px;
        min-width: auto;
        max-width: none;
        transform: translateY(400px);
    }

    .toast-notification.show {
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .card,
    .section {
        padding: var(--spacing-md);
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .user-dropdown-menu {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        max-height: 80vh;
        overflow-y: auto;
    }

    .user-dropdown-menu.active {
        transform: translateY(0);
    }

    .user-dropdown-menu:not(.active) {
        transform: translateY(100%);
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    body {
        background: white !important;
        color: black !important;
    }
    
    .sidebar,
    .mobile-toggle,
    .btn,
    .dark-mode-toggle,
    .modal {
        display: none !important;
    }
    
    .main-content {
        margin: 0 !important;
        box-shadow: none !important;
    }
    
    .card,
    .section {
        border: 1px solid #ccc !important;
        box-shadow: none !important;
    }
}

/* ============================================
   REDUCED MOTION SUPPORT
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ============================================
   PARTICLES BACKGROUND - OPTIMIZED (NO LAG)
   ============================================ */

.particles-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
    opacity: 0.6;
    transition: opacity 0.5s ease;
}

body.dark-mode .particles-background {
    opacity: 0.3;
}

/* ============================================
   LAYOUT STRUCTURE (SIMPLE & FAST)
   ============================================ */

/* Wrapper principal : transparent pour voir les particules */
.layout-wrapper {
    position: relative;
    z-index: 1;
    background: transparent !important;
}

/* ✅ ZONE DE CONTENU : BLANC PUR (pas de blur = pas de lag) */
.main-content {
    background: #ffffff !important;
}

/* Container : transparent */
.container {
    background: transparent;
}

/* ============================================
   SECTIONS & CARDS (BLANC PUR)
   ============================================ */

.section {
    background: #ffffff !important;
}

.top-header {
    background: #ffffff !important;
}

.card,
.chart-wrapper,
.toolbar {
    background: #ffffff !important;
}

/* ============================================
   DARK MODE (SIMPLE)
   ============================================ */

body.dark-mode .main-content {
    background: #0f172a !important;
}

body.dark-mode .section {
    background: #1e293b !important;
}

body.dark-mode .top-header {
    background: #0f172a !important;
}

body.dark-mode .card,
body.dark-mode .chart-wrapper,
body.dark-mode .toolbar {
    background: #1e293b !important;
}

/* ═══════════════════════════════════════════════════════════════
   UPGRADE MODAL - GLASSMORPHISM PREMIUM
   ═══════════════════════════════════════════════════════════════ */

.upgrade-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.upgrade-modal {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(40px) saturate(180%);
    border-radius: 28px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 
        0 20px 60px rgba(59, 130, 246, 0.3),
        0 0 80px rgba(139, 92, 246, 0.2);
    padding: 50px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

body.dark-mode .upgrade-modal {
    background: rgba(15, 23, 42, 0.95);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.upgrade-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    box-shadow: 0 10px 30px rgba(245, 158, 11, 0.4);
    animation: iconPulse 2s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.upgrade-icon i {
    font-size: 2.5rem;
    color: white;
}

.upgrade-modal h2 {
    font-size: 2rem;
    font-weight: 900;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #3B82F6, #8B5CF6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.upgrade-modal p {
    font-size: 1.1rem;
    color: #64748b;
    margin-bottom: 32px;
    line-height: 1.6;
}

body.dark-mode .upgrade-modal p {
    color: #cbd5e1;
}

.upgrade-cta-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-upgrade-primary {
    padding: 16px 32px;
    font-size: 1.1rem;
    font-weight: 800;
    color: white;
    background: linear-gradient(135deg, #3B82F6, #8B5CF6);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4);
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-upgrade-primary:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(59, 130, 246, 0.5);
}

.btn-upgrade-secondary {
    padding: 16px 32px;
    font-size: 1.1rem;
    font-weight: 700;
    color: #64748b;
    background: transparent;
    border: 2px solid #cbd5e1;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-upgrade-secondary:hover {
    background: rgba(203, 213, 225, 0.1);
    border-color: #94a3b8;
}

body.dark-mode .btn-upgrade-secondary {
    color: #cbd5e1;
    border-color: #475569;
}

body.dark-mode .btn-upgrade-secondary:hover {
    background: rgba(71, 85, 105, 0.2);
    border-color: #64748b;
}