/* ===== Bouton flottant (bas gauche) ===== */
.scolinker-help-toggle {
    position: fixed;
    left: 16px;
    bottom: 16px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: #2f95f5;
    color: #fff;
    font-size: 1.6rem;
    font-weight: 700;
    cursor: pointer;
    z-index: 100010;
    box-shadow: 0 8px 24px rgba(47, 149, 245, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.scolinker-help-toggle:hover {
    transform: translateY(-2px);
    background: #4aa4f7;
    box-shadow: 0 12px 28px rgba(47, 149, 245, 0.42);
}

/* Sur ordinateur, laisser libre la colonne des icones du menu lateral. */
@media (min-width: 1200px) {
    .scolinker-help-toggle {
        left: 92px;
        bottom: 20px;
        width: 52px;
        height: 52px;
        font-size: 1.4rem;
    }
}

/* ===== Overlay ===== */
.scolinker-help-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    padding: 12px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 100020;
}

.scolinker-help-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

body.loutty-help-open #theme-toggle {
    opacity: 0;
    pointer-events: none !important;
}

/* ===== Modale ===== */
.scolinker-help-modal {
    width: 100%;
    max-width: 420px;
    height: min(80vh, 760px);
    background: #0d0f14;
    border-radius: 22px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.04);
}

/* ===== Header ===== */
.scolinker-help-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #11151d;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    gap: 12px;
}

.scolinker-help-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.scolinker-help-header-avatar {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    object-fit: contain;
    background: #161b24;
    padding: 2px;
}

.scolinker-help-header h2 {
    margin: 0;
    color: #fff;
    font-size: 1rem;
    line-height: 1.2;
}

.scolinker-help-header p {
    margin: 2px 0 0;
    font-size: 0.8rem;
    color: #a7b0bf;
    line-height: 1.2;
}

/* ===== Bouton fermeture ===== */
.scolinker-help-close {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 50%;
    border: none;
    background: #2f95f5;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(47, 149, 245, 0.28);
}

/* ===== Messages ===== */
.scolinker-help-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    background: #0b0d12;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scrollbar-width: thin;
    scrollbar-color: rgba(47, 149, 245, 0.45) transparent;
}

.scolinker-help-messages::-webkit-scrollbar {
    width: 8px;
}

.scolinker-help-messages::-webkit-scrollbar-thumb {
    background: rgba(47, 149, 245, 0.4);
    border-radius: 999px;
}

.scolinker-help-messages::-webkit-scrollbar-track {
    background: transparent;
}

/* ===== Ligne message ===== */
.scolinker-message-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 88%;
}

.scolinker-message-row.assistant {
    align-self: flex-start;
}

.scolinker-message-row.user {
    align-self: flex-end;
    margin-left: auto;
    justify-content: flex-end;
}

/* ===== Avatar ===== */
.scolinker-message-avatar {
    width: 44px;
    min-width: 44px;
    height: 44px;
    border-radius: 14px;
    overflow: hidden;
    background: transparent;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    flex-shrink: 0;
}

.scolinker-message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: transparent;
}

/* Variante un peu plus haute pour éviter l’effet "coupé" sur certains gifs verticaux */
.scolinker-message-row.assistant .scolinker-message-avatar.is-talking {
    width: 48px;
    min-width: 48px;
    height: 64px;
    border-radius: 0;
    align-items: flex-end;
}

.scolinker-message-row.assistant .scolinker-message-avatar.is-talking img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ===== Bulles ===== */
.scolinker-message-bubble {
    padding: 10px 12px;
    border-radius: 18px;
    font-size: 0.92rem;
    line-height: 1.45;
    word-break: break-word;
    white-space: pre-wrap;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.scolinker-message-row.assistant .scolinker-message-bubble {
    background: #1a1f28;
    color: #fff;
    border-bottom-left-radius: 8px;
}

.scolinker-message-row.user .scolinker-message-bubble {
    background: #2f95f5;
    color: #fff;
    border-bottom-right-radius: 8px;
}

.scolinker-message-bubble p {
    margin: 0 0 0.65rem;
}

.scolinker-message-intro {
    white-space: normal;
}

.scolinker-message-bubble p:last-child,
.scolinker-message-bubble .scolinker-contact-options:last-child {
    margin-bottom: 0;
}

.scolinker-contact-options {
    margin: 0;
    padding-left: 1.1rem;
    white-space: normal;
}

.scolinker-contact-options li + li {
    margin-top: 0.5rem;
}

.scolinker-message-row.assistant .scolinker-message-bubble a {
    color: #79bdff;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.scolinker-message-row.assistant .scolinker-message-bubble a:hover {
    color: #b9dcff;
}

/* Curseur visuel pendant la frappe */
.scolinker-message-bubble.is-typing::after {
    content: "";
    display: inline-block;
    width: 7px;
    height: 1em;
    margin-left: 2px;
    vertical-align: -2px;
    background: rgba(255, 255, 255, 0.9);
    animation: louttyCaretBlink 0.9s step-end infinite;
}

@keyframes louttyCaretBlink {
    0%, 50% {
        opacity: 1;
    }
    50.01%, 100% {
        opacity: 0;
    }
}

/* ===== Form ===== */
.scolinker-help-form {
    display: flex;
    padding: 10px;
    gap: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background: #0f131a;
}

.scolinker-help-input {
    flex: 1;
    padding: 11px 14px;
    border-radius: 999px;
    border: none;
    background: #1a1f28;
    color: #fff;
    outline: none;
    font-size: 0.92rem;
}

.scolinker-help-input::placeholder {
    color: #98a2b3;
}

.scolinker-help-submit {
    background: #2f95f5;
    border: none;
    border-radius: 999px;
    padding: 11px 16px;
    color: #fff;
    cursor: pointer;
    font-weight: 600;
    flex-shrink: 0;
}

.scolinker-help-submit:disabled {
    opacity: 0.65;
    cursor: default;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
    .scolinker-help-overlay {
        padding: 0;
    }

    .scolinker-help-modal {
        max-width: 100%;
        width: 100%;
        height: 86vh;
        border-radius: 22px 22px 0 0;
    }

    .scolinker-help-toggle {
        left: 14px;
        bottom: 14px;
        width: 58px;
        height: 58px;
    }

    .scolinker-message-row {
        max-width: 94%;
    }
}

.scolinker-message-link-wrapper {
    margin-top: 2px;
}

.scolinker-message-link {
    display: inline-block;
    padding: 8px 12px;
    border-radius: 999px;
    background: #2f95f5;
    color: #ffffff;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: background 0.2s ease, transform 0.2s ease;
}

.scolinker-message-link:hover {
    background: #49a3f8;
    transform: translateY(-1px);
}
