/* ========== STYLES GÉNÉRAUX ========== */
body {
    font-size: 1.1rem;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ========== BOUTONS ========== */
.bouton-principal {
    transition: all 0.3s ease;
}

.bouton-principal:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.bouton-principal:focus {
    outline: 3px solid #3b82f6;
}

/* ========== ZONE DE CHAT ========== */
.conversation-container {
    flex-grow: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #a0aec0 #f7fafc;
    padding-bottom: 200px;
}

.conversation-container::-webkit-scrollbar {
    width: 8px;
}

.conversation-container::-webkit-scrollbar-track {
    background: #f7fafc;
}

.conversation-container::-webkit-scrollbar-thumb {
    background-color: #a0aec0;
    border-radius: 20px;
}

/* ========== ANIMATIONS ========== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-animation {
    animation: fadeIn 0.4s ease-out forwards;
}

@keyframes loadingDot {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-8px); }
}

.loading-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #002FA7;
    margin: 0 3px;
}

.loading-dot:nth-child(1) {
    animation: loadingDot 1.4s infinite ease-in-out;
}

.loading-dot:nth-child(2) {
    animation: loadingDot 1.4s infinite ease-in-out 0.2s;
}

.loading-dot:nth-child(3) {
    animation: loadingDot 1.4s infinite ease-in-out 0.4s;
}

@keyframes messageFlash {
    0% { background-color: rgba(191, 219, 254, 0.5); }
    100% { background-color: transparent; }
}

.message-flash {
    animation: messageFlash 1s ease-out;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

.recording-pulse {
    animation: pulse 1.5s infinite;
}

/* ========== MESSAGES ========== */
.message-utilisateur p,
.message-assistant p {
    margin: 0 !important;
    line-height: 1.2 !important;
}

.message-utilisateur,
.message-assistant {
    line-height: 1.3 !important;
}

.message-utilisateur {
    background-color: #e6f0ff;
    border-radius: 18px 18px 0 18px;
    max-width: 90%;
    margin-left: auto;
    margin-top: 20px !important;
    margin-bottom: 20px !important;
    padding: 10px 12px !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
    position: relative;
}

.message-assistant {
    background-color: #f0f4f8;
    border-radius: 18px 18px 18px 0;
    max-width: 90%;
    margin-right: auto;
    margin-top: 20px !important;
    margin-bottom: 20px !important;
    padding: 10px 12px !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
    position: relative;
}


/* ========== INPUT ========== */
.message-input {
    border-radius: 24px;
    transition: all 0.3s ease;
    max-height: 120px;
    overflow-y: auto;
    resize: none;
}

.message-input:focus {
    border-color: #002FA7;
    box-shadow: 0 0 0 3px rgba(0, 47, 167, 0.2);
}

.input-disabled {
    opacity: 0.5;
    pointer-events: none;
    background-color: #f3f4f6;
    border-color: #d1d5db;
}

/* Input container : structure de base (responsive géré dans MOBILE FIRST plus bas) */
.input-container {
    position: fixed;
    bottom: 18px;
    left: 0;
    right: 0;
    background-color: #ffffff;
    border-top: 1px solid #e5e7eb;
    z-index: 30;
    transition: all 0.3s ease;
}

.input-container > .container {
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
}

/* ========== TO-DO LISTS ========== */
.to-do-list li {
    position: relative;
    padding-left: 2rem;
    margin-bottom: 0.75rem;
    cursor: pointer;
}

.to-do-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.35rem;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid #002FA7;
    border-radius: 50%;
    cursor: pointer;
}

.to-do-list li.completed::before {
    background-color: #28A745;
    border-color: #28A745;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' d='M0 0h24v24H0z'/%3E%3Cpath d='M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z' fill='white'/%3E%3C/svg%3E");
    background-size: 70%;
    background-position: center;
    background-repeat: no-repeat;
}

.to-do-list li.completed {
    color: #4A5568;
    text-decoration: line-through;
}

.todo-progress-container {
    width: 100%;
    height: 6px;
    background-color: #f3f4f6;
    border-radius: 3px;
    margin-top: 8px;
    margin-bottom: 12px;
    overflow: hidden;
}

.todo-progress-bar {
    height: 100%;
    background-color: #2563eb;
    transition: width 0.3s ease;
}

