/* Variables globales */
:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --tertiary-color: #e7255b;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --admin-color: #6f42c1;
    
    --etat-nouveau: #007bff;
    --etat-ouvert: #28a745;
    --etat-attente: #ffc107;
    --etat-ferme: #6c757d;
    
    /* Thème clair (par défaut) */
    --bg-primary: #ffffff;
    --bg-secondary: #d4d8de;
    --bg-tertiary: #f8f9fa;
    --bg-quaternary: #eef0f3;
    --bg-navbar: linear-gradient(135deg, #b11b46 0%, #e7255b 100%);
    --bg-card: #ffffff;
    --bg-card-2: #eeeeee;
    --bg-content: #f4f5f7;
    --bg-hover: #f1f3f5;
    --bg-input: #eef0f3;
    --bg-input-2: #fafbfc;

    --color-card-title: #e7255b;
    
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-light: #495057;
    --text-navbar: #ffffff;
    
    --border-color: #dee2e6;
    --border-light: #e9ecef;
    --border-dark: #ced4da;
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.12);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.15);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.18);
}

/* Thème sombre */
[data-theme="dark"] {
    --bg-primary: #18191a;
    --bg-secondary: #2a2b2c;
    --bg-tertiary: #37383a;
    --bg-quaternary: #57595a;
    --bg-navbar: linear-gradient(135deg, #1a1b1c 0%, #242526 100%);
    --bg-card: #484a4b;
    --bg-card-2: #565859;
    --bg-content: #37383a;
    --bg-hover: #3a3b3c;
    --bg-input: #57595a;
    --bg-input-2: #4a4c4d;

    --color-card-title: #f2607e;
    
    --text-primary: #e4e6eb;
    --text-secondary: #b0b3b8;
    --text-light: #b8bbbf;
    --text-navbar: #ffffff;
    
    --border-color: #252627;
    --border-light: #3a3b3c;
    --border-dark: #4a4b4d;
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.5);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.6);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.7);
}

/* Reset et base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Navbar */
.navbar {
    background: var(--bg-navbar);
    color: var(--text-navbar);
    padding: 0.5rem 0;
    box-shadow: var(--shadow-sm);
}

.navbar-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand h1 {
    font-size: 1.5rem;
    font-weight: bold;
}

.navbar-user {
    position: relative;
}

/* Menu déroulant utilisateur */
.user-dropdown {
    position: relative;
}

.user-dropdown-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
}

.user-dropdown-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.dropdown-arrow {
    font-size: 0.7rem;
    transition: transform 0.3s ease;
}

.user-dropdown-toggle:hover .dropdown-arrow {
    transform: translateY(2px);
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: var(--bg-card);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    min-width: 250px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
    border: 1px solid var(--border-color);
}

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

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.95rem;
    font-family: inherit;
    transition: background-color 0.2s ease;
}

.dropdown-item:hover {
    background-color: var(--bg-hover);
}

.dropdown-header {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    background-color: var(--bg-tertiary);
    border-radius: 8px 8px 0 0;
    cursor: default;
}

.dropdown-header:hover {
    background-color: var(--bg-tertiary);
}

.dropdown-header strong {
    font-size: 1rem;
    color: var(--text-primary);
}

.dropdown-header small {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.dropdown-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 0.25rem 0;
}

.dropdown-icon {
    font-size: 1.1rem;
}

.dropdown-logout {
    color: #dc3545;
    font-weight: 500;
}

.dropdown-logout:hover {
    background-color: var(--bg-hover);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
}

.badge-admin {
    background-color: var(--admin-color);
    color: white;
}

/* Barre d'actions horizontale */
.action-bar {
    background: var(--bg-content);
    border-bottom: 2px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 0.5rem 0;
}

.action-bar-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    justify-content: center;
}

.action-bar .btn {
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
}

/* Layout principal */
.main-container {
    max-width: 1400px;
    margin: 1rem auto;
    padding: 0 2rem;
}

.content {
    background: var(--bg-content);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

/* Boutons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.9rem;
    text-align: center;
    transition: all 0.3s ease;
    font-weight: 500;
}

.btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-warning {
    background-color: var(--warning-color);
    color: #212529;
}

.btn-info {
    background-color: var(--info-color);
    color: white;
}

.btn-creeticket {
    background: linear-gradient(135deg, #63d65f 0%, #1fa71b 100%);
    color: white;
}

.btn-dashboard {
    background: linear-gradient(135deg, #44d4bc 0%, #11ac92 100%);
    color: white;
}

.btn-msgauto {
    background: linear-gradient(135deg, #4260e6 0%, #133fb9 100%);
    color: white;
}

.btn-communication {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn-grh {
    background: linear-gradient(135deg, #a1a1a1 0%, #747373 100%);
    color: white;
}

.btn-consommables {
    background: linear-gradient(135deg, #dacc57 0%, #b8ac0b 100%);
    color: white;
}

.btn-print {
    background-color: #b1a537;
    color: white;
}

.btn-trombinoscope {
    background: linear-gradient(135deg, #ee5e5e 0%, #c91919 100%);
    color: white;
}

.btn-stats {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

/* Formulaires */
.form-container {
    max-width: 800px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-light);
}

