:root {
    --primary-color: #2c5aa0;
    --secondary-color: #007bff;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #17a2b8;
    --dark-color: #343a40;
    --light-color: #f8f9fa;
    --white: #ffffff;
    --sidebar-width: 280px;
    --header-height: 60px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* Layout principal */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar - CORRIGÉE */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: transform 0.3s ease;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.1);
}

.sidebar-logo {
    width: 50px;
    height: 50px;
    margin: 0 auto 10px auto;
    display: block;
    object-fit: contain;
    background: white;
    border-radius: 8px;
    padding: 2px;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 24px;
    font-weight: 300;
    color: white;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Info utilisateur - CORRIGÉE */
.user-info {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(0, 0, 0, 0.05);
}

.user-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}

.user-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-details strong {
    display: block;
    font-size: 14px;
    color: white !important;
    font-weight: 600;
}

.user-details small {
    color: rgba(255, 255, 255, 0.8) !important;
    text-transform: uppercase;
    font-size: 11px;
    font-weight: 500;
}

/* Menu sidebar - CORRIGÉ */
.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu > li > a {
    display: block;
    padding: 15px 25px;
    color: rgba(255, 255, 255, 0.9) !important;
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    font-size: 14px;
    font-weight: 500;
}

.sidebar-menu > li > a:hover,
.sidebar-menu > li > a.active {
    background: rgba(255, 255, 255, 0.15) !important;
    border-left-color: #fff;
    color: #fff !important;
    transform: translateX(5px);
}

.sidebar-menu i {
    margin-right: 12px;
    width: 18px;
    text-align: center;
    font-size: 16px;
    color: inherit !important;
}

/* Sections du menu - CORRIGÉES */
.menu-section {
    margin-top: 25px;
}

.menu-section > span {
    display: block;
    padding: 10px 25px;
    color: rgba(255, 255, 255, 0.7) !important;
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 1px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 5px;
}

.menu-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.menu-section ul li a {
    padding: 12px 25px 12px 50px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85) !important;
    display: block;
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.menu-section ul li a:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    border-left-color: rgba(255, 255, 255, 0.6);
    color: #fff !important;
    transform: translateX(3px);
}

/* Corrections spécifiques pour éviter le texte bleu */
.sidebar a,
.sidebar a:visited,
.sidebar a:link {
    color: rgba(255, 255, 255, 0.9) !important;
}

.sidebar a:hover {
    color: #fff !important;
}

/* Contenu principal */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.top-header {
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 25px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    z-index: 999;
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 18px;
    color: #666;
    cursor: pointer;
    padding: 10px;
    border-radius: 4px;
    transition: background 0.3s ease;
    display: none;
}

.sidebar-toggle:hover {
    background: #f8f9fa;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Notifications */
.notification-btn {
    background: none;
    border: none;
    font-size: 18px;
    color: #666;
    cursor: pointer;
    position: relative;
    padding: 10px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.notification-btn:hover {
    background: #f8f9fa;
    color: var(--primary-color);
}

.notification-count {
    position: absolute;
    top: 5px;
    right: 5px;
    background: var(--danger-color);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Menu utilisateur */
.user-menu {
    position: relative;
}

.user-menu-btn {
    background: none;
    border: none;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 25px;
    transition: background 0.3s ease;
}

.user-menu-btn:hover {
    background: #f8f9fa;
}

.user-avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    z-index: 1000;
    display: none;
}

.user-dropdown.show {
    display: block;
}

.user-dropdown a {
    display: block;
    padding: 12px 16px;
    color: #333;
    text-decoration: none;
    transition: background 0.3s ease;
}

.user-dropdown a:hover {
    background: #f8f9fa;
}

.user-dropdown hr {
    margin: 0;
    border: none;
    border-top: 1px solid #e9ecef;
}

/* Dashboard styles - Ajout des styles manquants */
.dashboard {
    padding: 0;
}

.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e9ecef;
}

.dashboard-header h1 {
    margin: 0;
    color: #333;
    font-size: 28px;
    font-weight: 600;
}

.dashboard-header h1 i {
    color: var(--primary-color);
    margin-right: 10px;
}

.user-welcome {
    color: #666;
    font-size: 16px;
}

/* Grille de statistiques */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-left: 4px solid var(--primary-color);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.stat-card.warning {
    border-left-color: var(--warning-color);
}

.stat-card.info {
    border-left-color: var(--info-color);
}

.stat-card.success {
    border-left-color: var(--success-color);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color);
    color: white;
    font-size: 24px;
}

.stat-card.warning .stat-icon {
    background: var(--warning-color);
    color: #333;
}

.stat-card.info .stat-icon {
    background: var(--info-color);
}

