/* =========================================================================
   Matrix Digital — ia.css
   Assistant IA « Neo » : widget flottant (bas-droite) + section accueil. (P25)
   ========================================================================= */

/* ---------------------------------------------------------------- *
   LAUNCHER
 * ---------------------------------------------------------------- */
.mx-ia {
    position: fixed;
    /* À DROITE, juste au-dessus de la pile de boutons flottants (.mx-fab) */
    right: 20px; bottom: 248px; left: auto;
    z-index: var(--z-float, 900);
}
.mx-ia__launcher {
    position: relative;
    display: inline-flex; align-items: center; justify-content: center; gap: 9px;
    width: 188px;                      /* aligné sur la largeur des FAB */
    padding: 13px 18px;
    color: #fff;
    background: var(--mx-gradient);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 999px;
    font-family: var(--font-display); font-weight: 700; font-size: 0.92rem;
    letter-spacing: 0.02em;
    box-shadow: 0 8px 24px rgba(110, 47, 214, 0.5);
    cursor: pointer;
    transition: transform var(--t-fast), box-shadow var(--t-base);
}
.mx-ia__launcher:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(110, 47, 214, 0.6); }
.mx-ia__launcher-icon { font-size: 1.15rem; line-height: 1; }
.mx-ia--open .mx-ia__launcher { display: none; }
/* Neo est désormais intégré à la pile de boutons flottants (.mx-fab__btn--neo,
   data-mx-ia-open). On masque donc le launcher autonome ; le panneau reste géré ici. */
.mx-ia__launcher, .mx-ia__pulse { display: none; }

.mx-ia__pulse {
    position: absolute; inset: 0;
    border-radius: 999px;
    box-shadow: 0 0 0 0 rgba(110, 47, 214, 0.5);
    animation: mxIaPulse 2.4s infinite;
    pointer-events: none;
}
@keyframes mxIaPulse {
    0%   { box-shadow: 0 0 0 0 rgba(110, 47, 214, 0.5); }
    70%  { box-shadow: 0 0 0 16px rgba(110, 47, 214, 0); }
    100% { box-shadow: 0 0 0 0 rgba(110, 47, 214, 0); }
}
@media (prefers-reduced-motion: reduce) { .mx-ia__pulse { animation: none; } }

/* ---------------------------------------------------------------- *
   PANNEAU CONVERSATION
 * ---------------------------------------------------------------- */
.mx-ia__panel {
    position: fixed;
    /* Ancré dans le coin bas-droite (recouvre les FAB pendant la conversation) */
    right: 20px; bottom: 20px; left: auto; top: auto;
    z-index: var(--z-popup, 1200);
    width: 370px; max-width: calc(100vw - 40px);
    height: 540px; max-height: calc(100vh - 120px);
    display: flex; flex-direction: column;
    background: var(--mx-dark, #0d0d1a);
    border: 1px solid var(--mx-border);
    border-radius: 16px;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.55);
    overflow: hidden;
    animation: mxIaIn 0.25s ease both;
}
/* Correctif fermeture : l'attribut [hidden] doit l'emporter sur display:flex */
.mx-ia__panel[hidden] { display: none; }
@keyframes mxIaIn { from { opacity: 0; transform: translateY(16px) scale(0.98); } to { opacity: 1; transform: none; } }

.mx-ia__head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px;
    background: var(--mx-gradient);
    color: #fff;
}
.mx-ia__head-id { display: flex; align-items: center; gap: 10px; }
.mx-ia__avatar {
    width: 38px; height: 38px;
    display: grid; place-items: center;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 50%; font-size: 1.1rem;
}
.mx-ia__name { display: block; font-family: var(--font-display); font-size: 1rem; }
.mx-ia__status { display: block; font-size: 0.72rem; opacity: 0.85; }
.mx-ia__status::before {
    content: "●"; color: #4ade80; margin-right: 4px; font-size: 0.6rem; vertical-align: middle;
}
.mx-ia__close {
    background: none; border: none; color: #fff;
    font-size: 1.1rem; cursor: pointer; opacity: 0.85;
    width: 32px; height: 32px; border-radius: 8px;
}
.mx-ia__close:hover { opacity: 1; background: rgba(255, 255, 255, 0.15); }

