/**
 * AutoFit AI Search - Chat Assistant Stylesheet
 * v2.1.1 - Added product card classes for chat messages (moved from inline JS).
 */

#autofit-chat-fab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #2563eb;
    color: #fff;
    border-radius: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
    z-index: 99999;
    transition: 0.2s;
    padding: 8px 16px;
    font-family: Tahoma, Arial, sans-serif;
}

#autofit-chat-fab:hover {
    transform: scale(1.04);
    background: #1d4ed8;
}

.autofit-fab-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.autofit-fab-custom-img {
    width: 26px;
    height: 26px;
    object-fit: contain;
    border-radius: 50%;
    display: block;
}

.autofit-fab-custom-text {
    font-size: 20px;
    line-height: 1;
}

.autofit-fab-text {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
}

#autofit-chat-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    max-width: calc(100vw - 30px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    border: 1px solid #e2e8f0;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: Tahoma, Arial, sans-serif;
    direction: rtl;
}

#autofit-chat-window.autofit-chat-hidden { display: none; }

.autofit-chat-header {
    background: #2563eb;
    color: #fff;
    padding: 12px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.autofit-chat-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
}

#autofit-chat-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
}

#autofit-chat-messages {
    padding: 12px;
    height: 340px;
    overflow-y: auto;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.autofit-chat-msg {
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 13px;
    width: 100%;
    line-height: 1.4;
    box-sizing: border-box;
    word-wrap: break-word;
}

.autofit-chat-msg.ai {
    background: #e2e8f0;
    color: #1e293b;
    align-self: flex-start;
}

.autofit-chat-msg.user {
    background: #2563eb;
    color: #fff;
    align-self: flex-end;
    width: auto;
    max-width: 90%;
}

.autofit-chat-input-area {
    padding: 10px;
    background: #fff;
    border-top: 1px solid #e2e8f0;
}

.autofit-chat-input-area .autofit-search-input-group {
    display: flex;
    gap: 6px;
    align-items: center;
    background: #f8fafc;
    padding: 6px;
    border: 2px solid #cbd5e1;
    border-radius: 10px;
    transition: all 0.3s ease;
    margin-bottom: 8px;
}

.autofit-chat-input-area .autofit-search-input-group:focus-within {
    border-color: #2563eb;
    background: #fff;
}

#autofit-chat-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 6px;
    font-size: 13px;
    outline: none;
    color: #1e293b;
    font-family: Tahoma, Arial, sans-serif;
}

#autofit-chat-input::placeholder { color: #94a3b8; }

#autofit-chat-mic-btn,
#autofit-chat-clear-btn {
    background: #fff;
    border: 1px solid #cbd5e1;
    width: 34px;
    height: 34px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    padding: 0;
    flex-shrink: 0;
}

#autofit-chat-clear-btn.autofit-chat-clear-hidden { display: none; }

#autofit-chat-send-btn {
    width: 100%;
    background: #2563eb;
    color: #fff;
    border: none;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    font-family: Tahoma, Arial, sans-serif;
}

#autofit-chat-send-btn:hover { background: #1d4ed8; }

#autofit-chat-recent {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

#autofit-chat-recent .autofit-recent-item {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #334155;
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 20px;
    cursor: pointer;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#autofit-chat-recent .autofit-recent-item:hover { background: #e2e8f0; }

/* =========================================================
   ✅ NEW: Chat Product Cards (moved from inline JS styles)
========================================================= */
.autofit-chat-products-list {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.autofit-chat-prod-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    text-decoration: none;
    color: #1e293b;
    transition: all 0.2s ease;
}

.autofit-chat-prod-card:hover {
    border-color: #2563eb;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
    transform: translateX(-2px);
}

.autofit-chat-prod-img {
    width: 45px;
    height: 45px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.autofit-chat-prod-info {
    flex: 1;
    overflow: hidden;
    min-width: 0;
}

.autofit-chat-prod-name {
    font-weight: bold;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.autofit-chat-prod-price {
    color: #2563eb;
    font-size: 11px;
    margin-top: 2px;
    font-weight: 600;
}

@media (max-width: 480px) {
    #autofit-chat-window {
        width: calc(100vw - 20px);
        right: 10px;
        bottom: 80px;
    }
}