/* Styles pour la page Tickets - Utilise les mêmes styles que conversations */

.tickets-layout {
    display: flex;
    height: calc(100vh - 64px);
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #f1f5f9;
    width: 100%;
    max-width: none;
}

.tickets-sidebar {
    width: 350px;
    border-right: 1px solid #f1f5f9;
    display: flex;
    flex-direction: column;
    background: #fafbfc;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 24px;
    background: white;
}

.sidebar-header h3 {
    margin: 0 0 16px 0;
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.025em;
}

.filters {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.filters select {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    color: #374151;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.filters select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

.refresh-button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(30, 64, 175, 0.3);
}

/* Bouton d'envoi moderne */
.input-actions button {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 80px;
    justify-content: center;
}

.input-actions button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
}

.input-actions button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

/* Bouton d'envoi pour les notes internes */
.input-actions button.note-mode {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.input-actions button.note-mode:hover {
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
    background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%);
}

.input-actions button.note-mode:active {
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
}

.input-actions i {
    font-size: 12px;
}

.refresh-button:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.4);
}

.tickets-list {
    flex: 1;
    overflow-y: auto;
}

.ticket-item {
    padding: 15px 24px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.ticket-item:hover {
    background: #f8fafc;
    transform: translateX(2px);
}

.ticket-item.active {
    background: var(--primary-bg);
    box-shadow: 0 2px 8px rgba(30, 64, 175, 0.1);
}

.ticket-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary-color);
}

.ticket-header-info {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 6px;
}

.ticket-title {
    font-weight: 600;
    color: #0f172a;
    font-size: 14px;
    letter-spacing: -0.01em;
    line-height: 1.3;
}

.ticket-time {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 500;
}

.ticket-preview {
    margin-bottom: 8px;
    font-size: 12px;
    color: #475569;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ticket-preview strong {
    color: #1e293b;
}

.ticket-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ticket-avatar {
    flex-shrink: 0;
    margin-right: 12px;
    display: flex;
    flex-direction: row;
    gap: 10px;
}

.ticket-avatar .ticket-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ticket-name {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
}

.ticket-avatar .avatar {
    width: 35px;
    height: 30px;
    border-radius: 50%;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #6b7280;
    border: 2px solid #e5e7eb;
}

/* Anciens styles supprimés - remplacés par les nouveaux styles du header */

.ticket-info {
    flex: 1;
    min-width: 0;
}

.status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
    min-width: 80px;
    text-align: center;
}

/* Nouveaux statuts avec couleurs */
.status-badge.status-nouveau {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

.status-badge.status-en-cours {
    background: #fed7aa;
    color: #c2410c;
    border: 1px solid #fdba74;
}

.status-badge.status-attente-client {
    background: #e9d5ff;
    color: #7c3aed;
    border: 1px solid #c4b5fd;
}

.status-badge.status-attente-interne {
    background: #d6d3d1;
    color: #78716c;
    border: 1px solid #a8a29e;
}

.status-badge.status-resolu {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.status-badge.status-clos {
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid #d1d5db;
}

/* Support des anciens statuts pour la compatibilité */
.status-badge.active {
    background: #dcfce7;
    color: #166534;
}

.status-badge.open {
    background: #dbeafe;
    color: #1e40af;
}

.status-badge.closed {
    background: #f3f4f6;
    color: #6b7280;
}

.category-badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 500;
    background: #f3e8ff;
    color: #7c3aed;
}

/* Interface de chat */
.chat-interface {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    width: 100%;
    height: 100%;
    min-width: 0;
    overflow: hidden;
    max-width: none;
    flex: 1;
}

/* Conteneur de l'interface de chat */
#chatInterface {
    flex: 1;
    width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* Onglets de conversation */
.chat-tabs {
    display: flex;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.tab-btn {
    padding: 12px 20px;
    border: none;
    background: none;
    color: #64748b;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: #3b82f6;
    background: #f1f5f9;
}

.tab-btn.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
    background: #fff;
}

/* Contenu de conversation */
.chat-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    background: #fafbfc;
    width: 100%;
    display: flex;
    flex-direction: column;
}

/* Messages */
.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    padding: 0;
    flex: 1;
    overflow-y: auto;
}

.loading-messages {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #64748b;
    font-size: 14px;
    gap: 10px;
}

.loading-messages i {
    font-size: 16px;
}

