/* =====================================================
   EAttestation - Styles principaux
   ===================================================== */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --secondary: #64748b;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #f59e0b;
    --info: #0891b2;
    --dark: #1e293b;
    --sidebar-width: 260px;
    --header-height: 60px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f1f5f9;
    color: #334155;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--dark);
    color: #fff;
    z-index: 1000;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 16px 20px;
    font-size: 1.25rem;
    font-weight: 700;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-brand i {
    color: var(--primary);
    font-size: 1.5rem;
}

.sidebar-menu {
    list-style: none;
    padding: 10px 0;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-menu li a:hover,
.sidebar-menu li a.active {
    background: rgba(255,255,255,0.05);
    color: #fff;
    border-left-color: var(--primary);
}

.sidebar-menu li a i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

.sidebar-divider {
    border-top: 1px solid rgba(255,255,255,0.08);
    margin: 8px 20px;
}

/* Main content */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    overflow: hidden;
    min-width: 0;
}

/* Header */
.top-header {
    height: var(--header-height);
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 999;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-toggle-sidebar {
    display: none;
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--secondary);
    cursor: pointer;
}

.header-search {
    position: relative;
}

.header-search input {
    padding: 8px 16px 8px 36px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.875rem;
    width: 280px;
    transition: border-color 0.2s;
}

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

.header-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary);
    font-size: 0.875rem;
}

.notification-btn {
    position: relative;
    background: none;
    border: none;
    font-size: 1.15rem;
    color: var(--secondary);
    cursor: pointer;
    padding: 6px;
}

.notification-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--danger);
    color: #fff;
    font-size: 0.65rem;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-dropdown {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: background 0.2s;
}

.user-dropdown:hover { background: #f1f5f9; }

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
}

.user-info { line-height: 1.3; }
.user-info .name { font-size: 0.85rem; font-weight: 600; color: var(--dark); }
.user-info .role { font-size: 0.75rem; color: var(--secondary); }

/* Page content */
.page-content {
    padding: 24px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark);
}

.breadcrumb {
    font-size: 0.85rem;
    color: var(--secondary);
    margin-top: 4px;
}

.breadcrumb a { color: var(--primary); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

/* Cards */
.card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    margin-bottom: 24px;
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark);
}

.card-body { padding: 20px; }

/* Stat Cards — cliquables */
.stat-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

