/* ============================================
   چت‌بات هوشمند ده شاپس - نسخه حرفه‌ای
   ============================================ */

/* انیمیشن‌ها */
@keyframes slideIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes typingDots {
    0%, 20% { content: '•'; }
    40%, 60% { content: '••'; }
    80%, 100% { content: '•••'; }
}

/* دکمه */
#rasool-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    cursor: pointer;
    z-index: 999999;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.2);
    border-radius: 50%;
}

#rasool-toggle:hover {
    transform: scale(1.15) rotate(-5deg);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3);
}

#rasool-toggle svg {
    width: 60px;
    height: 60px;
    display: block;
}

/* باکس */
#rasool-box {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 420px;
    max-width: 92vw;
    height: 620px;
    max-height: 80vh;
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.25);
    z-index: 999998;
    display: none;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, sans-serif;
    direction: rtl;
    overflow: hidden;
    animation: slideIn 0.4s ease;
}

#rasool-box.left {
    right: auto;
    left: 30px;
}

/* هدر */
#rasool-header {
    background: #25D366;
    color: #ffffff;
    padding: 16px 20px;
    font-weight: 600;
    font-size: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

#rasool-close {
    font-size: 28px;
    cursor: pointer;
    background: none;
    border: none;
    color: #fff;
    padding: 0 8px;
    transition: transform 0.3s ease;
}

#rasool-close:hover {
    transform: rotate(90deg);
}

/* پیام‌ها */
#rasool-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: #f5f7fb;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#rasool-messages::-webkit-scrollbar {
    width: 4px;
}

#rasool-messages::-webkit-scrollbar-thumb {
    background: #c5cbd5;
    border-radius: 4px;
}

.ai, .user {
    padding: 10px 16px;
    border-radius: 16px;
    max-width: 85%;
    word-wrap: break-word;
    line-height: 1.7;
    animation: slideIn 0.3s ease;
}

.ai {
    background: #25D366;
    color: #ffffff;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 12px rgba(37, 211, 102, 0.2);
}

.ai.welcome {
    background: #f0f2f5;
    color: #333;
    border: 1px solid #e0e0e0;
    box-shadow: none;
}

.user {
    background: #ffffff;
    color: #1a1a1a;
    align-self: flex-end;
    border: 1px solid #e8ecf1;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.ai.typing {
    background: #e8ecf1;
    color: #6b7a8a;
    padding: 12px 20px;
    min-width: 70px;
}

.typing-dots::after {
    content: '•••';
    animation: typingDots 1.5s steps(3) infinite;
}

/* ورودی */
#rasool-input {
    padding: 16px;
    background: #ffffff;
    border-top: 1px solid #e8ecf1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
}

#rasool-text {
    width: 100%;
    min-height: 50px;
    max-height: 120px;
    padding: 10px 14px;
    border: 2px solid #e8ecf1;
    border-radius: 16px;
    resize: none;
    font-family: inherit;
    font-size: 14px;
    transition: border-color 0.3s ease;
    background: #f8f9fa;
}

#rasool-text:focus {
    outline: none;
    border-color: #25D366;
    background: #ffffff;
}

#rasool-send {
    width: 100%;
    padding: 12px;
    background: #25D366;
    color: #ffffff;
    border: none;
    border-radius: 16px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 12px rgba(37, 211, 102, 0.25);
}

#rasool-send:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(37, 211, 102, 0.35);
}

#rasool-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* کاربر */
#rasool-userinfo {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid #e8ecf1;
}

#rasool-userinfo input {
    padding: 10px 14px;
    border: 2px solid #e8ecf1;
    border-radius: 12px;
    font-size: 14px;
    flex: 1;
    background: #f8f9fa;
}

#rasool-userinfo input:focus {
    outline: none;
    border-color: #25D366;
    background: #ffffff;
}

#rasool-userinfo button {
    padding: 10px;
    background: #1a73e8;
    color: #fff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
}

#rasool-userinfo button:hover:not(:disabled) {
    background: #1557b0;
    transform: translateY(-1px);
}

#rasool-userinfo button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* محصول */
.rasool-product {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 14px;
    padding: 14px;
    margin: 4px 0;
}

.rasool-product img {
    border-radius: 8px;
    max-width: 100%;
    height: auto;
}

.rasool-btn {
    display: inline-block;
    padding: 6px 18px;
    background: #25D366;
    color: #fff !important;
    text-decoration: none;
    border-radius: 20px;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.3s ease;
}

.rasool-btn:hover {
    transform: scale(1.05);
    color: #fff !important;
}

/* ریسپانسیو */
@media (max-width: 768px) {
    #rasool-box {
        bottom: 80px;
        right: 10px;
        left: 10px;
        width: auto;
        height: 70vh;
    }
    
    #rasool-toggle {
        bottom: 20px;
        right: 20px;
        width: 54px;
        height: 54px;
    }
    
    #rasool-toggle svg {
        width: 54px;
        height: 54px;
    }
}

@media (max-width: 480px) {
    #rasool-box {
        height: 80vh;
        bottom: 70px;
    }
    
    .ai, .user {
        max-width: 92%;
        font-size: 14px;
        padding: 8px 12px;
    }
}