/* Styles communs pour tous les chats (mini-chat et chat principal) */

:root {
    --color-primary: #2C5545;
    --color-primary-light: #3e7a5a;
    --color-text: #222;
    --border-radius-md: 10px;
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.1);
}

.chat-container {
    display: flex;
    flex-direction: column;
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-lg);
    background: #fff;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-message {
    max-width: 80%;
    padding: 15px 20px;
    border-radius: var(--border-radius-md);
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
}

/* Style pour les listes à puces dans le chat */
.chat-message ul,
.chat-message ol {
    margin: 0.5em 0;
    padding-left: 1.2em;
    list-style-type: disc;
    list-style-position: outside;
}

.user-message {
    align-self: flex-end;
    background: var(--color-primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.bot-message {
    align-self: flex-start;
    background: #fff;
    color: var(--color-text);
    border-bottom-left-radius: 4px;
    border: 1px solid #eee;
}

.chat-input-container {
    display: flex;
    gap: 10px;
    padding: 15px;
    border-top: 1px solid #eee;
    background: #fff;
}

.chat-input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius-md);
    font-size: 0.95rem;
    resize: none;
    min-height: 40px;
    max-height: 120px;
    overflow-y: auto;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    color: #222;
}

.chat-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(44, 85, 69, 0.1);
}

.send-button, .chat-send {
    background: var(--color-primary);
    color: #fff;
    border: none;
    padding: 12px 20px;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    align-self: flex-end;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-button:hover, .chat-send:hover {
    background: var(--color-primary-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 5px 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typing 1s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.3s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* Responsive */
@media (max-width: 600px) {
    .chat-container {
        width: 100% !important;
        height: 100% !important;
        border-radius: 0 !important;
        padding: 0 !important;
    }
    .chat-messages {
        padding: 8px !important;
    }
    .chat-input-container {
        padding: 8px !important;
    }
}

.message-content {
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
    max-width: 100%;
}

.message-content p {
    margin: 0 0 10px 0;
}

.message-content p:last-child {
    margin-bottom: 0;
}

/* Styles pour les tableaux avec scroll horizontal */
.table-scroll {
    overflow-x: auto;
    background: #fff;
    border-radius: 8px;
    padding: 8px 4px 8px 4px;
    margin: 12px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid #e8e8e8;
    max-width: 100%;
}

.chat-message table {
    display: table;
    width: 100%;
    min-width: 400px;
    border-collapse: collapse;
    margin: 0;
    background: #fff;
    font-size: 0.95em;
    line-height: 1.4;
}

.chat-message th, .chat-message td {
    border: 1px solid #e0e0e0;
    padding: 8px 12px;
    text-align: left;
    white-space: nowrap;
}

.chat-message th {
    background: #f8f9fa;
    font-weight: 600;
    color: var(--color-primary, #2C5545);
    position: sticky;
    top: 0;
    z-index: 1;
}

.chat-message tr:nth-child(even) td {
    background: #fafbfc;
}

.chat-message tr:hover td {
    background: #f0f4f8;
}

/* Bouton copier pour les tableaux */
.copy-table-btn {
    display: inline-block;
    background: var(--color-primary, #2C5545);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.9em;
    margin-bottom: 8px;
    cursor: pointer;
    float: right;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(44,85,69,0.1);
}

.copy-table-btn:hover {
    background: var(--color-primary-light, #3e7a5a);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(44,85,69,0.15);
}

/* Responsive pour les tableaux */
@media (max-width: 600px) {
    .chat-message table {
        font-size: 0.9em;
        min-width: 300px;
    }
    
    .chat-message th, .chat-message td {
        padding: 6px 8px;
    }
    
    .table-scroll {
        padding: 4px 2px 4px 2px;
        margin: 8px 0;
    }
    
    .copy-table-btn {
        font-size: 0.85em;
        padding: 5px 10px;
    }
}

@media (max-width: 480px) {
    .chat-message table {
        font-size: 0.85em;
        min-width: 250px;
    }
    
    .chat-message th, .chat-message td {
        padding: 4px 6px;
    }
}

/* Forcer l'alignement des messages historiques comme les nouveaux messages */
.chat-message.user-message,
.chat-message.user-message.historique-block {
    align-self: flex-end !important;
    background: var(--color-primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.chat-message.bot-message,
.chat-message.bot-message.historique-block {
    align-self: flex-start !important;
    background: #fff;
    color: var(--color-text);
    border-bottom-left-radius: 4px;
    border: 1px solid #eee;
} 