a.stat-card {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

a.stat-card:hover {
    border-color: var(--primary);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: #dcfce7; color: var(--success); }
.stat-icon.orange { background: #fef3c7; color: var(--warning); }
.stat-icon.red { background: #fee2e2; color: var(--danger); }
.stat-icon.cyan { background: #cffafe; color: var(--info); }
.stat-icon.purple { background: #f3e8ff; color: #7c3aed; }

.stat-details .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark);
    line-height: 1;
}

.stat-details .stat-label {
    font-size: 0.8rem;
    color: var(--secondary);
    margin-top: 4px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    line-height: 1.5;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #d97706; color: #fff; }
.btn-info { background: var(--info); color: #fff; }
.btn-info:hover { background: #0e7490; color: #fff; }
.btn-secondary { background: #e2e8f0; color: var(--dark); }
.btn-secondary:hover { background: #cbd5e1; }
.btn-outline { background: transparent; border: 1px solid #e2e8f0; color: var(--dark); }
.btn-outline:hover { background: #f8fafc; }

.btn-sm { padding: 5px 10px; font-size: 0.8rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }

.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--dark);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: border-color 0.2s;
    background: #fff;
    color: var(--dark);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

select.form-control {
    appearance: auto;
}

textarea.form-control { min-height: 80px; resize: vertical; }

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

/* Tables */
.table-responsive { overflow-x: auto; }

table.dataTable {
    width: 100% !important;
    border-collapse: collapse;
}

.dataTables_wrapper {
    padding: 0;
}

.dataTables_wrapper .dataTables_filter input {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.85rem;
}

.dataTables_wrapper .dataTables_length select {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 4px 8px;
}

table.dataTable thead th {
    background: #f8fafc;
    padding: 12px 16px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--secondary);
    border-bottom: 2px solid #e2e8f0;
}

table.dataTable tbody td {
    padding: 12px 16px;
    font-size: 0.875rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

table.dataTable tbody tr:hover { background: #f8fafc; }

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

.bg-primary { background: var(--primary) !important; color: #fff; }
.bg-success { background: var(--success) !important; color: #fff; }
.bg-danger { background: var(--danger) !important; color: #fff; }
.bg-warning { background: var(--warning) !important; color: #fff; }
.bg-info { background: var(--info) !important; color: #fff; }
.bg-secondary { background: var(--secondary) !important; color: #fff; }
.bg-dark { background: var(--dark) !important; color: #fff; }

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
    background: #fff;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title { font-size: 1.1rem; font-weight: 600; }

.modal-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--secondary);
    padding: 4px;
}

.modal-body { padding: 20px; }
.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* Timeline */
.timeline { position: relative; padding-left: 30px; }
.timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e2e8f0;
}

.timeline-item {
    position: relative;
    padding-bottom: 20px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px var(--primary);
}

.timeline-date { font-size: 0.8rem; color: var(--secondary); margin-bottom: 4px; }
.timeline-content { font-size: 0.9rem; }

/* Alert — amélioré avec slide-in, close button, barre de progression */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    animation: alertSlideIn 0.35s ease;
    overflow: hidden;
}

.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: #cffafe; color: #155e75; border: 1px solid #a5f3fc; }

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

.alert-close {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
    color: inherit;
    padding: 0 4px;
    flex-shrink: 0;
}
.alert-close:hover { opacity: 1; }

.alert-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: currentColor;
    opacity: 0.3;
    animation: alertCountdown 5s linear forwards;
}

@keyframes alertCountdown {
    from { width: 100%; }
    to { width: 0%; }
}

.alert.alert-hiding {
    animation: alertSlideOut 0.3s ease forwards;
}

@keyframes alertSlideOut {
    to { transform: translateY(-10px); opacity: 0; height: 0; padding: 0; margin: 0; border: 0; }
}

/* Login page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--dark) 0%, #0f172a 100%);
    padding: 20px;
}

.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-card .logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-card .logo h1 {
    font-size: 1.8rem;
    color: var(--dark);
    margin-top: 8px;
}

.login-card .logo i { font-size: 2.5rem; color: var(--primary); }

.login-card .logo p {
    color: var(--secondary);
    font-size: 0.9rem;
    margin-top: 4px;
}

/* Empty state — amélioré avec CTA */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--secondary);
}

.empty-state i { font-size: 3rem; margin-bottom: 12px; opacity: 0.4; display: block; }
.empty-state p { font-size: 0.95rem; margin-bottom: 16px; }
.empty-state .btn { margin-top: 4px; }

/* Grid */
.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); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
.grid-6 { grid-template-columns: repeat(6, 1fr); }

/* Responsive */
@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-5 { grid-template-columns: repeat(3, 1fr); }
    .grid-6 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .btn-toggle-sidebar { display: block; }
    .header-search { display: none; }
    .grid-2, .grid-3, .grid-4, .grid-5, .grid-6 { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .page-content { padding: 16px; }
    .form-row { grid-template-columns: 1fr; }
    .stat-card { padding: 14px; }
    .stat-details .stat-value { font-size: 1.25rem; }
}

/* Sidebar overlay mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

.sidebar-overlay.active { display: block; }

/* DataTables overrides */
.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 5px 10px;
    border-radius: 6px;
    margin: 0 2px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--primary) !important;
    color: #fff !important;
    border: none;
}

.dataTables_wrapper .dataTables_info {
    font-size: 0.85rem;
    color: var(--secondary);
}

/* Transitions */
.fade-in { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* =====================================================
   UX Enhancements
   ===================================================== */

/* Loading overlay pour soumission de formulaire */
.loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
    backdrop-filter: blur(2px);
}

.loading-overlay.active { display: flex; }

.loading-spinner {
    width: 44px;
    height: 44px;
    border: 4px solid #e2e8f0;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-text {
    font-size: 0.9rem;
    color: var(--secondary);
    font-weight: 500;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Confirmation modal stylé (remplacement de confirm()) */
.confirm-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 3000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.confirm-modal-overlay.active { display: flex; }

.confirm-modal {
    background: #fff;
    border-radius: 16px;
    width: 90%;
    max-width: 420px;
    animation: modalIn 0.2s ease;
    overflow: hidden;
}

.confirm-modal-icon {
    text-align: center;
    padding: 24px 20px 8px;
}

.confirm-modal-icon i {
    font-size: 2.5rem;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.confirm-modal-icon.danger i { color: var(--danger); background: #fee2e2; }
.confirm-modal-icon.warning i { color: var(--warning); background: #fef3c7; }
.confirm-modal-icon.info i { color: var(--primary); background: var(--primary-light); }

.confirm-modal-body {
    text-align: center;
    padding: 8px 24px 20px;
}

.confirm-modal-body h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 8px;
}

.confirm-modal-body p {
    font-size: 0.9rem;
    color: var(--secondary);
    line-height: 1.5;
}

.confirm-modal-actions {
    display: flex;
    gap: 8px;
    padding: 16px 24px 24px;
    justify-content: center;
}

.confirm-modal-actions .btn { min-width: 120px; justify-content: center; }

/* Tooltip natif amélioré */
[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--dark);
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 400;
    white-space: nowrap;
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
    z-index: 1000;
}

[data-tooltip]:hover::after { opacity: 1; }

/* Scroll to top button */
.scroll-top-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(37,99,235,0.3);
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.3s, transform 0.3s, background 0.2s;
    pointer-events: none;
}

.scroll-top-btn.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.scroll-top-btn:hover { background: var(--primary-dark); }

/* Focus visible pour accessibilité clavier */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.btn:focus-visible,
.form-control:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(37,99,235,0.15);
}

/* Form validation states */
.form-control.is-invalid {
    border-color: var(--danger);
}

.form-control.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(220,38,38,0.1);
}

.form-error {
    color: var(--danger);
    font-size: 0.8rem;
    margin-top: 4px;
    display: none;
}

.form-control.is-invalid + .form-error,
.form-control.is-invalid ~ .form-error { display: block; }

/* Boutons avec état loading */
.btn.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn.btn-loading::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* Smooth scrollbar */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

/* Table row animation on load */
.datatable tbody tr {
    animation: rowFadeIn 0.3s ease backwards;
}

@keyframes rowFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Card subtile shadow au repos */
.card {
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: box-shadow 0.2s;
}

.card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* Notification pulse animation */
.notification-badge {
    animation: notifPulse 2s infinite;
}

@keyframes notifPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Sidebar menu section headers */
.sidebar-section-title {
    padding: 12px 20px 4px;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #475569;
}

/* DataTables wrapper cleaner spacing */
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_length {
    margin-bottom: 12px;
}

.dataTables_wrapper .dataTables_paginate {
    margin-top: 12px;
}

/* Active page indicator for pagination */
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--primary-light) !important;
    color: var(--primary) !important;
    border: none;
}

/* Password strength indicator */
.password-strength {
    height: 4px;
    border-radius: 2px;
    background: #e2e8f0;
    margin-top: 6px;
    overflow: hidden;
}

.password-strength-bar {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s, background 0.3s;
    width: 0%;
}

.password-strength-bar.weak { width: 33%; background: var(--danger); }
.password-strength-bar.medium { width: 66%; background: var(--warning); }
.password-strength-bar.strong { width: 100%; background: var(--success); }

/* Responsive table improvements */
@media (max-width: 768px) {
    .dataTables_wrapper .dataTables_filter,
    .dataTables_wrapper .dataTables_length {
        float: none !important;
        text-align: left !important;
        margin-bottom: 8px;
    }

    .dataTables_wrapper .dataTables_filter input {
        width: 100% !important;
        margin-left: 0 !important;
    }
}

/* Print */
@media print {
    /* Masquer les éléments UI */
    .sidebar, .top-header, .no-print, .btn, .sidebar-overlay { display: none !important; }
    /* Afficher l'en-tête d'impression */
    .print-only { display: block !important; }
    /* Layout pleine page */
    .main-content { margin-left: 0 !important; width: 100% !important; }
    .page-content { padding: 0 !important; }
    /* Grille en colonne unique */
    .grid-2, .grid-3 { grid-template-columns: 1fr !important; }
    /* Cartes propres sans ombres */
    .card { box-shadow: none !important; border: 1px solid #ddd !important; break-inside: avoid; }
    .card-header { background: #f8f8f8 !important; }
    /* Texte lisible. print-color-adjust remonté au body : la propriété est héritée,
       elle couvre donc tout le document. Sans elle, un fond coloré portant du texte
       blanc s'imprime blanc sur blanc — le texte disparaît purement et simplement. */
    body { color: #000 !important; background: #fff !important; font-size: 12pt;
           -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    /* Un tableau qui déborde doit répéter son en-tête, et ne pas couper ses lignes. */
    thead { display: table-header-group; }
    table tr { break-inside: avoid; page-break-inside: avoid; }
    /* Un conteneur à défilement n'a pas de sens sur du papier : tout doit sortir. */
    [style*="overflow-x"], [style*="overflow:auto"], [style*="overflow: auto"], [style*="max-height"] {
        overflow: visible !important; max-height: none !important;
    }
    .page-header { border-bottom: 1px solid #ccc; padding-bottom: 12px; margin-bottom: 16px; }
    .page-title { font-size: 1.2rem !important; }
    .breadcrumb { display: none !important; }
    /* Badge statut visible à l'impression */
    .badge { border: 1px solid #999 !important; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
    /* Timeline lisible */
    .timeline-item { break-inside: avoid; }
    /* Liens non soulignés */
    a { text-decoration: none !important; color: #000 !important; }
    /* Format du papier. Sans le mot-clé « size », la norme CSS laisse le choix au
       pilote d'impression du poste : le même document sortait en A4 chez l'un et
       en Letter chez l'autre, sans que le défaut soit reproductible. */
    @page { size: A4; margin: 1.5cm; }
}
