/* General Styles */
:root {
    --primary-color: #4a6fa5;
    --secondary-color: #6c8eba;
    --accent-color: #f0f4f9;
    --text-color: #333;
    --light-text: #666;
    --border-color: #d1dbe8;
    --success-color: #4CAF50;
    --warning-color: #FF9800;
    --error-color: #F44336;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: #f5f8fa;
    padding: 20px;
}

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

header {
    background-color: var(--primary-color);
    color: white;
    padding: 20px;
    text-align: center;
}

h1,
h2,
h3,
h4 {
    margin-bottom: 15px;
    font-weight: 600;
}

h1 {
    font-size: 28px;
}

h2 {
    font-size: 22px;
    color: var(--primary-color);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
}

h3 {
    font-size: 18px;
    color: var(--secondary-color);
}

h4 {
    font-size: 16px;
    color: var(--light-text);
}

button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
}

button:hover {
    background-color: var(--secondary-color);
}

input[type="file"] {
    margin-bottom: 10px;
    width: 100%;
}

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

/* Layout */
.main-content {
    display: flex;
    border-bottom: 1px solid var(--border-color);
}

.sidebar {
    width: 550px;
    background-color: var(--accent-color);
    padding: 20px;
    border-right: 1px solid var(--border-color);
    height: 600px;
    overflow-y: auto;
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 600px;
}

.section {
    margin-bottom: 25px;
}

/* Document List */
.documents-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: white;
    padding: 10px;
}

.file-item {
    display: flex;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid var(--border-color);
}

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

.filename {
    flex: 1;
    margin: 0 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.delete-button {
    background-color: var(--error-color);
    color: white;
    padding: 4px 8px;
    font-size: 12px;
}

.delete-button:hover {
    background-color: #d32f2f;
}

/* Chat Interface */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background-color: #f9fbfd;
}

.welcome-message {
    text-align: center;
    color: var(--light-text);
    margin: 20px 0;
}

.message {
    margin-bottom: 20px;
    max-width: 80%;
}

.user-message {
    margin-left: auto;
}

.bot-message {
    margin-right: auto;
}

.message-content {
    padding: 12px 16px;
    border-radius: 18px;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.user-message .message-content {
    background-color: var(--primary-color);
    color: white;
    border-bottom-right-radius: 4px;
}

.bot-message .message-content {
    background-color: white;
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 12px;
    color: #aaa;
    margin-top: 5px;
    display: block;
}

.bot-message .message-time {
    text-align: left;
}

.user-message .message-time {
    text-align: right;
    color: rgba(255, 255, 255, 0.7);
}

.model-label {
    display: inline-block;
    font-size: 12px;
    background-color: var(--secondary-color);
    color: white;
    padding: 2px 6px;
    border-radius: 12px;
    margin-top: 5px;
}

.chat-input {
    padding: 15px;
    border-top: 1px solid var(--border-color);
    background-color: white;
}

.chat-input form {
    display: flex;
}

#message {
    flex: 1;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    margin-right: 10px;
    outline: none;
    transition: border-color 0.2s;
}

#message:focus {
    border-color: var(--primary-color);
}

.chat-input button {
    border-radius: 20px;
    padding: 0 20px;
}

/* Loading Indicator */
#loading-indicator {
    display: none;
    text-align: center;
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.8);
    border-top: 1px solid var(--border-color);
    font-style: italic;
    color: var(--light-text);
}

/* Models Response Section */
.models-container {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.models-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

.model-response {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.model-title {
    background-color: var(--primary-color);
    color: white;
    padding: 10px 15px;
    font-weight: 500;
}

.model-text {
    padding: 15px;
    background-color: white;
}

.selected-files {
    padding: 10px 15px;
    background-color: var(--accent-color);
    font-size: 14px;
    border-top: 1px solid var(--border-color);
}

/* Documents Used Section */
.documents-used-container {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.documents-used-content {
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 15px;
    margin-top: 15px;
}

.doc-reference {
    margin-bottom: 20px;
    border-left: 3px solid var(--primary-color);
    padding-left: 15px;
}

.doc-header {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.doc-icon {
    font-size: 20px;
    margin-right: 10px;
}

.doc-name {
    font-weight: 500;
    margin-right: 10px;
}

.doc-page {
    font-size: 14px;
    color: var(--light-text);
}

.doc-content {
    background-color: var(--accent-color);
    padding: 12px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    white-space: pre-wrap;
}

/* Scenario Mode Section */
.scenario-container {
    padding: 20px;
}

.scenario-selection {
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
}

.scenario-questions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
    background-color: var(--accent-color);
    padding: 15px;
    border-radius: var(--border-radius);
}

.question-item {
    display: flex;
    align-items: center;
}

.question-item label {
    font-weight: 500;
    cursor: pointer;
}

.scenario-files-container {
    margin: 15px 0;
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 15px;
}

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

.scenario-models {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin-top: 10px;
    background-color: var(--accent-color);
    padding: 15px;
    border-radius: var(--border-radius);
}

.docs-header {
    cursor: pointer;
    padding: 8px;
    background-color: #f0f0f0;
    border-radius: 4px;
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.docs-header:hover {
    background-color: #e0e0e0;
}

.toggle-icon {
    font-size: 12px;
    transition: transform 0.3s;
}

.docs-content {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-top: 5px;
}

.scenario-questions-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
}

.question-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    padding: 8px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background-color: #f9f9f9;
}

.question-text-input {
    flex-grow: 1;
    margin: 0 10px;
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.delete-question-button {
    background-color: #ff6b6b;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.delete-question-button:hover {
    background-color: #ff4757;
}

.scenario-files-container {
    margin-top: 10px;
    margin-left: 30px;
    padding: 10px;
    background-color: #f0f0f0;
    border-radius: 4px;
    border-left: 3px solid #2196F3;
}

.action-button {
    background-color: #2196F3;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 12px;
    margin-left: 10px;
    cursor: pointer;
    font-size: 14px;
}

.action-button:hover {
    background-color: #0d8bf2;
}

.classification-loader {
    margin-top: 15px;
    padding: 10px;
    border-radius: 5px;
    background-color: #f0f8ff;
    text-align: center;
}

.spinner {
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid rgba(0, 123, 255, 0.3);
    border-radius: 50%;
    border-top-color: #007bff;
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 10px;
}

.output-format-input {
    width: 100%;
    padding: 6px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.output-format-display {
    background-color: #f0f8ff;
    padding: 5px;
    margin: 5px 0;
    border-radius: 4px;
    font-size: 0.9em;
}

/* S'assurer que les conteneurs de tags ont suffisamment d'espace */
.scenario-tags-container {
    padding: 8px;
    margin-top: 5px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background-color: #f9f9f9;
}

/* Style pour les titres h4 dans les containers */
.scenario-tags-container h4 {
    margin-top: 10px;
    margin-bottom: 5px;
    color: #333;
    font-size: 14px;
}

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