/* ========== QCM ========== */
.qcm-button {
    transition: all 0.3s ease;
}

.qcm-button:hover {
    transform: translateY(-2px);
}

.qcm-chat {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.qcm-chat-button {
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s ease;
    text-align: center;
}

.qcm-yes {
    background-color: #2563eb;
    color: white;
}

.qcm-yes:hover {
    background-color: #1d4ed8;
}

.qcm-no {
    background-color: #e2e8f0;
    color: #334155;
}

.qcm-no:hover {
    background-color: #cbd5e1;
}

.qcm-device-step {
    display: none;
    margin-bottom: 15px;
}

.qcm-device-step.active {
    display: block;
    animation: fadeIn 0.4s ease-out forwards;
}

.qcm-device-option {
    display: block;
    width: 100%;
    padding: 12px 15px;
    margin: 8px 0;
    border-radius: 8px;
    background-color: #f3f4f6;
    color: #374151;
    font-weight: 500;
    transition: all 0.2s ease;
    text-align: left;
    cursor: pointer;
}

.qcm-device-option:hover {
    background-color: #e5e7eb;
    transform: translateY(-2px);
}

.qcm-device-option i {
    margin-right: 8px;
    color: #2563eb;
}

.qcm-device-title {
    font-size: 1.1em;
    font-weight: 600;
    color: #1e40af;
    margin-bottom: 10px;
}

/* ========== JAUGE DE TOKENS ========== */
.token-gauge {
    height: 8px;
    border-radius: 4px;
    background-color: #e2e8f0;
    overflow: hidden;
    width: 100%;
}

.token-fill {
    height: 100%;
    background-color: #002FA7;
    transition: width 0.3s ease;
    float: left;
}

/* ========== IMAGES ========== */
.image-preview-container {
    display: none;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
    max-width: 100%;
    overflow-x: auto;
    padding: 5px 0;
}

.image-preview {
    display: inline-block;
    position: relative;
    margin-right: 8px;
    border-radius: 8px;
    overflow: hidden;
    width: 80px;
    height: 80px;
    min-width: 60px;
    min-height: 60px;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}

.image-preview .remove-image {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0,0,0,0.6);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
}

.message-image {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.message-image:hover {
    transform: scale(1.03);
}

.fullscreen-image-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 100;
    align-items: center;
    justify-content: center;
    display: none;
}

.fullscreen-image-modal.active {
    display: flex;
}

.fullscreen-image {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.close-fullscreen {
    position: absolute;
    top: 20px;
    left: 20px;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    background-color: rgba(0, 0, 0, 0.5);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}

.close-fullscreen:hover {
    background-color: rgba(255, 0, 0, 0.7);
}

/* ========== HEADER ========== */
.header-full {
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.header-compact {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
    transition: all 0.3s ease;
}

/* ========== ICÔNES INLINE IA ========== */
.senolo-inline-icon {
    display: inline-block;
    height: 32px;
    width: auto;
    vertical-align: -10px;
    margin: 0 4px 0 1px;
    border-radius: 6px;
}

/* ========== LIENS ANTI-ARNAQUE ========== */
.message-anti-arnaque a {
    color: #dc2626;
    text-decoration: line-through;
    cursor: not-allowed;
    opacity: 0.7;
}
.message-anti-arnaque a:hover {
    opacity: 1;
}

/* ========== MODÉRATION — Messages in-app ========== */
.moderation-message {
    margin: 12px 16px;
    border-radius: 12px;
    padding: 14px 18px;
    animation: moderationSlideIn 0.3s ease-out;
}
.moderation-violence {
    background: #fef2f2;
    border-left: 4px solid #dc2626;
}
.moderation-suicide {
    background: #eff6ff;
    border-left: 4px solid #2563eb;
}
.moderation-message-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.moderation-message-icon {
    flex-shrink: 0;
    font-size: 18px;
    margin-top: 2px;
}
.moderation-message-text {
    font-size: 14px;
    line-height: 1.5;
    color: #374151;
}

@keyframes moderationSlideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========== MODÉRATION — Modal ========== */
.modal-moderation-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: moderationFadeIn 0.2s ease-out;
}
.modal-moderation-box {
    background: white;
    border-radius: 16px;
    max-width: 440px;
    width: 90%;
    padding: 28px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
.modal-moderation-header {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
}
.modal-moderation-body {
    margin-bottom: 24px;
}
.modal-moderation-footer {
    text-align: center;
}
.modal-moderation-btn {
    color: white;
    border: none;
    padding: 12px 32px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}
.modal-moderation-btn:hover {
    opacity: 0.9;
}

@keyframes moderationFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}


/* ========== FOOTER ========== */
.footer-discret {
    background: #ffffff !important;
    color: #6b7280 !important;
    font-size: 0.6rem;
    padding: 0.25rem 1rem;
    text-align: center;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 31;
    opacity: 1 !important;
    border-top: 1px solid #e5e7eb;
    line-height: 1.4;
}

.footer-discret a {
    color: #6b7280 !important;
    text-decoration: none;
}

.footer-discret a:hover {
    color: #002FA7 !important;
    text-decoration: underline;
}

/* ========== MODALS ========== */
.modal-overlay {
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.modal-content {
    max-width: 500px;
    width: 90%;
}

.modal-scrollable {
    max-height: 80vh;
    overflow-y: auto;
}

.modal-email,
.modal-password,
.modal-name,
.add-device-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 50;
    justify-content: center;
    align-items: center;
}

.modal-email-container,
.modal-password-container,
.modal-name-container,
.add-device-container {
    background-color: white;
    border-radius: 10px;
    padding: 20px;
    width: 90%;
    max-width: 400px;
}

.add-device-container {
    max-width: 500px;
}

.add-device-input,
.password-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    margin-bottom: 15px;
}