.message {
    display: flex;
    gap: 8px;
    animation: fadeInUp 0.3s ease-out;
    align-items: flex-end;
    flex-direction: row;
    width: 100%;
    margin-bottom: 6px;
}

.message.user {
    align-self: flex-start;
    margin-right: auto;
    align-items: flex-end;
    justify-content: flex-start;
    width: 100%;
}

.message.agent {
    align-self: flex-end;
    flex-direction: row-reverse;
    margin-left: auto;
    align-items: flex-end;
    justify-content: flex-end;
    width: 100%;
    display: flex;
}

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

.message-avatar .avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 11px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
    border: 2px solid #fff;
    align-self: flex-end;
}

.message.agent .message-avatar .avatar {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

.message-content {
    background: #fff;
    padding: 10px 14px;
    border-radius: 16px;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #f1f5f9;
    transition: all 0.2s ease;
    min-width: 100px;
    max-width: 70%;
    width: fit-content;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    flex-shrink: 0;
}

.message-content:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
}

.message.agent .message-content {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: #ffffff;
    border: none;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    margin-left: auto;
    max-width: 70%;
}

.message.agent .message-content:hover {
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.message.agent .message-text {
    color: #ffffff !important;
}

.message.agent .message-meta {
    color: rgba(255, 255, 255, 0.9) !important;
}

.message-text {
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 4px;
    color: #374151;
    font-weight: 400;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    white-space: pre-wrap;
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    color: #94a3b8;
    font-weight: 500;
    margin-top: 2px;
}

.message.agent .message-meta {
    color: rgba(255, 255, 255, 0.8);
}

/* Nouvelle structure des messages avec heures externes */
.message-container {
    margin-bottom: 16px;
}

/* Séparateur de date */
.message-date-separator {
    display: flex;
    justify-content: center;
    margin: 20px 0 16px 0;
    position: relative;
}

.message-date-separator::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e2e8f0;
    z-index: 1;
}

.message-date-separator span {
    background: white;
    padding: 6px 16px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    border: 1px solid #e2e8f0;
    position: relative;
    z-index: 2;
}

.message-avatar {
    cursor: pointer;
    position: relative;
}

.message-avatar:hover .avatar {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Conteneur pour l'heure des messages */
.message-time-container {
    display: flex;
    justify-content: center;
    margin-bottom: 4px;
    margin-top: 8px;
}

.message-time {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 500;
    background: #f8fafc;
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

/* Supprimer les heures des bulles de message */
.message-meta {
    display: none;
}

/* Afficher seulement le statut pour les messages d'agent */
.message-status {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.8);
    font-style: italic;
    margin-top: 2px;
}

.note-author {
    font-size: 10px;
    color: #94a3b8;
    font-weight: 500;
    margin-top: 2px;
}

.message-status {
    font-style: italic;
}

/* Tooltip de contact */
.contact-tooltip {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    border: 1px solid #e2e8f0;
    padding: 16px;
    min-width: 200px;
    max-width: 280px;
    z-index: 10000;
    position: fixed;
    pointer-events: none;
}

.tooltip-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.tooltip-avatar .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.tooltip-info {
    flex: 1;
    min-width: 0;
}

.tooltip-name {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 2px;
    line-height: 1.3;
}

.tooltip-company {
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
}

.tooltip-details {
    border-top: 1px solid #f1f5f9;
    padding-top: 12px;
}

.tooltip-email {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #64748b;
}

.tooltip-email i {
    width: 14px;
    color: #94a3b8;
}

.tooltip-email span {
    word-break: break-all;
    line-height: 1.4;
}

/* Tooltip d'heure des messages */
.message-time-tooltip {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    white-space: nowrap;
    z-index: 10000;
    position: fixed;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Notes internes */
.internal-notes-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.internal-notes-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Style pour les messages de type note interne */
.message.internal-note .message-content {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%) !important;
    border: 1px solid #f59e0b !important;
    color: #92400e !important;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2) !important;
}

.message.internal-note .message-content:hover {
    box-shadow: 0 6px 16px rgba(245, 158, 11, 0.3) !important;
}

.message.internal-note .message-text {
    color: #92400e !important;
    font-weight: 400;
    font-size: 13px;
}

.message.internal-note .message-meta {
    color: #92400e !important;
    opacity: 0.8;
    font-size: 11px;
}

.message.internal-note .note-author {
    color: #92400e !important;
    font-weight: 600;
}

/* Style pour les messages de type note interne (nouveau système) */
.message[data-message-type="internal_note"] .message-content {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%) !important;
    border: 1px solid #f59e0b !important;
    color: #92400e !important;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2) !important;
}

