/* * Wp Product Smart Chat Styles
 * پشتیبانی از متغیرهای رنگی و موقعیت‌های مختلف
 */
@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css');

:root {
    --wpsc-main-color: #b38b4d; /* مقدار پیش‌فرض */
    --wpsc-main-color-dark: #967035;
}

#wpsc-chat-widget {
    position: fixed;
    z-index: 9999;
    font-family: 'Vazirmatn', sans-serif;
    direction: rtl;
    bottom: 30px;
}

/* --- تنظیمات موقعیت (Positioning) --- */

/* 1. چپ (پیش‌فرض) */
#wpsc-chat-widget.wpsc-pos-left {
    left: 30px;
    right: auto;
}
#wpsc-chat-widget.wpsc-pos-left #wpsc-chat-box {
    left: 0;
    transform-origin: bottom left;
}
/* تغییر: نمایش حباب در بالا */
#wpsc-chat-widget.wpsc-pos-left .wpsc-cta-bubble {
    left: 0;
    bottom: 75px; /* بالای دکمه */
    white-space: nowrap;
}
#wpsc-chat-widget.wpsc-pos-left .wpsc-cta-bubble::before {
    left: 24px; /* وسط دکمه */
    bottom: -6px;
    top: auto;
    border-width: 6px 6px 0 6px;
    border-color: #fff transparent transparent transparent; /* فلش رو به پایین */
}

/* 2. راست */
#wpsc-chat-widget.wpsc-pos-right {
    right: 30px;
    left: auto;
}
#wpsc-chat-widget.wpsc-pos-right #wpsc-chat-box {
    right: 0;
    transform-origin: bottom right;
}
/* تغییر: نمایش حباب در بالا */
#wpsc-chat-widget.wpsc-pos-right .wpsc-cta-bubble {
    right: 0;
    bottom: 75px; /* بالای دکمه */
    white-space: nowrap;
}
#wpsc-chat-widget.wpsc-pos-right .wpsc-cta-bubble::before {
    right: 24px; /* وسط دکمه */
    left: auto;
    bottom: -6px;
    top: auto;
    border-width: 6px 6px 0 6px;
    border-color: #fff transparent transparent transparent; /* فلش رو به پایین */
}

/* 3. وسط (Floating Center) */
#wpsc-chat-widget.wpsc-pos-center {
    left: 50%;
    transform: translateX(-50%);
    bottom: 20px;
}
#wpsc-chat-widget.wpsc-pos-center #wpsc-chat-box {
    left: 50%;
    transform: translateX(-50%) scale(1);
    transform-origin: bottom center;
    bottom: 80px;
}
#wpsc-chat-widget.wpsc-pos-center #wpsc-chat-box.hidden {
    transform: translateX(-50%) scale(0.9) translateY(20px);
}
#wpsc-chat-widget.wpsc-pos-center .wpsc-cta-bubble {
    bottom: 75px; /* بالای دکمه */
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
}
#wpsc-chat-widget.wpsc-pos-center .wpsc-cta-bubble.hidden-bubble {
    transform: translateX(-50%) translateY(10px);
    opacity: 0;
    visibility: hidden;
}
#wpsc-chat-widget.wpsc-pos-center .wpsc-cta-bubble::before {
    left: 50%;
    bottom: -6px;
    top: auto;
    transform: translateX(-50%);
    border-width: 6px 6px 0 6px;
    border-color: #fff transparent transparent transparent;
}


/* --- استایل دکمه --- */
#wpsc-toggle-btn {
    background-color: var(--wpsc-main-color);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    padding: 0;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
}

#wpsc-toggle-btn:hover {
    transform: translateY(-3px) scale(1.1);
    background-color: var(--wpsc-main-color-dark);
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}
/* برای حالت وسط که transform دارد، هاور متفاوت است */
#wpsc-chat-widget.wpsc-pos-center #wpsc-toggle-btn:hover {
    transform: scale(1.1);
}

.wpsc-icon-wrapper svg {
    width: 30px;
    height: 30px;
    fill: currentColor;
}

/* --- حباب CTA --- */
.wpsc-cta-bubble {
    position: absolute;
    background: #fff;
    color: #333;
    padding: 10px 15px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    font-size: 13px;
    font-weight: 500;
    border: 1px solid #eee;
    transition: all 0.3s ease;
    z-index: 9998;
}

.wpsc-cta-bubble.hidden-bubble {
    opacity: 0;
    visibility: hidden;
}

/* --- باکس چت --- */
#wpsc-chat-box {
    position: absolute;
    bottom: 80px;
    width: 380px;
    max-width: 90vw;
    height: 550px;
    max-height: 80vh;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: 1px solid #f0f0f0;
    opacity: 1;
}

