#mlclich-chat-widget {
    display: none;
    position: fixed;
    z-index: 999999;
    font-family: 'IRANSans', 'Tahoma', 'Segoe UI', sans-serif;
    direction: rtl;
    /* این کانتینر خودش نباید هیچ کلیکی را جذب کند — فقط عناصر واقعی و قابل مشاهده
       داخلش (دکمه و پاپ‌آپ) که پایین‌تر صراحتاً pointer-events را دوباره فعال
       می‌کنند، کلیک‌پذیر هستند. این یک لایه‌ی محافظتی اضافه است تا حتی در صورت
       بروز یک باگ چیدمان در آینده، این ویجت هرگز روی بقیه‌ی صفحه کلیک‌ها را
       نگیرد و لینک‌های سایت را غیرقابل‌کلیک نکند. */
    pointer-events: none;
}
#mlclich-chat-widget .mlclich-chat-button,
#mlclich-chat-widget .mlclich-chat-popup {
    pointer-events: auto;
}
.mlclich-chat-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(0,0,0,0.25);
    transition: transform 0.25s cubic-bezier(.34,1.56,.64,1), box-shadow 0.2s;
    position: relative;
}
.mlclich-chat-button:hover {
    transform: scale(1.06);
    box-shadow: 0 12px 28px rgba(0,0,0,0.3);
}
.mlclich-chat-button:active {
    transform: scale(0.96);
}
.mlclich-pulse-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(255,255,255,0.55);
    animation: mlclich-pulse 2.6s ease-out infinite;
    pointer-events: none;
}
@keyframes mlclich-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(255,255,255,0.45); }
    70%  { box-shadow: 0 0 0 14px rgba(255,255,255,0); }
    100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); }
}
.mlclich-chat-icon, .mlclich-close-icon {
    position: absolute;
    transition: transform 0.28s ease, opacity 0.2s ease;
}
.mlclich-close-icon {
    opacity: 0;
    transform: scale(0.4) rotate(-90deg);
}
.mlclich-chat-icon {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}
#mlclich-chat-widget.open .mlclich-chat-icon {
    opacity: 0;
    transform: scale(0.4) rotate(90deg);
}
#mlclich-chat-widget.open .mlclich-close-icon {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}
#mlclich-chat-widget.open .mlclich-pulse-ring {
    display: none;
}
.mlclich-unread-badge {
    position: absolute;
    top: -4px;
    left: -4px;
    background: #e53935;
    color: #fff;
    border-radius: 50%;
    min-width: 20px;
    height: 20px;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 0 0 2px #fff;
    animation: mlclich-badge-pop 0.3s ease;
}
@keyframes mlclich-badge-pop {
    0%   { transform: scale(0); }
    70%  { transform: scale(1.2); }
    100% { transform: scale(1); }
}
.mlclich-system-notice {
    background: #fff3cd;
    color: #664d03;
    border: 1px solid #ffe69c;
    border-radius: 12px;
    padding: 8px 12px;
    font-size: 0.8rem;
    margin: 6px 0;
    align-self: center;
    text-align: center;
    max-width: 90%;
}
.mlclich-typing-indicator {
    font-size: 0.75rem;
    color: #94a3b8;
    padding: 0 15px 6px;
    min-height: 16px;
}
.mlclich-name-prompt {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 12px 14px;
    margin: 8px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    align-self: stretch;
}
.mlclich-name-prompt-text {
    font-size: 13px;
    color: #334155;
    margin-bottom: 8px;
}
.mlclich-name-prompt-row {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
}
.mlclich-name-prompt-row input {
    flex: 1;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: 7px 10px;
    font-size: 13px;
    direction: rtl;
    outline: none;
    font-family: inherit;
}
.mlclich-name-prompt-row button {
    box-sizing: border-box;
    border: none;
    margin: 0;
    background: #2271b1;
    color: #fff;
    padding: 7px 14px !important;
    min-height: 0 !important;
    border-radius: 10px;
    font-size: 12.5px;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
}
.mlclich-name-prompt #mlclich-name-skip {
    box-sizing: border-box;
    border: none;
    margin: 0;
    background: transparent;
    display: block;
    width: 100%;
    text-align: center;
    font-size: 11.5px;
    font-family: inherit;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px !important;
    min-height: 0 !important;
}
.mlclich-name-prompt #mlclich-name-skip:hover {
    color: #64748b;
    text-decoration: underline;
}
.mlclich-chat-popup {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 360px;
    height: 480px;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 24px 48px rgba(15,23,42,0.18), 0 4px 12px rgba(15,23,42,0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, transform 0.25s cubic-bezier(.2,.9,.3,1);
    transform: translateY(16px) scale(0.98);
    transform-origin: bottom left;
}
#mlclich-chat-widget.open .mlclich-chat-popup {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}
.mlclich-chat-header {
    padding: 16px 18px;
    color: white;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.mlclich-chat-header-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.mlclich-chat-header-text {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}
.mlclich-chat-title {
    font-weight: 700;
    font-size: 14.5px;
    line-height: 1.3;
}
.mlclich-chat-subtitle {
    font-size: 11.5px;
    opacity: 0.85;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
}
.mlclich-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.3);
    flex-shrink: 0;
}
.mlclich-chat-close {
    box-sizing: border-box !important;
    background: rgba(255,255,255,0.16);
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
    color: white;
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
    min-height: 30px !important;
    border-radius: 50% !important;
    cursor: pointer;
    font-size: 15px;
    font-family: inherit;
    flex-shrink: 0;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background 0.15s;
}
.mlclich-chat-close:hover {
    background: rgba(255,255,255,0.3) !important;
}
.mlclich-chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: #f7f8fa;
    display: flex;
    flex-direction: column;
    scrollbar-width: thin;
}
.mlclich-chat-messages::-webkit-scrollbar {
    width: 6px;
}
.mlclich-chat-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 10px;
}
.message {
    max-width: 78%;
    margin-bottom: 10px;
    clear: both;
    animation: mlclich-msg-in 0.2s ease;
}
@keyframes mlclich-msg-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.message.user {
    align-self: flex-end;
    text-align: right;
}
.message.admin {
    align-self: flex-start;
    text-align: left;
}
.message .bubble {
    display: inline-block;
    padding: 9px 14px;
    border-radius: 16px;
    word-wrap: break-word;
    line-height: 1.55;
    font-size: 13.5px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.message.user .bubble {
    background: #eef0f3;
    color: #1e293b;
    border-bottom-right-radius: 4px;
}
.message.admin .bubble {
    color: #fff;
    border-bottom-left-radius: 4px;
}
.message-time {
    font-size: 0.68rem;
    margin-top: 3px;
    color: #94a3b8;
    display: block;
}
.mlclich-chat-input-area {
    display: flex;
    align-items: flex-end;
    padding: 12px;
    border-top: 1px solid #eef0f3;
    background: white;
    gap: 8px;
    flex-shrink: 0;
    position: relative;
}
.mlclich-chat-input-area textarea {
    flex: 1;
    border: 1.5px solid #e2e8f0;
    border-radius: 20px;
    padding: 9px 14px;
    resize: none;
    font-family: inherit;
    direction: rtl;
    font-size: 13.5px;
    max-height: 90px;
    transition: border-color 0.15s;
    outline: none;
}
.mlclich-chat-input-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.mlclich-chat-send {
    box-sizing: border-box !important;
    border: none !important;
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    border-radius: 50% !important;
    cursor: pointer;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0;
    color: #fff;
    transition: transform 0.15s, background 0.15s;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1 !important;
    gap: 0 !important;
}
.mlclich-chat-send svg {
    width: 18px !important;
    height: 18px !important;
    pointer-events: none;
    display: block !important;
    flex-shrink: 0;
}
.mlclich-chat-send:active {
    transform: scale(0.92);
}
.mlclich-chat-send:disabled {
    opacity: 0.6;
    cursor: default;
}
.mlclich-product-picker-btn {
    display: none;
    box-sizing: border-box !important;
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
    min-height: 30px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 50% !important;
    cursor: pointer;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0;
    color: #64748b;
    background: #f1f5f9;
    transition: background 0.15s, color 0.15s;
    line-height: 1 !important;
    gap: 0 !important;
}
.mlclich-product-picker-btn.mlclich-visible {
    display: flex !important;
}
.mlclich-product-picker-btn svg {
    width: 16px !important;
    height: 16px !important;
    display: block !important;
    flex-shrink: 0;
    pointer-events: none;
}
.mlclich-product-picker-btn:hover {
    background: #e2e8f0;
    color: #334155;
}
.mlclich-product-picker-popup {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 12px;
    right: 12px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    max-height: 240px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 5;
}
.mlclich-product-picker-search {
    border: none;
    border-bottom: 1px solid #eef0f3;
    padding: 10px 14px;
    font-size: 13px;
    direction: rtl;
    outline: none;
    flex-shrink: 0;
}
.mlclich-product-picker-list {
    overflow-y: auto;
    flex: 1;
}
.mlclich-product-picker-item {
    padding: 9px 14px;
    font-size: 13px;
    cursor: pointer;
    direction: rtl;
    border-bottom: 1px solid #f8fafc;
}
.mlclich-product-picker-item:hover {
    background: #f1f5f9;
}
.mlclich-product-picker-empty {
    padding: 14px;
    font-size: 12.5px;
    color: #94a3b8;
    text-align: center;
}
@media (max-width: 480px) {
    .mlclich-chat-popup {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        height: 100% !important;
        border-radius: 0 !important;
        transform: translateY(100%) !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    #mlclich-chat-widget.open .mlclich-chat-popup {
        transform: translateY(0) !important;
    }
    .mlclich-chat-header {
        padding-top: max(16px, env(safe-area-inset-top));
    }
    .mlclich-chat-button {
        width: 56px;
        height: 56px;
    }
}