/**
 * استایل چت‌بات هوشمند Pym
 * طراحی مدرن، واکنش‌گرا و راست‌چین
 */

/* کانتینر اصلی */
#pym-chatbot-container {
    position: fixed;
    z-index: 999999;
    font-family: inherit !important;
    direction: rtl !important;
}

/* موقعیت‌های مختلف */
#pym-chatbot-container.pym-chatbot-bottom-right {
    bottom: 20px;
    right: 20px;
}

#pym-chatbot-container.pym-chatbot-bottom-left {
    bottom: 20px;
    left: 20px;
}

#pym-chatbot-container.pym-chatbot-top-right {
    top: 20px;
    right: 20px;
}

#pym-chatbot-container.pym-chatbot-top-left {
    top: 20px;
    left: 20px;
}

/* دکمه باز/بسته کردن چت */
.pym-chat-toggle {
    width: 60px !important;
    height: 60px !important;
    border-radius: 50% !important;
    border: none !important;
    background-color: #0084ff !important;
    color: white !important;
    cursor: pointer !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s ease !important;
    position: relative;
}

.pym-chat-toggle:hover {
    transform: scale(1.1) !important;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2) !important;
}

.pym-chat-toggle:active {
    transform: scale(0.95) !important;
}

.pym-chat-toggle svg {
    width: 28px !important;
    height: 28px !important;
    transition: all 0.3s ease !important;
}

.pym-chat-icon {
    display: block !important;
}

.pym-close-icon {
    display: none !important;
    position: absolute;
}

.pym-chat-toggle.active .pym-chat-icon {
    display: none !important;
}

.pym-chat-toggle.active .pym-close-icon {
    display: block !important;
}

/* پنجره چت */
.pym-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px !important;
    max-width: calc(100vw - 40px) !important;
    height: 600px !important;
    max-height: calc(100vh - 120px) !important;
    background: white !important;
    border-radius: 16px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12) !important;
    display: none;
    flex-direction: column !important;
    overflow: hidden !important;
    animation: pym-slide-up 0.3s ease;
}

.pym-chat-window.active {
    display: flex;
}

@keyframes pym-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* هدر چت */
.pym-chat-header {
    background: linear-gradient(135deg, #0084ff 0%, #0066cc 100%) !important;
    color: white !important;
    padding: 20px !important;
    border-radius: 16px 16px 0 0 !important;
}

.pym-chat-header-content {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
}

.pym-chat-avatar {
    width: 48px !important;
    height: 48px !important;
    background: rgba(255, 255, 255, 0.2) !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
}

.pym-chat-avatar svg {
    width: 28px !important;
    height: 28px !important;
}

.pym-chat-header-text h3 {
    margin: 0 !important;
    font-size: 18px !important;
    font-weight: 600 !important;
}

.pym-chat-status {
    font-size: 13px !important;
    opacity: 0.9 !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
}

.pym-chat-status::before {
    content: '' !important;
    width: 8px !important;
    height: 8px !important;
    background: #4ade80 !important;
    border-radius: 50% !important;
    display: inline-block !important;
    animation: pym-pulse 2s infinite;
}

@keyframes pym-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* محتوای چت */
.pym-chat-messages {
    flex: 1 !important;
    overflow-y: auto !important;
    padding: 20px !important;
    background: #f8f9fa !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
}

.pym-chat-messages::-webkit-scrollbar {
    width: 6px !important;
}

.pym-chat-messages::-webkit-scrollbar-track {
    background: transparent !important;
}

.pym-chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e0 !important;
    border-radius: 3px !important;
}

.pym-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a0aec0 !important;
}

/* پیام‌ها */
.pym-message {
    display: flex !important;
    gap: 10px !important;
    animation: pym-message-appear 0.3s ease;
}

@keyframes pym-message-appear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pym-message-bot {
    align-self: flex-start !important;
}

.pym-message-user {
    align-self: flex-end !important;
    flex-direction: row-reverse !important;
}

.pym-message-avatar {
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    background: #0084ff !important;
    color: white !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    font-size: 14px !important;
    font-weight: 600 !important;
}

.pym-message-user .pym-message-avatar {
    background: #e2e8f0 !important;
    color: #334155 !important;
}

.pym-message-content {
    max-width: 75% !important;
    padding: 12px 16px !important;
    border-radius: 18px !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
    word-wrap: break-word !important;
}

.pym-message-bot .pym-message-content {
    background: white !important;
    color: #1e293b !important;
    border-bottom-right-radius: 4px !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
    line-height: 1.8 !important;
}

/* فرمت‌بندی متن پیام */
.pym-message-content strong {
    font-weight: 700 !important;
    color: #0f172a !important;
    display: block !important;
    margin: 12px 0 8px 0 !important;
    font-size: 15px !important;
}

