/* Chatbot Variables based on site style */
:root {
    --chat-bg: #141414;
    --chat-header-bg: #0a0a0a;
    --chat-text: #ffffff;
    --chat-accent: #39ff14;
    /* Neon Green */
    --chat-accent-dim: rgba(57, 255, 20, 0.1);
    --chat-user-msg-bg: #39ff14;
    --chat-user-msg-text: #000000;
    --chat-bot-msg-bg: #2a2a2a;
    --chat-bot-msg-text: #e0e0e0;
    --chat-border: #333;
    --chat-font: 'Inter', sans-serif;
}

/* Chat Toggle Button */
.chatbot-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: var(--chat-accent);
    color: #000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(57, 255, 20, 0.4);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 9999;
    border: none;
    font-size: 24px;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(57, 255, 20, 0.6);
}

.chatbot-toggle i {
    transition: transform 0.3s ease;
}

.chatbot-toggle.open i {
    transform: rotate(90deg);
}

/* Chat Window */
.chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    height: 600px;
    max-height: 80vh;
    background: var(--chat-bg);
    border: 1px solid var(--chat-border);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    font-family: var(--chat-font);
}

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

/* Chat Header */
.chatbot-header {
    padding: 16px 20px;
    background: var(--chat-header-bg);
    border-bottom: 1px solid var(--chat-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chatbot-title {
    font-weight: 700;
    color: var(--chat-text);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.bot-avatar {
    width: 32px;
    height: 32px;
    background: var(--chat-accent);
    color: #000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.chatbot-controls {
    display: flex;
    gap: 10px;
}

.close-chat {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 18px;
    transition: color 0.2s;
}

.close-chat:hover {
    color: #fff;
}

/* Messages Area */
.chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: #444 #1a1a1a;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: #1a1a1a;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 3px;
}

/* Message Bubbles */
.message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
    animation: messageIn 0.3s ease-out;
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.bot {
    align-self: flex-start;
    background: var(--chat-bot-msg-bg);
    color: var(--chat-bot-msg-text);
    border-bottom-left-radius: 2px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.message.user {
    align-self: flex-end;
    background: var(--chat-user-msg-bg);
    color: var(--chat-user-msg-text);
    border-bottom-right-radius: 2px;
    box-shadow: 0 2px 8px rgba(57, 255, 20, 0.2);
}

/* Markdown-like formatting helpers */
.message p {
    margin: 0 0 8px 0;
}

.message p:last-child {
    margin-bottom: 0;
}

.message ul,
.message ol {
    margin: 8px 0;
    padding-left: 20px;
}

.message li {
    margin-bottom: 4px;
}

.message strong {
    font-weight: 700;
}

.message a {
    color: inherit;
    text-decoration: underline;
}

/* Input Area */
.chatbot-input-area {
    padding: 16px;
    background: var(--chat-header-bg);
    border-top: 1px solid var(--chat-border);
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.chatbot-input {
    flex: 1;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 20px;
    padding: 12px 16px;
    color: #fff;
    font-family: inherit;
    font-size: 0.95rem;
    resize: none;
    max-height: 100px;
    min-height: 44px;
    outline: none;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.chatbot-input:focus {
    border-color: var(--chat-accent);
    box-shadow: 0 0 0 2px var(--chat-accent-dim);
}

.chatbot-send-btn {
    background: var(--chat-accent);
    color: #000;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 16px;
    flex-shrink: 0;
}

.chatbot-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 10px var(--chat-accent-dim);
}

.chatbot-send-btn:disabled {
    background: #333;
    color: #666;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: var(--chat-bot-msg-bg);
    border-radius: 12px;
    border-bottom-left-radius: 2px;
    width: fit-content;
    margin-bottom: 10px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #666;
    border-radius: 50%;
    animation: typingBounce 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 typingBounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Product Card Styling */
.chat-product-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #444;
    border-radius: 8px;
    padding: 10px;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-product-image {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 4px;
    background: #000;
}

.chat-product-title {
    font-size: 0.9em;
    font-weight: bold;
    color: #fff;
    margin: 0;
}

.chat-product-price {
    color: var(--chat-accent);
    font-size: 0.9em;
}

.chat-product-btn {
    background: var(--chat-accent);
    color: #000;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.85em;
    cursor: pointer;
    font-weight: 600;
    text-align: center;
    transition: 0.2s;
}

.chat-product-btn:hover {
    opacity: 0.9;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .chatbot-window {
        bottom: 0;
        right: 0;
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .chatbot-toggle {
        bottom: 120px;
        right: 20px;
        width: 50px;
        height: 50px;
    }
}