.message[data-message-type="internal_note"] .message-content:hover {
    box-shadow: 0 6px 16px rgba(245, 158, 11, 0.3) !important;
}

.message[data-message-type="internal_note"] .message-text {
    color: #92400e !important;
    font-weight: 400;
    font-size: 13px;
}

.message[data-message-type="internal_note"] .message-meta {
    color: #92400e !important;
    opacity: 0.8;
    font-size: 11px;
}





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

.note-author {
    display: flex;
    align-items: center;
    gap: 8px;
}

.note-author .avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
}

.note-author span {
    font-weight: 600;
    color: #92400e;
    font-size: 14px;
}

.note-time {
    color: #92400e;
    font-size: 12px;
}

.note-content {
    color: #92400e;
    font-size: 14px;
    line-height: 1.5;
}

/* Zone de saisie */
.chat-input-container {
    border-top: 1px solid #e2e8f0;
    background: #fff;
    padding: 16px 24px;
    flex-shrink: 0;
}

/* Mode note interne - fond jaune léger */
.input-area.internal-note-mode {
    background: #fef3c7 !important;
    border: 1px solid #f59e0b;
    border-radius: 0 0 16px 16px !important;
    padding: 16px !important;
    margin: 0 !important;
}

.input-area.internal-note-mode textarea {
    background: transparent !important;
    color: #92400e !important;
}

.input-area.internal-note-mode textarea::placeholder {
    color: #92400e !important;
    font-weight: 500;
}

.internal-note-textarea {
    background: transparent !important;
    color: #92400e !important;
}

.internal-note-textarea::placeholder {
    color: #92400e !important;
    font-weight: 500;
}

.input-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
    overflow: visible;
}

.input-tabs {
    display: flex;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 4px;
}

.input-tab {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: none;
    color: #64748b;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    position: relative;
}

.input-tab:hover {
    color: #3b82f6;
    background: #f1f5f9;
}

.input-tab.active {
    background: #ffffff;
    color: #3b82f6;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
    font-weight: 600;
}

.input-area {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    padding: 16px;
    background: #ffffff;
    border-radius: 0 0 16px 16px;
}

.input-area textarea {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    font-size: 14px;
    line-height: 1.5;
    font-family: inherit;
    background: transparent;
    min-height: 24px;
    max-height: 120px;
    padding: 0;
    color: #374151;
}

.input-area textarea::placeholder {
    color: #9ca3af;
    font-style: italic;
}

.input-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* États vides */
.empty-messages,
.empty-notes,
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #64748b;
    text-align: center;
}

.empty-messages i,
.empty-notes i,
.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-messages p,
.empty-notes p,
.empty-state p {
    font-size: 16px;
    margin: 0;
}

.chat-header {
    padding: 0;
    border-bottom: 1px solid #e2e8f0;
    background: white;
    flex-shrink: 0;
}

/* Nouveau design du header de ticket */
.chat-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    gap: 24px;
}

.ticket-main-info {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
    min-width: 0;
}

.ticket-avatar {
    flex-shrink: 0;
}

.ticket-avatar .avatar {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

/* Icône ticket réduite dans la liste */
.ticket-icon {
    width: 32px !important;
    height: 32px !important;
    font-size: 16px !important;
}

.ticket-details {
    flex: 1;
    min-width: 0;
}

.ticket-title {
    margin: 0 0 4px 0;
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.3;
    letter-spacing: -0.025em;
}

.ticket-description {
    margin: 0;
    font-size: 14px;
    color: #64748b;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Informations utilisateur dans le header (section droite) */
.user-info-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 180px;
    margin-right: 20px;
    color: #1f2937;
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    color: inherit;
}

.user-info-section .user-name {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937 !important;
    white-space: nowrap;
}

.user-info-section .user-email {
    font-size: 12px;
    color: #4b5563 !important;
    white-space: nowrap;
}

/* Nom utilisateur dans la liste des tickets */
.ticket-user {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
    margin-top: 4px;
}

/* Section d'assignation */
.assignment-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 140px;
    position: relative; /* Nécessaire pour le positionnement du dropdown */
}

.assignment-label {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}

