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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.header-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 20px;
}

/* Mode Toggle */
.mode-toggle {
    display: flex;
    gap: 10px;
    background: rgba(255, 255, 255, 0.1);
    padding: 5px;
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.mode-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    opacity: 0.7;
}

.mode-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

.mode-btn.active {
    background: rgba(255, 255, 255, 0.2);
    opacity: 1;
    font-weight: 600;
}

/* Mode Content */
.mode-content {
    display: none;
}

.mode-content.active {
    display: block;
}

/* Panels */
.status-panel,
.ingestion-panel,
.query-panel,
.class-management-panel,
.stats-panel,
.category-management-panel {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
}

.status-panel h2,
.ingestion-panel h2,
.query-panel h2,
.stats-panel h2 {
    margin-bottom: 20px;
    color: #2d3748;
    font-size: 1.4rem;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 10px;
}

/* Status Card */
.status-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.status-indicator {
    font-size: 2rem;
    min-width: 40px;
}

.status-text {
    flex: 1;
}

.status-text div:first-child {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.status-text div:last-child {
    color: #666;
    font-size: 0.9rem;
}

/* Form Controls */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2d3748;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Buttons */
.btn {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    line-height: 1.2;
}

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

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

.btn-primary:hover:not(:disabled) {
    opacity: 0.9;
}

.btn-secondary {
    background: #f7fafc;
    color: #4a5568;
    border: 1px solid #e2e8f0;
}

.btn-secondary:hover:not(:disabled) {
    background: #edf2f7;
    border-color: #cbd5e0;
}

.btn-danger {
    background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    opacity: 0.9;
}

.button-group {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

/* Progress Bar */
.progress-container {
    margin-top: 20px;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    width: 0%;
    transition: width 0.3s ease;
}

#progress-text {
    text-align: center;
    font-weight: 600;
    color: #2d3748;
}

/* Log Container */
.log-container {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
    max-height: 200px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    white-space: pre-wrap;
}

/* Results Container */
.results-container {
    margin-top: 20px;
}

.result-item {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.result-item h4 {
    color: #2d3748;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.result-item p {
    color: #4a5568;
    line-height: 1.6;
}

.similar-tickets {
    margin-top: 15px;
}

.similar-ticket {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.ticket-link {
    text-decoration: none;
    color: inherit;
    display: block;
    transition: all 0.2s ease;
}

.ticket-link:hover {
    text-decoration: none;
    color: inherit;
}

.ticket-link:hover .similar-ticket {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
    transform: translateY(-2px);
}

.similar-ticket .ticket-subject {
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 5px;
}

.similar-ticket .ticket-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 0.85rem;
    margin-top: 5px;
}

.similar-ticket .ticket-score {
    color: #667eea;
    font-size: 0.8rem;
}

.similar-ticket .ticket-category {
    color: #48bb78;
    font-size: 0.8rem;
}

.similar-ticket .ticket-id {
    color: #718096;
    font-size: 0.75rem;
}

/* Styles pour les sources RAG dans le chat - tableau compact */
.chat-sources-table-wrap {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e2e8f0;
}

.chat-sources-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.chat-sources-table th,
.chat-sources-table td {
    padding: 4px 8px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
}

.chat-sources-table th {
    font-weight: 600;
    color: #667eea;
    font-size: 0.75rem;
}

.chat-source-row {
    cursor: pointer;
    transition: background 0.15s ease;
}

.chat-source-row:hover {
    background: #f7fafc;
}

.chat-source-row.chat-source-row-expanded {
    background: #edf2f7;
}

.chat-source-type {
    font-size: 0.9rem;
}

.chat-source-label {
    font-weight: 500;
    color: #2d3748;
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
}

.chat-source-score {
    color: #667eea;
    font-variant-numeric: tabular-nums;
}

.chat-sources-block {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-sources-mcp-wrap {
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid #e2e8f0;
}

.chat-sources-mcp-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: #5a67d8;
    margin-bottom: 6px;
}

.chat-mcp-result-preview {
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.8rem;
}

.chat-source-detail-row td {
    padding: 8px 12px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.chat-source-detail-cell {
    font-size: 0.8rem;
}

.chat-source-chunk {
    max-height: 120px;
    overflow-y: auto;
    padding: 8px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    margin-bottom: 8px;
    white-space: pre-wrap;
    word-break: break-word;
    color: #4a5568;
}

.chat-source-link {
    display: inline-block;
    color: #667eea;
    font-weight: 500;
    text-decoration: none;
}

.chat-source-link:hover {
    text-decoration: underline;
}

.chat-source-actions {
    width: 36px;
    padding: 4px 6px !important;
    text-align: center;
    vertical-align: middle;
}

.chat-source-delete-btn {
    padding: 4px 6px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 4px;
    font-size: 1rem;
    opacity: 0.7;
}

.chat-source-delete-btn:hover:not(:disabled) {
    opacity: 1;
    background: #fee2e2;
}

.chat-source-delete-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Legacy - garder pour compatibilité */
.chat-similar-tickets {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e2e8f0;
}

.chat-tickets-list,
.chat-cms-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Styles pour les liens de tickets dans la recherche avancée */
.similar-ticket-link {
    text-decoration: none;
    color: inherit;
    display: block;
    transition: all 0.2s ease;
}

.similar-ticket-link:hover {
    text-decoration: none;
    color: inherit;
}

.similar-ticket-link:hover .similar-ticket {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
    transform: translateY(-2px);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stat-card {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

.stat-label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #2d3748;
}

/* Status Colors */
.status-healthy {
    background: #f0fff4;
    border-left: 4px solid #48bb78;
}

.status-partial {
    background: #fffbeb;
    border-left: 4px solid #ed8936;
}

.status-unhealthy {
    background: #fed7d7;
    border-left: 4px solid #f56565;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Loading Animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading {
    animation: spin 1s linear infinite;
}

/* Fade In Animation */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* Class Management Panel Styles */
.class-management-panel h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.class-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.class-status-card {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
    min-width: 300px;
}

.class-status-indicator {
    font-size: 2rem;
    min-width: 40px;
}

.class-status-text {
    flex: 1;
}

.class-status-message {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.class-status-details {
    color: #666;
    font-size: 0.9rem;
}

.class-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.class-details {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

.class-details h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.class-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.class-info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: white;
    border-radius: 6px;
    border-left: 4px solid #3498db;
}

.class-info-label {
    font-weight: 600;
    color: #555;
}

.class-info-item span:last-child {
    color: #2c3e50;
    font-weight: 500;
}

.class-categories-list h4 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.category-chip {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}

.category-chip:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.class-progress {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

.class-progress h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.class-progress-log {
    margin-top: 15px;
    max-height: 200px;
    overflow-y: auto;
    background: white;
    border-radius: 6px;
    padding: 15px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.4;
    white-space: pre-wrap;
    border: 1px solid #e9ecef;
}

/* Status indicators for classes */
.class-status-indicator.auto-generated {
    color: #27ae60;
}

.class-status-indicator.static {
    color: #f39c12;
}

.class-status-indicator.error {
    color: #e74c3c;
}

.class-status-indicator.loading {
    color: #3498db;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Class Generation Indicator in Ingestion Panel */
.class-generation-indicator {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    animation: slideIn 0.5s ease-out;
}

.class-generation-icon {
    font-size: 2rem;
    animation: pulse 2s infinite;
}

.class-generation-text {
    flex: 1;
}

.class-generation-title {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.class-generation-message {
    font-size: 0.9rem;
    opacity: 0.9;
}

.class-generation-indicator.completed {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

.class-generation-indicator.error {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.class-generation-indicator.skipped {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    box-shadow: 0 4px 12px rgba(243, 156, 18, 0.3);
}

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

/* Responsive design for class management */
@media (max-width: 768px) {
    .class-status {
        flex-direction: column;
        align-items: stretch;
    }
    
    .class-status-card {
        min-width: auto;
    }
    
    .class-actions {
        justify-content: center;
    }
    
    .class-info-grid {
        grid-template-columns: 1fr;
    }
    
    .categories-grid {
        grid-template-columns: 1fr;
    }
    
    .class-generation-indicator {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
}

/* Realtime Classes Panel Styles */
.realtime-classes-panel {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
    border: 1px solid #e9ecef;
}

.realtime-classes-panel h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.realtime-classes-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.realtime-classes-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

.realtime-classes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    max-height: 400px;
    overflow-y: auto;
    padding: 10px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.realtime-class-item {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.realtime-class-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.realtime-class-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.realtime-class-item:hover::before {
    left: 100%;
}

.realtime-class-item.auto-generated {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
}

.realtime-class-item.static {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
}

.realtime-class-item.new {
    animation: pulse 2s infinite;
    border: 2px solid #3498db;
}

.realtime-classes-stats {
    background: white;
    border-radius: 6px;
    padding: 15px;
    border: 1px solid #e9ecef;
}

.realtime-classes-stats h4 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f1f3f4;
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-label {
    font-weight: 500;
    color: #555;
}

.stat-value {
    font-weight: 600;
    color: #2c3e50;
}

.realtime-classes-stats .last-update {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
    font-size: 0.85rem;
    color: #666;
}

/* Auto-refresh indicator */
.auto-refresh-active {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%) !important;
    color: white !important;
}

.auto-refresh-active::after {
    content: ' 🔄';
    animation: spin 1s linear infinite;
}

/* Responsive design for realtime classes */
@media (max-width: 768px) {
    .realtime-classes-content {
        grid-template-columns: 1fr;
    }
    
    .realtime-classes-grid {
        grid-template-columns: 1fr;
    }
    
    .realtime-classes-controls {
        justify-content: center;
    }
}

/* Ticket Management Panel Styles */
.ticket-management-panel {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
}

.ticket-management-panel h2 {
    margin-bottom: 20px;
    color: #2d3748;
    font-size: 1.4rem;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 10px;
}

.ticket-filters {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    width: 100%;
    box-sizing: border-box;
}

.ticket-filters .form-group {
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

.ticket-filters .form-group input,
.ticket-filters .form-group select {
    width: 100%;
    box-sizing: border-box;
    max-width: 100%;
}

.filter-group {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr auto auto;
    gap: 15px;
    align-items: end;
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 1200px) {
    .filter-group {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .filter-group {
        grid-template-columns: 1fr;
    }
}

.ticket-stats {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #007bff;
}

.stats-header h4 {
    margin: 0;
    color: #495057;
    font-size: 1.3em;
    font-weight: 600;
}

.management-features {
    margin-bottom: 25px;
    padding: 15px;
    background: #e8f5e8;
    border-radius: 8px;
    border-left: 4px solid #28a745;
}

.management-features h5 {
    margin: 0 0 15px 0;
    color: #155724;
    font-size: 1.1em;
    font-weight: 600;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 12px;
}

.feature-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: white;
    border-radius: 6px;
    border: 1px solid #c3e6cb;
    font-size: 0.9em;
}

.feature-icon {
    font-size: 1.2em;
    margin-right: 10px;
    opacity: 0.8;
}

.feature-text {
    color: #155724;
    font-weight: 500;
}

.detailed-stats {
    padding: 15px;
    background: #f0f8ff;
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

.detailed-stats h5 {
    margin: 0 0 15px 0;
    color: #004085;
    font-size: 1.1em;
    font-weight: 600;
}

.stats-summary {
    margin-bottom: 20px;
}

.main-stat {
    display: flex;
    align-items: center;
    font-size: 1.2em;
    font-weight: 600;
    color: #004085;
}

.stat-label {
    margin-right: 8px;
}

.stat-value {
    color: #007bff;
    font-size: 1.4em;
    margin-right: 5px;
}

.stat-unit {
    color: #6c757d;
    font-size: 0.9em;
}

.categories-breakdown h6 {
    margin: 0 0 12px 0;
    color: #004085;
    font-size: 1em;
    font-weight: 600;
}

.categories-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.category-hierarchy {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.category-path {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    flex-grow: 1;
}

.categories-stats {
    display: none;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 25px;
}

.info-note {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    padding: 12px 15px;
    margin: 15px 0;
    border-radius: 4px;
    font-size: 14px;
    color: #1976d2;
}

.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: white;
    border-radius: 6px;
    border: 1px solid #b8daff;
    font-size: 0.9em;
    transition: all 0.2s ease;
}

.category-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.category-name {
    color: #004085;
    font-weight: 500;
}

.category-count {
    color: #007bff;
    font-weight: bold;
    background: #e3f2fd;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85em;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8em;
}

.btn-outline {
    background: transparent;
    border: 1px solid #007bff;
    color: #007bff;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-outline:hover {
    background: #007bff;
    color: white;
}

.tickets-container {
    min-height: 400px;
}

/* Styles pour les onglets */
.tabs-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
}

.tabs-header {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    overflow-x: auto;
}

.tab-button {
    flex: 1;
    padding: 15px 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    color: #6c757d;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
    min-width: 120px;
}

.tab-button:hover {
    background: #e9ecef;
    color: #495057;
}

.tab-button.active {
    background: white;
    color: #007bff;
    border-bottom-color: #007bff;
    font-weight: 600;
}

.tab-content {
    display: none;
    padding: 30px;
    min-height: 500px;
}

.tab-content.active {
    display: block;
}

/* Styles pour les panneaux */
.stats-panel,
.search-panel,
.settings-panel {
    max-width: 100%;
}

.search-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.search-results {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    min-height: 200px;
}

.settings-panel {
    max-width: 800px;
}

.settings-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

.settings-section h4 {
    margin: 0 0 15px 0;
    color: #495057;
    font-size: 1.1em;
}

.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #e9ecef;
}

.settings-item:last-child {
    border-bottom: none;
}

.gdrive-status {
    margin-left: 10px;
    font-size: 0.9em;
}
.gdrive-status-loading { color: #6b7280; }
.gdrive-status-ok { color: #10b981; }
.gdrive-status-error { color: #ef4444; }

.settings-item label {
    font-weight: 500;
    color: #495057;
    margin-right: 15px;
}

.settings-item select,
.settings-item input {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.9em;
}

/* Styles pour le toggle MCP */
.mcp-toggle-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 10px 0;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

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

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

.toggle-switch input:checked + .toggle-slider {
    background-color: #4CAF50;
}

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

.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 1px #4CAF50;
}

.mcp-status-text {
    font-weight: 600;
    font-size: 16px;
    color: #4CAF50;
}

.mcp-status-text.disabled {
    color: #999;
}

.mcp-info {
    margin-top: 15px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 8px;
    border-left: 4px solid #4CAF50;
}

.mcp-service-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #e0e0e0;
}

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

.mcp-service-label {
    font-weight: 500;
    color: #333;
}

.mcp-service-status-indicator {
    font-size: 14px;
    padding: 4px 12px;
    border-radius: 12px;
    background: #e0e0e0;
    color: #666;
}

.mcp-service-status-indicator.enabled {
    background: #c8e6c9;
    color: #2e7d32;
}

.mcp-service-status-indicator.disabled {
    background: #ffcdd2;
    color: #c62828;
}

/* Responsive pour les onglets */
@media (max-width: 768px) {
    .tabs-header {
        flex-direction: column;
    }
    
    .tab-button {
        flex: none;
        text-align: left;
        border-bottom: 1px solid #dee2e6;
        border-right: none;
    }
    
    .tab-button.active {
        border-bottom-color: #dee2e6;
        border-left: 3px solid #007bff;
    }
    
    .tab-content {
        padding: 20px 15px;
    }
    
    .search-form {
        grid-template-columns: 1fr;
    }
    
    .settings-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #666;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

.tickets-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    box-sizing: border-box;
}

.tickets-container {
    width: 100%;
    box-sizing: border-box;
    overflow-x: auto;
}

.ticket-item {
    background: #f8f9fa;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 12px;
    transition: all 0.3s ease;
    position: relative;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 16px;
    align-items: start;
}

@media (max-width: 1400px) {
    .ticket-item {
        grid-template-columns: 1fr 320px;
        gap: 14px;
    }
}

@media (max-width: 1200px) {
    .ticket-item {
        grid-template-columns: 1fr 280px;
        gap: 12px;
    }
}

.ticket-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.ticket-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.ticket-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #2d3748;
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
    margin: 0;
}

.ticket-id {
    font-size: 0.75rem;
    color: #666;
    font-family: 'Courier New', monospace;
    word-wrap: break-word;
    overflow-wrap: break-word;
    margin: 0;
}

.ticket-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.ticket-actions .btn {
    white-space: nowrap;
    padding: 4px 10px;
    font-size: 0.75rem;
    min-width: auto;
}

.ticket-content {
    color: #4a5568;
    line-height: 1.5;
    margin-top: 8px;
    margin-bottom: 8px;
    max-height: 60px;
    overflow: hidden;
    position: relative;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    width: 100%;
    box-sizing: border-box;
    font-size: 0.8rem;
    grid-column: 1 / -1;
}

.ticket-content.expanded {
    max-height: none;
}

.ticket-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    box-sizing: border-box;
    font-size: 0.8rem;
}

.ticket-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    min-width: 0;
    flex-wrap: nowrap;
    width: 100%;
}

.ticket-meta-label {
    color: #666;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 70px;
    font-size: 0.75rem;
}

.ticket-meta-value {
    color: #2d3748;
    word-wrap: break-word;
    overflow-wrap: break-word;
    min-width: 0;
    flex: 1;
    font-size: 0.8rem;
}

.ticket-category {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
    display: inline-block;
}

.ticket-status {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
    display: inline-block;
}

.ticket-status.open {
    background: #e6fffa;
    color: #00a085;
}

.ticket-status.in-progress {
    background: #fff5e6;
    color: #d69e2e;
}

.ticket-status.closed {
    background: #e6f3ff;
    color: #3182ce;
}

.ticket-status.pending {
    background: #f0f0f0;
    color: #666;
}

.ticket-priority {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
    display: inline-block;
}

.ticket-priority.low {
    background: #e6fffa;
    color: #00a085;
}

.ticket-priority.medium {
    background: #fff5e6;
    color: #d69e2e;
}

.ticket-priority.high {
    background: #ffe6e6;
    color: #e53e3e;
}

.ticket-priority.critical {
    background: #f0e6ff;
    color: #805ad5;
}

.ticket-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
    width: 100%;
    box-sizing: border-box;
    grid-column: 1 / -1;
}

.ticket-tag {
    background: #e2e8f0;
    color: #4a5568;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
    display: inline-block;
}

.ticket-dates {
    font-size: 0.7rem;
    color: #666;
    margin-top: 6px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    width: 100%;
    box-sizing: border-box;
    grid-column: 1 / -1;
}

/* Search & Chat Panel (fusionné) */
.search-chat-panel {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}

.panel-description {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 20px;
    font-style: italic;
}

.search-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 20px;
    margin-bottom: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.control-column-mcp .mcp-tiles-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-column-mcp #prestashop-instances-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-column-mcp #prestashop-instances-container .form-group {
    margin-bottom: 0;
}

.control-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 15px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.control-column .column-title {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 600;
    color: #2d3748;
    padding-bottom: 8px;
    border-bottom: 2px solid #e2e8f0;
}

.search-controls .form-group {
    margin-bottom: 0;
}

.search-controls .form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #495057;
}

.search-controls .checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.search-controls .checkbox-label:hover {
    background-color: #f0f0f0;
}

.search-controls .checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #667eea;
}

.search-controls .checkbox-label span {
    font-size: 0.95rem;
    color: #333;
}

/* Responsive: passer en colonne unique sur petits écrans */
@media (max-width: 768px) {
    .search-controls {
        grid-template-columns: 1fr;
    }
}

/* Chat Panel */
.chat-panel {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}

.chat-description {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.chat-controls {
    display: flex;
    gap: 15px;
    align-items: end;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.chat-controls .form-group {
    flex: 1;
    min-width: 200px;
}

.chat-controls .form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
}

.chat-controls .form-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.chat-and-feedback-wrapper {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 20px;
    align-items: start;
}
@media (max-width: 900px) {
    .chat-and-feedback-wrapper {
        grid-template-columns: 1fr;
    }
}

.chat-container {
    display: flex;
    flex-direction: column;
    min-height: 200px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8f9fa;
}

.chat-feedback-panel {
    background: #fff8e6;
    border: 1px solid #e2c76e;
    border-radius: 8px;
    padding: 16px;
    min-height: 200px;
}
.chat-feedback-title {
    margin: 0 0 8px 0;
    font-size: 1rem;
    color: #744210;
}
.chat-feedback-desc {
    font-size: 0.85rem;
    color: #5c4a1a;
    margin: 0 0 12px 0;
}
.chat-feedback-input {
    width: 100%;
    min-height: 100px;
    padding: 10px;
    border: 1px solid #e2c76e;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.9rem;
    margin-bottom: 12px;
    resize: vertical;
}
.chat-feedback-submit {
    width: 100%;
}
.chat-feedback-status {
    margin-top: 10px;
    font-size: 0.85rem;
}

.chat-messages {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-message {
    display: flex;
    flex-direction: column;
    max-width: 80%;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.chat-message.chat-user {
    align-self: flex-end;
}

.chat-message.chat-assistant {
    align-self: flex-start;
}

.chat-message .message-content {
    padding: 8px 12px;
    border-radius: 8px;
    line-height: 1.4;
    font-size: 0.88rem;
    max-height: none;
    overflow: visible;
}

.chat-message.chat-user .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.chat-assistant .message-content {
    background: white;
    color: #2d3748;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
}

.chat-message .message-content strong {
    display: block;
    margin-bottom: 3px;
    font-size: 0.78rem;
    opacity: 0.9;
}

.chat-message .reflection-steps {
    margin-top: 6px;
    padding-left: 0.75em;
    font-size: 0.85rem;
    opacity: 0.95;
}

.chat-message .reflection-steps-list {
    margin: 0;
    padding-left: 1em;
    list-style-type: disc;
}

.chat-message .reflection-steps-list li {
    margin-bottom: 2px;
}

.chat-message .message-actions {
    display: flex;
    gap: 6px;
    margin-top: 4px;
    justify-content: flex-end;
}

.chat-message .btn-edit-message,
.chat-message .btn-save-message,
.chat-message .btn-cancel-edit {
    padding: 4px 8px;
    font-size: 0.75rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    transition: all 0.2s;
}

.chat-message.chat-user .btn-edit-message:hover,
.chat-message.chat-user .btn-save-message:hover,
.chat-message.chat-user .btn-cancel-edit:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chat-message .message-edit-input {
    width: 100%;
    padding: 6px 10px;
    border: 2px solid #667eea;
    border-radius: 6px;
    font-size: 0.88rem;
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
    background: white;
    color: #2d3748;
    margin-bottom: 8px;
}

/* Notation des réponses assistant (0–10) */
.message-rating {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid #e2e8f0;
    font-size: 0.82rem;
    color: #4a5568;
}
.message-rating-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}
.message-rating-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.chat-rating-btn {
    min-width: 28px;
    padding: 4px 8px;
    font-size: 0.82rem;
    font-weight: 600;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    background: #f7fafc;
    color: #4a5568;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.chat-rating-btn:hover {
    background: #edf2f7;
    border-color: #667eea;
    color: #667eea;
}
.message-rating-feedback {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e2e8f0;
}
.message-rating-feedback-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 4px;
}
.message-rating-feedback-input {
    width: 100%;
    min-height: 70px;
    padding: 8px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.9rem;
    margin-bottom: 8px;
    resize: vertical;
    box-sizing: border-box;
}
.message-rating-feedback-submit {
    margin-bottom: 6px;
}
.message-rating-feedback-status {
    display: block;
    font-size: 0.85rem;
    color: #2d3748;
}

.message-rating-done {
    font-weight: 600;
    color: #38a169;
}

.chat-message .message-edit-input:focus {
    outline: none;
    border-color: #764ba2;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.chat-message .message-edit-note-wrap {
    margin-top: 8px;
}
.chat-message .message-edit-note-label {
    display: block;
    font-size: 0.8rem;
    color: #555;
    margin-bottom: 4px;
}
.chat-message .message-edit-note-input {
    width: 100%;
    padding: 6px 10px;
    border: 2px solid #667eea;
    border-radius: 6px;
    font-size: 0.88rem;
    resize: vertical;
}
.chat-message .message-edit-note-input:focus {
    outline: none;
    border-color: #764ba2;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.chat-input-container {
    display: flex;
    gap: 8px;
    padding: 10px;
    background: white;
    border-top: 1px solid #e2e8f0;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.88rem;
    font-family: inherit;
    resize: none;
    min-height: 38px;
    max-height: 120px;
    line-height: 1.4;
}

.chat-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.chat-input-container .btn {
    padding: 8px 16px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 30px;
    padding: 20px;
}

.pagination button {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    background: white;
    color: #4a5568;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pagination button:hover:not(:disabled) {
    background: #f7fafc;
    border-color: #cbd5e0;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination button.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.pagination-info {
    color: #666;
    font-size: 0.9rem;
}

/* Modal Styles */
/* Modal large pour les messages */
.modal-large {
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
}

/* Styles pour les messages */
.messages-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e2e8f0;
}

.messages-header h4 {
    margin: 0 0 5px 0;
    color: #2d3748;
    font-size: 1.2rem;
}

.messages-header p {
    margin: 0;
    color: #666;
    font-size: 0.9rem;
}

.messages-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message-item {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    transition: all 0.3s ease;
}

.message-item:hover {
    background: #edf2f7;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.message-item.message-nested {
    margin-left: 30px;
    border-left: 3px solid #667eea;
}

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

.message-number {
    font-weight: bold;
    color: #667eea;
    font-size: 0.9rem;
}

.message-type {
    background: #e2e8f0;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #4a5568;
}

.message-date {
    color: #666;
    font-size: 0.85rem;
}

.message-author {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.message-author strong {
    color: #2d3748;
}

.message-status {
    background: #cbd5e0;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
    color: #4a5568;
}

.message-format {
    background: #bee3f8;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
    color: #2c5282;
}

.message-children {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e2e8f0;
    padding-left: 20px;
}

.message-children strong {
    display: block;
    margin-bottom: 10px;
    color: #4a5568;
    font-size: 0.9rem;
}

.message-content {
    background: white;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    color: #2d3748;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.message-submessages {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e2e8f0;
}

.message-submessages strong {
    display: block;
    margin-bottom: 10px;
    color: #4a5568;
    font-size: 0.9rem;
}

.submessage-item {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 8px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.submessage-type {
    background: #cbd5e0;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    color: #4a5568;
    min-width: 40px;
    text-align: center;
    flex-shrink: 0;
}

.submessage-content {
    flex: 1;
    color: #4a5568;
    font-size: 0.9rem;
    line-height: 1.5;
}

.error-message {
    text-align: center;
    padding: 20px;
    color: #e53e3e;
    background: #fed7d7;
    border-radius: 8px;
    border: 1px solid #fc8181;
}

.btn-info {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    margin-left: 5px;
}

.btn-info:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(66, 153, 225, 0.3);
}

.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: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    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);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8f9fa;
    border-radius: 12px 12px 0 0;
}

.modal-header h3 {
    margin: 0;
    color: #2d3748;
    font-size: 1.3rem;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover {
    color: #000;
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    padding: 20px 25px;
    border-top: 1px solid #e2e8f0;
    background: #f8f9fa;
    border-radius: 0 0 12px 12px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
}

.ticket-preview {
    background: #f8f9fa;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
}

.ticket-preview .ticket-title {
    font-size: 1rem;
    margin-bottom: 10px;
}

.ticket-preview .ticket-content {
    font-size: 0.9rem;
    color: #666;
    max-height: 60px;
    overflow: hidden;
}

.warning-text {
    color: #e53e3e;
    font-weight: 600;
    text-align: center;
    margin-top: 15px;
}

/* Responsive design for ticket management */
@media (max-width: 768px) {
    .filter-group {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .ticket-stats {
        flex-direction: column;
        gap: 10px;
    }
    
    .ticket-item {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .ticket-header {
        flex-direction: column;
        gap: 6px;
    }
    
    .ticket-actions {
        align-self: stretch;
        justify-content: flex-start;
    }
    
    .ticket-meta {
        flex-direction: column;
        gap: 6px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
}

/* Styles pour les résultats RAG */
.rag-results {
    margin-top: 20px;
}

.rag-response {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.rag-response p {
    margin-bottom: 15px;
    font-weight: 500;
}

.response-content {
    margin: 15px 0;
}

.response-text {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 15px;
    margin-top: 10px;
    line-height: 1.6;
    white-space: pre-wrap;
}

.response-meta {
    display: flex;
    gap: 20px;
    margin-top: 15px;
    font-size: 0.9em;
    color: #6c757d;
}

.response-meta span {
    background: #e9ecef;
    padding: 4px 8px;
    border-radius: 4px;
}

.similar-tickets {
    margin-top: 20px;
}

.similar-ticket {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    transition: box-shadow 0.2s ease;
}

.similar-ticket:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

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

.ticket-id {
    background: #007bff;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: bold;
}

.ticket-category {
    background: #28a745;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8em;
}

.ticket-score {
    background: #ffc107;
    color: #212529;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: bold;
}

.ticket-title {
    font-weight: 600;
    margin-bottom: 8px;
    color: #495057;
}

.ticket-content {
    color: #6c757d;
    font-size: 0.9em;
    line-height: 1.4;
}

/* Amélioration de l'interface de recherche avancée */
.search-description {
    background: #e3f2fd;
    border: 1px solid #bbdefb;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
    color: #1565c0;
    font-style: italic;
}

.search-form {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.search-form .form-group {
    margin-bottom: 15px;
}

.search-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #495057;
}

.search-form textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-family: inherit;
    resize: vertical;
}

.search-form select,
.search-form input[type="date"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-family: inherit;
}

.search-results {
    margin-top: 20px;
}

.loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #6c757d;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Styles pour la section d'ingestion */
.progress-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
}

.progress-bar {
    flex: 1;
    height: 20px;
    background-color: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #45a049);
    border-radius: 10px;
    transition: width 0.3s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.log-container {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    height: 200px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.4;
    white-space: pre-wrap;
    margin-top: 10px;
}

.log-container::-webkit-scrollbar {
    width: 6px;
}

.log-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.log-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.log-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Styles pour les champs de configuration d'ingestion */
.settings-section .form-row {
    display: flex;
    gap: 15px;
    margin: 10px 0;
}

.settings-section .form-group {
    flex: 1;
}

.settings-section .form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.settings-section .form-group input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.settings-section .form-group input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* Styles pour la section des classes IA */
.class-status {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
}

.class-status-indicator {
    font-size: 20px;
}

.class-status-message {
    font-weight: 500;
}

.status-details {
    font-size: 14px;
    color: #666;
    margin-top: 5px;
}

.class-details {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin-top: 10px;
}

.class-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}

.class-info span {
    font-size: 14px;
    color: #555;
}

.class-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.category-chip {
    background-color: #007bff;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

/* Styles pour l'interface hybride */
.database-panel {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.stat-card {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
}

.stat-number {
    font-size: 2em;
    font-weight: bold;
    color: #007bff;
}

.stat-label {
    color: #6c757d;
    font-size: 0.9em;
}

.download-form {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    align-items: end;
}

.form-group {
    flex: 1;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
}

.btn-download {
    background: #28a745;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.btn-download:hover {
    background: #218838;
}

.btn-download:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    margin: 10px 0;
}

.progress-fill {
    height: 100%;
    background: #007bff;
    transition: width 0.3s ease;
}

.tickets-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.tickets-table th,
.tickets-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

.tickets-table th {
    background: #f8f9fa;
    font-weight: 600;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 500;
}

.status-processed {
    background: #d4edda;
    color: #155724;
}

.status-unprocessed {
    background: #fff3cd;
    color: #856404;
}

.status-error {
    background: #f8d7da;
    color: #721c24;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin: 20px 0;
}

.pagination button {
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    background: white;
    cursor: pointer;
    border-radius: 4px;
}

.pagination button:hover:not(:disabled) {
    background: #f8f9fa;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.alert {
    padding: 12px 16px;
    border-radius: 4px;
    margin: 15px 0;
}

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

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

/* Model Selection Styles */
.model-selection {
    margin: 20px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.model-options {
    display: flex;
    gap: 20px;
    margin-top: 15px;
}

.model-option {
    flex: 1;
}

.model-option input[type="radio"] {
    display: none;
}

.model-label {
    display: flex;
    align-items: center;
    padding: 20px;
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.model-label:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.2);
}

.model-option input[type="radio"]:checked + .model-label {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

.model-icon {
    font-size: 2.5rem;
    margin-right: 15px;
    min-width: 60px;
    text-align: center;
}

.model-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 15px;
}

.model-name {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
    white-space: nowrap;
}

.model-description {
    font-size: 0.9rem;
    opacity: 0.8;
    line-height: 1.4;
    margin: 0;
    flex: 1;
}

.ingestion-config {
    margin: 20px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

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

/* Styles pour l'arborescence des catégories */
.categories-panel {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}

/* Section Ingestion dans Catégories */
.ingestion-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.ingestion-section h4 {
    margin: 0 0 10px 0;
    color: #495057;
    font-size: 1.2em;
}

.section-description {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 15px;
    font-style: italic;
}

.ingestion-section .model-selection {
    margin: 15px 0;
    padding: 15px;
    background: white;
    border-radius: 6px;
}

.ingestion-section .model-selection h5 {
    margin: 0 0 10px 0;
    color: #495057;
    font-size: 1em;
}

.ingestion-section .ingestion-config {
    margin: 15px 0;
    padding: 15px;
    background: white;
    border-radius: 6px;
}

.ingestion-section .ingestion-config h5 {
    margin: 0 0 10px 0;
    color: #495057;
    font-size: 1em;
}

.categories-controls h4 {
    margin: 30px 0 15px 0;
    color: #495057;
    font-size: 1.2em;
    padding-top: 20px;
    border-top: 2px solid #e9ecef;
}

.categories-description {
    color: #666;
    margin-bottom: 20px;
    font-style: italic;
}

.categories-controls {
    margin-bottom: 25px;
}

.categories-status {
    margin-bottom: 25px;
}

.status-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
}

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

.status-header h4 {
    margin: 0;
    color: #495057;
}

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

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #e9ecef;
}

.status-label {
    font-weight: 500;
    color: #6c757d;
}

.status-value {
    font-weight: 600;
    color: #495057;
}

.categories-tree-container {
    margin-bottom: 25px;
}

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

.tree-header h4 {
    margin: 0;
    color: #495057;
}

.tree-controls {
    display: flex;
    gap: 10px;
}

.tree-search {
    margin-bottom: 15px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.tree-search input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
}

.categories-tree {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    min-height: 300px;
    max-height: 500px;
    overflow-y: auto;
}

.tree-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #6c757d;
}

.tree-node {
    margin: 5px 0;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.tree-node:hover {
    background: #e9ecef;
}

.tree-node.expanded {
    background: #d1ecf1;
}

.tree-node.selected {
    background: #cce5ff;
    border-left: 3px solid #007bff;
}

.tree-node-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tree-toggle {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #6c757d;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.tree-toggle.expanded {
    transform: rotate(90deg);
}

.tree-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.tree-label {
    font-weight: 500;
    color: #495057;
}

.tree-count {
    background: #6c757d;
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 11px;
    margin-left: auto;
}

.tree-children {
    margin-left: 24px;
    border-left: 1px solid #e9ecef;
    padding-left: 12px;
}

.tree-children.collapsed {
    display: none;
}

.categories-stats {
    margin-bottom: 25px;
}

.categories-stats h4 {
    margin-bottom: 15px;
    color: #495057;
}

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

.category-stat-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    transition: all 0.2s ease;
}

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

.category-stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.category-stat-name {
    font-weight: 600;
    color: #495057;
}

.category-stat-count {
    background: #007bff;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.category-stat-details {
    font-size: 14px;
    color: #6c757d;
}

.categories-actions {
    margin-bottom: 25px;
}

.categories-actions h4 {
    margin-bottom: 15px;
    color: #495057;
}

.action-groups {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.action-group {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
}

.action-group h5 {
    margin-bottom: 10px;
    color: #495057;
}

/* Indicateur de statut */
.status-indicator {
    font-size: 18px;
    animation: pulse 2s infinite;
}

.status-indicator.success {
    color: #28a745;
    animation: none;
}

.status-indicator.warning {
    color: #ffc107;
    animation: none;
}

.status-indicator.error {
    color: #dc3545;
    animation: none;
}

.status-indicator.loading {
    color: #6c757d;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Styles pour la recherche RAG */
.rag-response {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.rag-response h4 {
    color: #495057;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.response-content {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 15px;
    line-height: 1.6;
}

.response-content p {
    margin: 0;
    color: #495057;
}

.intent-info {
    background: #e3f2fd;
    border: 1px solid #bbdefb;
    border-radius: 6px;
    padding: 10px;
    font-size: 0.9em;
    color: #1976d2;
}

.intent-info strong {
    color: #0d47a1;
}

/* Amélioration du sélecteur de modèle */
.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #495057;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    background-color: white;
}

.form-control:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* ============================================================================
   GESTION AVANCÉE DES CATÉGORIES
   ============================================================================ */

.category-management-panel {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}

.management-actions {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.quick-action-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.2s ease;
}

.quick-action-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: #3b82f6;
}

.quick-action-card h4 {
    color: #1e293b;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.quick-action-card p {
    color: #64748b;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.quick-action-card ul {
    list-style: none;
    padding: 0;
}

.quick-action-card li {
    color: #475569;
    font-size: 0.85rem;
    margin-bottom: 5px;
    padding-left: 15px;
    position: relative;
}

.quick-action-card li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #10b981;
    font-weight: bold;
}

/* Styles pour l'interface de gestion des catégories */
.category-management {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.management-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.config-panel, .category-panel {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.panel-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.config-form {
    display: grid;
    gap: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group label {
    font-weight: 500;
    color: #374151;
}

.form-group input, .form-group select {
    padding: 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
}

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

.btn-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
}

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

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

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-warning {
    background: #f59e0b;
    color: white;
}

.btn-warning:hover {
    background: #d97706;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.category-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
}

.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.2s;
}

.category-item:hover {
    background-color: #f9fafb;
}

.category-item:last-child {
    border-bottom: none;
}

.category-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.category-name {
    font-weight: 500;
    color: #1f2937;
}

.category-stats {
    font-size: 12px;
    color: #6b7280;
}

.category-actions {
    display: flex;
    gap: 5px;
}

.ticket-management {
    grid-column: 1 / -1;
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.ticket-list {
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    margin-top: 15px;
}

.ticket-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #f3f4f6;
}

.ticket-item:last-child {
    border-bottom: none;
}

.ticket-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.ticket-subject {
    font-weight: 500;
    color: #1f2937;
}

.ticket-meta {
    font-size: 12px;
    color: #6b7280;
    display: flex;
    gap: 15px;
}

.category-select {
    min-width: 200px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: #f8fafc;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1e293b;
}

.stat-label {
    font-size: 0.875rem;
    color: #64748b;
    margin-top: 4px;
}

.loading {
    display: none;
    text-align: center;
    padding: 20px;
    color: #6b7280;
}

.error {
    background: #fef2f2;
    color: #dc2626;
    padding: 10px;
    border-radius: 6px;
    margin: 10px 0;
    border: 1px solid #fecaca;
}

.success {
    background: #f0fdf4;
    color: #16a34a;
    padding: 10px;
    border-radius: 6px;
    margin: 10px 0;
    border: 1px solid #bbf7d0;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 20px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

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

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #000;
}

.merge-split-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.category-checkboxes {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 10px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
}

/* Responsive design */
@media (max-width: 768px) {
    .management-grid {
        grid-template-columns: 1fr;
    }
    
    .quick-actions-grid {
        grid-template-columns: 1fr;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .ticket-item {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 10px;
    }
    
    .category-select {
        min-width: 100%;
    }
}

/* Checkbox label styles */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #667eea;
}

.checkbox-label span {
    font-size: 0.95rem;
    color: #333;
}

.form-hint {
    display: block;
    margin-top: 5px;
    font-size: 0.85rem;
    color: #666;
    font-style: italic;
}

.rag-status {
    display: inline-block;
    padding: 4px 8px;
    background: #e0e7ff;
    color: #4f46e5;
    border-radius: 4px;
    font-size: 0.85rem;
    margin-left: 10px;
}

/* Styles pour la page de configuration des prompts */
.prompts-config-panel {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}

.prompts-actions {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.prompts-status {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
    display: none;
}

.prompts-status.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

.prompts-status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

.prompts-status.loading {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
    display: block;
}

.prompts-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.prompt-card {
    background: #f8f9fa;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s ease;
}

.prompt-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: #667eea;
}

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

.prompt-header h4 {
    margin: 0;
    color: #2d3748;
    font-size: 1.1rem;
}

.prompt-description {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 15px;
    font-style: italic;
}

.prompt-card .form-group {
    margin-bottom: 15px;
}

.prompt-card .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #495057;
}

.prompt-card .prompt-content {
    width: 100%;
    padding: 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    resize: vertical;
}

.prompt-card .prompt-content:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.prompt-card .form-text {
    display: block;
    margin-top: 5px;
    font-size: 0.85rem;
    color: #6c757d;
}

.prompt-card .text-muted {
    color: #6c757d;
    font-size: 0.85rem;
    margin-top: 10px;
    display: block;
}

.prompt-actions-single {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
    margin-bottom: 10px;
}

.prompt-actions-single .btn-sm {
    padding: 6px 12px;
    font-size: 0.9rem;
}

.prompt-save-status {
    font-size: 0.85rem;
    font-weight: 500;
    display: none;
    margin-left: 10px;
}

.prompt-save-status.loading {
    color: #007bff;
    display: inline-block;
}

.prompt-save-status.success {
    color: #28a745;
    display: inline-block;
}

.prompt-save-status.error {
    color: #dc3545;
    display: inline-block;
}

@media (max-width: 768px) {
    .prompts-actions {
        flex-direction: column;
    }
    
    .prompts-actions .btn {
        width: 100%;
    }
    
    .prompt-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}
