/* Chat Widget Styles */
.chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.chat-button {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #007aff 0%, #0056b3 100%);
    border-radius: 50%;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 122, 255, 0.4);
}

.chat-panel {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    z-index: 1001;
}

.chat-header {
    background: linear-gradient(135deg, #007aff 0%, #0056b3 100%);
    color: white;
    padding: 16px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    max-height: 350px;
}

.chat-input-container {
    padding: 16px;
    border-top: 1px solid #eee;
    border-radius: 0 0 12px 12px;
    position: relative;
}

.chat-input {
    width: 100%;
    padding: 12px 40px 12px 12px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
    resize: none;
    font-family: inherit;
}

.chat-send-btn {
    position: absolute;
    right: 24px;
    bottom: 24px;
    background: #007aff;
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-send-btn:hover {
    background: #0056b3;
}

.message {
    margin-bottom: 12px;
    padding: 8px 12px;
    border-radius: 12px;
    max-width: 80%;
    word-wrap: break-word;
    line-height: 1.4;
}

.message.user {
    background: #007aff;
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.message.assistant {
    background: #f0f0f0;
    color: #333;
    border-bottom-left-radius: 4px;
}

/* Styles pour le contenu HTML dans les messages de l'assistant - tout en 1rem */
.message.assistant * {
    font-size: 1rem !important;
    line-height: 1.4;
}

.message.assistant h1,
.message.assistant h2,
.message.assistant h3,
.message.assistant h4,
.message.assistant h5,
.message.assistant h6 {
    margin: 0.5rem 0 0.25rem 0;
    font-size: 1rem !important;
    font-weight: bold;
}

.message.assistant p {
    margin: 0.25rem 0;
    font-size: 1rem !important;
}

.message.assistant ul,
.message.assistant ol {
    margin: 0.25rem 0;
    padding-left: 1rem;
    font-size: 1rem !important;
}

.message.assistant li {
    margin: 0.125rem 0;
    font-size: 1rem !important;
}

.message.assistant strong,
.message.assistant b {
    font-weight: bold;
    font-size: 1rem !important;
}

.message.assistant em,
.message.assistant i {
    font-style: italic;
    font-size: 1rem !important;
}

.message.assistant code {
    background: rgba(0, 0, 0, 0.1);
    padding: 0.125rem 0.25rem;
    border-radius: 0.1875rem;
    font-family: monospace;
    font-size: 1rem !important;
}

.message.assistant pre {
    background: rgba(0, 0, 0, 0.05);
    padding: 0.5rem;
    border-radius: 0.25rem;
    overflow-x: auto;
    font-family: monospace;
    font-size: 1rem !important;
    margin: 0.25rem 0;
}

.message.assistant pre code {
    background: none;
    padding: 0;
    font-size: 1rem !important;
}

.message.assistant blockquote {
    border-left: 0.1875rem solid #007aff;
    padding-left: 0.5rem;
    margin: 0.25rem 0;
    font-style: italic;
    font-size: 1rem !important;
}

.message.assistant a {
    color: #007aff;
    text-decoration: none;
    font-size: 1rem !important;
}

.message.assistant a:hover {
    text-decoration: underline;
}

.message.assistant table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.25rem 0;
    font-size: 1rem !important;
}

.message.assistant th,
.message.assistant td {
    border: 1px solid #ddd;
    padding: 0.25rem 0.5rem;
    text-align: left;
    font-size: 1rem !important;
}

.message.assistant th {
    background-color: rgba(0, 122, 255, 0.1);
    font-weight: bold;
}

.message.assistant br {
    line-height: 1rem;
}

.message.assistant div,
.message.assistant span {
    font-size: 1rem !important;
}

.typing-indicator {
    display: none;
    padding: 8px 12px;
    background: #f0f0f0;
    border-radius: 12px;
    max-width: 80%;
    font-style: italic;
    color: #666;
    border-bottom-left-radius: 4px;
}

.typing-indicator.show {
    display: block;
}

.typing-dots {
    display: inline-block;
}

.typing-dots::after {
    content: '';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

.chat-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-close-btn:hover {
    opacity: 0.8;
}