.assignment-display {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    min-height: 44px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.assignment-display:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.assigned-user {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.btn-edit-assignment {
    background: #3b82f6;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.btn-edit-assignment:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.btn-edit-assignment:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

/* Dropdown d'assignation */
.assignment-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    margin-top: 4px;
    overflow: hidden;
    min-width: 280px; /* Largeur minimale pour la lisibilité */
    width: max-content; /* S'adapte au contenu */
}

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

.dropdown-header span {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937; /* Texte plus foncé pour meilleure lisibilité */
}

.btn-close-dropdown {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.btn-close-dropdown:hover {
    background: #e2e8f0;
    color: #374151;
}

.dropdown-content {
    max-height: 300px;
    overflow-y: auto;
}

.loading-users {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px;
    color: #64748b;
    font-size: 14px;
}

.loading-users i {
    color: #3b82f6;
}

.no-users {
    padding: 16px;
    text-align: center;
    color: #64748b;
    font-size: 14px;
}

.users-list {
    padding: 8px 0;
}

.user-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f1f5f9; /* Séparateur entre les éléments */
}

.user-item:hover {
    background: #f8fafc;
}

.user-item .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1; /* Prend tout l'espace disponible */
}

.user-info .user-name {
    font-size: 14px;
    font-weight: 500;
    color: #1f2937; /* Texte plus foncé */
    line-height: 1.4;
}

.user-info .user-email {
    font-size: 12px;
    color: #6b7280; /* Texte secondaire */
    line-height: 1.3;
}

/* Styles pour la sélection multiple */
.assigned-users-container {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    min-height: 24px;
}

.assigned-user-avatar {
    position: relative;
}

.avatar-small {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.no-assignment {
    color: #64748b;
    font-size: 14px;
    font-style: italic;
}

/* Dropdown footer pour les boutons d'action */
.dropdown-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px; /* Plus d'espace pour meilleure lisibilité */
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    gap: 12px; /* Plus d'espace entre les boutons */
}

/* Styles pour l'autocomplétion des mentions */
.input-wrapper {
    position: relative;
    width: 100%;
}

#messageInput {
    width: 100%;
}

.mentions-dropdown {
    position: absolute;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
}

.mentions-list {
    padding: 8px 0;
}

.mention-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.mention-item:hover {
    background: #f8fafc;
}

.mention-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.mention-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mention-name {
    font-size: 14px;
    font-weight: 500;
    color: #1f2937;
}

.mention-email {
    font-size: 12px;
    color: #6b7280;
}

/* Styles pour les nouveaux filtres */
.filter-toggle {
    margin-top: 8px;
}

.switch-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #374151;
}

.switch-text {
    user-select: none;
    font-weight: 500;
}

.switch-container {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch-container input[type="checkbox"] {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.switch-container input:checked + .switch-slider {
    background-color: #3b82f6;
}

.switch-container input:checked + .switch-slider:before {
    transform: translateX(20px);
}

.dropdown-footer .btn {
    flex: 1;
    padding: 10px 16px; /* Plus de padding pour meilleure ergonomie */
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600; /* Texte plus gras */
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    min-height: 40px; /* Hauteur minimale pour meilleure accessibilité */
}

.btn-secondary {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.btn-secondary:hover {
    background: #e2e8f0;
    color: #374151;
}

.btn-primary {
    background: #3b82f6;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #2563eb;
}

.btn-primary:disabled {
    background: #cbd5e1;
    color: #94a3b8;
    cursor: not-allowed;
}

/* Styles pour les cases à cocher */
.user-checkbox {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.user-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #3b82f6;
    border-radius: 4px;
}

.user-item.selected {
    background: #eff6ff;
    border-left: 3px solid #3b82f6;
}

.user-item.selected:hover {
    background: #dbeafe;
}

/* Ajustement de l'espacement pour les items avec cases à cocher */
.user-item {
    gap: 8px;
}

.user-item .user-avatar {
    flex-shrink: 0;
}

.user-item .user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-weight: 500;
    color: #374151;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    font-size: 12px;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 11px;
    color: #1e40af; /* Couleur plus foncée pour meilleure lisibilité */
    font-weight: 600;
    background: #dbeafe; /* Fond plus contrasté */
    padding: 3px 8px;
    border-radius: 6px;
    margin-top: 3px;
    display: inline-block;
    border: 1px solid #bfdbfe; /* Bordure subtile */
}



.ticket-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.status-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 120px;
}

.status-label {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}

/* Styles pour les selects de statut */
.status-select {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid #e2e8f0;
    background: white;
    color: #1e293b;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    min-width: 140px;
}

.status-select:hover:not(:disabled) {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.status-select:focus:not(:disabled) {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.status-select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Styles dynamiques selon le statut sélectionné - statusSelect */
.status-select.status-nouveau {
    background: #dbeafe;
    color: #1e40af;
    border-color: #93c5fd;
}

.status-select.status-en-cours {
    background: #fed7aa;
    color: #c2410c;
    border-color: #fdba74;
}

.status-select.status-attente-client {
    background: #e9d5ff;
    color: #7c3aed;
    border-color: #c4b5fd;
}

.status-select.status-attente-interne {
    background: #d6d3d1;
    color: #78716c;
    border-color: #a8a29e;
}

.status-select.status-resolu {
    background: #dcfce7;
    color: #166534;
    border-color: #86efac;
}

.status-select.status-clos {
    background: #f3f4f6;
    color: #6b7280;
    border-color: #d1d5db;
}

/* Styles pour le select de filtre de statut */
#statusFilter {
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid #e2e8f0;
    background: white;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    min-width: 160px;
}

#statusFilter:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

#statusFilter:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Styles dynamiques pour le filtre selon la valeur sélectionnée */
#statusFilter.status-nouveau {
    background: #dbeafe;
    color: #1e40af;
    border-color: #93c5fd;
}

#statusFilter.status-en-cours {
    background: #fed7aa;
    color: #c2410c;
    border-color: #fdba74;
}