.form-control {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-dark);
    border-radius: 4px;
    font-size: 1rem;
    background-color: var(--bg-input);
    color: var(--text-primary);
}

.form-control-inline {
    width: auto;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border-dark);
    border-radius: 4px;
    font-size: 0.9rem;
    background-color: var(--bg-input);
    color: var(--text-primary);
}

.form-control:focus,
.form-control-inline:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,0.25);
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.form-check {
    display: flex;
    align-items: center;
}

.form-check-input {
    width: auto;
    margin-right: 0.5rem;
}

.form-text {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Flash Messages Overlay */
.flash-overlay {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
    pointer-events: none;
}

.flash-notification {
    pointer-events: all;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    position: relative;
    animation: slideInRight 0.3s ease-out, fadeOut 0.3s ease-in 4.7s;
    animation-fill-mode: forwards;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-weight: 500;
}

.flash-success {
    background-color: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.flash-error {
    background-color: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.flash-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

.flash-warning {
    background-color: #fff3cd;
    color: #856404;
    border-left: 4px solid #ffc107;
}

.close-flash {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: inherit;
    padding: 0;
    margin-left: auto;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.close-flash:hover {
    opacity: 1;
}

/* Animation pour les notifications */
@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
        transform: translateX(400px);
    }
}

/* Anciens styles (gardés pour compatibilité) */
.flash-messages {
    margin-bottom: 1rem;
}

.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    position: relative;
}

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

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

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

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

.close-alert {
    position: absolute;
    top: 0.5rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: inherit;
}

/* Login */
.login-container {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
    background: white;
    padding: 3rem;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
}

.login-box h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: #2c3e50;
}

/* Dashboard */
.dashboard-header {
    margin-bottom: 1rem;
}

.dashboard-header h2 {
    font-size: 1.5rem;
    margin-bottom: 0;
}

.search-bar {
    margin-bottom: 0.5rem;
}

.search-form {
    display: flex;
    gap: 0.5rem;
}

.search-input {
    flex: 1;
    padding: 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
    background: var(--bg-input-2);
    color: var(--text-primary);
}

.search-info {
    margin-top: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border-left: 4px solid var(--primary-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.btn-clear-search {
    font-weight: 600;
    padding: 0.6rem 1.2rem;
}

/* Stats */
.stats-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-item {
    flex: 1;
    padding: 1rem;
    border-radius: 4px;
    text-align: center;
    color: white;
}

.stat-nouveau { background-color: var(--etat-nouveau); }
.stat-ouvert { background-color: var(--etat-ouvert); }
.stat-attente { background-color: var(--etat-attente); }
.stat-ferme { background-color: var(--etat-ferme); }
.stat-total { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }

.stat-label {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: bold;
}

/* Onglets */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
}

.tab {
    padding: 0.6rem 1.2rem;
    text-decoration: none;
    color: var(--text-secondary);
    border: none;
    background: none;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.tab:hover {
    background-color: var(--bg-hover);
}

.tab.active {
    color: var(--primary-color);
    font-weight: bold;
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--primary-color);
}

.tab-count {
    background-color: var(--bg-content);
    color: var(--text-primary);
    padding: 0.2rem 0.4rem;
    border-radius: 10px;
    font-size: 0.75rem;
    margin-left: 0.5rem;
}

.filter-bar {
    margin-bottom: 0.75rem;
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.per-page-selector {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.per-page-selector label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin: 0;
}

.per-page-select {
    padding: 0.4rem 0.6rem;
    font-size: 0.9rem;
    background: var(--bg-input-2);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    min-width: 70px;
    transition: all 0.2s ease;
}

.per-page-select:hover {
    border-color: var(--primary-color);
}

.per-page-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.date-filter-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.date-filter-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.date-filter-group label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0;
}

.date-input {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
    background: var(--bg-input-2);
    color: var(--text-primary);
}

/* Tableau tickets */
.tickets-table-container {
    overflow-x: auto;
}

.tickets-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    table-layout: fixed;
}

.tickets-table thead {
    background-color: var(--bg-tertiary);
}

.tickets-table th {
    padding: 0.3rem 0.75rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-light);
    border-bottom: 2px solid var(--border-color);
    font-size: 0.85rem;
    line-height: 1.2;
}

.tickets-table td {
    padding: 0.25rem 0.75rem !important;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    line-height: 1.2 !important;
    height: 34px;
}

/* Affichage date responsive */
.date-mobile {
    display: none;
}

.date-desktop {
    display: inline;
}

/* Affichage état responsive */
.etat-mobile {
    display: none;
}

.etat-desktop {
    display: inline;
}

