/* ==========================================================
   FG SUPPORT - ASSISTANT IA V2
   VRAIE INTERFACE DE CHAT
   ========================================================== */

.fg-assistant,
.fg-assistant * {
    box-sizing: border-box;
}

.fg-assistant {
    position: fixed;

    z-index: 9999;

    right: 24px;
    bottom: 24px;

    font-family: inherit;
}


/* ==========================================================
   BOUTON FLOTTANT
   ========================================================== */

.fg-assistant__launcher {
    padding: 9px 16px 9px 9px;

    display: flex;
    align-items: center;
    gap: 11px;

    border: 0;
    border-radius: 999px;

    background:
        linear-gradient(
            135deg,
            #252f63,
            #171e45
        );

    color: #fff;

    cursor: pointer;

    box-shadow:
        0 16px 44px rgba(17, 23, 55, .28);

    transition:
        transform 200ms ease,
        box-shadow 200ms ease;
}

.fg-assistant__launcher:hover {
    transform: translateY(-3px);

    box-shadow:
        0 22px 55px rgba(17, 23, 55, .34);
}

.fg-assistant__launcher-icon {
    width: 48px;
    height: 48px;

    flex: 0 0 48px;

    display: grid;
    place-items: center;

    border-radius: 16px;

    background:
        linear-gradient(
            135deg,
            #ff7b00,
            #ff9a2e
        );

    overflow: hidden;
}

.fg-assistant__launcher-icon img {
    width: 32px;
    height: 32px;

    display: block;

    object-fit: contain;
}