#statusFilter.status-attente-client {
    background: #e9d5ff;
    color: #7c3aed;
    border-color: #c4b5fd;
}

#statusFilter.status-attente-interne {
    background: #d6d3d1;
    color: #78716c;
    border-color: #a8a29e;
}

#statusFilter.status-resolu {
    background: #dcfce7;
    color: #166534;
    border-color: #86efac;
}

#statusFilter.status-all {
    background: white;
    color: #374151;
    border-color: #e2e8f0;
}

#statusFilter.status-my_tasks {
    background: #eff6ff;
    color: #1e40af;
    border-color: #bfdbfe;
}

#statusFilter.status-my_mentions {
    background: #fef3c7;
    color: #92400e;
    border-color: #fde68a;
}

/* Badge de statut cliquable */
.status-badge-container {
    position: relative;
    display: inline-block;
}

.status-badge-clickable {
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 100px;
    justify-content: space-between;
    border: 1px solid transparent;
}

.status-badge-clickable:hover:not([data-disabled="true"]) {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.status-badge-clickable.active {
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.status-badge-clickable[data-disabled="true"] {
    opacity: 0.6;
    cursor: not-allowed;
}

.status-dropdown-icon {
    font-size: 10px;
    transition: transform 0.2s ease;
}

.status-badge-clickable.active .status-dropdown-icon {
    transform: rotate(180deg);
}

/* Dropdown menu */
.status-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    margin-top: 4px;
    overflow: hidden;
}

.status-option {
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f1f5f9;
}

.status-option:last-child {
    border-bottom: none;
}

.status-option:hover {
    background-color: #f8fafc;
}

/* Styles pour les différents statuts du badge cliquable */
.status-badge-clickable.status-nouveau {
    background: #dbeafe;
    color: #1e40af;
    border-color: #93c5fd;
}

.status-badge-clickable.status-en-cours {
    background: #fed7aa;
    color: #c2410c;
    border-color: #fdba74;
}

.status-badge-clickable.status-attente-client {
    background: #e9d5ff;
    color: #7c3aed;
    border-color: #c4b5fd;
}

.status-badge-clickable.status-attente-interne {
    background: #d6d3d1;
    color: #78716c;
    border-color: #a8a29e;
}

.status-badge-clickable.status-resolu {
    background: #dcfce7;
    color: #166534;
    border-color: #86efac;
}

.status-badge-clickable.status-clos {
    background: #f3f4f6;
    color: #6b7280;
    border-color: #d1d5db;
}

.action-buttons {
    display: flex;
    gap: 12px;
    align-items: center;
}

.ticket-info h4 {
    margin: 0 0 5px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
}

.ticket-details {
    font-size: 14px;
    color: #64748b;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f9fafb;
}

.message {
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.message.user {
    flex-direction: row;
}

.message.agent {
    flex-direction: row-reverse;
}

.message-avatar {
    flex-shrink: 0;
}

.message-avatar .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: white;
}

.message.user .message-avatar .avatar {
    background: #6b7280;
}

.message.agent .message-avatar .avatar {
    background: #3b82f6;
}

.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.message.user .message-content {
    background: white;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
}

.message.agent .message-content {
    background: #3b82f6;
    color: white;
    border-bottom-right-radius: 4px;
}

.message-meta {
    font-size: 12px;
    color: #64748b;
    margin-top: 4px;
    padding: 0 4px;
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Messages reçus (utilisateur) - alignement à gauche */
.message.user .message-meta {
    justify-content: flex-start;
}

/* Messages envoyés (agent) - alignement à droite */
.message.agent .message-meta {
    justify-content: flex-end;
}

.message-text {
    margin-bottom: 4px;
}

.message-time {
    font-size: 11px;
    color: #94a3b8;
}

/* Messages reçus (utilisateur) - alignement à gauche */
.message.user .message-time {
    text-align: left;
}

/* Messages envoyés (agent) - alignement à droite */
.message.agent .message-time {
    text-align: right;
}

.message-status {
    font-size: 11px;
    color: #10b981;
    font-weight: 500;
}

/* Messages envoyés (agent) - alignement à droite */
.message.agent .message-status {
    text-align: right;
}

.note-author {
    font-size: 11px;
    color: #f59e0b;
    font-weight: 500;
}

.chat-input-container {
    padding: 20px;
    border-top: 1px solid #e2e8f0;
    background: white;
}

.chat-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    font-size: 14px;
    resize: none;
    max-height: 120px;
    min-height: 44px;
}

.chat-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.send-button {
    background: #3b82f6;
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.send-button:hover {
    background: #2563eb;
}

.send-button:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

/* États vides et de chargement */
.empty-chat {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #64748b;
}

.empty-chat i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.loading i {
    font-size: 24px;
    color: #3b82f6;
}

.error-message {
    color: #dc2626;
    text-align: center;
    padding: 40px;
}

.error-message i {
    font-size: 48px;
    margin-bottom: 16px;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-primary {
    background: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
}

/* Bouton désactivé */
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #e2e8f0 !important;
    color: #94a3b8 !important;
}

.btn:disabled:hover {
    background-color: #e2e8f0 !important;
    color: #94a3b8 !important;
    transform: none !important;
}

/* Styles pour les boutons d'action */
.btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
    min-height: 40px;
}

.btn i {
    font-size: 14px;
}

.btn span {
    font-size: 14px;
    font-weight: 600;
}

/* Bouton secondaire (Assigner) */
.btn-secondary {
    background: #f8fafc;
    color: #64748b;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn-secondary:hover {
    background: #f1f5f9;
    color: #475569;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12);
}

.btn-secondary:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn-secondary:disabled {
    background: #f3f4f6;
    color: #9ca3af;
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
    box-shadow: none;
}

/* Bouton de fermeture */
.btn-close {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.btn-close:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

.btn-close:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}

/* Bouton de réouverture */
.btn-reopen {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.btn-reopen:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.btn-reopen:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
}

/* Message de ticket fermé */
.ticket-closed {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 12px;
    padding: 16px;
    margin: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ticket-closed-message {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #dc2626;
    font-size: 14px;
    font-weight: 500;
}

.ticket-closed-message i {
    font-size: 16px;
    color: #dc2626;
}

/* Styles de désactivation pour les éléments du nouveau header */
.priority-select:disabled {
    background: #f8fafc;
    color: #94a3b8;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn:disabled {
    background: #f3f4f6;
    color: #9ca3af;
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
    box-shadow: none;
}

.btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Responsive */
@media (max-width: 768px) {
    .tickets-layout {
        flex-direction: column;
        height: auto;
    }
    
    .conversations-sidebar {
        width: 100%;
        max-height: 300px;
    }
    
    .chat-interface {
        min-height: 400px;
    }

    /* Header responsive */
    .chat-header-content {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        padding: 16px;
    }

    .ticket-main-info {
        gap: 12px;
    }

    .ticket-avatar .avatar {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .ticket-title {
        font-size: 16px;
    }

    .ticket-controls {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .user-info-section {
        margin-right: 0;
        min-width: auto;
    }

    .status-section {
        min-width: auto;
    }

    .action-buttons {
        justify-content: stretch;
    }

    .btn {
        flex: 1;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .chat-header-content {
        padding: 12px;
    }

    .ticket-main-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .ticket-avatar {
        align-self: center;
    }

    .ticket-controls {
        gap: 8px;
    }

    .action-buttons {
        flex-direction: column;
        gap: 8px;
    }
}
