/* RAG Chat Extension Styles - Préfixés pour éviter les conflits */

.ragChat-container {
    display: flex;
    flex: 1;
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.ragChat-container * {
    box-sizing: border-box;
}

:root {
    --ragChat-bg-primary: #ffffff;
    --ragChat-bg-secondary: #f7f7f8;
    --ragChat-bg-tertiary: #ffffff;
    --ragChat-text-primary: #353740;
    --ragChat-text-secondary: #6e6e80;
    --ragChat-border-color: #e5e5e6;
    --ragChat-user-message-bg: #ffffff;
    --ragChat-assistant-message-bg: #f7f7f8;
    --ragChat-input-bg: #ffffff;
    --ragChat-input-border: #d1d5db;
    --ragChat-button-bg: #3C8DBC;
    --ragChat-button-hover: #2E6F9A;
    --ragChat-button-disabled: #d1d5db;
    --ragChat-shadow: rgba(0, 0, 0, 0.1);
}

.ragChat-container.dark-mode {
    --ragChat-bg-primary: #343541;
    --ragChat-bg-secondary: #444654;
    --ragChat-bg-tertiary: #343541;
    --ragChat-text-primary: #ececf1;
    --ragChat-text-secondary: #c5c5d2;
    --ragChat-border-color: #565869;
    --ragChat-user-message-bg: #343541;
    --ragChat-assistant-message-bg: #444654;
    --ragChat-input-bg: #40414f;
    --ragChat-input-border: #565869;
    --ragChat-button-bg: #3C8DBC;
    --ragChat-button-hover: #2E6F9A;
    --ragChat-button-disabled: #565869;
    --ragChat-shadow: rgba(0, 0, 0, 0.3);
}

.ragChat-sidebar {
    width: 260px;
    background-color: var(--ragChat-bg-tertiary);
    border-right: 1px solid var(--ragChat-border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ragChat-sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--ragChat-border-color);
}

.ragChat-new-conversation-btn {
    width: 100%;
    padding: 10px 16px;
    background-color: var(--ragChat-button-bg);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.ragChat-new-conversation-btn:hover {
    background-color: var(--ragChat-button-hover);
}

.ragChat-sidebar-search {
    padding: 12px 16px;
    border-bottom: 1px solid var(--ragChat-border-color);
}

.ragChat-search-input {
    width: 100%;
    padding: 8px 12px;
    background-color: var(--ragChat-input-bg);
    border: 1px solid var(--ragChat-border-color);
    border-radius: 8px;
    font-size: 13px;
    color: var(--ragChat-text-primary);
    outline: none;
    transition: border-color 0.2s;
}

.ragChat-search-input:focus {
    border-color: var(--ragChat-button-bg);
}

.ragChat-search-input::placeholder {
    color: var(--ragChat-text-secondary);
}

.ragChat-sidebar-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--ragChat-text-primary);
    margin-top: 16px;
    margin-bottom: 8px;
    padding: 0 16px;
}

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

