/* ==========================================================================
   CDM — Conseiller flottant, aligné sur la direction artistique du site
   Le composant est piloté par des variables : on bascule la palette en sombre
   puis on ajuste la géométrie (pilules, coins arrondis, accent bleu).
   Chargée après site.css.
   ========================================================================== */

#cdm-panel,
#cdm-bubble {
    --cdm-accent: #2563eb;
    --cdm-accent-dark: #1d4ed8;
    --cdm-accent-soft: rgba(37, 99, 235, .22);
    --cdm-accent-glow: rgba(37, 99, 235, .38);
    --cdm-glow-1: #60a5fa;
    --cdm-glow-2: #2563eb;
    --cdm-bg: #0d0e13;
    --cdm-surface: #14151c;
    --cdm-surface-2: rgba(255, 255, 255, .06);
    --cdm-text: #f5f5f5;
    --cdm-text-muted: #9a9aa2;
    --cdm-border: rgba(255, 255, 255, .14);
    --cdm-header-text: #f5f5f5;
    --cdm-header-muted: #9a9aa2;
    --cdm-header-border: rgba(255, 255, 255, .12);
}

/* ------------------------------------------------------------- La bulle */
#cdm-bubble {
    width: 58px;
    height: 58px;
    background: #14151c;
    border: 1px solid rgba(37, 99, 235, .65);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .55), 0 0 0 0 var(--cdm-accent-glow);
}

#cdm-bubble:hover {
    background: #1d1e29;
    border-color: #2563eb;
}

#cdm-notif {
    border-color: #14151c !important;
}

/* ------------------------------------------------------------- Le panneau */
#cdm-panel {
    border-radius: 18px;
    border-color: var(--cdm-border);
    box-shadow: 0 24px 70px rgba(0, 0, 0, .6);
    overflow: hidden;
}

#cdm-header {
    background: linear-gradient(150deg, rgba(37, 99, 235, .28), rgba(255, 255, 255, .03));
}

#cdm-header strong {
    text-transform: none;
    letter-spacing: -.01em;
    font-size: 14px;
}

#cdm-close {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, .16);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s ease, border-color .15s ease;
}

#cdm-close:hover {
    background: rgba(255, 255, 255, .1);
    border-color: rgba(255, 255, 255, .35);
}

.cdm-avatar {
    border-radius: 10px;
    background: rgba(255, 255, 255, .08);
}

/* ------------------------------------------------------------- Messages */
.cdm-msg {
    border-radius: 14px;
    box-shadow: none;
}

.cdm-msg.bot {
    border: 1px solid rgba(255, 255, 255, .1);
    border-bottom-left-radius: 5px;
}

.cdm-msg.user {
    background: rgba(37, 99, 235, .3);
    border: 1px solid rgba(37, 99, 235, .55);
    color: #f5f5f5;
    box-shadow: none;
    border-bottom-right-radius: 5px;
}

/* Boutons de réponse rapide : même vocabulaire que les onglets du menu */
.cdm-quick-btn {
    background: rgba(255, 255, 255, .05);
    border-radius: 999px;
    border-color: rgba(255, 255, 255, .14);
    font-weight: 600;
    box-shadow: none;
    padding: 10px 14px;
}

.cdm-quick-btn:hover {
    background: rgba(255, 255, 255, .12);
    border-color: rgba(255, 255, 255, .3);
}

.cdm-quick-btn .cdm-qb-icon {
    border-radius: 8px;
    background: rgba(37, 99, 235, .25);
}

/* ------------------------------------------------------- Zone de saisie */
#cdm-input-row {
    background: var(--cdm-surface);
    border-top: 1px solid var(--cdm-border);
}

#cdm-input {
    background: #0d0e13;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 999px;
    color: #f5f5f5;
    padding: 11px 16px;
}

#cdm-input::placeholder { color: #6f7079; }
#cdm-input:focus { outline: none; border-color: rgba(37, 99, 235, .8); }

#cdm-send,
.cdm-mic-btn {
    border-radius: 999px;
}

#cdm-send {
    background: #f5f5f5;
    color: #0a0a0a;
    border: 1px solid #f5f5f5;
}

#cdm-send:hover {
    background: transparent;
    color: #f5f5f5;
}

.cdm-mic-btn {
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .16);
    color: #9a9aa2;
}

.cdm-mic-btn:hover {
    background: rgba(255, 255, 255, .13);
    color: #f5f5f5;
}

/* Le panneau doit rester au-dessus de la barre d'onglets sur mobile */
@media (max-width: 899px) {
    #cdm-panel {
        border-radius: 16px;
    }
}

/* ── Le monogramme CDM dans la bulle ───────────────────────────────────── */
.cdm-bubble-logo {
    /* Le sigle est large et bas : on le cadre à la largeur de la bulle plutôt
       qu'à sa hauteur, sans quoi il flotterait au milieu d'un grand vide. */
    width: 32px;
    height: auto;
    display: block;
    pointer-events: none;
}

#cdm-bubble:hover .cdm-bubble-logo { transform: scale(1.06); }

.cdm-bubble-logo { transition: transform .18s ease; }

@media (prefers-reduced-motion: reduce) {
    .cdm-bubble-logo { transition: none; }
}

/* L'avatar de l'entête : le monogramme détouré, posé sur la pastille claire
   plutôt qu'une tuile noire sur fond noir. */
.cdm-avatar {
    object-fit: contain;
    padding: 5px 6px;
}
