/* Premium AI Chatbot CSS */

:root {
    --chat-primary: #10b981; /* Emerald */
    --chat-primary-dark: #059669;
    --chat-bg: rgba(255, 255, 255, 0.95);
    --chat-text: #1f2937;
    --chat-border: rgba(255, 255, 255, 0.2);
    --chat-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    --chat-user-msg: linear-gradient(135deg, #10b981, #059669);
    --chat-bot-msg: #f3f4f6;
    --chat-bot-text: #374151;
}

/* Chatbot Launcher Bubble */
#chatbot-launcher {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: var(--chat-primary);
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
}

#chatbot-launcher:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.6);
}

#chatbot-launcher svg {
    width: 32px;
    height: 32px;
    fill: white;
}

/* Main Chatbot Window */
#chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 120px);
    background: var(--chat-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--chat-border);
    border-radius: 20px;
    box-shadow: var(--chat-shadow);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}

#chatbot-window.active {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0) scale(1);
}

/* Header */
#chatbot-header {
    background: linear-gradient(135deg, #10b981, #059669);
    padding: 20px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 20px 20px 0 0;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-avatar {
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.chatbot-title {
    font-weight: 600;
    font-size: 16px;
    margin: 0;
    letter-spacing: 0.5px;
}

.chatbot-subtitle {
    font-size: 12px;
    opacity: 0.8;
    margin: 0;
}

#chatbot-close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

#chatbot-close:hover {
    background: rgba(255,255,255,0.4);
}

/* Chat Body */
#chatbot-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

#chatbot-body::-webkit-scrollbar {
    width: 6px;
}
#chatbot-body::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.1);
    border-radius: 3px;
}

/* Messages */
.chat-msg {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    animation: fadeIn 0.3s ease forwards;
    word-wrap: break-word;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-msg.bot {
    background: var(--chat-bot-msg);
    color: var(--chat-bot-text);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.chat-msg.user {
    background: var(--chat-user-msg);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 16px;
    background: var(--chat-bot-msg);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    align-items: center;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Product Card */
.chat-products-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 5px;
}
.chat-product-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border: 1px solid #e5e7eb;
    width: 220px;
    flex-shrink: 0;
}

.chat-product-img {
    width: 100%;
    height: 140px;
    object-fit: cover;
}

.chat-product-info {
    padding: 12px;
}

.chat-product-title {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 4px;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-product-price {
    color: var(--chat-primary);
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 8px;
}

.chat-product-btn {
    display: block;
    text-align: center;
    background: var(--chat-primary);
    color: white;
    text-decoration: none;
    padding: 8px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.2s;
}

.chat-product-btn:hover {
    background: var(--chat-primary-dark);
}

/* Input Area */
#chatbot-input-area {
    padding: 16px;
    background: white;
    border-top: 1px solid #f3f4f6;
    display: flex;
    gap: 10px;
    border-radius: 0 0 20px 20px;
}

#chatbot-input {
    flex: 1;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    padding: 12px 16px;
    font-size: 14px;
    outline: none;
    transition: border 0.3s, box-shadow 0.3s;
    background: #f9fafb;
}

#chatbot-input:focus {
    border-color: var(--chat-primary);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
    background: white;
}

#chatbot-send {
    background: var(--chat-primary);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, background 0.2s;
}

#chatbot-send:hover {
    background: var(--chat-primary-dark);
    transform: scale(1.05);
}

#chatbot-send svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    margin-left: 2px;
}

/* Responsive */
@media (max-width: 480px) {
    #chatbot-window {
        bottom: 0;
        right: 0;
        width: 100vw;
        height: 100vh;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }
    #chatbot-header {
        border-radius: 0;
    }
    #chatbot-input-area {
        border-radius: 0;
    }
}
