/* ══════════════════════════════════════
   CHATBOX — Assistant d'Axel
   ══════════════════════════════════════ */

.chatbox-btn {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 62px;
    height: 62px;
    background: linear-gradient(135deg, #1a73e8, #00bcd4);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 24px rgba(26, 115, 232, 0.45);
    z-index: 9999;
    border: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chatbox-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 10px 32px rgba(26, 115, 232, 0.55);
}

.chatbox-btn i {
    color: white;
    font-size: 26px;
    transition: opacity 0.2s;
}

.chatbox-btn .icon-open  { display: block; }
.chatbox-btn .icon-close { display: none; }
.chatbox-btn.active .icon-open  { display: none; }
.chatbox-btn.active .icon-close { display: block; }

.chatbox-notif {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid white;
    font-size: 10px;
    color: white;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse-notif 2s infinite;
}

@keyframes pulse-notif {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.2); }
}

/* ── Panel ── */
.chatbox-panel {
    position: fixed;
    bottom: 106px;
    right: 28px;
    width: 360px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.16);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.85) translateY(16px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity  0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: bottom right;
    max-height: 560px;
}

.chatbox-panel.open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: all;
}

/* ── Header ── */
.chat-header {
    background: linear-gradient(135deg, #1a73e8, #00bcd4);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    flex-shrink: 0;
}

.chat-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.22);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.chat-header-info h4 {
    font-weight: 700;
    font-size: 15px;
    margin: 0 0 3px;
    font-family: 'Poppins', sans-serif;
}

.chat-header-info span {
    font-size: 12px;
    opacity: 0.88;
    display: flex;
    align-items: center;
    gap: 5px;
}

.online-dot {
    width: 7px;
    height: 7px;
    background: #4ade80;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.35);
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.35); }
    50%       { box-shadow: 0 0 0 5px rgba(74, 222, 128, 0.1); }
}

.chat-close {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
    flex-shrink: 0;
}

.chat-close:hover { background: rgba(255, 255, 255, 0.28); }

/* ── Messages ── */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px 16px 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 300px;
    min-height: 160px;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: #e0e0e0; border-radius: 4px; }

.chat-msg {
    display: flex;
    flex-direction: column;
    max-width: 82%;
    animation: msg-in 0.25s ease;
}

@keyframes msg-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.chat-msg.bot  { align-self: flex-start; }
.chat-msg.user { align-self: flex-end; }

.chat-bubble {
    padding: 11px 15px;
    border-radius: 18px;
    font-size: 13.5px;
    line-height: 1.55;
    font-family: 'Inter', sans-serif;
    white-space: pre-line;
}

.bot  .chat-bubble {
    background: #f1f5f9;
    color: #1a1a1a;
    border-bottom-left-radius: 4px;
}

.user .chat-bubble {
    background: linear-gradient(135deg, #1a73e8, #00bcd4);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-bubble a {
    color: #1a73e8;
    font-weight: 600;
    text-decoration: none;
}

.chat-bubble a:hover { text-decoration: underline; }
.user .chat-bubble a { color: rgba(255,255,255,0.9); }

/* ── Typing dots ── */
.typing-dots {
    display: flex;
    gap: 5px;
    padding: 4px 2px;
    align-items: center;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: #94a3b8;
    border-radius: 50%;
    animation: typing 1.3s infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30%            { transform: translateY(-7px); opacity: 1; }
}

/* ── Quick replies ── */
.chat-quick {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding: 8px 16px 10px;
    flex-shrink: 0;
}

.quick-btn {
    background: rgba(26, 115, 232, 0.07);
    color: #1a73e8;
    border: 1px solid rgba(26, 115, 232, 0.22);
    border-radius: 20px;
    padding: 7px 14px;
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    font-family: 'Inter', sans-serif;
}

.quick-btn:hover {
    background: #1a73e8;
    color: white;
    border-color: #1a73e8;
    transform: translateY(-1px);
}

/* ── Input ── */
.chat-input-row {
    padding: 12px 16px 14px;
    border-top: 1px solid #f0f4f8;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}

.chat-input {
    flex: 1;
    border: 1.5px solid #e2e8f0;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 13.5px;
    outline: none;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.2s;
    background: #fafafa;
    color: #1a1a1a;
}

.chat-input:focus { border-color: #1a73e8; background: white; }
.chat-input::placeholder { color: #94a3b8; }

.chat-send {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #1a73e8, #00bcd4);
    border: none;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}

.chat-send:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 14px rgba(26, 115, 232, 0.4);
}

/* ── Rate warning ── */
.chat-rate-warning {
    display: none;
    margin: 0 16px 10px;
    padding: 9px 14px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 8px;
    font-size: 12.5px;
    color: #92400e;
    font-family: 'Inter', sans-serif;
    line-height: 1.4;
}

/* ── Input désactivé ── */
.chat-input:disabled,
.chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Mobile ── */
@media (max-width: 480px) {
    .chatbox-panel {
        width: calc(100vw - 16px);
        right: 8px;
        bottom: 90px;
        border-radius: 16px;
    }

    .chatbox-btn {
        right: 16px;
        bottom: 16px;
        width: 56px;
        height: 56px;
    }
}