.stat-card.success .stat-icon {
    background: var(--success-color);
}

.stat-content h3 {
    margin: 0 0 5px;
    font-size: 32px;
    font-weight: 700;
    color: #333;
}

.stat-content p {
    margin: 0;
    color: #666;
    font-size: 14px;
    font-weight: 500;
}

/* Contenu du dashboard */
.dashboard-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
}

.dashboard-left,
.dashboard-right {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Actions rapides */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
}

.quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 20px 15px;
    background: #f8f9fa;
    border-radius: 12px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.quick-action:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(44, 90, 160, 0.3);
    text-decoration: none;
}

.quick-action i {
    font-size: 24px;
    color: var(--primary-color);
    transition: color 0.3s ease;
}

.quick-action:hover i {
    color: white;
}

.quick-action span {
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    line-height: 1.3;
}

/* Responsive dashboard */
@media (max-width: 1024px) {
    .dashboard-content {
        grid-template-columns: 1fr;
    }
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .dashboard-header h1 {
        font-size: 24px;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .stat-card {
        padding: 20px;
        gap: 15px;
    }
    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }
}
.content-wrapper {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

/* Cards */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.card-body {
    padding: 20px;
}

.card-actions {
    margin-left: auto;
    display: flex;
    gap: 10px;
}

/* Boutons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    line-height: 1.4;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #1a4480;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-warning {
    background: var(--warning-color);
    color: #212529;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-info {
    background: var(--info-color);
    color: white;
}

.btn-outline-primary {
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--primary-color);
    color: white;
}

.btn-outline-success {
    border: 1px solid var(--success-color);
    color: var(--success-color);
    background: transparent;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-group {
    display: flex;
}

.btn-group .btn {
    margin-right: 0;
    border-radius: 0;
}

.btn-group .btn:first-child {
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
}

.btn-group .btn:last-child {
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 4px;
}

.badge-primary { background: var(--primary-color); color: white; }
.badge-secondary { background: #6c757d; color: white; }
.badge-success { background: var(--success-color); color: white; }
.badge-warning { background: var(--warning-color); color: #212529; }
.badge-danger { background: var(--danger-color); color: white; }
.badge-info { background: var(--info-color); color: white; }
.badge-dark { background: var(--dark-color); color: white; }

/* Alertes */
.alert {
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    border: 1px solid transparent;
}

.alert-success {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.alert-danger {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.alert-warning {
    background: #fff3cd;
    border-color: #ffeaa7;
    color: #856404;
}

.alert-info {
    background: #d1ecf1;
    border-color: #bee5eb;
    color: #0c5460;
}

/* Formulaires */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.form-control {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(44, 90, 160, 0.1);
}

.form-control.is-invalid {
    border-color: var(--danger-color);
}

.invalid-feedback {
    color: var(--danger-color);
    font-size: 12px;
    margin-top: 5px;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.table th,
.table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

.table-hover tbody tr:hover {
    background: #f8f9fa;
}

.table .reference {
    font-family: 'Courier New', monospace;
    font-weight: bold;
}

/* État urgent */
.table .courrier-row.urgent {
    background: #fff5f5;
    border-left: 4px solid var(--danger-color);
}

/* Pagination */
.pagination-nav {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

.pagination {
    display: flex;
    list-style: none;
    gap: 5px;
}

.pagination li a {
    padding: 8px 12px;
    border: 1px solid #ddd;
    color: var(--primary-color);
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.pagination li.active a {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination li a:hover {
    background: #f8f9fa;
}

/* État vide */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-state i {
    margin-bottom: 20px;
}

.empty-state h4 {
    margin-bottom: 10px;
    color: #333;
}

/* Utilitaires */
.text-muted { color: #6c757d !important; }
.text-primary { color: var(--primary-color) !important; }
.text-success { color: var(--success-color) !important; }
.text-warning { color: var(--warning-color) !important; }
.text-danger { color: var(--danger-color) !important; }
.text-info { color: var(--info-color) !important; }

.mt-2 { margin-top: 10px; }
.mt-3 { margin-top: 20px; }
.mb-2 { margin-bottom: 10px; }
.mb-3 { margin-bottom: 20px; }

.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -10px;
}

.col-md-2, .col-md-3, .col-md-6 {
    padding: 0 10px;
    flex: 1;
}

.col-md-2 { flex: 0 0 16.666%; }
.col-md-3 { flex: 0 0 25%; }
.col-md-6 { flex: 0 0 50%; }

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .sidebar-toggle {
        display: block !important;
    }
    
    .row {
        flex-direction: column;
    }
    
    .col-md-2, .col-md-3, .col-md-6 {
        flex: 1;
        margin-bottom: 15px;
    }
}