/* ============================================
   ASSISTANT IA — Bulle + panneau de chat
   Reutilise les variables CSS de base.css (theme clair/sombre automatique via
   :root[data-color-mode]) -- ne JAMAIS coder une couleur en dur ici.
   ============================================ */

.swl-assistant-bubble {
    position: fixed;
    right: var(--space-lg, 24px);
    bottom: var(--space-lg, 24px);
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full, 9999px);
    background: var(--red-primary, #e6053e);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    cursor: pointer;
    box-shadow: var(--glass-shadow-lg, 0 16px 64px rgba(0, 0, 0, 0.6));
    z-index: var(--z-toast, 50);
    transition: transform var(--transition-fast, 150ms) ease, background var(--transition-fast, 150ms) ease;
}

.swl-assistant-bubble:hover {
    transform: scale(1.06);
    background: var(--red-bright, #ff2d5c);
}

.swl-assistant-panel {
    position: fixed;
    right: var(--space-lg, 24px);
    bottom: calc(56px + var(--space-lg, 24px) + var(--space-sm, 8px));
    width: min(380px, calc(100vw - 32px));
    max-height: min(560px, calc(100vh - 140px));
    background: var(--bg-secondary, #0a0a0f);
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.08));
    border-radius: var(--radius-lg, 16px);
    box-shadow: var(--glass-shadow-lg, 0 16px 64px rgba(0, 0, 0, 0.6));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px) scale(0.98);
    transition: opacity var(--transition-base, 300ms) ease, transform var(--transition-base, 300ms) ease, visibility var(--transition-base, 300ms);
    z-index: var(--z-toast, 50);
}

.swl-assistant-panel.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.swl-assistant-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md, 16px);
    border-bottom: 1px solid var(--glass-border, rgba(255, 255, 255, 0.08));
    background: var(--bg-tertiary, #111118);
}

.swl-assistant-title {
    display: flex;
    align-items: center;
    gap: var(--space-sm, 8px);
    font-family: var(--font-display, 'Bebas Neue', cursive);
    letter-spacing: 0.5px;
    color: var(--text-primary, #F2F2F5);
    font-size: 15px;
}

.swl-assistant-logo {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.swl-assistant-close {
    background: none;
    border: none;
    color: var(--text-secondary, rgba(242, 242, 245, 0.7));
    cursor: pointer;
    font-size: 16px;
    padding: var(--space-xs, 4px);
    border-radius: var(--radius-sm, 8px);
}

.swl-assistant-close:hover {
    color: var(--text-primary, #F2F2F5);
    background: var(--bg-glass-hover, rgba(255, 255, 255, 0.08));
}

.swl-assistant-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-md, 16px);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm, 8px);
    font-family: var(--font-body, 'Inter', sans-serif);
    font-size: 13.5px;
    line-height: 1.5;
}

.swl-assistant-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: var(--radius-md, 12px);
    color: var(--text-primary, #F2F2F5);
    word-wrap: break-word;
}

.swl-assistant-msg a {
    color: var(--red-bright, #ff2d5c);
    text-decoration: underline;
}

.swl-assistant-msg--assistant {
    align-self: flex-start;
    background: var(--bg-card, rgba(255, 255, 255, 0.03));
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.08));
    border-bottom-left-radius: 4px;
}

.swl-assistant-msg--user {
    align-self: flex-end;
    background: var(--red-primary, #e6053e);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.swl-assistant-typing {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 12px 16px;
}

.swl-assistant-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-tertiary, rgba(242, 242, 245, 0.4));
    animation: swl-assistant-blink 1.1s infinite ease-in-out;
}

.swl-assistant-typing span:nth-child(2) { animation-delay: 0.15s; }
.swl-assistant-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes swl-assistant-blink {
    0%, 80%, 100% { opacity: 0.25; }
    40% { opacity: 1; }
}

.swl-assistant-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs, 4px);
    padding: 0 var(--space-md, 16px) var(--space-sm, 8px);
}

.swl-assistant-chip {
    font-family: var(--font-body, 'Inter', sans-serif);
    font-size: 12px;
    padding: 6px 10px;
    border-radius: var(--radius-full, 9999px);
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.08));
    background: var(--bg-glass, rgba(255, 255, 255, 0.05));
    color: var(--text-secondary, rgba(242, 242, 245, 0.7));
    cursor: pointer;
    transition: background var(--transition-fast, 150ms) ease;
}

.swl-assistant-chip:hover {
    background: var(--bg-glass-hover, rgba(255, 255, 255, 0.08));
    color: var(--text-primary, #F2F2F5);
}

.swl-assistant-form {
    display: flex;
    gap: var(--space-sm, 8px);
    padding: var(--space-md, 16px);
    border-top: 1px solid var(--glass-border, rgba(255, 255, 255, 0.08));
}

.swl-assistant-input {
    flex: 1;
    background: var(--bg-glass, rgba(255, 255, 255, 0.05));
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.08));
    border-radius: var(--radius-full, 9999px);
    padding: 10px 16px;
    color: var(--text-primary, #F2F2F5);
    font-family: var(--font-body, 'Inter', sans-serif);
    font-size: 13.5px;
    min-width: 0;
}

.swl-assistant-input:focus {
    outline: 2px solid var(--red-primary, #e6053e);
    outline-offset: 1px;
}

.swl-assistant-send {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 50%;
    border: none;
    background: var(--red-primary, #e6053e);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.swl-assistant-send:hover {
    background: var(--red-bright, #ff2d5c);
}

.swl-assistant-footnote {
    font-size: 10.5px;
    color: var(--text-tertiary, rgba(242, 242, 245, 0.4));
    padding: 0 var(--space-md, 16px) var(--space-sm, 8px);
    margin: 0;
}

.swl-assistant-footnote a {
    color: var(--text-secondary, rgba(242, 242, 245, 0.7));
}

@media (max-width: 560px) {
    .swl-assistant-panel {
        right: 0;
        bottom: 0;
        left: 0;
        top: 0;
        width: 100%;
        max-height: 100%;
        border-radius: 0;
        transform: translateY(100%);
    }

    .swl-assistant-panel.is-open {
        transform: translateY(0);
    }

    .swl-assistant-bubble {
        right: 12px;
        bottom: var(--space-md, 16px);
        width: 48px;
        height: 48px;
        font-size: 19px;
        transition: transform 220ms ease, opacity 220ms ease, background var(--transition-fast, 150ms) ease;
    }

    .swl-assistant-bubble.is-hidden-scroll {
        transform: translateY(140%);
        opacity: 0;
        pointer-events: none;
    }
}

@media (max-width: 560px) and (prefers-reduced-motion: reduce) {
    .swl-assistant-bubble { transition: none; }
}
