/* Smart Chat by Pirrha — widget Orus */
:root {
    --sc-pirrha-color: #6c5ce7;
    --sc-pirrha-color-2: #2d2554;
    --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 12px;
    background: #fff;
    display: flex;
    gap: 6px;
    align-items: flex-end;
}
.sc-pirrha-input {
    flex: 1;
    min-width: 0;
    border: 1px solid #dcdce2;
    border-radius: 20px;
    padding: 9px 14px;
    font-size: 14px;
    line-height: 1.4;
    resize: none;
    font-family: inherit;
    outline: none;
    min-height: 38px;
    max-height: 120px;
    transition: border-color .15s;
}
.sc-pirrha-input:focus { border-color: var(--sc-pirrha-color); }

/* Groupe d'icônes à droite (mic + envoi), compactes */
.sc-pirrha-actions {
    display: flex;
    gap: 4px;
    align-items: flex-end;
    flex-shrink: 0;
}

/* Bouton envoi : icône ronde compacte, couleur secondaire */
.sc-pirrha-send {
    background: var(--sc-pirrha-color-2);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 38px; height: 38px;
    min-width: 38px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .12s, opacity .12s;
}
.sc-pirrha-send:hover { transform: scale(1.06); }
.sc-pirrha-send:disabled { opacity: .35; cursor: not-allowed; transform: none; }
.sc-pirrha-send svg { display: block; }

/* Bouton micro : icône ronde discrète */
.sc-pirrha-mic {
    background: transparent;
    color: #888;
    border: 1px solid #dcdce2;
    border-radius: 50%;
    width: 38px; height: 38px;
    min-width: 38px;
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s, border-color .15s;
}
.sc-pirrha-mic:hover { background: #f5f4fa; color: var(--sc-pirrha-color-2); border-color: var(--sc-pirrha-color-2); }
.sc-pirrha-mic.listening {
    background: #ffe5e5;
    color: #c0392b;
    border-color: #f5b7b1;
    animation: sc-pirrha-pulse 1s ease-in-out infinite;
}
@keyframes sc-pirrha-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(192, 57, 43, .4); }
    50%      { box-shadow: 0 0 0 6px rgba(192, 57, 43, 0); }
}

/* ===== Lead Bot v2 : quick-reply buttons + formulaire inline ===== */
.sc-pirrha-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 2px 10px;
    align-self: flex-start;
    max-width: 100%;
}
.sc-pirrha-qr-btn {
    background: #fff;
    color: var(--sc-pirrha-color-2);
    border: 1.5px solid var(--sc-pirrha-color-2);
    border-radius: 18px;
    padding: 8px 14px;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sc-pirrha-qr-btn:hover {
    background: var(--sc-pirrha-color-2);
    color: #fff;
}
.sc-pirrha-qr-btn:active { transform: scale(.97); }

.sc-pirrha-form {
    background: #fff;
    border: 1px solid #e6e6ea;
    border-radius: 14px;
    padding: 14px 16px;
    margin: 8px 0;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.sc-pirrha-form-row { display: flex; flex-direction: column; gap: 3px; }
.sc-pirrha-form-row label {
    font-size: 12px;
    color: #555;
    font-weight: 600;
}
.sc-pirrha-form-row input {
    border: 1px solid #dcdce2;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13.5px;
    font-family: inherit;
    outline: none;
    transition: border-color .15s;
}
.sc-pirrha-form-row input:focus {
    border-color: var(--sc-pirrha-color-2);
}
.sc-pirrha-consent {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 11.5px;
    color: #666;
    line-height: 1.45;
    cursor: pointer;
    margin-top: 4px;
}
.sc-pirrha-consent input[type=checkbox] {
    margin-top: 2px;
    flex-shrink: 0;
}
.sc-pirrha-consent a { color: var(--sc-pirrha-color-2); }
.sc-pirrha-form-submit {
    background: var(--sc-pirrha-color-2);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 11px 16px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    margin-top: 6px;
    transition: opacity .15s;
}
.sc-pirrha-form-submit:hover { opacity: .92; }
.sc-pirrha-form-submit:disabled { opacity: .5; cursor: not-allowed; }
.sc-pirrha-form-err {
    color: #922b21;
    font-size: 12px;
    margin-top: -2px;
    min-height: 14px;
}

/* ===== Funnel inline (shortcode dans une page) ===== */
.sc-pirrha-inline-lead {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    max-width: 560px;
    margin: 20px auto;
}
.sc-pirrha-inline-win {
    background: #f7f7fa;
    border: 1px solid #e6e6ea;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 6px 24px rgba(0,0,0,.08);
}
.sc-pirrha-inline-body {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 120px;
    max-height: 600px;
    overflow-y: auto;
}
.sc-pirrha-inline-detail {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-self: stretch;
}
.sc-pirrha-inline-detail .sc-pirrha-input {
    border-radius: 12px;
    min-height: 60px;
}
.sc-pirrha-inline-detail .sc-pirrha-qr-btn { align-self: flex-end; }

.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;
    }
}