#wpsc-chat-box.hidden {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transform: scale(0.9) translateY(20px); /* پیش‌فرض برای چپ و راست */
}

/* هدر چت */
.wpsc-header {
    background: linear-gradient(135deg, #333, #555);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 2;
}

.wpsc-title-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wpsc-avatar {
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.wpsc-avatar svg { width: 20px; height: 20px; fill: #fff; }

.wpsc-title {
    font-weight: 700;
    font-size: 15px;
    display: flex;
    align-items: center;
}

.wpsc-header-online-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #4caf50;
    border-radius: 50%;
    margin-right: 8px;
    box-shadow: 0 0 6px rgba(76, 175, 80, 0.8);
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7); }
    70% { box-shadow: 0 0 0 6px rgba(76, 175, 80, 0); }
    100% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0); }
}

.wpsc-subtitle {
    font-size: 11px;
    opacity: 0.8;
    display: block;
}

#wpsc-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: rgba(255,255,255,0.8);
    padding: 0 4px;
}

#wpsc-close-btn:hover {
    color: white;
}

/* سایر استایل‌ها (بدون تغییر عمده) */
.wpsc-product-summary {
    background: #fcfcfc;
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 12px;
}
.wpsc-prod-thumb {
    width: 70px; /* تغییر: بزرگ‌تر شدن تصویر */
    height: 70px; /* تغییر: بزرگ‌تر شدن تصویر */
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}
.wpsc-prod-thumb img { width: 100%; height: 100%; object-fit: cover; }
.wpsc-prod-details { display: flex; flex-direction: column; gap: 4px; }
.wpsc-prod-name { font-size: 13px; font-weight: bold; color: #333; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.wpsc-prod-price { font-size: 12px; color: var(--wpsc-main-color); font-weight: 700; }

#wpsc-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.wpsc-message {
    padding: 12px 16px;
    border-radius: 12px;
    max-width: 85%;
    font-size: 14px;
    line-height: 1.7;
    position: relative;
    animation: wpscFadeIn 0.3s ease;
}
@keyframes wpscFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.bot-message { background-color: #f5f5f5; color: #333; align-self: flex-start; border: 1px solid #eee; }
.user-message { background-color: #333; color: #fff; align-self: flex-end; }

/* استایل محصولات پیشنهادی */
.wpsc-similar-container {
    margin-top: 10px;
    border-top: 1px solid #eee;
    padding-top: 10px;
    background: #fafafa;
    border-radius: 0 0 12px 12px;
    padding-bottom: 5px;
}
.wpsc-similar-label {
    font-size: 12px;
    font-weight: bold;
    color: #555;
    margin: 0 10px 8px 10px;
    display: block;
}
.wpsc-similar-list {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 0 10px 10px 10px;
    scrollbar-width: thin;
}
.wpsc-similar-item {
    min-width: 110px;
    width: 110px;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 8px;
    text-decoration: none;
    background: #fff;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.wpsc-similar-item:hover {
    border-color: var(--wpsc-main-color);
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.wpsc-similar-img {
    width: 100%;
    height: 90px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 6px;
    background-color: #f9f9f9;
}
.wpsc-similar-title {
    font-size: 11px;
    color: #333;
    text-align: center;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 30px; 
}

.wpsc-input-area {
    padding: 15px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    background: #fff;
    align-items: flex-end;
}
#wpsc-user-input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    resize: none;
    height: 45px; /* تغییر: ارتفاع اولیه برای دو خط */
    min-height: 45px; /* تغییر: حداقل ارتفاع برای دو خط */
    max-height: 100px;
    font-family: inherit;
}
#wpsc-user-input:focus { border-color: var(--wpsc-main-color); }

/* اصلاح دکمه ارسال پیام */
#wpsc-send-btn {
    background: #333;
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}
#wpsc-send-btn svg {
    width: 20px;
    height: 20px;
    fill: #fff; /* اطمینان از سفید بودن آیکون */
}
#wpsc-send-btn:hover { background-color: var(--wpsc-main-color); transform: scale(1.05); }

.typing-indicator { display: flex; gap: 4px; padding: 8px 12px; align-items: center; height: 20px; }
.typing-dot { width: 6px; height: 6px; background: #999; border-radius: 50%; animation: wpscBounce 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 wpscBounce { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1); } }

@media (max-width: 480px) {
    #wpsc-chat-box { position: fixed; bottom: 0; left: 0; right: 0; width: 100%; height: 100%; max-width: 100%; max-height: 100%; border-radius: 0; z-index: 10000; transform: none !important; }
    #wpsc-chat-box.hidden { transform: translateY(100%) !important; visibility: hidden; }
}