/* Floating Chat Bubble */
.ru-chat-bubble {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #4f46e5, #06b6d4);
    border-radius: 50%;
    box-shadow: 0 4px 20px rgba(79, 70, 229, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    transition: transform 0.2s, box-shadow 0.2s;
}

.ru-chat-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(79, 70, 229, 0.5);
}

.ru-chat-bubble svg {
    width: 28px;
    height: 28px;
    fill: #fff;
}

/* Chat Window Container */
#ru-chatbot {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    max-width: calc(100vw - 40px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    z-index: 9999;
    display: none;
    transform-origin: bottom right;
}

#ru-chatbot.ru-chat-open {
    display: block;
}

/* Chat Header */
.ru-chat-header {
    background: linear-gradient(135deg, #4f46e5, #06b6d4);
    color: #fff;
    padding: 16px 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ru-chat-header-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ru-chat-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.ru-chat-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Takeover Indicator */
.ru-takeover-indicator {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
    padding: 8px 12px;
    font-size: 12px;
    border-radius: 6px;
    margin: 0 12px;
    display: none;
    align-items: center;
    gap: 6px;
}

.ru-takeover-indicator.active {
    display: flex;
}

/* Messages Container */
.ru-chat-messages {
    height: 400px;
    overflow-y: auto;
    padding: 16px;
    background: #f9fafb;
    scroll-behavior: smooth;
}

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

.ru-chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.ru-chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.ru-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Message Bubbles */
.ru-message {
    margin-bottom: 16px;
    display: flex;
    gap: 8px;
    opacity: 0;
    transform: translateY(10px);
}

.ru-message.user {
    flex-direction: row;
}

.ru-message.ai,
.ru-message.admin {
    flex-direction: row-reverse;
}

.ru-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4f46e5, #06b6d4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.ru-message.user .ru-message-avatar {
    background: #6b7280;
}

.ru-message.admin .ru-message-avatar {
    background: #10b981;
}

.ru-message-content {
    max-width: 75%;
}

.ru-message-bubble {
    padding: 10px 14px;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    word-wrap: break-word;
    line-height: 1.5;
}

.ru-message.user .ru-message-bubble {
    background: #f3f4f6;
    color: #1f2937;
}

.ru-message.ai .ru-message-bubble,
.ru-message.admin .ru-message-bubble {
    background: linear-gradient(135deg, #4f46e5, #06b6d4);
    color: #fff;
}

.ru-message-sender {
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 4px;
    opacity: 0.8;
}

/* Typing Indicator */
.ru-typing-indicator {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #fff;
    border-radius: 12px;
    width: fit-content;
}

.ru-typing-indicator.active {
    display: flex;
}

.ru-typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
}

/* Input Area */
.ru-chat-input-area {
    border-top: 1px solid #e5e7eb;
    padding: 12px;
    background: #fff;
}

#ru-chatbot input {
    width: 100%;
    border: 1px solid #d1d5db;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#ru-chatbot input:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

#ru-chatbot input::placeholder {
    color: #9ca3af;
}

/* RTL Support */
html[dir="rtl"] .ru-chat-bubble {
    right: auto;
    left: 20px;
}

html[dir="rtl"] #ru-chatbot {
    right: auto;
    left: 20px;
    transform-origin: bottom left;
}

html[dir="rtl"] .ru-message.user {
    flex-direction: row-reverse;
}

html[dir="rtl"] .ru-message.ai,
html[dir="rtl"] .ru-message.admin {
    flex-direction: row;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #ru-chatbot {
        width: calc(100vw - 20px);
        right: 10px;
        bottom: 80px;
    }

    .ru-chat-bubble {
        right: 10px;
        bottom: 10px;
    }

    .ru-chat-messages {
        height: 350px;
    }

    html[dir="rtl"] #ru-chatbot {
        left: 10px;
    }

    html[dir="rtl"] .ru-chat-bubble {
        left: 10px;
    }
}
/* Product Cards */
.ru-product-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    margin: 8px 0;
    transition: transform 0.2s, box-shadow 0.2s;
    max-width: 280px;
}

.ru-product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.ru-product-image {
    width: 100%;
    height: 180px;
    overflow: hidden;
    background: #f9fafb;
}

.ru-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

.ru-product-name {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: #1f2937;
    line-height: 1.4;
}

.ru-product-price {
    font-size: 16px;
    font-weight: 700;
    color: #4f46e5;
    margin-bottom: 10px;
}

.ru-product-link {
    display: inline-block;
    background: linear-gradient(135deg, #4f46e5, #06b6d4);
    color: #fff !important;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: opacity 0.2s;
}

.ru-product-link:hover {
    opacity: 0.9;
}

.ru-message-bubble .ru-product-card {
    margin: 4px 0;
}
