.tk-ai-chat-toggle {
    position: fixed;
    bottom: 18px;
    right: 18px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    border: none;
    border-radius: 9999px;
    box-shadow: 0 10px 28px rgba(99, 102, 241, 0.4);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    font-weight: 700;
    z-index: 62;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.tk-ai-chat-toggle:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 32px rgba(99, 102, 241, 0.45);
}
@media (max-width: 768px) {
    .tk-ai-chat-toggle { bottom: 96px; }
}

.tk-ai-chat-panel {
    position: fixed;
    bottom: 88px;
    right: 18px;
    width: min(380px, calc(100vw - 36px));
    max-height: min(520px, calc(100vh - 120px));
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
    border: 1px solid rgba(148, 163, 184, 0.35);
    z-index: 63;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
@media (max-width: 768px) {
    .tk-ai-chat-panel {
        bottom: 166px;
        max-height: min(480px, calc(100vh - 200px));
    }
}
.tk-ai-chat-panel.hidden { display: none; }

.tk-ai-chat-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: linear-gradient(135deg, #6366f1 0%, #7c3aed 100%);
    color: #fff;
}
.tk-ai-chat-title {
    font-weight: 700;
    font-size: 0.95rem;
    margin: 0;
}
.tk-ai-chat-sub {
    font-size: 0.75rem;
    opacity: 0.9;
    margin: 4px 0 0;
}
.tk-ai-chat-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    cursor: pointer;
    flex-shrink: 0;
}

.tk-ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f8fafc;
}
.tk-ai-msg {
    max-width: 92%;
    padding: 10px 12px;
    border-radius: 14px;
    font-size: 0.875rem;
    line-height: 1.45;
}
.tk-ai-msg-user {
    align-self: flex-end;
    background: #6366f1;
    color: #fff;
    border-bottom-right-radius: 4px;
}
.tk-ai-msg-bot {
    align-self: flex-start;
    background: #fff;
    color: #334155;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
}
.tk-ai-msg-loading {
    opacity: 0.7;
    font-style: italic;
}

.tk-ai-product-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}
.tk-ai-product-card {
    display: flex;
    gap: 10px;
    padding: 8px;
    background: #f1f5f9;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}
.tk-ai-product-card img,
.tk-ai-product-img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 8px;
    background: #fff;
    flex-shrink: 0;
    display: block;
}
.tk-ai-product-img-ph {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #cbd5e1;
    flex-shrink: 0;
    font-size: 1.1rem;
}
.tk-ai-product-card-body {
    flex: 1;
    min-width: 0;
}
.tk-ai-product-name {
    font-weight: 600;
    font-size: 0.8rem;
    color: #0f172a;
    line-clamp: 2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.tk-ai-product-price {
    font-size: 0.75rem;
    color: #6366f1;
    font-weight: 700;
    margin-top: 2px;
}
.tk-ai-product-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
    flex-wrap: wrap;
}
.tk-ai-product-actions a,
.tk-ai-product-actions button {
    font-size: 0.7rem;
    padding: 4px 8px;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
}
.tk-ai-btn-view {
    background: #fff;
    color: #475569;
    border: 1px solid #cbd5e1 !important;
}
.tk-ai-btn-cart {
    background: #6366f1;
    color: #fff;
}
.tk-ai-btn-cart:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.tk-ai-chat-form {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #e2e8f0;
    background: #fff;
}
.tk-ai-chat-form input {
    flex: 1;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 0.875rem;
    outline: none;
}
.tk-ai-chat-form input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}
.tk-ai-chat-form button {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 12px;
    background: #6366f1;
    color: #fff;
    cursor: pointer;
    flex-shrink: 0;
}
.tk-ai-chat-form button:disabled {
    opacity: 0.6;
    cursor: wait;
}

/* Décaler WhatsApp / Telegram au-dessus du chatbot */
.whatsapp-btn { bottom: 84px !important; }
.telegram-btn { bottom: 150px !important; }
@media (max-width: 768px) {
    .whatsapp-btn { bottom: 162px !important; }
    .telegram-btn { bottom: 228px !important; }
}