/* Journal des messages */
.mx-ia__log {
    flex: 1; overflow-y: auto;
    padding: 16px;
    display: flex; flex-direction: column; gap: 10px;
    scrollbar-width: thin;
}
.mx-ia__msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.9rem; line-height: 1.45;
    white-space: pre-wrap; word-wrap: break-word;
}
.mx-ia__msg--bot {
    align-self: flex-start;
    background: var(--mx-navy-mid, #1a1a2e);
    color: var(--mx-off-white);
    border-bottom-left-radius: 4px;
}
.mx-ia__msg--user {
    align-self: flex-end;
    background: var(--mx-blue, #2F6BFF);
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* Suggestions */
.mx-ia__suggestions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }
.mx-ia__chip {
    padding: 8px 12px;
    background: transparent;
    border: 1px solid var(--mx-border);
    border-radius: 999px;
    color: var(--mx-off-white);
    font-size: 0.8rem; cursor: pointer;
    transition: border-color var(--t-fast), color var(--t-fast);
}
.mx-ia__chip:hover { border-color: var(--mx-cyan); color: var(--mx-cyan); }

/* Indicateur de saisie */
.mx-ia__typing { display: inline-flex; gap: 4px; align-items: center; }
.mx-ia__typing span {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--mx-muted);
    animation: mxIaBlink 1.2s infinite both;
}
.mx-ia__typing span:nth-child(2) { animation-delay: 0.2s; }
.mx-ia__typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes mxIaBlink { 0%, 80%, 100% { opacity: 0.3; } 40% { opacity: 1; } }

/* Formulaire */
.mx-ia__form {
    display: flex; gap: 8px; align-items: center;
    padding: 12px; border-top: 1px solid var(--mx-border);
}
.mx-ia__input {
    flex: 1;
    padding: 10px 14px;
    background: var(--mx-navy-mid, #1a1a2e);
    border: 1px solid var(--mx-border);
    border-radius: 999px;
    color: var(--mx-off-white); font-size: 0.9rem;
}
.mx-ia__input:focus { outline: none; border-color: var(--mx-cyan); }
.mx-ia__send {
    flex: 0 0 auto;
    width: 42px; height: 42px;
    display: grid; place-items: center;
    background: var(--mx-gradient); color: #fff;
    border: none; border-radius: 50%;
    font-size: 1rem; cursor: pointer;
    transition: transform var(--t-fast);
}
.mx-ia__send:hover { transform: scale(1.06); }
.mx-ia__legal {
    margin: 0; padding: 0 12px 10px;
    font-size: 0.68rem; color: var(--mx-muted); text-align: center;
}

/* Mobile */
/* Sur mobile, la pile .mx-fab est masquée → Neo revient dans le coin bas-droite. */
@media (max-width: 767px) {
    .mx-ia { right: 16px; bottom: 16px; left: auto; }
}
@media (max-width: 480px) {
    .mx-ia__panel {
        left: 0; right: 0; bottom: 0; top: auto;
        width: 100vw; max-width: 100vw;
        height: 80vh; max-height: 80vh;
        border-radius: 16px 16px 0 0;
    }
}

/* ---------------------------------------------------------------- *
   SECTION ACCUEIL « Assistant Neo »
 * ---------------------------------------------------------------- */
.mx-home-ia .mx-ia-card {
    position: relative; overflow: hidden;
    padding: clamp(32px, 5vw, 56px);
    background: linear-gradient(135deg, rgba(110, 47, 214, 0.16), rgba(47, 107, 255, 0.12));
    border: 1px solid var(--mx-border);
    border-radius: 20px;
    text-align: center;
}
.mx-home-ia .mx-ia-card__badge {
    display: inline-block;
    padding: 5px 14px; margin-bottom: 16px;
    background: var(--mx-gradient); color: #fff;
    border-radius: 999px; font-size: 0.74rem; font-weight: 600;
    letter-spacing: 0.04em; text-transform: uppercase;
}
.mx-home-ia .mx-ia-card__title { font-size: clamp(1.6rem, 3vw, 2.3rem); margin-bottom: 12px; }
.mx-home-ia .mx-ia-card__sub { max-width: 560px; margin: 0 auto 24px; color: var(--mx-muted); }
.mx-home-ia .mx-ia-card__actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.mx-home-ia .mx-ia-card__orb {
    width: 72px; height: 72px; margin: 0 auto 18px;
    display: grid; place-items: center;
    background: var(--mx-gradient); border-radius: 50%;
    font-size: 2rem; color: #fff;
    box-shadow: 0 0 40px rgba(110, 47, 214, 0.5);
}
