/* Styles spécifiques au mini-chat. Les styles de base sont dans chat-common.css */

@import url('chat-common.css');

/* Positionnement du mini-chat */
.chat-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    transform: translateY(calc(100% - 60px));
    transition: all 0.3s ease;
    z-index: 1000;
}

.chat-container.open {
    transform: translateY(0);
}

.chat-container.fullscreen {
    width: 100%;
    height: 100%;
    bottom: 0;
    right: 0;
    border-radius: 0;
    max-width: 1200px;
    margin: 0 auto;
    left: 0;
    right: 0;
    top: 0;
    background: #f8f9fa;
}

.chat-container.fullscreen .chat-messages {
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    padding: 20px;
}

.chat-container.fullscreen .chat-input-container {
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    padding: 20px;
    background: white;
    border-top: 1px solid #eee;
}

.chat-container.fullscreen .chat-header {
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    border-radius: 0;
    background: var(--color-primary);
    padding: 20px;
}

/* Header du mini-chat */
.chat-header {
    background: var(--color-primary);
    color: white;
    padding: 15px;
    border-radius: var(--border-radius-md) var(--border-radius-md) 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.chat-header:hover {
    background: var(--color-primary-light);
}

.chat-container.fullscreen .chat-header {
    border-radius: 0;
}

.chat-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: white;
    pointer-events: none;
}

.chat-controls {
    display: flex;
    gap: 10px;
    pointer-events: none;
}

.chat-toggle, .chat-fullscreen {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 5px;
    transition: opacity 0.3s ease;
    pointer-events: auto;
}

.chat-toggle:hover, .chat-fullscreen:hover {
    opacity: 0.8;
}

.chat-messages {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    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);
}

.user-message {
    align-self: flex-end;
    background: var(--color-primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.bot-message {
    align-self: flex-start;
    background: white;
    color: var(--color-text);
    border-bottom-left-radius: 4px;
    border: 1px solid #eee;
}

.chat-container.fullscreen .bot-message {
    max-width: 90%;
}

.chat-container.fullscreen .user-message {
    max-width: 90%;
}

/* Styles pour le formatage du texte */
.bot-message .message-content {
    white-space: pre-wrap;
}

.bot-message .message-content ul {
    margin: 0px 0;
    padding-left: 24px;
}

.bot-message .message-content li {
    margin: 0px 0;
}

.bot-message .message-content strong {
    font-weight: 600;
    color: var(--color-primary);
}

.chat-input-container {
    padding: 15px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
}

.chat-input {
    flex-grow: 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: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.chat-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(44, 85, 69, 0.1);
}

.chat-send {
    background: var(--color-primary);
    color: white;
    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);
}

.chat-send:hover {
    background: var(--color-primary-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* Indicateur de chargement */
.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: 480px) {
    .chat-container {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }

    .chat-header {
        border-radius: 0;
    }
}

/* Animation fade-in pour les messages */
.fade-in {
    animation: fadeIn 0.5s ease;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Bouton de connexion dans le chat */
.chat-login-btn {
    background: var(--color-primary, #2C5545);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 10px 18px;
    margin: 10px 0 0 0;
    font-size: 1em;
    cursor: pointer;
    transition: background 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}
.chat-login-btn:hover {
    background: var(--color-primary-light, #3e7a5a);
}

/* Boutons d'accueil pour la synthèse */
.resume-btn, .new-btn, .show-summary-btn {
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 7px 16px;
    font-size: 1em;
    margin: 0 6px 6px 0;
    cursor: pointer;
    transition: background 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}
.resume-btn:hover, .new-btn:hover, .show-summary-btn:hover {
    background: var(--color-primary-light);
}

.show-summary-btn {
    margin-top: 10px;
    margin-bottom: 8px;
    display: inline-block;
}

.summary-detail-block {
    background: #f7f7f7;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 12px 16px;
    margin: 10px 0 8px 0;
}

/* Style pour les tableaux Markdown dans le chat */
.chat-message table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    background: #fff;
    font-size: 0.97em;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.chat-message th, .chat-message td {
    border: 1px solid #e0e0e0;
    padding: 8px 12px;
    text-align: left;
}
.chat-message th {
    background: #f5f5f5;
    font-weight: bold;
}
.chat-message tr:nth-child(even) td {
    background: #fafafa;
}

/* Bouton copier pour les tableaux */
.copy-table-btn {
    display: inline-block;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 0.9em;
    margin-bottom: 4px;
    cursor: pointer;
    float: right;
    transition: background 0.2s;
}
.copy-table-btn:hover {
    background: var(--color-primary-light);
}

/* Responsive : tableaux scrollables sur mobile */
.chat-message table {
    display: block;
    overflow-x: auto;
    max-width: 100%;
    width: max-content;
    min-width: 300px;
}

@media (max-width: 600px) {
    .chat-message table {
        font-size: 0.92em;
        min-width: 240px;
    }
}

/* 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;
}

.chat-message li {
    margin-bottom: 4px;
    padding: 0;
    line-height: 1.4;
}

.chat-message li:last-child {
    margin-bottom: 0;
}

.chat-message p {
    margin: 0.5em 0;
    padding: 0;
}

/* Conteneur scrollable pour les tableaux */
.table-scroll {
    overflow-x: auto;
    background: #fff;
    border-radius: 6px;
    padding: 6px 2px 6px 2px;
    margin: 8px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.chat-message table {
    display: table;
    width: 100%;
    min-width: 320px;
    border-collapse: collapse;
    margin: 0;
    background: #fff;
    font-size: 0.97em;
}

.chat-message th, .chat-message td {
    border: 1px solid #e0e0e0;
    padding: 5px 8px;
    text-align: left;
    line-height: 1.2;
}

.chat-message th {
    background: #f5f5f5;
    font-weight: bold;
}

.chat-message tr:nth-child(even) td {
    background: #fafafa;
}

@media (max-width: 600px) {
    .chat-message table {
        font-size: 0.91em;
        min-width: 240px;
    }
    .table-scroll {
        padding: 2px 0 2px 0;
    }
}