.ragChat-conversation-item {
    padding: 10px 12px;
    margin-bottom: 4px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.ragChat-conversation-item:hover {
    background-color: var(--ragChat-bg-secondary);
}

.ragChat-conversation-item.active {
    background-color: var(--ragChat-bg-secondary);
}

.ragChat-conversation-title {
    flex: 1;
    font-size: 14px;
    color: var(--ragChat-text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.ragChat-conversation-title-input {
    width: 100%;
    font-size: 14px;
    color: var(--ragChat-text-primary);
    background-color: var(--ragChat-input-bg);
    border: 1px solid var(--ragChat-button-bg);
    border-radius: 4px;
    padding: 4px 8px;
    outline: none;
    font-family: inherit;
}

.ragChat-conversation-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.ragChat-conversation-item:hover .ragChat-conversation-actions {
    opacity: 1;
}

.ragChat-conversation-btn {
    padding: 4px;
    background: none;
    border: none;
    color: var(--ragChat-text-secondary);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ragChat-conversation-btn:hover {
    background-color: var(--ragChat-bg-primary);
}

.ragChat-conversation-btn.delete:hover {
    color: #ef4444;
}

.ragChat-conversation-btn.edit:hover {
    color: var(--ragChat-button-bg);
}

.ragChat-chat-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: var(--ragChat-bg-primary);
    color: var(--ragChat-text-primary);
}

.ragChat-header {
    background-color: var(--ragChat-bg-tertiary);
    border-bottom: 1px solid var(--ragChat-border-color);
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.ragChat-header h1 {
    font-size: 18px;
    font-weight: 600;
    color: var(--ragChat-text-primary);
    margin: 0;
}

.ragChat-theme-toggle-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ragChat-theme-toggle-label {
    font-size: 14px;
    color: var(--ragChat-text-secondary);
    user-select: none;
}

.ragChat-theme-toggle {
    position: relative;
    width: 52px;
    height: 28px;
    background-color: var(--ragChat-border-color);
    border-radius: 14px;
    cursor: pointer;
    transition: background-color 0.3s;
    border: none;
    outline: none;
    padding: 0;
}

.ragChat-theme-toggle.active {
    background-color: var(--ragChat-button-bg);
}

.ragChat-theme-toggle-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.ragChat-theme-toggle.active .ragChat-theme-toggle-slider {
    transform: translateX(24px);
}

.ragChat-theme-toggle:hover {
    opacity: 0.8;
}

.ragChat-chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.ragChat-message {
    display: flex;
    gap: 16px;
    max-width: 768px;
    margin: 0 auto;
    width: 100%;
    animation: ragChat-fadeIn 0.3s ease-in;
    flex-direction: column;
}

.ragChat-message-content-wrapper {
    display: flex;
    gap: 16px;
    width: 100%;
}

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

.ragChat-message.user .ragChat-message-content-wrapper {
    flex-direction: row-reverse;
    align-items: center;
}

.ragChat-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.ragChat-message.user .ragChat-message-avatar {
    background: linear-gradient(135deg, #3C8DBC 0%, #2E6F9A 100%);
    color: white;
    border: none;
    box-shadow: 0 2px 8px rgba(60, 141, 188, 0.3);
}

.ragChat-container.dark-mode .ragChat-message.user .ragChat-message-avatar {
    background: linear-gradient(135deg, #4A9FD4 0%, #3C8DBC 100%);
    box-shadow: 0 2px 12px rgba(60, 141, 188, 0.4);
}

.ragChat-message.assistant .ragChat-message-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.ragChat-message.assistant .ragChat-message-avatar i {
    font-size: 14px;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.ragChat-container.dark-mode .ragChat-message.assistant .ragChat-message-avatar {
    background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 100%);
    box-shadow: 0 2px 12px rgba(139, 92, 246, 0.4);
}

.ragChat-message-content {
    flex: 1;
    padding: 12px 16px;
    border-radius: 8px;
    line-height: 1.6;
    font-size: 15px;
    word-wrap: break-word;
}

.ragChat-message.user .ragChat-message-content {
    background-color: var(--ragChat-user-message-bg);
    border: 1px solid var(--ragChat-border-color);
}

.ragChat-message.assistant .ragChat-message-content {
    background-color: var(--ragChat-assistant-message-bg);
}

.ragChat-message-content code {
    background-color: var(--ragChat-bg-primary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    border: 1px solid var(--ragChat-border-color);
}

.ragChat-message-content pre {
    background-color: var(--ragChat-bg-primary);
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 8px 0;
    border: 1px solid var(--ragChat-border-color);
}

.ragChat-message-content pre code {
    background: none;
    padding: 0;
    border: none;
}

.ragChat-loading {
    display: flex;
    gap: 4px;
    align-items: center;
}

.ragChat-loading-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--ragChat-text-secondary);
    animation: ragChat-bounce 1.4s infinite ease-in-out both;
}

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

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

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

.ragChat-input-container {
    background-color: var(--ragChat-bg-tertiary);
    border-top: 1px solid var(--ragChat-border-color);
    padding: 16px 20px;
    display: flex;
    gap: 12px;
    align-items: center;
    
}

.ragChat-input-wrapper {
    flex: 1;
    max-width: 768px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    gap: 12px;
    align-items: center;
}

.ragChat-input-area {
    flex: 1;
    position: relative;
}

#ragChat-messageInput {
    width: 100%;
    min-height: 44px;
    max-height: 200px;
    padding: 12px 16px;
    border: 1px solid var(--ragChat-input-border);
    border-radius: 12px;
    background-color: var(--ragChat-input-bg);
    color: var(--ragChat-text-primary);
    font-size: 15px;
    font-family: inherit;
    resize: none;
    outline: none;
    line-height: 1.5;
    transition: border-color 0.2s;
}

#ragChat-messageInput:focus {
    border-color: var(--ragChat-button-bg);
}

#ragChat-messageInput::placeholder {
    color: var(--ragChat-text-secondary);
}

.ragChat-send-button {
    background-color: var(--ragChat-button-bg);
    color: white;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
    flex-shrink: 0;
}

.ragChat-send-button:hover:not(:disabled) {
    background-color: var(--ragChat-button-hover);
}

.ragChat-send-button:disabled {
    background-color: var(--ragChat-button-disabled);
    cursor: not-allowed;
}

.ragChat-send-button svg {
    width: 20px;
    height: 20px;
}

.ragChat-empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
    color: var(--ragChat-text-secondary);
}

.ragChat-empty-state h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--ragChat-text-primary);
}

