/* Assistant « Propos et enseignements de Christophe Flamingo » — widget de chat.
   Charte du site : --bg #363657, --accent #FF8CA8 (rose), --gold #d4af37, texte blanc. */
:root {
    --as-bg: #363657;
    --as-accent: #FF8CA8;
    --as-gold: #d4af37;
    --as-panel: #ffffff;
    --as-ink: #2a2a3a;
    --as-muted: #6b6b80;
}

.as-launch {
    position: fixed;
    /* safe-area : ne jamais passer sous la barre iOS / le home indicator */
    right: max(20px, env(safe-area-inset-right, 0px));
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    z-index: 9998;
    max-width: calc(100vw - 24px);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    border: 0;
    border-radius: 999px;
    background: var(--as-bg);
    color: #fff;
    font-family: 'Quicksand', system-ui, sans-serif;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .28);
    border: 1px solid rgba(212, 175, 55, .5);
}
.as-launch:hover { background: #40406a; }
.as-launch .as-dot { font-size: 18px; }

.as-panel {
    position: fixed;
    right: max(20px, env(safe-area-inset-right, 0px));
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    z-index: 9999;
    width: min(380px, calc(100vw - 16px));
    height: min(560px, calc(100vh - 32px));
    /* dvh = viewport dynamique mobile (barre d'URL) ; fallback vh ci-dessus */
    height: min(560px, calc(100dvh - 32px));
    display: none;
    flex-direction: column;
    background: var(--as-panel);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .4);
    font-family: 'Quicksand', system-ui, sans-serif;
}
.as-panel.as-open { display: flex; }

.as-head {
    background: var(--as-bg);
    color: #fff;
    padding: 14px 16px;
}
.as-head h3 { margin: 0; font-size: 15px; font-weight: 700; }
.as-head p { margin: 3px 0 0; font-size: 12px; color: #cfcfe4; }
.as-close {
    position: absolute;
    top: 10px;
    right: 12px;
    background: transparent;
    border: 0;
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.as-note {
    background: #fbf3f5;
    border-bottom: 1px solid #f0dde3;
    color: var(--as-ink);
    font-size: 12px;
    line-height: 1.45;
    padding: 10px 14px;
}
.as-note b { color: var(--as-bg); }
.as-note a { color: var(--as-accent); font-weight: 700; text-decoration: none; }

.as-log {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    background: #f7f7fb;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.as-msg { max-width: 85%; padding: 9px 12px; border-radius: 12px; font-size: 14px; line-height: 1.5; }
.as-msg.as-user { align-self: flex-end; background: var(--as-accent); color: #3a1720; border-bottom-right-radius: 4px; }
.as-msg.as-bot { align-self: flex-start; background: #fff; color: var(--as-ink); border: 1px solid #e7e7f0; border-bottom-left-radius: 4px; }
.as-msg.as-sys { align-self: center; background: transparent; color: var(--as-muted); font-size: 12px; text-align: center; }
.as-src { margin-top: 6px; font-size: 11.5px; color: var(--as-muted); }
.as-src b { color: var(--as-bg); font-weight: 700; }

.as-typing { align-self: flex-start; color: var(--as-muted); font-size: 13px; font-style: italic; }

.as-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid #ececf3; background: #fff; }
.as-form textarea {
    flex: 1;
    resize: none;
    border: 1px solid #d8d8e4;
    border-radius: 10px;
    padding: 9px 11px;
    font-family: inherit;
    font-size: 14px;
    max-height: 90px;
}
.as-form textarea:focus { outline: 2px solid var(--as-accent); border-color: transparent; }
.as-send {
    border: 0;
    border-radius: 10px;
    background: var(--as-bg);
    color: #fff;
    font-weight: 700;
    padding: 0 16px;
    cursor: pointer;
}
.as-send:disabled { opacity: .5; cursor: default; }

@media (max-width: 480px) {
    .as-panel { right: 8px; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
    .as-launch { right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
}
