/* Chatbot Styles */
.ai-agent-chatbot {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

/* Chat Icon */
.ai-agent-chat-icon {
    position: fixed;
    bottom: 20px;
    width: 60px;
    height: 60px;
    background-color: var(--ai-agent-theme-color, #0073aa);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    z-index: 999999;
}

.ai-agent-chatbot[data-position="bottom-right"] .ai-agent-chat-icon {
    right: 20px;
}

.ai-agent-chatbot[data-position="bottom-left"] .ai-agent-chat-icon {
    left: 20px;
}

.ai-agent-chat-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.ai-agent-chat-icon svg {
    width: 30px;
    height: 30px;
    color: white;
}

.ai-agent-chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #ff4444;
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: bold;
}

/* Chat Window */
.ai-agent-chat-window {
    position: fixed;
    bottom: 90px;
    width: 380px;
    height: 600px;
    max-height: 80vh;
    background-color: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    z-index: 999999;
}

.ai-agent-chatbot[data-position="bottom-right"] .ai-agent-chat-window {
    right: 20px;
}

.ai-agent-chatbot[data-position="bottom-left"] .ai-agent-chat-window {
    left: 20px;
}

/* Chat Header */
.ai-agent-chat-header {
    padding: 20px;
    color: white;
    border-radius: 16px 16px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-agent-chat-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: white;
}

.ai-agent-chat-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.ai-agent-chat-close:hover {
    opacity: 1;
}

.ai-agent-chat-close svg {
    width: 24px;
    height: 24px;
}

/* Messages Container */
.ai-agent-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background-color: #f5f5f5;
}

.ai-agent-message {
    margin-bottom: 16px;
    display: flex;
}

.ai-agent-message-user {
    justify-content: flex-end;
}

.ai-agent-message-bot {
    justify-content: flex-start;
}

.ai-agent-message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 16px;
    word-wrap: break-word;
}

.ai-agent-message-user .ai-agent-message-content {
    background-color: var(--ai-agent-theme-color, #0073aa);
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-agent-message-bot .ai-agent-message-content {
    background-color: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.ai-agent-message-error {
    background-color: #fee;
    color: #c33;
}

/* Typing Indicator */
.ai-agent-typing .ai-agent-message-content {
    display: flex;
    align-items: center;
    padding: 16px;
}

.ai-agent-typing span {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #999;
    margin-right: 4px;
    animation: typing 1.4s infinite;
}

.ai-agent-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.ai-agent-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Input Container */
.ai-agent-chat-input-container {
    padding: 16px;
    background-color: white;
    border-top: 1px solid #e0e0e0;
    border-radius: 0 0 16px 16px;
}

#ai-agent-chat-form {
    display: flex;
    align-items: center;
}

.ai-agent-chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.ai-agent-chat-input:focus {
    border-color: var(--ai-agent-theme-color, #0073aa);
}

.ai-agent-chat-send {
    margin-left: 8px;
    padding: 8px;
    background-color: var(--ai-agent-theme-color, #0073aa);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-agent-chat-send:hover {
    transform: scale(1.1);
}

.ai-agent-chat-send svg {
    width: 20px;
    height: 20px;
    color: white;
}

/* Products Display */
.ai-agent-products {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-agent-product {
    display: flex;
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

.ai-agent-product:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.ai-agent-product img {
    width: 80px;
    height: 80px;
    object-fit: cover;
}

.ai-agent-product-info {
    padding: 12px;
    flex: 1;
}

.ai-agent-product-info h4 {
    margin: 0 0 4px 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.ai-agent-product-price {
    margin: 4px 0;
    font-size: 16px;
    font-weight: bold;
    color: var(--ai-agent-theme-color, #0073aa);
}

.ai-agent-product-desc {
    margin: 4px 0;
    font-size: 12px;
    color: #666;
    line-height: 1.4;
}

.ai-agent-product-link {
    display: inline-block;
    margin-top: 8px;
    padding: 6px 12px;
    background-color: var(--ai-agent-theme-color, #0073aa);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 12px;
    transition: background-color 0.2s;
}

.ai-agent-product-link:hover {
    background-color: #005a87;
    color: white;
}

/* Responsive */
@media (max-width: 480px) {
    .ai-agent-chat-window {
        width: 100%;
        height: 100%;
        max-height: 100%;
        bottom: 0;
        right: 0;
        left: 0;
        border-radius: 0;
    }

    .ai-agent-chat-icon {
        bottom: 10px;
        right: 10px;
        width: 50px;
        height: 50px;
    }

    .ai-agent-chat-header {
        border-radius: 0;
    }

    .ai-agent-chat-input-container {
        border-radius: 0;
    }
}

/* RTL Support */
.rtl .ai-agent-message-user {
    justify-content: flex-start;
}

.rtl .ai-agent-message-bot {
    justify-content: flex-end;
}

.rtl .ai-agent-message-user .ai-agent-message-content {
    border-bottom-right-radius: 16px;
    border-bottom-left-radius: 4px;
}

.rtl .ai-agent-message-bot .ai-agent-message-content {
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 4px;
}

.rtl .ai-agent-chat-send {
    margin-left: 0;
    margin-right: 8px;
}

.rtl .ai-agent-product {
    flex-direction: row-reverse;
}
