/* ==============================================
   MCP Search AI Chatbot — Styles dynamiques
   Les couleurs utilisent des variables CSS
   injectées par le hook displayHeader de PHP
   ============================================== */

/* Position du widget (droite ou gauche) */
#mcp-chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999;
    font-family: Arial, sans-serif;
    width: 60px;
    height: 60px;
}

#mcp-chatbot-container.mcp-pos-left {
    right: auto;
    left: 20px;
}

#mcp-chatbot-container.mcp-pos-left #mcp-chatbot-window {
    right: auto;
    left: 0;
}

/* Bouton flottant */
#mcp-chatbot-trigger {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 60px;
    height: 60px;
    background-color: var(--mcp-color-theme, #102e5c);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    color: white;
    font-size: 24px;
    transition: transform 0.2s, box-shadow 0.2s;
}

#mcp-chatbot-trigger:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

/* Fenêtre de chat */
#mcp-chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 360px;
    height: 520px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--mcp-color-theme, #102e5c);
}

/* En-tête */
.mcp-chatbot-header {
    background-color: var(--mcp-color-theme, #102e5c);
    color: white;
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mcp-chatbot-title {
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
}

.mcp-bot-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.5);
}

.mcp-bot-avatar-emoji {
    font-size: 28px;
    line-height: 1;
}

#mcp-chatbot-close {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
}

#mcp-chatbot-close:hover {
    opacity: 1;
}

/* Zone des messages */
#mcp-chatbot-messages {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    background-color: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Messages */
.mcp-message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
}

.mcp-message.mcp-user {
    align-self: flex-end;
}

.mcp-message.mcp-bot {
    align-self: flex-start;
}

.mcp-bubble {
    padding: 10px 15px;
    border-radius: 15px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}

.mcp-msg-header {
    font-size: 11px;
    color: #888;
    margin-bottom: 4px;
    padding: 0 4px;
}

.mcp-user .mcp-msg-header {
    text-align: right;
}

/* Bulles utilisateur */
.mcp-user .mcp-bubble {
    background-color: var(--mcp-color-user-bg, #e9ecef);
    color: var(--mcp-color-user-text, #333333);
    border-bottom-right-radius: 3px;
}

/* Bulles IA */
.mcp-bot .mcp-bubble {
    background-color: var(--mcp-color-bot-bg, #e4e7f3);
    color: var(--mcp-color-bot-text, #333333);
    border-bottom-left-radius: 3px;
}

/* Zone de saisie */
.mcp-chatbot-input-area {
    display: flex;
    padding: 10px;
    border-top: 1px solid #eee;
    background: white;
    gap: 6px;
    align-items: flex-end;
}

#mcp-search-input {
    flex-grow: 1;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 9px 12px;
    outline: none;
    resize: none;
    overflow-y: auto;
    max-height: 100px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    transition: border-color 0.2s;
}

#mcp-search-input:focus {
    border-color: var(--mcp-color-theme, #102e5c);
}

#mcp-search-btn {
    background: var(--mcp-color-theme, #102e5c);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 9px 16px;
    cursor: pointer;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

#mcp-search-btn:hover {
    opacity: 0.85;
}

/* Liste de produits dans le chat */
.mcp-product-list {
    margin-top: 10px;
    padding: 0;
    list-style: none;
    font-size: 13px;
}

.mcp-product-item {
    margin-bottom: 8px;
}

.mcp-product-card {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none !important;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 8px;
    transition: box-shadow 0.2s, border-color 0.2s;
    cursor: pointer;
}

.mcp-product-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    border-color: var(--mcp-color-theme, #102e5c);
}

.mcp-product-img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: 5px;
    flex-shrink: 0;
    background: #f5f5f5;
}

.mcp-product-img-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: #f5f5f5;
}

.mcp-product-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.mcp-product-name {
    color: var(--mcp-color-theme, #102e5c);
    font-weight: bold;
    font-size: 12px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mcp-product-ref {
    color: #888;
    font-size: 11px;
}

.mcp-product-price {
    color: #222;
    font-weight: bold;
    font-size: 13px;
}

/* Boutons d'options cliquables */
.mcp-options-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 5px 0;
}

.mcp-option-btn {
    background-color: var(--mcp-color-theme, #102e5c);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 13px;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
}

.mcp-option-btn:hover:not(:disabled) {
    opacity: 0.85;
    transform: scale(1.03);
}

.mcp-option-btn:disabled {
    opacity: 0.45;
    cursor: default;
}

/* Animation de frappe (3 points) */
.mcp-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 18px !important;
}

.mcp-typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #999;
    animation: mcp-dot-bounce 1.4s infinite ease-in-out;
}

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

@keyframes mcp-dot-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}