/* ========== RECONNAISSANCE VOCALE ========== */
.voice-record-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 0;
}

.voice-record-btn {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #002FA7;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    font-size: 26px;
    cursor: pointer;
    transition: background 0.3s;
}

.voice-record-btn.recording {
    background: #dc2626;
    animation: rec-glow 3s ease-in-out infinite;
}

@keyframes rec-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.3); }
    50%      { box-shadow: 0 0 0 14px rgba(220, 38, 38, 0); }
}

.voice-status {
    font-size: 15px;
    margin-top: 12px;
    color: #374151;
    text-align: center;
}

.voice-timer {
    font-size: 28px;
    font-weight: 700;
    color: #dc2626;
    font-variant-numeric: tabular-nums;
    margin-top: 6px;
}

.voice-transcript {
    margin-top: 16px;
    padding: 14px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    width: 100%;
    min-height: 70px;
    max-height: 160px;
    overflow-y: auto;
    font-size: 16px;
    line-height: 1.5;
    color: #111827;
}

.voice-controls {
    margin-top: 14px;
    display: flex;
    justify-content: space-between;
    width: 100%;
    gap: 10px;
}

#speechPreview {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0,0,0,0.7);
    color: white;
    padding: 10px 15px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 1050;
    max-width: 80%;
    text-align: center;
    display: none;
}

/* ========== CAMÉRA ========== */
.camera-capture-btn {
    position: absolute;
    bottom: 20px; 
    left: 50%;
    transform: translateX(-50%);
    width: 70px; 
    height: 70px;
    border-radius: 50%;
    background-color: white;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 30;
}

.camera-action-btn {
    width: 64px;
    height: 64px;
    margin: 0 20px;
    border-radius: 50%;
}

.camera-toggle-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    z-index: 30;
}

@media (orientation: portrait) {
    .camera-container {
        width: 100%;
        height: 100%;
    }
    
    .camera-controls {
        position: absolute;
        bottom: 20px;
        left: 0;
        right: 0;
        display: flex;
        justify-content: center;
        z-index: 20;
    }
    
    .camera-capture-btn {
        position: fixed;
        bottom: 120px;
    }
}

@media (orientation: landscape) {
    .camera-container {
        width: 70%;
        height: 100%;
        margin: 0 auto;
    }
    
    .camera-controls {
        position: absolute;
        right: 20px;
        top: 50%;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 20px;
        z-index: 20;
    }
    
    .camera-capture-btn {
        position: fixed;
        right: 120px;
        top: 50%;
        transform: translateY(-50%);
        left: auto;
    }
}

