/* ========================================
   SITE BTP - FEUILLE DE STYLES PRINCIPALE
   ======================================== */

/* Variables CSS - Thème Sombre (par défaut) */
:root {
    /* Couleurs principales - Bleu Nuit */
    --bg-primary: #0d1b2a;
    --bg-secondary: #1b263b;
    --bg-tertiary: #415a77;
    --bg-card: #1b263b;
    --bg-hover: #2d3f5a;
    
    /* Textes */
    --text-primary: #e0e1dd;
    --text-secondary: #a8b2c1;
    --text-muted: #778da9;
    
    /* Accents - Couleurs du logo ECORSE AFRIC */
    --accent-primary: #3a5ba0;
    --accent-secondary: #4a6db8;
    --accent-success: #7cb342;
    --accent-warning: #fcc419;
    --accent-danger: #ff6b6b;
    --accent-info: #3a5ba0;
    --accent-green: #7cb342;
    --accent-blue: #3a5ba0;
    
    /* Catégories */
    --color-commercial: #3a5ba0;
    --color-technique: #7cb342;
    --color-rh: #fcc419;
    --color-admin: #cc5de8;
    --color-logistique: #ff922b;
    --color-securite: #ff6b6b;
    
    /* Bordures & Ombres */
    --border-color: #415a77;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    
    /* Dimensions */
    --sidebar-width: 280px;
    --sidebar-collapsed: 70px;
    --header-height: 60px;
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

/* Thème Clair */
[data-theme="light"] {
    --bg-primary: #f8f9fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e9ecef;
    --bg-card: #ffffff;
    --bg-hover: #e9ecef;
    
    --text-primary: #212529;
    --text-secondary: #495057;
    --text-muted: #6c757d;
    
    --accent-primary: #3a5ba0;
    --accent-secondary: #4a6db8;
    --accent-green: #7cb342;
    --accent-blue: #3a5ba0;
    
    --border-color: #dee2e6;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: var(--transition);
}

a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--accent-secondary);
}

/* ========================================
   LAYOUT PRINCIPAL
   ======================================== */

.app-container {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: var(--transition);
}

.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed);
}

.content-wrapper {
    padding: 24px;
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height));
}

/* ========================================
   HEADER
   ======================================== */

.header {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 100;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.sidebar-collapsed .header {
    left: var(--sidebar-collapsed);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.menu-toggle {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.menu-toggle:hover {
    background: var(--bg-hover);
}

/* Barre de recherche */
.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    padding: 8px 16px;
    gap: 8px;
    min-width: 300px;
}

.search-box input {
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    width: 100%;
    font-size: 0.95rem;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.search-box i {
    color: var(--text-muted);
}

/* Switch Thème */
.theme-switch {
    display: flex;
    align-items: center;
    gap: 8px;
}

.theme-switch label {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: var(--bg-tertiary);
    transition: var(--transition);
    border-radius: 26px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: var(--accent-primary);
    transition: var(--transition);
    border-radius: 50%;
}

.theme-switch input:checked + .slider:before {
    transform: translateX(24px);
}

.theme-icon {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

/* ========================================
   SIDEBAR
   ======================================== */

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    z-index: 200;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed);
}

/* Logo */
.sidebar-logo {
    height: 80px;
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    gap: 14px;
    background: linear-gradient(135deg, rgba(58, 91, 160, 0.1) 0%, rgba(124, 179, 66, 0.1) 100%);
}

.sidebar-logo .logo-img {
    width: 50px;
    height: 50px;
    min-width: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent-primary);
    box-shadow: 0 4px 12px rgba(58, 91, 160, 0.3);
    transition: var(--transition);
}

.sidebar-logo .logo-img:hover {
    transform: scale(1.05);
    border-color: var(--accent-success);
    box-shadow: 0 6px 16px rgba(124, 179, 66, 0.4);
}

.sidebar-collapsed .sidebar-logo .logo-img {
    width: 40px;
    height: 40px;
    min-width: 40px;
}

.sidebar-logo h1 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent-primary);
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-collapsed .sidebar-logo h1 {
    opacity: 0;
    width: 0;
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    display: none;
}

