/* ═══════════════════════════════════════════════════════════════
   CHATBOT WIDGET
   Fichier: chatbot.css
   Convention: chatbot-{element}[-{modifier}]
   ═══════════════════════════════════════════════════════════════ */

/* ─── Bouton flottant ─── */
.chatbot-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--gradient-main);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.chatbot-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(102, 126, 234, 0.5);
}

.chatbot-fab svg {
    width: 28px;
    height: 28px;
    fill: white;
}

.chatbot-fab--hidden {
    display: none;
}

/* ─── Container principal ─── */
.chatbot-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 400px;
    height: 560px;
    background: var(--bg-primary);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--gray-200);
}

.chatbot-container--open {
    display: flex;
    animation: chatbot-slideUp 0.25s ease-out;
}

@keyframes chatbot-slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ─── Header ─── */
.chatbot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--gradient-main);
    color: white;
    flex-shrink: 0;
}

.chatbot-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 15px;
}

.chatbot-header-title svg {
    width: 22px;
    height: 22px;
    fill: white;
}

.chatbot-header-status {
    font-size: 11px;
    opacity: 0.8;
    font-weight: 400;
}

.chatbot-header-actions {
    display: flex;
    gap: 8px;
}

.chatbot-header-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    font-size: 14px;
}

.chatbot-header-btn:hover {
    background: rgba(255, 255, 255, 0.35);
}

/* ─── Zone messages ─── */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bg-secondary);
}

.chatbot-messages::-webkit-scrollbar {
    width: 4px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 2px;
}

/* ─── Bulles de message ─── */
.chatbot-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.chatbot-msg--user {
    align-self: flex-end;
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.chatbot-msg--assistant {
    align-self: flex-start;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--gray-200);
    border-bottom-left-radius: 4px;
}

.chatbot-msg--assistant strong {
    color: var(--primary-dark);
    font-weight: 700;
}

/* ─── Listes dans les messages ─── */
.chatbot-list {
    margin: 6px 0;
    padding-left: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chatbot-list li {
    padding: 5px 10px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border-left: 3px solid var(--primary);
    font-size: 13px;
    line-height: 1.5;
}

/* ─── Prix en euros ─── */
.chatbot-price {
    font-weight: 700;
    color: var(--primary-dark);
}

.chatbot-price--up {
    color: #16a34a;
}

.chatbot-price--down {
    color: #dc2626;
}

/* ─── Flèches ─── */
.chatbot-arrow {
    color: var(--gray-400);
    margin: 0 2px;
    font-size: 12px;
}

.chatbot-msg--error {
    align-self: center;
    background: #fef2f2;
    color: var(--danger);
    border: 1px solid #fecaca;
    font-size: 13px;
}

/* ─── Indicateur typing ─── */
.chatbot-typing {
    align-self: flex-start;
    padding: 10px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--gray-200);
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    display: none;
}

.chatbot-typing--visible {
    display: flex;
    gap: 4px;
    align-items: center;
}

.chatbot-typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--gray-400);
    animation: chatbot-bounce 1.2s infinite;
}

.chatbot-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.chatbot-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes chatbot-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* ─── Zone input ─── */
.chatbot-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--gray-200);
    background: var(--bg-primary);
    flex-shrink: 0;
}

.chatbot-input {
    flex: 1;
    border: 1px solid var(--gray-300);
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: border-color 0.2s;
}

.chatbot-input:focus {
    border-color: var(--primary);
}

.chatbot-input::placeholder {
    color: var(--text-muted);
}

.chatbot-send {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--gradient-main);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.chatbot-send:hover {
    transform: scale(1.1);
}

.chatbot-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.chatbot-send svg {
    width: 18px;
    height: 18px;
    fill: white;
}

/* ─── Message de bienvenue ─── */
.chatbot-welcome {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.6;
}

.chatbot-welcome-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.chatbot-suggestions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 12px;
}

.chatbot-suggestion {
    background: var(--bg-primary);
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--primary);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    text-align: left;
}

.chatbot-suggestion:hover {
    background: #f0f1ff;
    border-color: var(--primary-light);
}

/* ─── Images de cartes dans les réponses ─── */
.chatbot-card-hero {
    text-align: center;
    margin-bottom: 10px;
}

.chatbot-card-hero .chatbot-card-img {
    height: 160px;
}

.chatbot-card-images {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.chatbot-card-link {
    display: block;
    border-radius: 6px;
    overflow: hidden;
    transition: transform 0.2s;
}

.chatbot-card-link:hover {
    transform: scale(1.05);
}

.chatbot-card-img {
    height: 120px;
    width: auto;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

/* ─── Responsive ─── */
@media (max-width: 480px) {
    .chatbot-container {
        width: calc(100vw - 16px);
        height: calc(100vh - 80px);
        bottom: 8px;
        right: 8px;
        border-radius: 12px;
    }

    .chatbot-fab {
        bottom: 16px;
        right: 16px;
    }
}