/* ========== APPAREILS ========== */
.device-buttons-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
    justify-content: center;
}

.device-button {
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s ease;
    text-align: center;
    flex-grow: 1;
    flex-basis: 30%;
    min-width: 150px;
}

.device-button:hover {
    transform: translateY(-2px);
}

.device-button.add-device {
    background-color: #4ade80;
    color: white;
}

.device-button.add-device:hover {
    background-color: #22c55e;
}

.device-button.other-question {
    background-color: #f59e0b;
    color: white;
}

.device-button.other-question:hover {
    background-color: #d97706;
}

.device-button.web-help-button {
    background-color: #3b82f6;
    color: white;
}

.device-button.web-help-button:hover {
    background-color: #2563eb;
}

.device-button.decouverte-btn {
    background-color: #a855f7;
    color: white;
}

.device-button.decouverte-btn:hover {
    background-color: #9333ea;
}

.device-button.config-btn {
    background-color: #10b981;
    color: white;
}

.device-button.config-btn:hover {
    background-color: #059669;
}

.device-button.electro-btn {
    background-color: #f97316;
    color: white;
}

.device-button.electro-btn:hover {
    background-color: #ea580c;
}

.device-button.connexion-btn {
    background-color: #0ea5e9;
    color: white;
}

.device-button.connexion-btn:hover {
    background-color: #0284c7;
}

.device-button.settings-button {
    background-color: #6366f1;
    color: white;
}

.device-button.settings-button:hover {
    background-color: #4f46e5;
}

.device-button.fraud-detector-button {
    background-color: #ef4444;
    color: white;
}

.device-button.fraud-detector-button:hover {
    background-color: #dc2626;
}

/* ========== COULEURS APPAREILS ========== */
.color-senolo-blue {
    background-color: #002FA7;
    color: white;
}

.color-senolo-green {
    background-color: #00A86B;
    color: white;
}

.color-orange {
    background-color: #F59E0B;
    color: white;
}

.color-purple {
    background-color: #8B5CF6;
    color: white;
}

.color-black {
    background-color: #111827;
    color: white;
}

.color-white {
    background-color: #FFFFFF;
    color: #111827;
    border: 1px solid #E5E7EB;
}

/* ========== SÉLECTION ICÔNES/COULEURS ========== */
.icon-selection, .color-selection {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
    margin-bottom: 15px;
}

.icon-option, .color-option {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.icon-option:hover, .color-option:hover {
    transform: scale(1.1);
}

.icon-option.selected, .color-option.selected {
    border: 2px solid #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.3);
}

.icon-option {
    background-color: #f3f4f6;
    font-size: 24px;
}

/* ========== DÉTECTEUR D'ARNAQUE ========== */
.fraud-score-container {
    border: 1px solid #e5e7eb;
    padding: 1rem;
    border-radius: 0.5rem;
    text-align: center;
}

.fraud-score-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.fraud-score-title {
    font-weight: 600;
    margin-top: 0.5rem;
    color: #1f2937;
}

.fraud-score-circle {
    width: 100px;
    height: 100px;
}

.fraud-gauge text {
    font-family: Arial, sans-serif;
    font-size: 20px;
    fill: #333333;
}

/* ========== DIVERS ========== */
.loading-initial {
    text-align: center;
    padding: 20px;
    color: #4b5563;
}

.settings-link {
    color: #2563eb;
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}

.settings-link:hover {
    text-decoration: none;
}

.external-link-icon {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-left: 4px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' d='M0 0h24v24H0z'/%3E%3Cpath d='M10 6v2H5v11h11v-5h2v6a1 1 0 01-1 1H4a1 1 0 01-1-1V7a1 1 0 011-1h6zm11-3v8h-2V6.413l-7.793 7.794-1.414-1.414L17.585 5H13V3h8z' fill='%232563eb'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    vertical-align: middle;
}

.spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ========== BOUTON SUITE (réponse décomposée) — BLEU SENOLO PLEIN ========== */
.bouton-suite {
    display: inline-block;
    width: auto;
    padding: 8px 18px;
    margin-top: 6px;
    background: #002FA7;
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    animation: fadeIn 0.3s ease-out;
}
.bouton-suite:hover {
    background: #0041d1;
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 47, 167, 0.3);
}
.bouton-suite:active {
    transform: scale(0.98);
}

