/* =========================================================
   Assistant widget — chat flottant bas-droite
   Cohérent avec le style éditorial (navy, Fraunces pour titre).
   ========================================================= */

#assistant-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9998;
    font-family: 'Public Sans', 'Inter', system-ui, sans-serif;
}

/* Bouton flottant */
#assistant-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background: #0a2540;
    color: #fff;
    border: 1px solid #0a2540;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    box-shadow: 0 12px 30px -8px rgba(10, 37, 64, 0.4);
    transition: transform 200ms ease, box-shadow 200ms ease;
}
#assistant-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 36px -6px rgba(10, 37, 64, 0.5);
}
#assistant-toggle.hidden { display: none; }

@media (max-width: 640px) {
    #assistant-toggle-label { display: none; }
    #assistant-toggle { padding: 14px; }
}

/* Panneau chat */
#assistant-panel {
    display: none;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 580px;
    max-height: calc(100vh - 48px);
    background: #fcfbf8;
    border: 1px solid #e8e5df;
    border-radius: 4px;
    box-shadow: 0 20px 60px -20px rgba(10, 37, 64, 0.3);
    flex-direction: column;
    overflow: hidden;
}
#assistant-panel.open {
    display: flex;
    animation: assistant-slide-in 280ms cubic-bezier(.2,.8,.2,1) both;
}
@keyframes assistant-slide-in {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 640px) {
    #assistant-widget { bottom: 16px; right: 16px; left: 16px; }
    #assistant-panel { width: 100%; height: calc(100vh - 96px); }
}

/* Header */
#assistant-header {
    padding: 18px 20px 14px;
    background: #0a2540;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.assistant-eyebrow {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.6);
    margin-bottom: 2px;
}
#assistant-title {
    font-family: 'Fraunces', Cambria, Georgia, serif;
    font-weight: 400;
    font-variation-settings: "opsz" 48, "SOFT" 60;
    font-size: 19px;
    line-height: 1.1;
    letter-spacing: -0.01em;
    color: #fff;
}
#assistant-close {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    padding: 4px;
    border-radius: 2px;
    transition: color 180ms, background 180ms;
}
#assistant-close:hover {
    color: #fff;
    background: rgba(255,255,255,0.08);
}

/* Messages */
#assistant-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    font-size: 14px;
    line-height: 1.55;
}
.assistant-msg {
    max-width: 90%;
    padding: 12px 16px;
    border-radius: 4px;
    color: #1a1a1a;
    word-wrap: break-word;
    white-space: pre-wrap;
}
.assistant-msg p {
    margin: 0;
}
.assistant-msg p + p { margin-top: 8px; }
.assistant-msg ul {
    margin: 8px 0 0;
    padding-left: 18px;
}
.assistant-msg ul li {
    color: #5b6268;
    margin-bottom: 4px;
}
.assistant-msg a {
    color: #0a2540;
    text-decoration: underline;
}
.assistant-msg-bot {
    background: #fff;
    border: 1px solid #e8e5df;
    align-self: flex-start;
}
.assistant-msg-user {
    background: #0a2540;
    color: #fff;
    align-self: flex-end;
    border: 1px solid #0a2540;
}
.assistant-msg-error {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #991b1b;
    align-self: flex-start;
    font-size: 13px;
}

/* Typing indicator */
#assistant-typing {
    display: flex;
    gap: 6px;
    padding: 0 20px 10px;
}
#assistant-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #9ca3af;
    animation: assistant-bounce 1.4s infinite ease-in-out both;
}
#assistant-typing span:nth-child(2) { animation-delay: 0.15s; }
#assistant-typing span:nth-child(3) { animation-delay: 0.30s; }
@keyframes assistant-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Form */
#assistant-form {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #e8e5df;
    background: #fff;
}
#assistant-input {
    flex: 1;
    resize: none;
    border: 1px solid #e8e5df;
    border-radius: 2px;
    padding: 10px 14px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    color: #0a0a0a;
    background: #fff;
    max-height: 120px;
    transition: border-color 150ms;
}
#assistant-input:focus {
    outline: none;
    border-color: #0a2540;
}
#assistant-send {
    padding: 10px 14px;
    background: #0a2540;
    color: #fff;
    border: 1px solid #0a2540;
    border-radius: 2px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 150ms;
}
#assistant-send:hover:not(:disabled) {
    background: #041528;
}
#assistant-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Footer */
#assistant-footer {
    padding: 8px 16px 12px;
    font-size: 11px;
    color: #6b7280;
    text-align: center;
    background: #fff;
    border-top: 1px solid #f3f2ee;
}
#assistant-footer a {
    color: #0a2540;
    text-decoration: none;
    border-bottom: 1px solid currentColor;
}
