/* backend/public/css/admin-styles.css */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #c62292 0%, #8e1b6d 100%);
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: #333;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-logout {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.95);
    padding: 25px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card h3 {
    color: #666;
    margin-bottom: 10px;
    font-size: 14px;
}

.number {
    font-size: 36px;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.label {
    color: #888;
    font-size: 12px;
}

.tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 5px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.tab {
    flex: 1;
    padding: 15px 20px;
    border: none;
    background: transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.tab.active {
    background: #c62292;
    color: white;
    box-shadow: 0 4px 15px rgba(198, 34, 146, 0.4);
}

/* Badge de notification sur les onglets */
.tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.tab-badge {
    background: #e53e3e;
    color: white;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    animation: badge-pulse 2s infinite;
    box-shadow: 0 2px 8px rgba(229, 62, 62, 0.4);
}

.tab.active .tab-badge {
    background: white;
    color: #c62292;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

@keyframes badge-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.main-content {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.controls {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-box input,
select,
input[type="date"] {
    padding: 12px 15px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.search-box input:focus,
select:focus,
input[type="date"]:focus {
    outline: none;
    border-color: #c62292;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: #c62292;
    color: white;
}

.btn-primary:hover {
    background: #a01d76;
    transform: translateY(-2px);
}

.btn-success {
    background: #48bb78;
    color: white;
}

.btn-success:hover {
    background: #38a169;
    transform: translateY(-2px);
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-details {
    background: #3182ce;
    color: white;
    margin-right: 5px;
}

.btn-details:hover {
    background: #2c5aa0;
}

.btn-danger {
    background: #e53e3e;
    color: white;
    margin-left: 5px;
}

.btn-danger:hover {
    background: #c53030;
    transform: translateY(-2px);
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

th, td {
    text-align: left;
    padding: 15px 12px;
    border-bottom: 1px solid #e1e8ed;
}

th {
    background: #f7fafc;
    font-weight: 600;
    color: #4a5568;
}

tr:hover {
    background: #f7fafc;
}

.status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status.active {
    background: #c6f6d5;
    color: #22543d;
}

.status.pending {
    background: #fed7d7;
    color: #742a2a;
}

.alert {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: none;
}

.alert.success {
    background: #c6f6d5;
    color: #22543d;
    border: 1px solid #9ae6b4;
}

.alert.error {
    background: #fed7d7;
    color: #742a2a;
    border: 1px solid #feb2b2;
}

/* MODALS */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 2% auto;
    padding: 0;
    border-radius: 15px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    background: linear-gradient(135deg, #c62292 0%, #8e1b6d 100%);
    color: white;
    padding: 20px 30px;
    border-radius: 15px 15px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 24px;
}

.close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #4a5568;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #c62292;
}

/* Styles spécifiques pour les détails du diagnostic */
.diagnostic-details {
    display: grid;
    gap: 20px;
}

.detail-section {
    background: #f7fafc;
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid #c62292;
}

.detail-section h3 {
    color: #2d3748;
    margin-bottom: 15px;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.detail-item {
    background: white;
    padding: 12px 15px;
    border-radius: 8px;
    border: 1px solid #e1e8ed;
}

.detail-item strong {
    color: #4a5568;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-item span {
    display: block;
    color: #2d3748;
    font-size: 14px;
    margin-top: 4px;
}

.inspection-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.inspection-tag {
    background: #c62292;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
}

.photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.photo-item {
    background: #e1e8ed;
    aspect-ratio: 1;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 12px;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .controls {
        flex-direction: column;
    }

    .modal-content {
        width: 95%;
        margin: 5% auto;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }
}
/* =============================================================================
   AFFICHAGE DES PHOTOS DANS L'INTERFACE ADMIN
============================================================================= */

.photo-count {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: #e8f4fd;
    color: #1976d2;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    margin-top: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
}

.photo-item {
    background: #ffffff;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.photo-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.photo-item img:hover {
    opacity: 0.9;
}

.photo-item .photo-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: #f0f0f0;
    color: #666;
    font-size: 12px;
    text-align: center;
    padding: 8px;
}

/* Section de photos avec titre */
.photos-section {
    margin-top: 20px;
}

.photos-section h4 {
    color: #2d3748;
    margin-bottom: 10px;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.photos-section.empty {
    opacity: 0.6;
}

.photos-section.empty .photos-grid {
    background: #f5f5f5;
    border: 2px dashed #d0d0d0;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photos-section.empty .empty-message {
    color: #666;
    font-style: italic;
    font-size: 14px;
}

/* Modal pour agrandir les photos */
.photo-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.photo-modal-content {
    max-width: 90%;
    max-height: 90%;
    position: relative;
}

.photo-modal-content img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

.photo-modal-header {
    position: absolute;
    top: -50px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    font-size: 16px;
}

.photo-modal-title {
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 12px;
    border-radius: 4px;
}

.photo-modal-close {
    background: rgba(0, 0, 0, 0.7);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    cursor: pointer;
    font-size: 24px;
    transition: background 0.2s ease;
}

.photo-modal-close:hover {
    background: rgba(0, 0, 0, 0.9);
}

/* Améliorations pour les détails du diagnostic */
.diagnostic-details {
    display: grid;
    gap: 25px;
    max-height: 80vh;
    overflow-y: auto;
    padding-right: 10px;
}

.diagnostic-details::-webkit-scrollbar {
    width: 6px;
}

.diagnostic-details::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.diagnostic-details::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.diagnostic-details::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Sections de détails avec icônes */
.detail-section h3 {
    color: #2d3748;
    margin-bottom: 15px;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e2e8f0;
}

/* Tags d'inspection */
.inspection-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.inspection-tag {
    background: linear-gradient(135deg, #c62292 0%, #8e1b6d 100%);
    color: white;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Réponse expert */
.expert-response {
    background: linear-gradient(135deg, #f6f9fc 0%, #e9f5f0 100%);
    border-left: 4px solid #48bb78;
    padding: 20px;
    border-radius: 8px;
}

.expert-response-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.expert-response-date {
    color: #666;
    font-size: 12px;
}

.expert-response-message {
    line-height: 1.6;
    color: #2d3748;
}

/* Styles responsives */
@media (max-width: 768px) {
    .photos-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 8px;
    }
    
    .detail-grid {
        grid-template-columns: 1fr;
    }
    
    .diagnostic-details {
        max-height: 70vh;
    }
    
    .photo-modal-content {
        max-width: 95%;
        max-height: 95%;
    }
    
    .photo-modal-header {
        top: -45px;
        font-size: 14px;
    }
    
    .photo-modal-title {
        padding: 6px 10px;
        font-size: 14px;
    }
    
    .photo-modal-close {
        width: 35px;
        height: 35px;
        font-size: 20px;
    }
}

/* Amélioration du tableau des diagnostics */
.diagnostics-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.diagnostics-table th {
    background: linear-gradient(135deg, #c62292 0%, #8e1b6d 100%);
    color: white;
    padding: 12px 8px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.diagnostics-table td {
    padding: 12px 8px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
}

.diagnostics-table tr:hover {
    background: #f7fafc;
}

.diagnostics-table tr:last-child td {
    border-bottom: none;
}

/* Indicateurs de statut améliorés */
.status {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.status.active {
    background: #c6f6d5;
    color: #22543d;
}

.status.active::before {
    content: "✓";
    font-weight: bold;
}

.status.pending {
    background: #fed7d7;
    color: #742a2a;
}

.status.pending::before {
    content: "⏳";
}

/* Boutons d'action améliorés */
.btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 2px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.btn-details {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-details:hover {
    background: #cbd5e0;
    color: #2d3748;
}

.btn-primary {
    background: linear-gradient(135deg, #c62292 0%, #8e1b6d 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #a01d76 0%, #6e1552 100%);
}

.btn-small {
    padding: 4px 8px;
    font-size: 11px;
}

/* Animation de chargement */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #666;
}

.loading::before {
    content: "";
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #c62292;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* États vides */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-state h3 {
    color: #4a5568;
    margin-bottom: 10px;
}

.empty-state p {
    margin-bottom: 20px;
    line-height: 1.5;
}

/* Améliorations pour les alertes */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: none;
    border-left: 4px solid;
}

.alert.success {
    background: #f0fff4;
    color: #22543d;
    border-left-color: #38a169;
}

.alert.error {
    background: #fff5f5;
    color: #742a2a;
    border-left-color: #e53e3e;
}

.alert.info {
    background: #ebf8ff;
    color: #2a4365;
    border-left-color: #3182ce;
}

.alert.warning {
    background: #fffbeb;
    color: #744210;
    border-left-color: #d69e2e;
}

/* Compteur de photos dans le tableau */
.photo-count {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: linear-gradient(135deg, #e2f2ff 0%, #f0f8ff 100%);
    color: #1976d2;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid #bbdefb;
}

/* Amélioration des modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 2% auto;
    padding: 0;
    border-radius: 15px;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    background: linear-gradient(135deg, #c62292 0%, #8e1b6d 100%);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.modal-body {
    padding: 0;
    overflow-y: auto;
    max-height: calc(90vh - 80px);
}

.close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Responsive final */
@media (max-width: 480px) {
    .photos-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }
    
    .modal-content {
        width: 95%;
        margin: 5% auto;
    }
    
    .modal-header {
        padding: 15px 20px;
    }
    
    .modal-header h2 {
        font-size: 18px;
    }
    
    .detail-section {
        padding: 15px;
    }
    
    .diagnostics-table th,
    .diagnostics-table td {
        padding: 8px 4px;
        font-size: 12px;
    }
    
    .btn {
        padding: 4px 6px;
        font-size: 10px;
    }
}

/* =============================================================================
   CONVERSATION THREAD STYLES (Messages utilisateurs)
============================================================================= */

.conversation-thread {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.conversation-thread::-webkit-scrollbar {
    width: 6px;
}

.conversation-thread::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.conversation-thread::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.conversation-thread::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.conversation-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 12px;
    position: relative;
}

.conversation-message.user-message {
    background: linear-gradient(135deg, #e8f4fd 0%, #d6eaff 100%);
    border: 1px solid #b3d7f5;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.conversation-message.admin-message {
    background: linear-gradient(135deg, #c62292 0%, #8e1b6d 100%);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 12px;
    gap: 12px;
}

.user-message .message-header {
    color: #4a5568;
}

.admin-message .message-header {
    color: rgba(255, 255, 255, 0.85);
}

.message-author {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.message-time {
    font-size: 11px;
    opacity: 0.8;
}

.message-body {
    line-height: 1.5;
    font-size: 14px;
}

.user-message .message-body {
    color: #2d3748;
}

.admin-message .message-body {
    color: white;
}

/* Reply modal header */
.reply-modal-header {
    background: #f7fafc;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-left: 4px solid #c62292;
}

.reply-modal-header p {
    margin: 5px 0;
    color: #4a5568;
}

.conversation-history {
    margin-bottom: 20px;
}

.conversation-history h4 {
    color: #2d3748;
    margin-bottom: 10px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Message details view */
.message-details .detail-section h4 {
    color: #2d3748;
    margin-bottom: 10px;
    font-size: 16px;
    font-weight: 600;
}

.message-details .detail-section {
    margin-bottom: 15px;
}

.message-content {
    background: white;
    padding: 12px 15px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    line-height: 1.6;
    color: #2d3748;
}

/* Status badges for user messages */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-badge.pending {
    background: #fef3c7;
    color: #92400e;
}

.status-badge.info {
    background: #dbeafe;
    color: #1e40af;
}

.status-badge.active {
    background: #d1fae5;
    color: #065f46;
}

.status-badge.archived {
    background: #e5e7eb;
    color: #4b5563;
}

/* Admin notes section */
.admin-notes {
    background: #fffbeb !important;
    border-left-color: #f59e0b !important;
}

.admin-notes h4 {
    color: #92400e !important;
}

/* Original message in reply modal */
.original-message-text {
    background: #f7fafc;
    padding: 12px 15px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    margin-top: 8px;
    color: #4a5568;
    line-height: 1.5;
    max-height: 150px;
    overflow-y: auto;
}

/* Reply section styling */
.reply-section {
    background: #f0fff4 !important;
    border-left-color: #48bb78 !important;
}

.reply-section h4 {
    color: #22543d !important;
}

/* Text muted helper */
.text-muted {
    color: #718096;
    font-style: italic;
}

/* Conversation count in table */
.conversation-count {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: linear-gradient(135deg, #e8f4fd 0%, #d6eaff 100%);
    color: #2563eb;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    margin-top: 4px;
}

/* Responsive conversation */
@media (max-width: 768px) {
    .conversation-message {
        max-width: 95%;
    }

    .conversation-thread {
        max-height: 300px;
        padding: 10px;
    }

    .message-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}

/* =============================================================================
   CHAT-STYLE MESSAGE DETAILS (User Messages)
============================================================================= */

.message-details-container {
    padding: 20px;
}

/* User info header card */
.message-info-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.user-info-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    border-left: 4px solid #c62292;
}

.user-avatar {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #c62292 0%, #8e1b6d 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
    flex-shrink: 0;
}

.user-details {
    flex: 1;
}

.user-details h3 {
    margin: 0 0 5px 0;
    color: #2d3748;
    font-size: 18px;
}

.user-details p {
    margin: 2px 0;
    color: #4a5568;
    font-size: 14px;
}

.user-details p a {
    color: #c62292;
    text-decoration: none;
}

.user-details p a:hover {
    text-decoration: underline;
}

.user-details .company {
    color: #718096;
    font-style: italic;
}

.message-status-large {
    padding: 8px 16px;
}

.message-status-large .status {
    font-size: 14px;
    padding: 8px 16px;
}

/* Site info card */
.site-info-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 15px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    border: 1px solid #e2e8f0;
}

.site-info-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.site-info-item .icon {
    font-size: 20px;
    width: 30px;
    text-align: center;
}

.site-info-item strong {
    display: block;
    font-size: 11px;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.site-info-item span {
    color: #2d3748;
    font-size: 14px;
}

/* GPS link styles */
.gps-link {
    color: #3182ce;
    text-decoration: none;
    font-weight: 500;
}

.gps-link:hover {
    color: #2c5282;
    text-decoration: underline;
}

.gps-accuracy {
    display: block;
    font-size: 11px;
    color: #718096;
    margin-top: 2px;
}

/* Subject bar */
.message-subject-bar {
    background: linear-gradient(135deg, #c62292 0%, #8e1b6d 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.subject-icon {
    font-size: 20px;
}

.subject-text {
    font-size: 16px;
    font-weight: 600;
}

/* Chat container */
.chat-container {
    background: #f8f9fa;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    margin-bottom: 20px;
}

.chat-header {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    color: white;
    padding: 12px 20px;
    font-weight: 600;
    font-size: 14px;
}

.chat-messages {
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.chat-empty {
    text-align: center;
    padding: 40px;
    color: #718096;
}

/* Chat bubbles */
.chat-bubble {
    max-width: 80%;
    padding: 15px;
    border-radius: 15px;
    position: relative;
}

.user-bubble {
    background: linear-gradient(135deg, #fce4ec 0%, #f8bbd9 100%);
    border: 1px solid #f48fb1;
    align-self: flex-start;
    border-bottom-left-radius: 5px;
}

.admin-bubble {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border: 1px solid #90caf9;
    align-self: flex-end;
    border-bottom-right-radius: 5px;
}

.bubble-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.bubble-author {
    font-weight: 600;
    font-size: 13px;
    color: #2d3748;
}

.bubble-time {
    font-size: 11px;
    color: #718096;
}

.bubble-subject {
    font-weight: 600;
    font-size: 14px;
    color: #4a5568;
    margin-bottom: 8px;
    padding: 5px 10px;
    background: rgba(255,255,255,0.5);
    border-radius: 5px;
}

.bubble-content {
    font-size: 14px;
    line-height: 1.6;
    color: #2d3748;
}

/* Admin notes section */
.admin-notes-section {
    background: #fffbeb;
    border-radius: 12px;
    padding: 20px;
    border-left: 4px solid #f59e0b;
}

.admin-notes-section h4 {
    color: #92400e;
    margin: 0 0 12px 0;
    font-size: 14px;
}

.notes-content {
    color: #78350f;
    font-size: 14px;
    line-height: 1.6;
}

/* Reply modal styles */
.reply-user-info {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    border-left: 4px solid #c62292;
}

.reply-user-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.reply-avatar {
    font-size: 24px;
    background: linear-gradient(135deg, #c62292 0%, #8e1b6d 100%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.reply-user-details {
    flex: 1;
}

.reply-user-details strong {
    display: block;
    color: #2d3748;
    font-size: 15px;
}

.reply-user-details span {
    color: #718096;
    font-size: 13px;
}

.reply-site-info {
    display: flex;
    gap: 20px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e2e8f0;
}

.reply-site-info span {
    color: #4a5568;
    font-size: 13px;
}

.reply-subject-bar {
    background: linear-gradient(135deg, #c62292 0%, #8e1b6d 100%);
    color: white;
    padding: 12px 15px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 15px;
}

.reply-chat-container {
    background: #f8f9fa;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    margin-bottom: 15px;
}

.reply-chat-header {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    color: white;
    padding: 10px 15px;
    font-weight: 600;
    font-size: 13px;
}

.reply-chat-messages {
    padding: 15px;
    max-height: 250px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Responsive for message details */
@media (max-width: 768px) {
    .message-info-header {
        grid-template-columns: 1fr;
    }

    .site-info-card {
        grid-template-columns: 1fr;
    }

    .chat-bubble {
        max-width: 95%;
    }

    .chat-messages {
        max-height: 300px;
    }

    .reply-chat-messages {
        max-height: 200px;
    }

    .reply-site-info {
        flex-direction: column;
        gap: 8px;
    }
}

/* =============================================================================
   STATS BAR - Barre de statistiques compacte en ligne
   ============================================================================= */

.stats-bar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 12px;
    padding: 12px 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid #e2e8f0;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.stat-item:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: translateY(-1px);
}

.stat-icon {
    font-size: 16px;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: #1a202c;
    min-width: 24px;
    text-align: center;
}

.stat-item .stat-label {
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
}

.stat-separator {
    width: 1px;
    height: 32px;
    background: linear-gradient(to bottom, transparent, #cbd5e1, transparent);
    margin: 0 8px;
}

/* Couleurs par type */
.stat-item.new .stat-value {
    color: #f59e0b;
}

.stat-item.new:hover {
    background: rgba(245, 158, 11, 0.1);
}

.stat-item.read .stat-value {
    color: #3b82f6;
}

.stat-item.read:hover {
    background: rgba(59, 130, 246, 0.1);
}

.stat-item.replied .stat-value {
    color: #10b981;
}

.stat-item.replied:hover {
    background: rgba(16, 185, 129, 0.1);
}

.stat-item.total .stat-value {
    color: #8b5cf6;
}

.stat-item.total:hover {
    background: rgba(139, 92, 246, 0.1);
}

/* Responsive pour la stats bar */
@media (max-width: 768px) {
    .stats-bar {
        justify-content: center;
        padding: 10px;
    }

    .stat-item {
        padding: 6px 10px;
    }

    .stat-value {
        font-size: 18px;
    }

    .stat-item .stat-label {
        font-size: 11px;
    }

    .stat-separator {
        height: 24px;
        margin: 0 4px;
    }
}

@media (max-width: 480px) {
    .stats-bar {
        flex-wrap: wrap;
        gap: 8px;
    }

    .stat-separator {
        display: none;
    }

    .stat-item {
        flex: 1 1 calc(50% - 8px);
        justify-content: center;
        background: rgba(255, 255, 255, 0.6);
    }
}

/* =============================================================================
   SECTION DESCRIPTION
   ============================================================================= */

.section-description {
    color: #64748b;
    font-size: 14px;
    margin-bottom: 20px;
    padding: 12px 16px;
    background: #f8fafc;
    border-left: 3px solid #c62292;
    border-radius: 0 8px 8px 0;
}

/* =============================================================================
   USERS TABS (Utilisateurs / Administrateurs)
   ============================================================================= */

.users-tabs {
    margin-bottom: 20px;
}

.tabs-container {
    display: flex;
    gap: 8px;
    background: #f1f5f9;
    padding: 6px;
    border-radius: 12px;
    width: fit-content;
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tab-btn:hover {
    background: rgba(198, 34, 146, 0.1);
    color: #c62292;
}

.tab-btn.active {
    background: #c62292;
    color: white;
    box-shadow: 0 2px 8px rgba(198, 34, 146, 0.3);
}

.users-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.users-header .controls {
    display: flex;
    gap: 10px;
    align-items: center;
    margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .tabs-container {
        width: 100%;
        justify-content: center;
    }

    .tab-btn {
        padding: 8px 12px;
        font-size: 12px;
    }

    .users-header {
        flex-direction: column;
        align-items: stretch;
    }

    .users-header .controls {
        flex-direction: column;
    }
}

/* =============================================================================
   PIÈCES JOINTES - PREVIEW ET STYLES
============================================================================= */

.attachment-preview {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    max-width: 250px;
}

.attachment-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.attachment-name {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #333;
}

.attachment-size {
    color: #888;
    font-size: 12px;
    flex-shrink: 0;
}

.attachment-remove {
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
}

.attachment-remove:hover {
    background: #c0392b;
}

.form-help {
    display: block;
    margin-top: 5px;
    color: #888;
    font-size: 12px;
}

input[type="file"] {
    padding: 10px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    width: 100%;
    cursor: pointer;
    transition: border-color 0.2s;
}

input[type="file"]:hover {
    border-color: #c62292;
}

input[type="file"]:focus {
    outline: none;
    border-color: #c62292;
}