/* ========== MEDIA QUERIES ========== */

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE V2 — MOBILE FIRST
   Base = mobile (smartphone < 481px). Puis agrandissement progressif.
   ════════════════════════════════════════════════════════════════ */

/* === BASE : MOBILE (< 481px) === */

/* Conversation : laisser de la place pour input + footer fixed */
.conversation-container {
    padding-bottom: 180px;
}

/* Quand le bouton "C'est fait" est présent, agrandir l'espace bas
   pour que la dernière phrase de l'IA ne soit pas masquée */
body:has(#boutonSuite) .conversation-container {
    padding-bottom: 240px;
}

/* Bouton TTS sous chaque réponse de l'assistant */
.btn-tts-message {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(0, 47, 167, 0.06);
    color: #002FA7;
    border: 1px solid rgba(0, 47, 167, 0.15);
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-tts-message:hover {
    background: rgba(0, 47, 167, 0.12);
}

.btn-tts-message[data-tts-state="playing"] {
    background: #002FA7;
    color: white;
}

.btn-tts-message[data-tts-state="loading"] {
    background: rgba(0, 47, 167, 0.18);
    color: #002FA7;
    cursor: wait;
}

.btn-tts-message:focus,
.btn-tts-message:focus-visible {
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(0, 47, 167, 0.3) !important;
    border-color: #002FA7 !important;
}

/* Input container : compact, bord bas serré au footer */
.input-container {
    bottom: 18px;
    padding: 8px 10px 4px 10px !important;
}

.input-container form {
    padding: 8px 10px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06) !important;
    gap: 4px;
}

/* Compteur caché en mobile (peu de place) */
#charCountDisplay {
    display: none !important;
}

/* Image preview compact en mobile */
.image-preview-container {
    margin-bottom: 6px;
}

/* Zone texte */
.message-input {
    font-size: 0.95rem;
    padding: 8px 12px !important;
    border-radius: 18px;
}

/* Bouton envoyer rond — BLEU SENOLO PLEIN (#002FA7), même que les icônes */
#envoyerMessage {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    flex-shrink: 0;
    background: #002FA7 !important;
    color: white !important;
    border-radius: 50% !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 2px 6px rgba(0, 47, 167, 0.25);
}

#envoyerMessage:hover:not(:disabled) {
    background: #0041d1 !important;
    transform: scale(1.05);
}

#envoyerMessage i {
    font-size: 0.95rem !important;
}

/* Boutons d'action : icônes seules, centrés */
.message-actions {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    justify-content: center !important;
    gap: 8px !important;
    margin-top: 6px !important;
    grid-template-columns: unset !important;
}

.message-actions button {
    flex: 0 0 auto !important;
    width: 54px !important;
    min-width: 54px !important;
    height: 44px !important;
    min-height: 44px !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 10px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background-color: #dbeafe;
    color: #002FA7;
    border: none;
    cursor: pointer;
}

.message-actions button:hover:not(:disabled) {
    background-color: #bfdbfe;
}

.message-actions button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.message-actions button#boutonCopierConvId {
    background-color: #f3f4f6;
    color: #6b7280;
}

.message-actions button span {
    display: none !important;
}

.message-actions button i {
    margin: 0 !important;
    font-size: 1.05rem !important;
}

/* Footer : visible mais discret en mobile */
.footer-discret {
    font-size: 0.55rem !important;
    padding: 3px 8px !important;
    line-height: 1.3 !important;
}


/* === TABLETTE PETITE (≥ 481px) : footer un peu plus lisible === */
@media (min-width: 481px) {
    .conversation-container {
        padding-bottom: 160px;
    }

    .footer-discret {
        font-size: 0.6rem !important;
        padding: 4px 12px !important;
    }
}