.sidebar-collapsed .nav-section-title {
    opacity: 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    gap: 12px;
    margin-bottom: 4px;
    transition: var(--transition);
    white-space: nowrap;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-primary);
    color: #ffffff;
}

.nav-item i {
    font-size: 1.2rem;
    min-width: 24px;
    text-align: center;
}

.nav-item span {
    overflow: hidden;
}

.sidebar-collapsed .nav-item span {
    opacity: 0;
    width: 0;
}

/* Badge catégorie */
.nav-badge {
    margin-left: auto;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
}

.badge-commercial { background: var(--color-commercial); color: #fff; }
.badge-technique { background: var(--color-technique); color: #fff; }
.badge-rh { background: var(--color-rh); color: #000; }
.badge-admin { background: var(--color-admin); color: #fff; }
.badge-logistique { background: var(--color-logistique); color: #fff; }
.badge-securite { background: var(--color-securite); color: #fff; }

.sidebar-collapsed .nav-badge {
    display: none;
}

/* ========================================
   BREADCRUMB
   ======================================== */

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    font-size: 0.9rem;
}

.breadcrumb a {
    color: var(--text-muted);
}

.breadcrumb a:hover {
    color: var(--accent-primary);
}

.breadcrumb span {
    color: var(--text-muted);
}

.breadcrumb .current {
    color: var(--text-primary);
    font-weight: 500;
}

/* ========================================
   TITRES & SECTIONS
   ======================================== */

.page-header {
    margin-bottom: 32px;
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--accent-primary);
    display: inline-block;
}

/* ========================================
   CARTES
   ======================================== */

.card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    padding: 24px;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.card-body {
    color: var(--text-secondary);
}

/* Grilles de cartes */
.cards-grid {
    display: grid;
    gap: 24px;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* Cartes module dashboard */
.module-card {
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.module-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    transition: var(--transition);
}

.module-card.commercial::before { background: var(--color-commercial); }
.module-card.technique::before { background: var(--color-technique); }
.module-card.rh::before { background: var(--color-rh); }
.module-card.admin::before { background: var(--color-admin); }
.module-card.logistique::before { background: var(--color-logistique); }
.module-card.securite::before { background: var(--color-securite); }

.module-card:hover::before {
    width: 6px;
}

.module-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin-bottom: 16px;
}

.module-icon.commercial { background: rgba(77, 171, 247, 0.15); color: var(--color-commercial); }
.module-icon.technique { background: rgba(81, 207, 102, 0.15); color: var(--color-technique); }
.module-icon.rh { background: rgba(252, 196, 25, 0.15); color: var(--color-rh); }
.module-icon.admin { background: rgba(204, 93, 232, 0.15); color: var(--color-admin); }
.module-icon.logistique { background: rgba(255, 146, 43, 0.15); color: var(--color-logistique); }
.module-icon.securite { background: rgba(255, 107, 107, 0.15); color: var(--color-securite); }

.module-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.module-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ========================================
   TABLEAUX
   ======================================== */

.table-container {
    overflow-x: auto;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--bg-tertiary);
}

th, td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

td {
    color: var(--text-primary);
}

tbody tr:hover {
    background: var(--bg-hover);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* ========================================
   BOUTONS
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: var(--transition);
}

.btn-primary {
    background: var(--accent-primary);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--accent-secondary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--bg-hover);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--accent-primary);
    color: var(--accent-primary);
}

.btn-outline:hover {
    background: var(--accent-primary);
    color: #ffffff;
}

.btn-success { background: var(--accent-success); color: #fff; }
.btn-warning { background: var(--accent-warning); color: #000; }
.btn-danger { background: var(--accent-danger); color: #fff; }

.btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.btn-lg { padding: 14px 28px; font-size: 1.1rem; }

/* ========================================
   FORMULAIRES
   ======================================== */

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(77, 171, 247, 0.2);
}

.form-control::placeholder {
    color: var(--text-muted);
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

select.form-control {
    cursor: pointer;
}

/* ========================================
   ALERTES & BADGES
   ======================================== */

.alert {
    padding: 16px 20px;
    border-radius: var(--border-radius);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-info { background: rgba(34, 184, 207, 0.15); color: var(--accent-info); border-left: 4px solid var(--accent-info); }
.alert-success { background: rgba(81, 207, 102, 0.15); color: var(--accent-success); border-left: 4px solid var(--accent-success); }
.alert-warning { background: rgba(252, 196, 25, 0.15); color: var(--accent-warning); border-left: 4px solid var(--accent-warning); }
.alert-danger { background: rgba(255, 107, 107, 0.15); color: var(--accent-danger); border-left: 4px solid var(--accent-danger); }

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-secondary { background: rgba(108, 117, 125, 0.2); color: #6c757d; }
.badge-info { background: rgba(34, 184, 207, 0.2); color: var(--accent-info); }
.badge-success { background: rgba(81, 207, 102, 0.2); color: var(--accent-success); }
.badge-warning { background: rgba(252, 196, 25, 0.2); color: #b38600; }
.badge-danger { background: rgba(255, 107, 107, 0.2); color: var(--accent-danger); }
.badge-primary { background: rgba(77, 171, 247, 0.2); color: var(--accent-primary); }

/* ========================================
   STATISTIQUES (Dashboard)
   ======================================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 24px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
}

.stat-content h3 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-content p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ========================================
   PAGE D'ACCUEIL
   ======================================== */

.hero-section {
    text-align: center;
    padding: 60px 40px;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border-radius: var(--border-radius);
    margin-bottom: 40px;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.hero-title span {
    color: var(--accent-primary);
}

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 32px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.features-section {
    margin-bottom: 40px;
}

.feature-card {
    text-align: center;
    padding: 32px;
}

.feature-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    background: rgba(77, 171, 247, 0.15);
    color: var(--accent-primary);
}

.feature-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.feature-desc {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 1200px) {
    .grid-4 { grid-template-columns: repeat(3, 1fr); }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 992px) {
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .search-box { min-width: 200px; }
}

@media (max-width: 768px) {
    /* Sidebar en drawer */
    .sidebar {
        transform: translateX(-100%);
        box-shadow: var(--shadow-lg);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .header {
        left: 0;
    }
    
    .search-box {
        display: none;
    }
    
    /* Grilles */
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    /* Hero */
    .hero-section {
        padding: 40px 20px;
    }
    
    .hero-title {
        font-size: 1.75rem;
    }
    
    .hero-buttons {
        flex-direction: column;
    }
    
    /* Overlay */
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 150;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
}

@media (max-width: 480px) {
    .content-wrapper {
        padding: 16px;
    }
    
    .card {
        padding: 16px;
    }
    
    .page-title {
        font-size: 1.5rem;
    }
    
    .stat-card {
        flex-direction: column;
        text-align: center;
    }
}

/* ========================================
   ANIMATIONS
   ======================================== */

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* Scrollbar personnalisée */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* ========================================
   PAGE PARAMÈTRES - SYSTÈME D'ONGLETS
   ======================================== */

/* Navigation par onglets */
.settings-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    background: var(--bg-secondary);
    padding: 8px;
    border-radius: var(--border-radius);
    flex-wrap: wrap;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 24px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--border-radius);
    transition: var(--transition);
    flex: 1;
    justify-content: center;
    min-width: 200px;
}

.tab-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--accent-green);
    color: #fff;
    box-shadow: var(--shadow-sm);
}

.tab-btn i {
    font-size: 1.1rem;
}

/* Contenu des onglets */
.tab-content {
    min-height: 400px;
}

.tab-pane {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-pane.active {
    display: block;
}

/* Formulaire entreprise */
.required {
    color: var(--accent-danger);
}

.logo-upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
    text-align: center;
    background: var(--bg-tertiary);
    transition: var(--transition);
}

.logo-upload-zone:hover {
    border-color: var(--accent-primary);
    background: var(--bg-hover);
}

.logo-preview {
    margin-bottom: 16px;
}

.logo-preview i {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: block;
}

.logo-preview p {
    color: var(--text-muted);
    margin-bottom: 4px;
}

.logo-preview span {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.logo-preview img {
    max-width: 150px;
    max-height: 150px;
    border-radius: var(--border-radius);
    object-fit: contain;
}

/* Actions formulaire */
.form-actions {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.save-status {
    color: var(--accent-success);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.save-status.error {
    color: var(--accent-danger);
}

/* Légende des rôles */
.roles-legend {
    margin-top: 24px;
    padding: 20px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
}

.roles-legend h4 {
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.legend-items {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.legend-item span:last-child {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-content,
.modal {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.3s ease;
}

.modal {
    display: none;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
}

.modal.active {
    display: block;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1001;
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.8rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--accent-danger);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

/* Options de thème */
.theme-options {
    display: flex;
    gap: 16px;
    margin-top: 8px;
}

.theme-option {
    cursor: pointer;
}

.theme-option input {
    display: none;
}

.theme-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 30px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.theme-preview i {
    font-size: 1.5rem;
}

.theme-preview.dark {
    background: #1b263b;
    color: #e0e1dd;
}

.theme-preview.light {
    background: #f8f9fa;
    color: #212529;
}

.theme-option input:checked + .theme-preview {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(58, 91, 160, 0.3);
}

/* Options de couleur */
.color-options {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.color-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.color-btn:hover {
    transform: scale(1.1);
}

.color-btn.active {
    border: 3px solid #fff;
    box-shadow: 0 0 0 2px var(--accent-primary);
}

/* Checkbox personnalisée */
.checkbox-option {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.checkbox-option:last-of-type {
    border-bottom: none;
}

.checkbox-option input {
    width: 20px;
    height: 20px;
    accent-color: var(--accent-primary);
}

.checkbox-option span:last-child {
    flex: 1;
}

/* Avatar utilisateur */
.user-avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
}

/* System info */
.system-info {
    margin-top: 32px;
}

/* ========================================
   RESPONSIVE - TABLETTE (768px)
   ======================================== */
@media (max-width: 768px) {
    .settings-tabs {
        flex-direction: column;
    }
    
    .tab-btn {
        min-width: 100%;
        justify-content: flex-start;
    }
    
    .theme-options {
        flex-direction: column;
    }
    
    .legend-items {
        flex-direction: column;
        gap: 12px;
    }
    
    .modal-content {
        margin: 10px;
        max-height: 90vh;
    }
    
    /* Grilles adaptatives */
    .cards-grid.grid-2,
    .cards-grid.grid-3,
    .cards-grid.grid-4 {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    /* Stats cards */
    .stat-card {
        padding: 16px;
    }
    
    .stat-card h3 {
        font-size: 1.4rem;
    }
}

/* ========================================
   RESPONSIVE - MOBILE (576px)
   ======================================== */
@media (max-width: 576px) {
    /* Sidebar cachée */
    .sidebar {
        transform: translateX(-100%);
        z-index: 1000;
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    /* Main content pleine largeur */
    .main-content {
        margin-left: 0 !important;
        padding: 10px;
    }
    
    .header {
        left: 0 !important;
        padding: 0 10px;
    }
    
    /* Typographie */
    h1 { font-size: 1.2rem; }
    h2 { font-size: 1.1rem; }
    h3 { font-size: 1rem; }
    
    /* Header page */
    .page-header {
        padding: 8px 0;
        margin-bottom: 12px;
    }
    
    .page-header h1 {
        font-size: 1.1rem;
    }
    
    .page-subtitle {
        font-size: 0.75rem;
    }
    
    /* ===== ONGLETS - Tous visibles ===== */
    .settings-tabs,
    .tab-buttons {
        display: flex;
        gap: 8px;
        width: 100%;
        margin-bottom: 16px;
    }
    
    .tab-btn {
        flex: 1;
        padding: 12px 10px;
        font-size: 0.8rem;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
    }
    
    .tab-btn i {
        font-size: 1rem;
    }
    
    /* ===== STATISTIQUES - 3 colonnes compactes ===== */
    .cards-grid.grid-3 {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    .cards-grid.grid-2,
    .cards-grid.grid-4 {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .stat-card {
        padding: 10px 8px;
        flex-direction: column;
        text-align: center;
    }
    
    .stat-icon {
        width: 36px;
        height: 36px;
        min-width: 36px;
        margin-bottom: 6px;
    }
    
    .stat-icon i {
        font-size: 1rem;
    }
    
    .stat-content {
        text-align: center;
    }
    
    .stat-card h3 {
        font-size: 0.95rem;
        margin-bottom: 2px;
    }
    
    .stat-card p {
        font-size: 0.65rem;
        line-height: 1.2;
    }
    
    /* ===== CARTES / SECTIONS ===== */
    .card {
        padding: 12px;
        margin-bottom: 12px;
        border-radius: 10px;
    }
    
    .card-header,
    .section-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 12px;
        gap: 8px;
    }
    
    .card-title {
        font-size: 0.85rem;
    }
    
    .card-header .btn,
    .section-header .btn {
        padding: 6px 10px;
        font-size: 0.7rem;
    }
    
    /* ===== TABLEAUX - Scroll interne avec écran fixe ===== */
    .table-responsive,
    .table-container {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        background: var(--bg-secondary);
    }
    
    .data-table,
    .table-responsive table,
    .table-container table {
        width: 100%;
        min-width: 500px;
        font-size: 0.7rem;
        border-collapse: collapse;
    }
    
    .data-table th,
    .data-table td,
    table th,
    table td {
        padding: 8px 6px;
        white-space: nowrap;
        border-bottom: 1px solid var(--border-color);
    }
    
    .data-table th {
        font-size: 0.65rem;
        font-weight: 600;
        text-transform: uppercase;
        background: var(--bg-tertiary);
        position: sticky;
        top: 0;
    }
    
    /* Boutons tableau */
    .data-table .btn-sm,
    table .btn-sm {
        padding: 4px 6px;
        font-size: 0.65rem;
    }
    
    .badge {
        font-size: 0.6rem;
        padding: 2px 5px;
    }
    
    /* ===== BOUTONS ACTIONS ===== */
    .header-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        margin-top: 12px;
    }
    
    .header-actions .btn {
        padding: 8px 12px;
        font-size: 0.75rem;
    }
    
    .btn {
        padding: 8px 12px;
        font-size: 0.75rem;
    }
    
    .btn-sm {
        padding: 5px 8px;
        font-size: 0.7rem;
    }
    
    /* ===== FORMULAIRES - 2 par ligne ===== */
    .form-group {
        margin-bottom: 10px;
    }
    
    .form-label {
        font-size: 0.75rem;
        margin-bottom: 4px;
    }
    
    .form-control {
        padding: 8px 10px;
        font-size: 0.8rem;
    }
    
    /* ===== MODALS ===== */
    .modal-overlay {
        padding: 15px;
        align-items: center;
    }
    
    .modal-content {
        width: 100%;
        max-height: 85vh;
        border-radius: 12px;
    }
    
    .modal-header {
        padding: 12px 14px;
    }
    
    .modal-header h3 {
        font-size: 0.9rem;
    }
    
    .modal-body {
        padding: 14px;
        max-height: 60vh;
        overflow-y: auto;
    }
    
    .modal-body .cards-grid.grid-2 {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .modal-footer {
        padding: 10px 14px;
        gap: 8px;
    }
    
    .modal-footer .btn {
        flex: 1;
        padding: 10px;
        font-size: 0.8rem;
    }
}

/* ========================================
   RESPONSIVE - TRÈS PETIT MOBILE (400px)
   ======================================== */
@media (max-width: 400px) {
    .main-content {
        padding: 8px;
    }
    
    /* Stats empilées en 3 colonnes */
    .cards-grid.grid-3 {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }
    
    .stat-card {
        padding: 8px 6px;
    }
    
    .stat-icon {
        width: 30px;
        height: 30px;
        min-width: 30px;
    }
    
    .stat-icon i {
        font-size: 0.85rem;
    }
    
    .stat-card h3 {
        font-size: 0.85rem;
    }
    
    .stat-card p {
        font-size: 0.6rem;
    }
    
    /* Onglets compacts */
    .tab-btn {
        padding: 10px 8px;
        font-size: 0.75rem;
    }
    
    .tab-btn i {
        font-size: 0.9rem;
    }
    
    /* Tableau */
    .data-table,
    table {
        min-width: 450px;
        font-size: 0.65rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 6px 4px;
    }
    
    /* Modal */
    .modal-body {
        padding: 10px;
    }
    
    .modal-body .cards-grid.grid-2 {
        gap: 8px;
    }
}
