/**
 * SupportPilot AI - Chatbot Widget Styles
 */

/* Widget Container */
.supportpilot-widget {
    position: fixed;
    z-index: 999999;
    font-family: var(--supportpilot-font, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
}

.supportpilot-widget.bottom-right {
    bottom: 20px;
    right: 20px;
}

.supportpilot-widget.bottom-left {
    bottom: 20px;
    left: 20px;
}

/* Toggle Button */
.supportpilot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--supportpilot-gradient, linear-gradient(135deg, #1e7eff, #00d4ff));
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(30, 126, 255, 0.4);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.supportpilot-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(30, 126, 255, 0.5);
}

.supportpilot-toggle svg {
    width: 28px;
    height: 28px;
    fill: white;
}

.supportpilot-toggle .icon-close {
    display: none;
}

.supportpilot-widget.open .supportpilot-toggle .icon-chat {
    display: none;
}

.supportpilot-widget.open .supportpilot-toggle .icon-close {
    display: block;
}

/* Chat Window */
.supportpilot-chat {
    position: absolute;
    bottom: 70px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 520px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.supportpilot-widget.bottom-right .supportpilot-chat {
    right: 0;
}

.supportpilot-widget.bottom-left .supportpilot-chat {
    left: 0;
}

.supportpilot-widget.open .supportpilot-chat {
    display: flex;
    animation: supportpilot-slideIn 0.3s ease;
}

@keyframes supportpilot-slideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Chat Header */
.supportpilot-header {
    background: var(--supportpilot-gradient, linear-gradient(135deg, #1e7eff, #00d4ff));
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.supportpilot-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.supportpilot-avatar svg {
    width: 24px;
    height: 24px;
    fill: white;
}

.supportpilot-header-text h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.supportpilot-header-text span {
    font-size: 12px;
    opacity: 0.9;
}

/* Messages Container */
.supportpilot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f7f8fa;
}

/* Message Bubbles */
.supportpilot-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.supportpilot-message.bot {
    align-self: flex-start;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 16px 16px 16px 4px;
}

.supportpilot-message.user {
    align-self: flex-end;
    background: var(--supportpilot-primary, #1e7eff);
    color: white;
    border-radius: 16px 16px 4px 16px;
}

.supportpilot-message.typing {
    background: white;
    border: 1px solid #e5e7eb;
}

.supportpilot-typing-indicator {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.supportpilot-typing-indicator span {
    width: 8px;
    height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    animation: supportpilot-bounce 1.4s infinite;
}

.supportpilot-typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.supportpilot-typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes supportpilot-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* Input Area */
.supportpilot-input-area {
    padding: 12px 16px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 8px;
    background: white;
}

.supportpilot-input {
    flex: 1;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.supportpilot-input:focus {
    border-color: var(--supportpilot-primary, #1e7eff);
}

.supportpilot-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--supportpilot-primary, #1e7eff);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.supportpilot-send:hover {
    background: var(--supportpilot-primary-hover, #1e7eff);
}

.supportpilot-send:disabled {
    background: #d1d5db;
    cursor: not-allowed;
}

.supportpilot-send svg {
    width: 18px;
    height: 18px;
    fill: white;
}

/* Rating */
.supportpilot-rating {
    display: flex;
    gap: 4px;
    margin-top: 8px;
}

.supportpilot-rating button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.supportpilot-rating button:hover,
.supportpilot-rating button.active {
    opacity: 1;
}

/* Powered by */
.supportpilot-powered {
    text-align: center;
    padding: 8px;
    font-size: 11px;
    color: #9ca3af;
    border-top: 1px solid #f3f4f6;
}

.supportpilot-powered a {
    color: inherit;
    text-decoration: none;
}

/* Markdown in messages */
.supportpilot-message strong {
    font-weight: 600;
}

.supportpilot-message em {
    font-style: italic;
}

.supportpilot-message code {
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 13px;
}

.supportpilot-message a {
    color: var(--supportpilot-primary, #1e7eff);
}

.supportpilot-message.user a {
    color: white;
    text-decoration: underline;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .supportpilot-chat {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        bottom: 70px;
    }
    
    .supportpilot-widget.bottom-right .supportpilot-chat,
    .supportpilot-widget.bottom-left .supportpilot-chat {
        right: 10px;
        left: auto;
    }
    
    .supportpilot-widget.bottom-left .supportpilot-chat {
        left: 10px;
        right: auto;
    }
}

/* Hide on mobile if disabled */
.supportpilot-widget.hide-mobile {
    display: none;
}

@media (min-width: 481px) {
    .supportpilot-widget.hide-mobile {
        display: block;
    }
}

/* ─────────────────────────────────────────────────────────────────────────
   DÛ-9.9 — Consentement bloquant (RGPD) — ajouté 2026-07-21
   POURQUOI ces règles : la porte doit être VISIBLE et OCCUPER la zone de
   conversation. Une simple ligne de texte au-dessus de la saisie serait un
   « bandeau non bloquant », que la spec refuse explicitement comme consentement.
   Couleurs : uniquement la variable de marque --supportpilot-primary (bleu HDdev
   #1e7eff par défaut) et des gris neutres — aucune couleur hors charte (#28).
   ───────────────────────────────────────────────────────────────────────── */
.supportpilot-consent {
    padding: 18px 16px;
    font-size: 13px;
    line-height: 1.5;
    color: #172230;
    background: #f5f7fa;
    border-bottom: 1px solid #e2e8f0;
    max-height: 320px;
    overflow-y: auto;
}
.supportpilot-consent-title {
    font-weight: 600;
    margin: 0 0 8px;
    color: #0c1219;
}
.supportpilot-consent p { margin: 0 0 10px; }
.supportpilot-consent a {
    color: var(--supportpilot-primary, #1e7eff);
    text-decoration: underline;
}
.supportpilot-consent-accept {
    width: 100%;
    padding: 10px 14px;
    border: 0;
    border-radius: 6px;
    background: var(--supportpilot-primary, #1e7eff);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.supportpilot-consent-accept:hover { filter: brightness(1.08); }

/* La saisie désactivée doit se VOIR : sans ça, l'utilisateur clique dans le vide
   et croit à un bug plutôt qu'à un consentement requis. */
.supportpilot-input:disabled,
.supportpilot-send:disabled {
    opacity: .5;
    cursor: not-allowed;
}
