/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    direction: rtl;
    background-color: #f5f5f5;
}

/* Demo Content */
.demo-content {
    max-width: 800px;
    margin: 50px auto;
    padding: 20px;
    text-align: center;
}

.demo-content h1 {
    color: #333;
    margin-bottom: 20px;
}

.demo-content p {
    color: #666;
    font-size: 18px;
}

/* Chatbot Bubble */
.chatbot-bubble {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    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 cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    color: white;
}

.chatbot-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.chatbot-bubble svg {
    width: 28px;
    height: 28px;
}

.chatbot-bubble.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0);
}

/* Notification Badge */
.chatbot-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: white;
    font-size: 12px;
    font-weight: 700;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
    animation: badgePulse 2s infinite;
}

.chatbot-badge.hidden {
    display: none;
}

@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Chatbot Window */
.chatbot-window {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 380px;
    height: 550px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    transform: scale(0);
    transform-origin: bottom right;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1001;
    overflow: hidden;
}

.chatbot-window.open {
    transform: scale(1);
    opacity: 1;
}

/* Header */
.chatbot-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 16px 16px 0 0;
}

.chatbot-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 16px;
}

.chatbot-icon {
    width: 24px;
    height: 24px;
}

.chatbot-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.chatbot-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.chatbot-close svg {
    width: 20px;
    height: 20px;
}

/* Messages Container */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-color: #f8f9fa;
}

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

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

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

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Message Styles */
.message {
    display: flex;
    gap: 8px;
    animation: messageSlide 0.3s ease-out;
}

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

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

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
    overflow: hidden;
}

.message.bot .message-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4px;
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.message.user .message-avatar {
    background: #e5e7eb;
}

.message-content {
    max-width: 70%;
    padding: 10px 14px;
    border-radius: 16px;
    line-height: 1.5;
    font-size: 14px;
    word-wrap: break-word;
}

.message.bot .message-content {
    background: white;
    color: #1f2937;
    border-bottom-right-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.message.user .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-left-radius: 4px;
}

/* Bold text styling */
.message-content strong {
    font-weight: 700;
    color: #667eea;
}

.message.user .message-content strong {
    color: white;
    font-weight: 700;
}

/* Product Link Styling */
.message-content a {
    color: #667eea;
    text-decoration: underline;
    font-weight: 500;
    transition: opacity 0.2s ease;
}

.message-content a:hover {
    opacity: 0.8;
}

.message.user .message-content a {
    color: white;
}

/* Input Container */
.chatbot-input-container {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 10px;
}

.chatbot-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
    direction: rtl;
}

.chatbot-input:focus {
    border-color: #667eea;
}

.chatbot-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chatbot-send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.chatbot-send:active {
    transform: scale(0.95);
}

.chatbot-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chatbot-send svg {
    width: 20px;
    height: 20px;
}

/* Typing Indicator */
.chatbot-typing {
    display: flex;
    gap: 4px;
    padding: 10px 20px;
    background: white;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #667eea;
    animation: typingAnimation 1.4s infinite;
}

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

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingAnimation {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Welcome Message Special Styling */
.welcome-message {
    background: linear-gradient(135deg, #f0f4ff 0%, #f8f0ff 100%);
    border: 1px solid #e0e7ff;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 480px) {
    .chatbot-window {
        width: calc(100vw - 20px);
        max-height: calc(100vh - 20px);
        height: auto;
        min-height: 400px;
        bottom: 70px;
        right: 10px;
        border-radius: 12px;
    }

    .chatbot-bubble {
        bottom: 75px;
        right: 15px;
    }

    .message-content {
        max-width: 80%;
    }
}

/* Smooth Animations */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

