@font-face {
    font-family: 'PP Agrandir';
    src: url('./fonts/PPAgrandir-Regular.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'PP Agrandir';
    src: url('./fonts/PPAgrandir-Bold.woff2') format('woff2');
    font-weight: bold;
    font-style: normal;
}

:root {
    --user-color: #0A3856; /* Bleu Empirik */
    --ai-color: #4A6D8C; /* Nouvelle couleur pour les messages AI (bleu gris) */
    --accent-color: #FCC02D; /* Jaune Empirik */
    --bg-color: #ffffff;
    --input-bg: #ffffff;
    --border-color: #ddd;
    --text-color: #000;
    --sidebar-width: 0px; /* Sidebar cachée */
    --sidebar-bg: #f0f0f0;
    --loading-color: #4A6D8C; /* Nouvelle couleur pour le chargement */
    --error-color: #ff4d4f;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'PP Agrandir', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.app-container {
    display: flex;
    width: 100%;
    max-width: 1200px;
    height: 90vh;
    background-color: white;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
}

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: none; /* Cacher la sidebar */
    flex-direction: column;
}

.sidebar-header {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--user-color);
    color: white;
}

.sidebar-header h2 {
    margin: 0;
    font-size: 1.2rem;
}

.conversations-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.conversation-item {
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.conversation-item:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.conversation-item.active {
    background-color: rgba(10, 56, 86, 0.1);
    border-left: 3px solid var(--user-color);
}

.conversation-title {
    font-weight: 500;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-date {
    font-size: 0.8rem;
    color: #777;
}

.chat-container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 20px;
}

.chat-header {
    text-align: center;
    padding: 15px 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: white;
    color: black;
    border-radius: 0;
}

.header-left {
    display: flex;
    align-items: center;
}

.header-logo {
    height: 53px; /* Augmentation de 33% par rapport à 40px */
    max-width: 266px; /* Augmentation de 33% par rapport à 200px */
    object-fit: contain;
}

.version-tag {
    font-size: 12px;
    color: #666;
    margin-left: 10px;
    padding: 2px 6px;
    background-color: #f0f0f0;
    border-radius: 4px;
    font-weight: normal;
}

.header-right {
    display: flex;
    gap: 10px;
}

.new-conversation-button {
    background-color: var(--ai-color);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.2s;
}

.new-conversation-button:hover {
    background-color: #c94609;
}

.logout-button {
    background-color: var(--accent-color);
    color: var(--user-color);
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.2s;
}

.logout-button:hover {
    background-color: #e9b023;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease-in-out;
    max-width: 80%;
}

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

.user-message {
    align-self: flex-end;
    color: black;
    background-color: #f0f0f0;
    padding: 12px;
    border-radius: 18px 18px 0 18px;
    margin-right: 10px;
}

.ai-message {
    align-self: flex-start;
    color: black;
    background-color: white;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
    margin-left: 10px;
}

.message-content {
    word-wrap: break-word;
}

.message-content img {
    max-width: 100%;
    border-radius: 8px;
    margin-top: 10px;
    max-height: 400px;
    object-fit: contain;
}

.chart-container {
    width: 100%;
    margin-top: 10px;
}

.chat-input-container {
    display: flex;
    padding: 15px;
    background-color: var(--input-bg);
    border-top: 1px solid var(--border-color);
    border-radius: 10px;
    margin-top: 20px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.chat-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 12px;
    font-size: 16px;
    resize: none;
    max-height: 150px;
    min-height: 50px;
    border-radius: 8px;
    background-color: var(--input-bg);
}

.send-button {
    background-color: var(--ai-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    margin-left: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    font-size: 0; /* Cacher le texte */
    position: relative;
}

.send-button::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M2.01 21L23 12 2.01 3 2 10l15 2-15 2z"/></svg>');
    background-size: contain;
    background-repeat: no-repeat;
}

.send-button:hover {
    background-color: #3a5a75;
}

.send-button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.loading-indicator {
    display: none;
    align-self: flex-start;
    margin: 10px 0;
    padding: 10px;
    min-width: 80px;
}

.loading-dots {
    display: flex;
}

.loading-dot {
    height: 10px;
    width: 10px;
    margin: 0 5px;
    background-color: var(--loading-color);
    border-radius: 50%;
    display: inline-block;
    animation: bounce 1.5s infinite ease-in-out;
}

.loading-dot:nth-child(1) {
    animation-delay: 0s;
}

.loading-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

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

.error-message {
    background-color: var(--error-color);
    color: white;
    padding: 10px;
    border-radius: 8px;
    margin: 10px 0;
    text-align: center;
    align-self: center;
    max-width: 80%;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Styles pour les graphiques */
.chart-container {
    margin-top: 15px;
    background-color: white;
    border-radius: 8px;
    padding: 10px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ai-message .chart-container {
    background-color: white;
    color: var(--text-color);
}

.chart-title {
    font-weight: bold;
    margin-bottom: 10px;
    color: var(--text-color);
    text-align: center;
    font-size: 14px;
}

canvas {
    width: 100% !important;
    height: auto !important;
    max-height: 300px;
}

@media (max-width: 768px) {
    .chat-container {
        padding: 10px;
    }

    .message {
        max-width: 90%;
    }

    .chat-input-container {
        padding: 10px;
    }
    
    .chart-container {
        max-width: 100%;
    }
}