/* === DESKTOP (≥ 768px) : icônes + texte, layout confortable === */
@media (min-width: 768px) {
    .conversation-container {
        padding-bottom: 140px;
    }

    .input-container {
        bottom: 22px;
        padding: 10px 1rem 4px 1rem !important;
    }

    .input-container form {
        padding: 10px 14px !important;
    }

    .message-input {
        font-size: 1rem;
        padding: 10px 14px !important;
    }

    #envoyerMessage {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
    }

    /* Boutons : passage à icône + texte */
    .message-actions {
        justify-content: flex-start !important;
        gap: 8px !important;
    }

    .message-actions button {
        width: auto !important;
        min-width: 0 !important;
        padding: 8px 16px !important;
        height: auto !important;
    }

    .message-actions button span {
        display: inline !important;
        font-size: 0.85rem !important;
        margin-left: 6px;
    }

    #charCountDisplay {
        display: block !important;
    }

    .footer-discret {
        font-size: 0.65rem !important;
    }
}


/* === KEYBOARD OPEN (mobile, clavier visible) ===
   Détection via JS qui ajoute body.keyboard-open. On compresse encore. */
body.keyboard-open #charCountDisplay,
body.keyboard-open #imagePreviewContainer {
    display: none !important;
}

body.keyboard-open .footer-discret {
    font-size: 0.45rem !important;
    padding: 1px 8px !important;
    line-height: 1.2 !important;
    border-top: none !important;
}

body.keyboard-open .input-container {
    bottom: 14px !important;
    padding: 6px 8px !important;
    box-shadow: 0 -3px 12px rgba(0, 0, 0, 0.12) !important;
    z-index: 9999 !important;
}

body.keyboard-open .input-container form {
    padding: 4px 6px !important;
    gap: 4px !important;
}

body.keyboard-open .message-actions {
    margin-top: 4px !important;
    gap: 6px !important;
    height: auto !important;
}

body.keyboard-open .message-actions button {
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
}

body.keyboard-open .message-actions button i {
    font-size: 0.95rem !important;
}

body.keyboard-open .message-input {
    font-size: 1rem !important;
    padding: 6px 10px !important;
}

body.keyboard-open #envoyerMessage {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
}



@media (prefers-contrast: high) {
    body {
        background: white !important;
        color: black !important;
    }
    
    .message-utilisateur {
        background: #b3d1ff !important;
        color: black !important;
        border: 2px solid black !important;
    }
    
    .message-assistant {
        background: #d1d1d1 !important;
        color: black !important;
        border: 2px solid black !important;
    }
    
    .bouton-principal {
        border: 3px solid black !important;
    }
}

/* ========== STREAMING ========== */
.streaming-cursor {
    display: inline-block;
    width: 2px;
    height: 1.1em;
    background-color: #002FA7;
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: cursorBlink 1s step-end infinite;
}

@keyframes cursorBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.message-streaming {
    border-left: 3px solid #3b82f6;
}

/* ========== INDICATEURS D'ACTIVITÉ ========== */
.activity-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background-color: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 20px;
    margin: 8px 0;
    animation: fadeIn 0.3s ease-out;
    font-size: 0.9rem;
    color: #1e40af;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: opacity 0.3s ease;
}

.activity-indicator.fade-out {
    opacity: 0;
}

.activity-icon {
    font-size: 1.1rem;
}

.activity-text {
    font-weight: 500;
}

.activity-dots {
    display: flex;
    gap: 3px;
    align-items: center;
}

.activity-dots span {
    display: inline-block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background-color: #3b82f6;
    animation: activityBounce 1.4s infinite ease-in-out;
}

.activity-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.activity-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes activityBounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-6px); }
}

.activity-details {
    display: none;
    margin-top: 4px;
    padding: 8px 12px;
    background-color: #f8fafc;
    border-radius: 8px;
    font-size: 0.8rem;
    color: #64748b;
}

/* ========== WCAG AAA — Largeur de ligne et espacement ========== */
.message-assistant p,
.message-utilisateur p,
.message-assistant li,
.message-utilisateur li {
    max-width: 70ch;
}

p + p {
    margin-top: 1.5em;
}

/* ========== WCAG ACCESSIBILITE ========== */

/* WCAG Focus Visible */
*:focus-visible {
    outline: 3px solid #E8A838;
    outline-offset: 2px;
}

/* Skip Link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #002FA7;
    color: white;
    padding: 8px 16px;
    z-index: 10000;
    font-size: 14px;
    text-decoration: none;
    transition: top 0.2s;
}
.skip-link:focus {
    top: 0;
}

/* Label visuellement cache mais accessible */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Mouvement reduit */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}