* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --text-dark: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-light);
    color: var(--text-dark);
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* SIDEBAR */
.sidebar {
    width: 280px;
    background: var(--bg-white);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 14px;
    color: var(--text-dark);
}

.close-mobile-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-dark);
    cursor: pointer;
    padding: 5px;
}

.topics-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.topic-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-light);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    text-align: left;
}

.topic-btn:hover {
    background: var(--bg-light);
    color: var(--primary);
}

.topic-btn.active {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
    border-color: var(--primary);
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-light);
    text-align: center;
}

/* MAIN CONTENT */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-light);
}

header {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-dark);
    cursor: pointer;
    padding: 5px;
}

.header-info {
    flex: 1;
}

.header-info h1 {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.subtitle {
    font-size: 14px;
    color: var(--text-light);
}

.header-actions {
    display: flex;
    gap: 10px;
}

.new-chat-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s ease;
}

.new-chat-btn:hover {
    background: var(--primary-dark);
}

/* CHAT SECTION */
.chat-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow: hidden;
}

.chat-window {
    flex: 1;
    background: var(--bg-white);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
    overflow: hidden;
}

#chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    display: flex;
    gap: 12px;
    animation: slideIn 0.3s ease;
}

.message.user {
    justify-content: flex-end;
}

.message.bot {
    justify-content: flex-start;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.avatar.bot-avatar {
    background: var(--primary);
    color: white;
}

.avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.5;
    font-size: 14px;
    word-wrap: break-word;
}

.message.user .bubble {
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.bot .bubble {
    background: var(--bg-light);
    color: var(--text-dark);
    border-bottom-left-radius: 4px;
}

.bubble.loading {
    display: flex;
    gap: 4px;
    align-items: center;
}

.bubble.loading span {
    width: 8px;
    height: 8px;
    background: var(--text-light);
    border-radius: 50%;
    animation: bounce 1.4s infinite;
}

.bubble.loading span:nth-child(2) {
    animation-delay: 0.2s;
}

.bubble.loading span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {
    0%, 80%, 100% {
        opacity: 0.4;
        transform: translateY(0);
    }
    40% {
        opacity: 1;
        transform: translateY(-8px);
    }
}

.message-sources {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 8px;
    font-style: italic;
}

/* INPUT AREA */
.input-area {
    padding: 20px;
    border-top: 1px solid var(--border);
    background: var(--bg-white);
}

#chat-form {
    display: flex;
    gap: 10px;
}

#user-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.2s ease;
}

#user-input:focus {
    outline: none;
    border-color: var(--primary);
}

#send-btn {
    padding: 12px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

#send-btn:hover {
    background: var(--primary-dark);
}

#send-btn:disabled {
    background: var(--text-light);
    cursor: not-allowed;
}

.input-hint {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 8px;
}

/* FOOTER */
footer {
    padding: 15px 20px;
    text-align: center;
    font-size: 12px;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.footer-links a {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-light);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: var(--primary);
}

/* OVERLAY */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        z-index: 100;
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .overlay.active {
        display: block;
    }

    .menu-btn,
    .close-mobile-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .header-info h1 {
        font-size: 18px;
    }

    .new-chat-btn span {
        display: none;
    }

    .bubble {
        max-width: 85%;
    }

    .topics-list {
        padding: 10px;
    }

    .topic-btn span {
        display: none;
    }

    .topic-btn {
        justify-content: center;
        padding: 12px;
    }

    .topic-btn.active::after {
        content: '';
        position: absolute;
    }

    footer {
        display: none;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-light);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}


/* Suggestions section */
.suggestions-section {
    padding: 20px 16px 12px 16px;
    border-bottom: 1px solid var(--border);
}

.suggestions-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 12px;
}

.suggestions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.suggestion-chip {
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-dark);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.suggestion-chip:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Responsive : ajustement sur mobile */
@media (max-width: 768px) {
    .suggestions-section {
        padding: 16px 12px;
    }
    .suggestion-chip {
        font-size: 11px;
        padding: 5px 10px;
    }
    .suggestions-title span {
        font-size: 12px;
    }
}

/* Typing indicator animation */
.message.bot.typing .bubble {
    background: var(--bg-light);
    padding: 12px 20px;
    min-width: 60px;
}

.typing-bubble {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
}

.typing-bubble span {
    width: 8px;
    height: 8px;
    background: var(--text-light);
    border-radius: 50%;
    display: inline-block;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-bubble span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-bubble span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typingBounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1.2);
        opacity: 1;
    }
}

