/* ============================================================
   AR ChatBot — Agence Révélation
   ============================================================ */

:root {
    --ar-primary:    #1a73e8;
    --ar-primary-dk: #1557b0;
    --ar-white:      #ffffff;
    --ar-bg:         #f5f7fb;
    --ar-text:       #1a1a2e;
    --ar-text-light: #6b7280;
    --ar-border:     #e5e7eb;
    --ar-bot-bg:     #ffffff;
    --ar-user-bg:    var(--ar-primary);
    --ar-shadow:     0 8px 30px rgba(0,0,0,.18);
    --ar-radius:     16px;
    --ar-font:       -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── Conteneur global ── */
#ar-chatbot-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    font-family: var(--ar-font);
    font-size: 14px;
}

/* ── Bouton flottant ── */
#ar-chatbot-toggle {
    position: relative;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: var(--ar-primary);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 18px rgba(26,115,232,.45);
    transition: transform .2s, background .2s;
    outline: none;
}
#ar-chatbot-toggle:hover  { background: var(--ar-primary-dk); transform: scale(1.08); }
#ar-chatbot-toggle:focus  { outline: 3px solid rgba(26,115,232,.4); }

/* Badge non-lu */
.ar-badge {
    position: absolute;
    top: 2px; right: 2px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    width: 18px; height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}

/* ── Fenêtre de chat ── */
#ar-chatbot-window {
    position: absolute;
    bottom: 72px;
    right: 0;
    width: 360px;
    max-height: 560px;
    background: var(--ar-white);
    border-radius: var(--ar-radius);
    box-shadow: var(--ar-shadow);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: arSlideUp .25s ease;
}
#ar-chatbot-window.ar-open { display: flex; }

@keyframes arSlideUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── En-tête ── */
.ar-chat-header {
    background: var(--ar-primary);
    color: var(--ar-white);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.ar-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}
.ar-avatar {
    width: 38px; height: 38px;
    background: rgba(255,255,255,.25);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}
.ar-chat-header strong { display: block; font-size: 14px; }
.ar-status { font-size: 11px; opacity: .85; }

.ar-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.ar-wa-button {
    color: var(--ar-white);
    opacity: .85;
    display: flex;
    align-items: center;
    transition: opacity .2s;
    text-decoration: none;
}
.ar-wa-button:hover { opacity: 1; }

#ar-chatbot-close {
    background: none;
    border: none;
    color: var(--ar-white);
    font-size: 16px;
    cursor: pointer;
    opacity: .8;
    padding: 0 4px;
    line-height: 1;
}
#ar-chatbot-close:hover { opacity: 1; }

/* ── Zone messages ── */
#ar-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: var(--ar-bg);
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}

/* Bulle de message */
.ar-message {
    display: flex;
    gap: 8px;
    max-width: 85%;
    animation: arFadeIn .2s ease;
}
@keyframes arFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.ar-message.ar-bot  { align-self: flex-start; }
.ar-message.ar-user { align-self: flex-end; flex-direction: row-reverse; }

.ar-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    line-height: 1.5;
    font-size: 13.5px;
    word-break: break-word;
    white-space: pre-wrap;
}
.ar-bot  .ar-bubble { background: var(--ar-bot-bg); color: var(--ar-text); border-radius: 4px 14px 14px 14px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.ar-user .ar-bubble { background: var(--ar-user-bg); color: var(--ar-white); border-radius: 14px 14px 4px 14px; }

/* Indicateur de frappe */
.ar-typing .ar-bubble {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
}
.ar-dot {
    width: 7px; height: 7px;
    background: var(--ar-text-light);
    border-radius: 50%;
    animation: arBounce 1.2s infinite;
}
.ar-dot:nth-child(2) { animation-delay: .2s; }
.ar-dot:nth-child(3) { animation-delay: .4s; }
@keyframes arBounce {
    0%, 80%, 100% { transform: scale(.8); opacity: .5; }
    40%            { transform: scale(1.2); opacity: 1; }
}

/* ── Suggestions rapides ── */
#ar-quick-replies {
    padding: 8px 12px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    background: var(--ar-bg);
    border-top: 1px solid var(--ar-border);
    flex-shrink: 0;
}
.ar-quick-btn {
    background: var(--ar-white);
    border: 1px solid var(--ar-primary);
    color: var(--ar-primary);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: background .15s, color .15s;
    white-space: nowrap;
}
.ar-quick-btn:hover { background: var(--ar-primary); color: var(--ar-white); }

/* ── Zone de saisie ── */
.ar-chat-input-area {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px;
    background: var(--ar-white);
    border-top: 1px solid var(--ar-border);
    flex-shrink: 0;
}

#ar-chat-input {
    flex: 1;
    border: 1px solid var(--ar-border);
    border-radius: 22px;
    padding: 10px 14px;
    font-size: 13.5px;
    font-family: var(--ar-font);
    resize: none;
    outline: none;
    max-height: 100px;
    overflow-y: auto;
    line-height: 1.4;
    transition: border .2s;
    color: var(--ar-text);
}
#ar-chat-input:focus { border-color: var(--ar-primary); }
#ar-chat-input::placeholder { color: var(--ar-text-light); }

#ar-chat-send {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--ar-primary);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--ar-white);
    transition: background .2s, transform .15s;
}
#ar-chat-send:hover   { background: var(--ar-primary-dk); }
#ar-chat-send:active  { transform: scale(.92); }
#ar-chat-send:disabled { opacity: .5; cursor: not-allowed; }

/* ── Pied de page ── */
.ar-chat-footer {
    text-align: center;
    font-size: 11px;
    color: var(--ar-text-light);
    padding: 6px;
    background: var(--ar-white);
    border-top: 1px solid var(--ar-border);
}

/* ── Responsive mobile ── */
@media (max-width: 480px) {
    #ar-chatbot-container { bottom: 16px; right: 12px; }
    #ar-chatbot-window    { width: calc(100vw - 24px); right: -12px; max-height: 70vh; }
}
