/* Smart Chat by Pirrha — widget Orus */
:root {
    --sc-pirrha-color: #6c5ce7;
    --sc-pirrha-pos: right;
    --sc-pirrha-bottom: 20px;
}

.sc-pirrha-fab,
.sc-pirrha-window,
.sc-pirrha-window * { box-sizing: border-box; }

.sc-pirrha-fab {
    position: fixed;
    right: 20px;
    bottom: var(--sc-pirrha-bottom);
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: var(--sc-pirrha-color);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    z-index: 2147483000;
    transition: transform .15s ease;
    overflow: hidden;
    padding: 0;
}
.sc-pirrha-fab:hover { transform: scale(1.06); }

.sc-pirrha-fab-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* Quand le FAB est une image (Orus full ou URL custom), pas de fond coloré */
.sc-pirrha-fab:has(.sc-pirrha-fab-avatar) {
    background: transparent;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .22);
}

html.sc-pirrha-left .sc-pirrha-fab {
    right: auto;
    left: 20px;
}

.sc-pirrha-window {
    position: fixed;
    right: 20px;
    bottom: calc(var(--sc-pirrha-bottom) + 70px);
    width: 360px;
    max-width: calc(100vw - 40px);
    height: 540px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .22);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 2147483000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
}
html.sc-pirrha-left .sc-pirrha-window {
    right: auto;
    left: 20px;
}
.sc-pirrha-window.open { display: flex; }

.sc-pirrha-header {
    background: var(--sc-pirrha-color);
    color: #fff;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.sc-pirrha-header-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, .35);
    flex-shrink: 0;
}
.sc-pirrha-title {
    font-weight: 600;
    font-size: 15px;
    flex: 1;
}
.sc-pirrha-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.sc-pirrha-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    background: #f7f7fa;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sc-pirrha-msg {
    max-width: 80%;
    padding: 10px 13px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.45;
    word-wrap: break-word;
}
/* Bulles user : texte brut, on garde pre-wrap pour respecter les sauts du visiteur */
.sc-pirrha-msg.user {
    align-self: flex-end;
    background: var(--sc-pirrha-color);
    color: #fff;
    border-bottom-right-radius: 4px;
    white-space: pre-wrap;
}
/* Bulles bot : HTML rendu (markdown léger), pas de pre-wrap = pas d'espaces fantômes */
.sc-pirrha-msg.bot {
    align-self: flex-start;
    background: #fff;
    color: #222;
    border: 1px solid #e6e6ea;
    border-bottom-left-radius: 4px;
}
.sc-pirrha-msg.bot br + br { display: none; } /* sécurité : jamais deux <br> consécutifs */
.sc-pirrha-msg.err {
    align-self: center;
    background: #fde9e8;
    color: #922b21;
    font-size: 12px;
    border-radius: 8px;
}

.sc-pirrha-typing { align-self: flex-start; font-size: 12px; color: #888; padding: 0 4px; }
.sc-pirrha-typing span { display: inline-block; animation: sc-pirrha-dot 1.2s infinite; }
.sc-pirrha-typing span:nth-child(2) { animation-delay: .15s; }
.sc-pirrha-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes sc-pirrha-dot {
    0%, 60%, 100% { opacity: .3; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-3px); }
}

.sc-pirrha-input-wrap {
    border-top: 1px solid #e6e6ea;
    padding: 10px;
    background: #fff;
    display: flex;
    gap: 8px;
    align-items: flex-end;
}
.sc-pirrha-input {
    flex: 1;
    border: 1px solid #dcdce2;
    border-radius: 10px;
    padding: 9px 12px;
    font-size: 14px;
    resize: none;
    font-family: inherit;
    outline: none;
    max-height: 100px;
}
.sc-pirrha-input:focus { border-color: var(--sc-pirrha-color); }
.sc-pirrha-send {
    background: var(--sc-pirrha-color);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 9px 14px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}
.sc-pirrha-send:disabled { opacity: .5; cursor: not-allowed; }

.sc-pirrha-footer {
    padding: 8px 12px 6px;
    background: #fafafc;
    border-top: 1px solid #eee;
    text-align: center;
    font-size: 11px;
    color: #999;
}
.sc-pirrha-disclaimer {
    font-size: 10.5px;
    color: #a59cc7;
    margin-bottom: 2px;
    line-height: 1.3;
}
.sc-pirrha-credit { font-size: 11px; }
.sc-pirrha-footer a { color: #999; text-decoration: none; }
.sc-pirrha-footer a:hover { color: var(--sc-pirrha-color); }

/* Liens et formatage dans les messages bot */
.sc-pirrha-msg.bot a {
    color: var(--sc-pirrha-color);
    text-decoration: underline;
    word-break: break-word;
}
.sc-pirrha-msg.bot a:hover { opacity: .85; }
.sc-pirrha-msg.bot strong { font-weight: 600; }
.sc-pirrha-msg.bot em { font-style: italic; }

@media (max-width: 480px) {
    .sc-pirrha-window {
        right: 10px;
        bottom: calc(var(--sc-pirrha-bottom) + 70px);
        width: calc(100vw - 20px);
        height: 70vh;
    }
}