.ticket-row {
    cursor: pointer;
    transition: background-color 0.2s ease;
    height: 34px;
}

.ticket-row:hover {
    background-color: var(--bg-hover);
}

.ticket-row.etat-nouveau {
    border-left: 4px solid var(--etat-nouveau);
}

.ticket-row.etat-ouvert {
    border-left: 4px solid var(--etat-ouvert);
}

.ticket-row.etat-attente {
    border-left: 4px solid var(--etat-attente);
}

.ticket-row.etat-ferme {
    border-left: 4px solid var(--etat-ferme);
    opacity: 0.7;
}

.ticket-row.etat-message {
    border-left: 4px solid #9c27b0;
}

.badge-etat-1 {
    background-color: var(--etat-nouveau);
    color: white;
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    display: inline-block;
    line-height: 1.2;
}

.badge-etat-2 {
    background-color: var(--etat-ouvert);
    color: white;
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    display: inline-block;
    line-height: 1.2;
}

.badge-etat-3 {
    background-color: var(--etat-attente);
    color: #212529;
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    display: inline-block;
    line-height: 1.2;
}

.badge-etat-4 {
    background-color: var(--etat-ferme);
    color: white;
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    display: inline-block;
    line-height: 1.2;
}

.badge-etat-5 {
    background-color: #9c27b0;
    color: white;
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    display: inline-block;
    line-height: 1.2;
}

.objet-cell {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #dee2e6;
    flex-wrap: wrap;
    gap: 1rem;
}

.pagination .btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.pagination-pages {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.page-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 35px;
    height: 35px;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-decoration: none;
    color: var(--text-primary);
    background-color: var(--bg-card);
    transition: all 0.2s ease;
    font-weight: 500;
}

.page-number:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.page-number.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    cursor: default;
}

.page-ellipsis {
    padding: 0 0.5rem;
    color: #6c757d;
}

.pagination-jump {
    display: flex;
    align-items: center;
}

.jump-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.jump-input {
    width: 70px;
    padding: 0.4rem;
    border: 1px solid var(--border-dark);
    border-radius: 4px;
    font-size: 0.9rem;
    text-align: center;
    background-color: var(--bg-input);
    color: var(--text-primary);
}

.jump-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}

.pagination-info {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Détail ticket */
.ticket-print-group {
    display: contents; /* invisible pour le layout écran → header pleine largeur */
}

.ticket-detail-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.4rem 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.6rem;
    border-bottom: 2px solid var(--border-color);
}

.ticket-detail-header h2 {
    line-height: 1.2;
    margin: 0;
    min-width: 0;
    word-break: break-word;
}