.ragChat-empty-state p {
    font-size: 15px;
    max-width: 500px;
}

.ragChat-suggestions-container {
    margin-top: 32px;
    width: 100%;
    max-width: 768px;
}

.ragChat-suggestions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 20px;
}

.ragChat-suggestion-item {
    padding: 12px 16px;
    background-color: var(--ragChat-bg-secondary);
    border: 1px solid var(--ragChat-border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    font-size: 14px;
    color: var(--ragChat-text-primary);
    word-wrap: break-word;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ragChat-suggestion-item i {
    flex-shrink: 0;
    font-size: 14px;
}

.ragChat-suggestion-item:hover {
    background-color: var(--ragChat-button-bg);
    color: white;
    border-color: var(--ragChat-button-bg);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--ragChat-shadow);
}

.ragChat-suggestion-item.question {
    border-left: 3px solid var(--ragChat-button-bg);
}

.ragChat-suggestion-item.sujet {
    border-left: 3px solid #8b5cf6;
}

.ragChat-followup-suggestions {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--ragChat-border-color);
    width: 100%;
    margin-left: 0;
}

.ragChat-message.assistant .ragChat-followup-suggestions {
    margin-left: 48px;
    max-width: calc(100% - 48px);
}

.ragChat-followup-suggestions-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

@media (max-width: 600px) {
    .ragChat-followup-suggestions-list {
        grid-template-columns: 1fr;
    }
}

.ragChat-followup-suggestion-item {
    padding: 8px 12px;
    background-color: var(--ragChat-bg-primary);
    border: 1px solid var(--ragChat-border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
    color: var(--ragChat-text-primary);
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ragChat-followup-suggestion-item:hover {
    background-color: var(--ragChat-button-bg);
    color: white;
    border-color: var(--ragChat-button-bg);
}

.ragChat-followup-suggestion-item i {
    flex-shrink: 0;
    font-size: 14px;
    color: #FFC107;
}

.ragChat-followup-suggestion-item:hover i {
    color: white;
}

.ragChat-error-message {
    background-color: #fee;
    color: #c33;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 8px 0;
    border: 1px solid #fcc;
}

.ragChat-container.dark-mode .ragChat-error-message {
    background-color: #4a2c2c;
    color: #ff6b6b;
    border-color: #5a3a3a;
}

@media (max-width: 768px) {
    .ragChat-message {
        padding: 0 8px;
    }

    .ragChat-input-wrapper {
        padding: 0 8px;
    }

    .ragChat-header {
        padding: 12px 16px;
    }
}

/* Scrollbar styling */
.ragChat-chat-container::-webkit-scrollbar {
    width: 8px;
}

.ragChat-chat-container::-webkit-scrollbar-track {
    background: transparent;
}

.ragChat-chat-container::-webkit-scrollbar-thumb {
    background-color: var(--ragChat-border-color);
    border-radius: 4px;
}

.ragChat-chat-container::-webkit-scrollbar-thumb:hover {
    background-color: var(--ragChat-text-secondary);
}

.ragChat-conversations-list::-webkit-scrollbar {
    width: 8px;
}

.ragChat-conversations-list::-webkit-scrollbar-track {
    background: transparent;
}

.ragChat-conversations-list::-webkit-scrollbar-thumb {
    background-color: var(--ragChat-border-color);
    border-radius: 4px;
}

.ragChat-conversations-list::-webkit-scrollbar-thumb:hover {
    background-color: var(--ragChat-text-secondary);
}