.pym-message-content ul {
    margin: 8px 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

.pym-message-content li {
    padding: 6px 0 6px 20px !important;
    position: relative !important;
    line-height: 1.6 !important;
}

.pym-message-content li:before {
    content: "•" !important;
    position: absolute !important;
    right: 0 !important;
    color: #0084ff !important;
    font-weight: bold !important;
    font-size: 18px !important;
}

/* لیست شماره‌دار */
.pym-numbered-item {
    display: flex !important;
    gap: 12px !important;
    margin: 16px 0 !important;
    padding: 12px !important;
    background: #f8fafc !important;
    border-radius: 12px !important;
    border-right: 3px solid #0084ff !important;
}

.pym-numbered-item .pym-number {
    flex-shrink: 0 !important;
    width: 28px !important;
    height: 28px !important;
    background: #0084ff !important;
    color: white !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-weight: 700 !important;
    font-size: 14px !important;
}

.pym-numbered-item .pym-text {
    flex: 1 !important;
    line-height: 1.7 !important;
}

.pym-numbered-item .pym-text strong {
    margin: 0 0 4px 0 !important;
    font-size: 14px !important;
}

.pym-message-user .pym-message-content {
    background: #0084ff !important;
    color: white !important;
    border-bottom-left-radius: 4px !important;
}

.pym-message-time {
    font-size: 11px !important;
    color: #94a3b8 !important;
    margin-top: 4px !important;
    text-align: right !important;
}

/* انیمیشن تایپ */
.pym-typing-indicator {
    display: flex !important;
    gap: 4px !important;
    padding: 12px 16px !important;
    background: white !important;
    border-radius: 18px !important;
    width: fit-content !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

.pym-typing-dot {
    width: 8px !important;
    height: 8px !important;
    background: #cbd5e0 !important;
    border-radius: 50% !important;
    animation: pym-typing 1.4s infinite;
}

.pym-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.pym-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes pym-typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* فوتر چت (ورودی) */
.pym-chat-footer {
    padding: 16px !important;
    background: white !important;
    border-top: 1px solid #e2e8f0 !important;
}

#pym-chat-form {
    display: flex !important;
    gap: 8px !important;
    align-items: center !important;
}

.pym-chat-input {
    flex: 1 !important;
    padding: 12px 16px !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 24px !important;
    font-size: 14px !important;
    outline: none !important;
    transition: all 0.2s ease !important;
    font-family: inherit !important;
}

.pym-chat-input:focus {
    border-color: #0084ff !important;
    box-shadow: 0 0 0 4px rgba(0, 132, 255, 0.1) !important;
}

.pym-chat-input::placeholder {
    color: #94a3b8 !important;
}

.pym-chat-send {
    width: 44px !important;
    height: 44px !important;
    border-radius: 50% !important;
    border: none !important;
    background: #0084ff !important;
    color: white !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
    flex-shrink: 0 !important;
}

.pym-chat-send:hover {
    background: #0066cc !important;
    transform: scale(1.05) !important;
}

.pym-chat-send:active {
    transform: scale(0.95) !important;
}

.pym-chat-send:disabled {
    background: #cbd5e0 !important;
    cursor: not-allowed !important;
    transform: none !important;
}

.pym-chat-send svg {
    width: 20px !important;
    height: 20px !important;
}

/* واکنش‌گرا برای موبایل */
@media (max-width: 480px) {
    #pym-chatbot-container {
        bottom: 10px !important;
        right: 10px !important;
        left: 10px !important;
    }
    
    .pym-chat-window {
        width: 100% !important;
        height: calc(100vh - 100px) !important;
        bottom: 70px;
        right: 0;
        left: 0;
        border-radius: 16px 16px 0 0 !important;
    }
    
    .pym-chat-toggle {
        width: 56px !important;
        height: 56px !important;
    }
    
    .pym-message-content {
        max-width: 85% !important;
    }
}

/* افکت‌های اضافی */
.pym-fade-in {
    animation: pym-fade-in 0.3s ease;
}

@keyframes pym-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.pym-shake {
    animation: pym-shake 0.5s ease;
}

@keyframes pym-shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
}

/* کارت‌های محصول - مینیمال و جذاب */
.pym-products-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    margin-top: 12px !important;
}

.pym-product-card {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

.pym-product-card:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
    border-color: #cbd5e0 !important;
}

.pym-product-image {
    width: 100% !important;
    height: 100px !important;
    object-fit: cover !important;
    background: #f1f5f9 !important;
    display: block !important;
}

.pym-product-info {
    padding: 10px 12px !important;
}

.pym-product-title {
    font-size: 13px !important;
    font-weight: 600 !important;
    margin: 0 0 6px 0 !important;
    color: #1e293b !important;
    line-height: 1.4 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    white-space: normal !important;
}

.pym-product-price {
    font-size: 14px !important;
    font-weight: 700 !important;
    color: #10b981 !important;
    margin: 0 0 8px 0 !important;
    direction: rtl !important;
}

.pym-product-link {
    display: inline-block !important;
    width: 100% !important;
    padding: 6px 12px !important;
    background: var(--pym-primary-color, #0084ff) !important;
    color: white !important;
    text-align: center !important;
    text-decoration: none !important;
    border-radius: 6px !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    transition: all 0.2s ease !important;
    border: none !important;
}

.pym-product-link:hover {
    background: var(--pym-primary-dark, #0066cc) !important;
    transform: scale(1.02) !important;
    color: white !important;
}

/* واکنش‌گرا برای موبایل */
@media (max-width: 768px) {
    .pym-products-grid {
        grid-template-columns: 1fr !important;
    }
}