.fg-assistant__launcher-copy {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.fg-assistant__launcher-copy strong {
    font-size: .86rem;
    font-weight: 900;
}

.fg-assistant__launcher-copy small {
    margin-top: 2px;

    color: rgba(255, 255, 255, .72);

    font-size: .68rem;
}


/* ==========================================================
   FENETRE
   ========================================================== */

.fg-assistant__panel {
    position: absolute;

    right: 0;
    bottom: 76px;

    width: min(430px, calc(100vw - 32px));

    height:
        min(
            680px,
            calc(100vh - 115px)
        );

    display: flex;
    flex-direction: column;

    overflow: hidden;

    border:
        1px solid
        rgba(37, 47, 99, .12);

    border-radius: 24px;

    background: #fff;

    box-shadow:
        0 34px 90px rgba(17, 23, 55, .28);
}

.fg-assistant__panel[hidden] {
    display: none !important;
}


/* ==========================================================
   HEADER
   ========================================================== */

.fg-assistant__header {
    min-height: 82px;

    padding: 13px 15px;

    flex: 0 0 auto;

    display: flex;
    align-items: center;
    justify-content: space-between;

    background:
        radial-gradient(
            circle at 84% 0%,
            rgba(255, 123, 0, .17),
            transparent 40%
        ),
        linear-gradient(
            135deg,
            #252f63,
            #171e45
        );

    color: #fff;
}

.fg-assistant__identity {
    display: flex;
    align-items: center;
    gap: 11px;
}

.fg-assistant__avatar {
    width: 52px;
    height: 52px;

    flex: 0 0 52px;

    display: grid;
    place-items: center;

    overflow: hidden;

    border-radius: 16px;

    background:
        linear-gradient(
            135deg,
            #ff7b00,
            #ff9a2e
        );

    box-shadow:
        0 8px 22px rgba(255, 123, 0, .20);
}

.fg-assistant__avatar img {
    width: 34px;
    height: 34px;

    object-fit: contain;

    display: block;
}

.fg-assistant__identity-copy {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.fg-assistant__identity-copy strong {
    font-size: .92rem;
    line-height: 1.2;
}

.fg-assistant__identity-copy span {
    display: flex;
    align-items: center;
    gap: 7px;

    color: rgba(255, 255, 255, .72);

    font-size: .66rem;
    font-weight: 700;
}

.fg-assistant__identity-copy i {
    width: 8px;
    height: 8px;

    display: block;

    border-radius: 50%;

    background: #22c77a;

    box-shadow:
        0 0 0 4px rgba(34, 199, 122, .13);
}

.fg-assistant__close {
    width: 42px;
    height: 42px;

    display: grid;
    place-items: center;

    border: 0;
    border-radius: 50%;

    background:
        rgba(255, 255, 255, .09);

    color: #fff;

    cursor: pointer;

    font-family: inherit;
    font-size: 1.55rem;
}


/* ==========================================================
   CORPS DU CHAT
   ========================================================== */

.fg-assistant__body {
    min-height: 0;

    flex: 1;

    display: flex;
    flex-direction: column;

    overflow: hidden;

    background:
        linear-gradient(
            180deg,
            #f6f7fb,
            #fafbfe
        );
}


/* ==========================================================
   MESSAGES
   ========================================================== */

.fg-assistant__messages {
    min-height: 0;

    flex: 1;

    padding: 20px 16px;

    overflow-y: auto;

    overscroll-behavior: contain;

    scroll-behavior: smooth;
}

.fg-assistant__message {
    width: 100%;

    margin: 0 0 14px;

    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.fg-assistant__message--assistant {
    justify-content: flex-start;
}

.fg-assistant__message--user {
    justify-content: flex-end;
}

.fg-assistant__message-avatar {
    width: 30px;
    height: 30px;

    flex: 0 0 30px;

    display: grid;
    place-items: center;

    overflow: hidden;

    border-radius: 10px;

    background:
        linear-gradient(
            135deg,
            #ff7b00,
            #ff9a2e
        );
}

.fg-assistant__message-avatar img {
    width: 21px;
    height: 21px;

    object-fit: contain;
}

.fg-assistant__message--user
.fg-assistant__message-avatar {
    display: none;
}

.fg-assistant__bubble {
    width: auto;
    max-width: 82%;

    padding: 11px 14px;

    border-radius:
        6px
        17px
        17px
        17px;

    background: #fff;

    color: #303750;

    text-align: left !important;

    font-size: .82rem;
    line-height: 1.55;

    white-space: pre-wrap;
    overflow-wrap: anywhere;

    box-shadow:
        0 4px 16px rgba(17, 23, 55, .065);
}

.fg-assistant__message--user
.fg-assistant__bubble {
    border-radius:
        17px
        17px
        6px
        17px;

    background:
        linear-gradient(
            135deg,
            #252f63,
            #1d2759
        );

    color: #fff;

    box-shadow:
        0 6px 18px rgba(37, 47, 99, .16);
}

.fg-assistant__message--pending
.fg-assistant__bubble {
    color: #747b91;

    font-style: italic;
}

.fg-assistant__bubble a {
    color: #e86800;

    font-weight: 800;

    text-decoration:
        underline;

    text-underline-offset: 2px;
}


/* ==========================================================
   SUGGESTIONS INITIALES
   ========================================================== */

.fg-assistant__quick {
    flex: 0 0 auto;

    padding:
        12px
        15px
        13px;

    border-top:
        1px solid
        rgba(37, 47, 99, .07);

    background: #fff;
}

.fg-assistant__quick p {
    margin:
        0
        0
        9px;

    color: #727991;

    text-align: left;

    font-size: .65rem;
    font-weight: 800;
}

.fg-assistant__quick-list {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.fg-assistant__quick button {
    padding: 8px 11px;

    border:
        1px solid
        rgba(37, 47, 99, .14);

    border-radius: 999px;

    background: #fff;

    color: #353e64;

    cursor: pointer;

    font-family: inherit;
    font-size: .66rem;
    font-weight: 800;

    transition:
        border-color 170ms ease,
        color 170ms ease,
        background 170ms ease;
}

.fg-assistant__quick button:hover {
    border-color:
        rgba(255, 123, 0, .45);

    background: #fff8f1;

    color: #e26700;
}

.fg-assistant.has-conversation
.fg-assistant__quick {
    display: none;
}


/* ==========================================================
   COMPOSER
   ========================================================== */

.fg-assistant__composer {
    flex: 0 0 auto;

    padding:
        11px
        12px
        9px;

    border-top:
        1px solid
        rgba(37, 47, 99, .09);

    background: #fff;
}

.fg-assistant__form {
    width: 100%;

    min-height: 76px;

    padding:
        10px
        10px
        10px
        14px;

    display: flex;
    align-items: flex-end;
    gap: 9px;

    border:
        1px solid
        rgba(37, 47, 99, .16);

    border-radius: 18px;

    background: #fff;

    box-shadow:
        0 4px 18px rgba(17, 23, 55, .055);

    transition:
        border-color 180ms ease,
        box-shadow 180ms ease;
}

.fg-assistant__form:focus-within {
    border-color:
        rgba(255, 123, 0, .62);

    box-shadow:
        0 0 0 4px rgba(255, 123, 0, .08);
}

.fg-assistant__input {
    width: 100%;

    min-height: 52px;
    max-height: 145px;

    padding:
        5px
        2px;

    flex: 1;

    resize: none;

    overflow-y: auto;

    border: 0;
    outline: 0;

    background: transparent;

    color: #242b48;

    font-family: inherit;
    font-size: .84rem;
    line-height: 1.5;

    text-align: left;
}

.fg-assistant__input::placeholder {
    color: #9ca1b2;
}

.fg-assistant__send {
    width: 46px;
    height: 46px;

    flex: 0 0 46px;

    display: grid;
    place-items: center;

    padding: 0;

    border: 0;
    border-radius: 15px;

    background:
        linear-gradient(
            135deg,
            #ff7b00,
            #f26800
        );

    color: #fff;

    cursor: pointer;

    box-shadow:
        0 7px 18px rgba(255, 123, 0, .24);

    transition:
        transform 170ms ease,
        box-shadow 170ms ease;
}

.fg-assistant__send:hover {
    transform: translateY(-2px);

    box-shadow:
        0 9px 23px rgba(255, 123, 0, .30);
}

.fg-assistant__send:disabled {
    opacity: .48;

    cursor: wait;

    transform: none;
}

.fg-assistant__hint {
    margin:
        7px
        2px
        0;

    color: #9a9fb0;

    text-align: center;

    font-size: .55rem;
}


/* ==========================================================
   MOBILE
   ========================================================== */

@media (max-width: 600px) {

    .fg-assistant {
        right: 12px;
        bottom: 14px;
    }

    .fg-assistant__launcher {
        padding: 7px;
    }

    .fg-assistant__launcher-copy {
        display: none;
    }

    .fg-assistant__launcher-icon {
        width: 50px;
        height: 50px;

        flex-basis: 50px;
    }

    .fg-assistant__panel {
        position: fixed;

        left: 8px;
        right: 8px;
        bottom: 76px;

        width: auto;

        height:
            min(
                700px,
                calc(100dvh - 92px)
            );

        border-radius: 20px;
    }

    .fg-assistant__header {
        min-height: 76px;

        padding:
            11px
            13px;
    }

    .fg-assistant__avatar {
        width: 48px;
        height: 48px;

        flex-basis: 48px;
    }

    .fg-assistant__messages {
        padding:
            16px
            12px;
    }

    .fg-assistant__bubble {
        max-width: 86%;

        font-size: .81rem;
    }

    .fg-assistant__quick {
        padding:
            10px
            12px;
    }

    .fg-assistant__composer {
        padding:
            9px
            9px
            8px;
    }

    .fg-assistant__form {
        min-height: 74px;
    }

}


/* ==========================================================
   REDUCED MOTION
   ========================================================== */

@media (prefers-reduced-motion: reduce) {

    .fg-assistant__launcher,
    .fg-assistant__send,
    .fg-assistant__quick button {
        transition: none;
    }

    .fg-assistant__messages {
        scroll-behavior: auto;
    }

}


/* ==========================================================
   FG ASSISTANT - ICONE EXACTE DU LOGO FOOTER
   Source : logo-fg-support-footer.png
   On conserve uniquement le carré orange + blanc à gauche.
   ========================================================== */


/* Les trois cadres deviennent les fenêtres de recadrage */

.fg-assistant__launcher-icon,
.fg-assistant__avatar,
.fg-assistant__message-avatar {
    position: relative !important;

    overflow: hidden !important;

    padding: 0 !important;

    background: transparent !important;
}


/* IMPORTANT :
   logo footer = 390 x 93
   hauteur mise à 100%
   largeur automatique
   le conteneur carré masque tout ce qui dépasse à droite.
*/

.fg-assistant__launcher-icon img,
.fg-assistant__avatar img,
.fg-assistant__message-avatar img {
    position: absolute !important;

    top: 0 !important;
    left: 0 !important;

    width: auto !important;
    max-width: none !important;

    height: 100% !important;
    max-height: none !important;

    margin: 0 !important;
    padding: 0 !important;

    display: block !important;

    object-fit: initial !important;
    object-position: initial !important;

    transform: none !important;
}


/* Bouton flottant */

.fg-assistant__launcher-icon {
    width: 48px !important;
    height: 48px !important;

    flex:
        0
        0
        48px !important;

    border-radius: 14px !important;
}


/* En-tête du chat */

.fg-assistant__avatar {
    width: 52px !important;
    height: 52px !important;

    flex:
        0
        0
        52px !important;

    border-radius: 15px !important;
}


/* Petit avatar à côté des réponses */

.fg-assistant__message-avatar {
    width: 30px !important;
    height: 30px !important;

    flex:
        0
        0
        30px !important;

    border-radius: 9px !important;
}



/* ==========================================================
   FG ASSISTANT - TYPOGRAPHIE CHAT V4
   ========================================================== */

/* Le texte HTML normal ne conserve plus les indentations
   et retours à la ligne parasites du template. */

.fg-assistant__bubble {
    white-space: normal !important;

    text-align: left !important;

    font-size: .84rem !important;
    font-weight: 400 !important;
    line-height: 1.55 !important;

    letter-spacing: 0 !important;
    word-spacing: normal !important;

    text-wrap: pretty;
}


/* Les retours à la ligne voulus restent propres */

.fg-assistant__bubble br {
    display: block;
    content: "";

    margin-top: 5px;
}


/* Pas de justification ou centrage hérité */

.fg-assistant__messages,
.fg-assistant__message,
.fg-assistant__bubble {
    text-align: left !important;
}


/* Largeur plus naturelle des réponses */

.fg-assistant__message--assistant
.fg-assistant__bubble {
    max-width: 82% !important;
}


/* Message visiteur */

.fg-assistant__message--user
.fg-assistant__bubble {
    max-width: 78% !important;
}


/* Le champ de saisie reste parfaitement aligné */

.fg-assistant__input {
    text-align: left !important;

    font-size: .86rem !important;
    line-height: 1.45 !important;
}


/* Suggestions plus légères */

.fg-assistant__quick button {
    font-size: .65rem !important;
    font-weight: 750 !important;

    line-height: 1.25 !important;
}

