* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    /* Fond cosmique profond avec un dégradé spatial immersif */
    background: radial-gradient(circle at 50% 20%, #1b1b3a 0%, #0b0b16 60%, #05050a 100%);
    color: #e2e8f0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 15px;
}

/* Mode Pleine Page Immersif */
.chat-wrapper {
    width: 100%;
    max-width: 1200px; /* Largeur généreuse pour un confort visuel maximal */
    height: 92vh; /* Occupe presque toute la hauteur de l'écran */
    background: rgba(13, 15, 33, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 20px;
    box-shadow: 0 0 40px rgba(99, 102, 241, 0.25), inset 0 0 15px rgba(129, 140, 248, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(129, 140, 248, 0.3);
}

/* En-tête enrichi avec le bandeau et le logo circulaire */
.chat-header {
    background: linear-gradient(135deg, #1e1b4b 0%, #31104f 100%);
    color: #ffffff;
    padding: 0;
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid rgba(129, 140, 248, 0.2);
    overflow: hidden;
}

.header-banner-container {
    width: 100%;
    height: 110px; /* Hauteur réduite de moitié par rapport à 240px */
    overflow: hidden;
}

.header-banner {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top; /* Force l'ancrage strict sur le haut de l'image */
    opacity: 0.85;
}

.header-banner {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.85;
}

.header-title-area {
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(13, 15, 33, 0.6);
}

.header-logo-container {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #38bdf8;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: #0b0b16;
}

.header-logo {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Rogne et remplit parfaitement le cercle */
}

.chat-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: #f8fafc;
}

.status-indicator {
    font-size: 0.8rem;
    opacity: 0.85;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 3px;
    color: #cbd5e1;
}

.dot {
    width: 8px;
    height: 8px;
    background-color: #38bdf8; /* Étoile bleue néon / Cyan */
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 8px #38bdf8;
}

.chat-messages {
    flex: 1;
    padding: 25px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: transparent;
}

.message {
    display: flex;
    max-width: 80%;
}

.message.user {
    align-self: flex-end;
}

.message.bot {
    align-self: flex-start;
}

/* Correction globale pour empêcher tout retrait ou indentation intempestive sur les retours à la ligne */
.message-content {
    padding: 14px 18px;
    border-radius: 16px;
    font-size: 0.95rem;
    line-height: 1.6;
    word-wrap: break-word;
    white-space: pre-wrap;
    text-indent: 0 !important;
    padding-left: 18px !important;
    margin-left: 0 !important;
}

.message-content p, .message-content div {
    text-indent: 0 !important;
    margin-left: 0 !important;
}

.user .message-content {
    background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
    color: #ffffff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.bot .message-content {
    background: rgba(30, 41, 59, 0.7);
    color: #f1f5f9;
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(148, 163, 184, 0.15);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.message-content.error {
    background-color: rgba(127, 29, 29, 0.6);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 14px 18px;
    background: rgba(30, 41, 59, 0.7);
    border-radius: 16px;
    width: fit-content;
    border: 1px solid rgba(148, 163, 184, 0.15);
}

.typing-indicator span {
    width: 7px;
    height: 7px;
    background: #818cf8;
    border-radius: 50%;
    animation: bounce 1.3s infinite ease-in-out;
    box-shadow: 0 0 6px #818cf8;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.15s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.3s; }

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

.chat-input-area {
    padding: 16px 24px;
    background: rgba(15, 23, 42, 0.9);
    border-top: 1px solid rgba(129, 140, 248, 0.2);
    display: flex;
    gap: 12px;
}

.chat-input-area input {
    flex: 1;
    padding: 12px 18px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(129, 140, 248, 0.3);
    border-radius: 25px;
    outline: none;
    font-size: 0.95rem;
    color: #ffffff;
    transition: all 0.3s ease;
}

.chat-input-area input::placeholder {
    color: #94a3b8;
}

.chat-input-area input:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
}

.chat-input-area button {
    background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px rgba(79, 70, 229, 0.4);
}

.chat-input-area button:hover {
    background: linear-gradient(135deg, #6366f1 0%, #60a5fa 100%);
    box-shadow: 0 0 15px rgba(96, 165, 250, 0.6);
    transform: scale(1.05);
}

.chat-input-area button:disabled {
    background: #334155;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* Styles pour les titres d'articles propres et stylisés */
.article-title-block {
    margin-top: 18px;
    margin-bottom: 10px;
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.article-number {
    font-size: 1.1rem;
    font-weight: 700;
    color: #94a3b8;
}

.article-main-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #38bdf8; /* Cyan lumineux spatial */
    text-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

/* 1. Les Liens vers les articles : Couleur Vert Émeraude / Radar Stellaire */
.contact-link {
    display: inline-block;
    background-color: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #34d399; /* Vert émeraude lumineux */
    font-weight: 600;
    text-decoration: none;
    padding: 1px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    margin-left: 4px;
    transition: all 0.2s ease;
}

.contact-link:hover {
    background-color: rgba(16, 185, 129, 0.3);
    color: #ffffff;
    box-shadow: 0 0 8px rgba(52, 211, 153, 0.5);
    text-decoration: none;
}

/* 2. Les Sous-titres (finissant par un :) : Couleur Ambre / Or Stellaire */
.sub-section-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #fbbf24; /* Ambre doré */
    margin-top: 14px;
    margin-bottom: 6px;
    text-shadow: 0 0 6px rgba(251, 191, 36, 0.2);
}

.sub-section-title-inline {
    font-weight: 700;
    color: #fbbf24;
}

/* 3. Les Mots-clefs : Couleur Violet Néon / Plasma */
.inline-keyword {
    display: inline;
    font-weight: 600;
    color: #c084fc; /* Violet néon */
    background-color: rgba(192, 132, 252, 0.1);
    border: 1px solid rgba(192, 132, 252, 0.2);
    padding: 1px 5px;
    border-radius: 4px;
}

.label-dossier {
    display: inline;
    font-weight: 600;
    color: #f472b6; /* Rose cosmique pour le dossier */
    background-color: rgba(244, 114, 182, 0.12);
    border: 1px solid rgba(244, 114, 182, 0.3);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.9rem;
    margin-right: 4px;
}