.ticket-meta {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.ticket-date {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.ticket-info-card,
.ticket-description-card,
.ticket-actions-card,
.ticket-messages-card {
    background: var(--bg-card);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.ticket-info-card h3,
.ticket-description-card h3,
.ticket-actions-card h3,
.ticket-messages-card h3 {
    margin-bottom: 0.5rem;
    color: var(--color-card-title);
    font-size: 1.15rem;
    font-weight: 700;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--color-card-title);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.take-charge-section {
    margin-bottom: 1rem;
}

.take-charge-section .btn-block {
    width: 100%;
    margin-bottom: 0.5rem;
}

.take-charge-section .alert {
    padding: 0.75rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.admin-action-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 0;
}

.admin-action-buttons form {
    display: inline-block;
}

.admin-action-buttons .btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    white-space: nowrap;
    line-height: 1.5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.admin-action-buttons .alert {
    flex: 1 1 100%;
    padding: 0.75rem;
    border-radius: 4px;
    margin: 0 0 0.5rem 0;
}

.info-table {
    width: 100%;
    table-layout: auto;
}

.info-table th {
    text-align: left;
    padding: 0.15rem 0.5rem 0.15rem 0;
    font-weight: 600;
    color: var(--text-light);
    width: 1%;
    white-space: nowrap;
    font-size: 0.85rem;
    line-height: 1.3;
}

.info-table td {
    padding: 0.15rem 0 0.15rem 0.5rem;
    font-size: 0.85rem;
    line-height: 1.3;
}

.description-content {
    background: var(--bg-quaternary);
    padding: 1rem;
    border-radius: 6px;
    white-space: pre-wrap;
    font-size: 0.95rem;
    border: 1px solid var(--border-color);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
    line-height: 1.5;
    color: var(--text-primary);
    font-weight: 500;
}

/* Messages */
.messages-list {
    max-height: 500px;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.message {
    background: var(--bg-card);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.message-own {
    background: var(--bg-quaternary);
    border: 1px solid var(--border-light);
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.message-date {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.message-content {
    white-space: pre-wrap;
    all: unset;
    display: block;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.message-attachment {
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-light);
}

.message-attachment a {
    font-size: 0.9rem;
    text-decoration: none;
}

/* Bouton d'édition de message */
.btn-edit-message {
    background: none;
    border: none;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    opacity: 0.6;
    transition: opacity 0.2s, transform 0.1s;
}

.btn-edit-message:hover {
    opacity: 1;
    transform: scale(1.1);
}

.btn-delete-message {
    background: none;
    border: none;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    opacity: 0.6;
    transition: opacity 0.2s, transform 0.1s;
}

.btn-delete-message:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Textarea d'édition de message */
.message-edit-textarea {
    width: 100%;
    min-height: 100px;
    padding: 0.75rem;
    border: 2px solid var(--primary-color);
    border-radius: 6px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 0.75rem;
}

.message-edit-textarea:focus {
    outline: none;
    border-color: var(--primary-dark);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Boutons d'édition de message */
.message-edit-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-start;
}

.message-edit-buttons button {
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
}

/* Liens dans les messages */
.message-content .message-link,
.description-content .message-link {
    color: var(--primary-color);
    text-decoration: underline;
    word-break: break-all;
    transition: color 0.2s;
}

.message-content .message-link:hover,
.description-content .message-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.no-messages {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
}

.message-form-container {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 1rem;
    border: 1px solid var(--border-color);
}

.ticket-bottom-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #dee2e6;
}

/* Messages automatiques */
.categorie-card {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

.categorie-card h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.message-auto-item {
    background: var(--bg-card);
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.message-auto-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.message-auto-actions {
    display: flex;
    gap: 0.5rem;
}

.message-auto-content {
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
    .main-container {
        padding: 0 1rem;
    }
    
    .action-bar-container {
        padding: 0 1rem;
    }
    
    .action-bar .btn {
        font-size: 0.85rem;
        padding: 0.5rem 0.8rem;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .stats-bar {
        flex-wrap: wrap;
    }
    
    .stat-item {
        min-width: calc(50% - 0.5rem);
    }
    
    .flash-overlay {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .flash-notification {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    .navbar-container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .user-dropdown-menu {
        right: auto;
        left: 50%;
        transform: translateX(-50%) translateY(-10px);
        min-width: 90vw;
        max-width: 300px;
    }
    
    .user-dropdown-menu.show {
        transform: translateX(-50%) translateY(0);
    }
    
    .user-dropdown-toggle {
        font-size: 0.9rem;
        padding: 0.4rem 0.8rem;
    }
    
    .pagination {
        justify-content: center;
    }
    
    .pagination-pages {
        order: 1;
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .pagination-jump {
        order: 2;
    }
    
    .pagination-info {
        order: 3;
        width: 100%;
        text-align: center;
    }
    
    .page-number {
        min-width: 30px;
        height: 30px;
        font-size: 0.85rem;
    }
    
    /* Tableau responsive sur mobile */
    .tickets-table {
        font-size: 0.7rem !important;
        table-layout: auto !important;
        display: table !important;
    }
    
    .tickets-table th,
    .tickets-table td {
        padding: 0.25rem 0.3rem !important;
        font-size: 0.7rem !important;
        white-space: nowrap !important;
    }
    
    /* Masquer certaines colonnes sur mobile - DASHBOARD UNIQUEMENT */
    .dashboard-table .tickets-table thead tr th:nth-child(4),
    .dashboard-table .tickets-table tbody tr td:nth-child(4) {
        display: none !important;  /* Service */
    }
    
    .dashboard-table .tickets-table thead tr th:nth-child(5),
    .dashboard-table .tickets-table tbody tr td:nth-child(5) {
        display: none !important;  /* Institution */
    }
    
    .dashboard-table .tickets-table thead tr th:nth-child(6),
    .dashboard-table .tickets-table tbody tr td:nth-child(6) {
        display: none !important;  /* Type */
    }
    
    /* Colonnes dashboard sur mobile */
    .dashboard-table .tickets-table thead tr th:nth-child(1),
    .dashboard-table .tickets-table tbody tr td:nth-child(1) {
        width: 48px !important;
        max-width: 48px !important;
    }
    
    .dashboard-table .tickets-table thead tr th:nth-child(2),
    .dashboard-table .tickets-table tbody tr td:nth-child(2) {
        width: 42px !important;
        max-width: 42px !important;
        font-size: 0.65rem !important;
    }
    
    .dashboard-table .tickets-table thead tr th:nth-child(3),
    .dashboard-table .tickets-table tbody tr td:nth-child(3) {
        max-width: 75px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
    
    .dashboard-table .tickets-table thead tr th:nth-child(7),
    .dashboard-table .tickets-table tbody tr td:nth-child(7) {
        max-width: 110px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }
    
    .dashboard-table .tickets-table thead tr th:nth-child(8),
    .dashboard-table .tickets-table tbody tr td:nth-child(8) {
        width: 50px !important;
        max-width: 50px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
    
    /* Ajuster la colonne objet sur mobile */
    .objet-cell {
        max-width: 110px !important;
        font-size: 0.7rem !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }
    
    /* Affichage date mobile uniquement */
    .date-desktop {
        display: none !important;
    }
    
    .date-mobile {
        display: inline !important;
    }
    
    /* Badges plus petits sur mobile */
    .badge-etat-1,
    .badge-etat-2,
    .badge-etat-3,
    .badge-etat-4,
    .badge-etat-5 {
        padding: 0.15rem 0.25rem !important;
        font-size: 0.55rem !important;
        display: inline-block !important;
        line-height: 1 !important;
        border-radius: 3px !important;
    }
    
    /* Afficher version courte des états sur mobile */
    .etat-desktop {
        display: none !important;
    }
    
    .etat-mobile {
        display: inline !important;
    }
    
    /* Container avec scroll horizontal */
    .tickets-table-container {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    /* Onglets responsive */
    .tabs {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .tab {
        font-size: 0.85rem;
        padding: 0.5rem 0.75rem;
        flex: 1 1 auto;
        min-width: calc(33.33% - 0.5rem);
    }
    
    /* Barre de recherche responsive */
    .search-form {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .search-input {
        width: 100%;
    }
    
    .search-form .btn {
        width: 100%;
    }
    
    /* Filtre de dates responsive */
    .filter-bar {
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
    }
    
    .filter-bar .btn {
        width: 100%;
        justify-content: center;
    }
    
    .date-filter-form {
        width: 100%;
    }
    
    .date-filter-group {
        display: grid;
        grid-template-columns: auto 1fr;
        gap: 0.5rem 0.75rem;
        align-items: center;
    }
    
    .date-filter-group label {
        margin: 0;
        font-size: 0.85rem;
        font-weight: 600;
        text-align: right;
    }
    
    .date-input {
        width: 100%;
        padding: 0.5rem;
        font-size: 0.85rem;
    }
    
    .date-filter-group .btn {
        grid-column: 1 / -1;
        margin-top: 0.5rem;
    }
    
    /* === PAGE DÉTAIL TICKET RESPONSIVE === */
    
    /* Header du ticket */
    .ticket-detail-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        padding-bottom: 0.75rem;
    }
    
    .ticket-detail-header h2 {
        font-size: 1.1rem;
        line-height: 1.3;
        word-break: break-word;
    }
    
    .ticket-meta {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
        width: 100%;
    }
    
    .ticket-date {
        font-size: 0.8rem;
    }
    
    /* Cards du ticket */
    .ticket-info-card,
    .ticket-description-card,
    .ticket-actions-card,
    .ticket-messages-card {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
    }
    
    .ticket-info-card h3,
    .ticket-description-card h3,
    .ticket-actions-card h3,
    .ticket-messages-card h3 {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }
    
    /* Tableau d'informations */
    .info-table {
        font-size: 0.8rem;
    }
    
    .info-table th {
        padding: 0.25rem 0.5rem 0.25rem 0;
        font-size: 0.8rem;
        vertical-align: top;
    }
    
    .info-table td {
        padding: 0.25rem 0 0.25rem 0.5rem;
        font-size: 0.8rem;
        word-break: break-word;
    }
    
    .info-table select.form-control-inline {
        font-size: 0.8rem;
        padding: 0.25rem;
        width: 100%;
    }
    
    /* Boutons d'actions admin */
    .admin-action-buttons {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .admin-action-buttons .btn {
        min-width: auto;
        width: 100%;
        font-size: 0.85rem;
        padding: 0.6rem;
    }
    
    /* Description */
    .description-content {
        font-size: 0.85rem;
        padding: 0.75rem;
    }
    
    /* Messages */
    .messages-list {
        max-height: 400px;
    }
    
    .message {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
    }
    
    .message-header {
        flex-direction: column;
        gap: 0.25rem;
        align-items: flex-start;
    }
    
    .message-header strong {
        font-size: 0.9rem;
    }
    
    .message-date {
        font-size: 0.75rem;
    }
    
    .message-content {
        font-size: 0.85rem;
        line-height: 1.4;
    }
    
    .message-attachment {
        margin-top: 0.5rem;
    }
    
    .message-attachment .btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.6rem;
    }
    
    /* Formulaire de message */
    .message-form-container {
        padding: 1rem;
    }
    
    .message-form-container h4 {
        font-size: 0.95rem;
        margin-bottom: 0.75rem;
    }
    
    .message-form .form-control {
        font-size: 0.85rem;
        padding: 0.6rem;
    }
    
    .message-form textarea.form-control {
        min-height: 120px;
    }
    
    .message-form select.form-control {
        font-size: 0.85rem;
    }
    
    .message-form .form-text {
        font-size: 0.75rem;
    }
    
    .message-form button[type="submit"] {
        width: 100%;
        padding: 0.75rem;
        font-size: 0.9rem;
    }
    
    /* Actions en bas */
    .ticket-bottom-actions {
        flex-direction: column;
        gap: 0.5rem;
        margin-top: 1rem;
        padding-top: 1rem;
    }
    
    .ticket-bottom-actions .btn {
        width: 100%;
    }
    
    /* === PAGE MES TICKETS RESPONSIVE === */
    
    /* Filtres ouverts/fermés */
    .page-header h2 {
        font-size: 1.3rem;
        text-align: center;
    }
    
    .filter-bar .btn {
        flex: 1;
        min-width: 0;
        font-size: 0.85rem;
    }
    
    /* Tableau my_tickets - colonnes: État(1), Date(2), Type(3), Objet(4), Agent(5) */
    
    /* Colonne État */
    .my-tickets-table .tickets-table thead tr th:nth-child(1),
    .my-tickets-table .tickets-table tbody tr td:nth-child(1) {
        width: 48px !important;
        max-width: 48px !important;
    }
    
    /* Colonne Date */
    .my-tickets-table .tickets-table thead tr th:nth-child(2),
    .my-tickets-table .tickets-table tbody tr td:nth-child(2) {
        width: 42px !important;
        max-width: 42px !important;
        font-size: 0.65rem !important;
    }
    
    /* Masquer colonne Type sur mobile pour my_tickets */
    .my-tickets-table .tickets-table thead tr th:nth-child(3),
    .my-tickets-table .tickets-table tbody tr td:nth-child(3) {
        display: none !important;
    }
    
    /* Colonne Objet my_tickets (devient 4e colonne mais affichée comme 3e) */
    .my-tickets-table .tickets-table thead tr th:nth-child(4),
    .my-tickets-table .tickets-table tbody tr td:nth-child(4) {
        max-width: 130px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }
    
    /* Colonne Agent my_tickets (5e colonne mais affichée comme 4e) */
    .my-tickets-table .tickets-table thead tr th:nth-child(5),
    .my-tickets-table .tickets-table tbody tr td:nth-child(5) {
        width: 55px !important;
        max-width: 55px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
}

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

.icon {
    font-size: 1.2rem;
    margin-right: 0.25rem;
    font-style: normal;
    display: inline-block;
}

/* Communication admin */
.admin-communication-container {
    max-width: 900px;
    margin: 0 auto;
}

.admin-communication-container h2 {
    margin-bottom: 1.5rem;
    color: #306fad;
}

.info-box {
    background: var(--bg-card-2);
    border-left: 4px solid #2196F3;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
    border-left: 4px solid #2196F3;
}

.info-box h3 {
    margin-bottom: 0.75rem;
    color: #1976D2;
    font-size: 1.1rem;
}

.info-box p {
    color: var(--text-primary);
    line-height: 1.6;
    margin: 0;
}

.alert-form {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.alert-form textarea {
    width: 100%;
    min-height: 150px;
    padding: 1rem;
    border: 1px solid var(--border-dark);
    border-radius: 4px;
    font-size: 1rem;
    font-family: Arial, sans-serif;
    resize: vertical;
    background-color: var(--bg-input);
    color: var(--text-primary);
}

.alert-form textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* Bouton de basculement de thème */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-size: 0.95rem;
    font-family: inherit;
    transition: background-color 0.2s ease;
}

.theme-toggle:hover {
    background-color: var(--bg-hover);
}

.theme-toggle .dropdown-icon {
    font-size: 1.1rem;
}

/* Statistiques */
.statistics-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.statistics-container h2 {
    margin-bottom: 2rem;
    color: #296aac;
}

.period-selector {
    background: var(--bg-card-2);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.period-selector h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 1.2rem;
}

.period-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.custom-date-selector {
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
    margin-top: 1rem;
}

.custom-date-selector h4 {
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 1rem;
}

.date-form {
    width: 100%;
}

.date-inputs {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: flex-end;
}

.date-inputs .btn {
    padding: 0.5rem 1.5rem;
    white-space: nowrap;
    line-height: 1.4;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.date-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.date-input-group label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.date-input-group input[type="date"] {
    padding: 0.5rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.9rem;
}

.stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card-2);
    padding: 1rem;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    text-align: center;
    border: 2px solid var(--border-color);
}

.stat-card h4 {
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-primary);
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.chart-section {
    background: var(--bg-card-2);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.chart-section h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.chart-section canvas {
    max-height: 300px;
}

.stats-tables {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.stats-table {
    background: var(--bg-card-2);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.stats-table h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.stats-table table {
    width: 100%;
    border-collapse: collapse;
}

.stats-table thead {
    background: var(--bg-tertiary);
}

.stats-table th {
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-light);
    border-bottom: 2px solid var(--border-color);
}

.stats-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

/* Hover désactivé pour les tableaux de statistiques */
/* .stats-table tbody tr:hover {
    background: var(--bg-hover);
} */

/* Recherche d'utilisateur */
.user-search-section {
    background: var(--bg-card-2);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.user-search-section h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 1.2rem;
}

.user-search-form {
    margin-bottom: 1rem;
}

.user-search-input {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.user-search-input input[type="text"] {
    flex: 1;
    min-width: 250px;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-primary);
    border-radius: 4px;
    font-size: 1rem;
}

.user-search-input input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.user-search-input .btn {
    padding: 0.5rem 1.5rem;
    white-space: nowrap;
    line-height: 1.4;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.user-stats-results {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: var(--bg-card);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.user-stats-results h4 {
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    font-size: 1.2rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-color);
}

.user-stats-results h5 {
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
}

.user-stats-results .stats-overview {
    margin-bottom: 1.5rem;
}

.user-stats-results .stat-card h5 {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.user-stats-results .stat-number {
    font-size: 1.8rem;
}

.user-stats-details {
    margin-top: 1.5rem;
}

.user-stats-details table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card-2);
    border-radius: 4px;
    overflow: hidden;
}

.user-stats-details thead {
    background: var(--bg-tertiary);
}

.user-stats-details th {
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-light);
    border-bottom: 2px solid var(--border-color);
}

.user-stats-details td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

/* Hover désactivé pour le tableau de stats utilisateur */
/* .user-stats-details tbody tr:hover {
    background: var(--bg-hover);
} */

.actions {
    text-align: center;
    margin-top: 2rem;
}

/* Responsive pour les statistiques */
@media (max-width: 768px) {
    .statistics-container {
        padding: 0.75rem;
    }
    
    .statistics-container h2 {
        font-size: 1.3rem;
        margin-bottom: 1rem;
        text-align: center;
    }
    
    /* Sélecteur de période */
    .period-selector {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .period-selector h3 {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }
    
    .period-buttons {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .period-buttons .btn {
        font-size: 0.85rem;
        padding: 0.5rem;
        white-space: nowrap;
    }
    
    .custom-date-selector {
        padding-top: 1rem;
        margin-top: 1rem;
    }
    
    .custom-date-selector h4 {
        font-size: 0.9rem;
        margin-bottom: 0.75rem;
    }
    
    .date-inputs {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .date-input-group {
        width: 100%;
    }
    
    .date-input-group label {
        font-size: 0.85rem;
    }
    
    .date-input-group input[type="date"] {
        width: 100%;
        padding: 0.5rem;
        font-size: 0.85rem;
    }
    
    .date-inputs .btn {
        width: 100%;
        margin-top: 0.5rem;
    }
    
    /* Vue d'ensemble des stats */
    .stats-overview {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
        margin-bottom: 1.5rem;
    }
    
    .stat-card {
        padding: 0.75rem;
    }
    
    .stat-card h4 {
        font-size: 0.8rem;
        margin-bottom: 0.5rem;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    /* Graphiques */
    .charts-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .chart-section {
        padding: 1rem;
        overflow: hidden;
        box-sizing: border-box;
    }
    
    .chart-section h3 {
        font-size: 0.95rem;
        margin-bottom: 0.75rem;
    }
    
    .chart-section canvas {
        max-height: 250px !important;
        max-width: 100% !important;
        height: auto !important;
        display: block;
        margin: 0 auto;
    }
    
    /* Tableaux */
    .stats-tables {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-bottom: 1rem;
    }
    
    .stats-table {
        padding: 1rem;
        overflow-x: auto;
    }
    
    .stats-table h3 {
        font-size: 0.95rem;
        margin-bottom: 0.75rem;
    }
    
    .stats-table table {
        font-size: 0.85rem;
        min-width: 100%;
    }
    
    .stats-table th {
        padding: 0.5rem 0.35rem;
        font-size: 0.8rem;
        white-space: nowrap;
    }
    
    .stats-table td {
        padding: 0.5rem 0.35rem;
        font-size: 0.8rem;
    }
    
    /* Première colonne (noms) peut avoir ellipsis si trop long */
    .stats-table td:first-child {
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    /* Deuxième colonne (nombres) reste compacte */
    .stats-table td:last-child,
    .stats-table th:last-child {
        text-align: right;
        width: 60px;
    }
}

/* Centrage du titre de la page */
.page-header {
    text-align: center;
}

/* Règles d'impression */
@media print {
    /* Masquer les éléments non nécessaires à l'impression */
    .navbar,
    .action-bar,
    .ticket-actions-card,
    .message-form-container,
    .form-actions,
    .btn,
    button,
    .admin-action-buttons,
    .alert,
    .flash-overlay {
        display: none !important;
    }
    
    /* Supprimer la limitation de hauteur et le scroll pour les messages */
    .messages-list {
        max-height: none !important;
        overflow: visible !important;
    }
    
    /* Optimiser les messages pour l'impression */
    .message {
        page-break-inside: avoid;
        break-inside: avoid;
    }
    
    /* Ajuster les marges et le fond pour l'impression */
    body {
        background: white !important;
        color: black !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    /* Éliminer tout espace en haut */
    .main-container, .content {
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        box-shadow: none !important;
        background: white !important;
    }

    /* Wrapper impression : devient un vrai bloc pour éviter le saut de page */
    .ticket-print-group {
        display: block !important;
    }

    /* Réduire les espacements pour optimiser l'impression */
    .ticket-detail-header {
        margin-top: 0 !important;
        margin-bottom: 0.5rem !important;
        padding-top: 0 !important;
        padding-bottom: 0.3rem !important;
        display: flex !important;
        border-bottom: 1px solid #ddd !important;
        break-after: avoid !important;
        page-break-after: avoid !important;
    }
    
    .ticket-detail-container {
        margin: 0 auto !important;
        padding: 0 !important;
        break-before: avoid !important;
        page-break-before: avoid !important;
    }
    
    .ticket-info-card,
    .ticket-description-card {
        box-shadow: none !important;
        border: 1px solid #ddd;
        page-break-inside: avoid;
        break-inside: avoid;
        margin-bottom: 0.5rem;
        padding: 0.75rem;
    }

    .ticket-messages-card {
        box-shadow: none !important;
        border: 1px solid #ddd;
        margin-bottom: 0.5rem;
        padding: 0.75rem;
        page-break-before: auto;
        break-before: auto;
    }
    
    /* Améliorer la lisibilité */
    .message-content,
    .description-content {
        color: black !important;
    }

    .info-table select,
    .info-table option {
        color: black !important;
        border-color: white !important;
        background: white !important;
        appearance: none !important;
        -webkit-appearance: none !important;
    }
    
    /* Réduire les espacements */
    .message {
        margin-bottom: 0.5rem;
        padding: 0.75rem;
    }
    
    h2, h3 {
        margin-top: 0;
        margin-bottom: 0.5rem;
    }
}

/* ===========================
   Détail de demande de matériel
   =========================== */
.ticket-detail-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.ticket-header h1 {
    margin: 0;
    font-size: 24px;
    color: var(--text-primary);
}

.info-section {
    background: var(--bg-card);
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

.info-section h2 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 18px;
    color: var(--text-primary);
    border-bottom: 2px solid #007bff;
    padding-bottom: 10px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.info-item {
    display: flex;
    flex-direction: column;
}

.info-item label {
    font-weight: bold;
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 5px;
}

.info-item strong,
.info-item span {
    font-size: 16px;
    color: var(--text-primary);
}

.detail-box {
    margin-bottom: 20px;
}

.detail-box:last-child {
    margin-bottom: 0;
}

.detail-box h3 {
    font-size: 16px;
    color: #007bff;
    margin-bottom: 10px;
}

.content-box {
    background: var(--bg-tertiary);
    padding: 15px;
    border-left: 4px solid #007bff;
    border-radius: 4px;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: var(--text-primary);
}

/* Animations pour notifications */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Style pour l'adresse IP cliquable */
.ip-address {
    cursor: pointer;
    user-select: none;
    padding: 2px 5px;
    border-radius: 3px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.ip-address:hover {
    background-color: var(--bg-card-2);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Notification de copie */
.copy-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--success-color);
    color: white;
    padding: 15px 20px;
    border-radius: 5px;
    box-shadow: var(--shadow-lg);
    z-index: 10000;
    animation: slideIn 0.3s ease-out;
}

/* Modal de transfert */
.transfer-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.transfer-modal-content {
    background: var(--bg-card);
    padding: 0;
    border-radius: 10px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.transfer-modal-content h3 {
    margin: 0;
    padding: 20px 30px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
}

.transfer-modal-content p {
    color: var(--text-primary);
    padding: 15px 30px 0 30px;
}

#membersList {
    margin: 0;
    padding: 20px 30px;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
    max-height: 300px;
    /* Scrollbar Firefox */
    scrollbar-width: thin;
    scrollbar-color: var(--border-dark) var(--bg-tertiary);
}

/* Scrollbar Webkit (Chrome, Edge, Safari) */
#membersList::-webkit-scrollbar {
    width: 8px;
}

#membersList::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

#membersList::-webkit-scrollbar-thumb {
    background: var(--border-dark);
    border-radius: 4px;
}

#membersList::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

#membersList label {
    display: block;
    padding: 10px;
    margin: 5px 0;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-primary);
}

#membersList label:hover {
    background: var(--bg-hover);
    border-color: var(--primary-color);
}

#membersList input[type="checkbox"] {
    margin-right: 10px;
    cursor: pointer;
}

#membersList .member-info {
    display: flex;
    flex-direction: column;
}

#membersList .member-name {
    font-weight: bold;
    color: var(--text-primary);
}

#membersList .member-email {
    font-size: 0.85em;
    color: var(--text-secondary);
}

.transfer-modal-buttons {
    display: flex;
    gap: 10px;
    padding: 20px 30px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-card);
    border-radius: 0 0 10px 10px;
}

.transfer-modal-buttons button {
    flex: 1;
}