/* =====================================================================
   chat.css — ظاهر جدید پنل چت و پیام خوش‌آمد (بعد از style.css بارگذاری می‌شود)
   دکمه‌های هاوردار و پنل منوی تماس همچنان در style.css هستند.
   ===================================================================== */

/* ---------- پیام خوش‌آمد (Teaser) ---------- */
#contactus .cu-teaser {
    position: absolute;
    bottom: calc(100% + 14px);
    right: 0;
    width: 230px;
    padding: 10px 14px 10px 30px;
    background: #fff;
    color: #333;
    border-radius: 14px 14px 4px 14px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, .22);
    cursor: pointer;
    text-align: right;
    direction: rtl;
    z-index: 1001;
    animation: cu-teaser-in .35s ease-out;
}

#contactus .cu-teaser::after {
    content: "";
    position: absolute;
    bottom: -7px;
    right: 22px;
    width: 14px;
    height: 14px;
    background: #fff;
    transform: rotate(45deg);
    box-shadow: 3px 3px 5px rgba(0, 0, 0, .08);
}

.cu-teaser-name {
    font-size: 11px;
    font-weight: 700;
    color: #0041c2;
    margin-bottom: 2px;
}

.cu-teaser-text {
    font-size: 14px;
    line-height: 1.7;
}

.cu-teaser-close {
    position: absolute;
    top: 4px;
    left: 6px;
    border: 0;
    background: transparent;
    color: #aaa;
    font-size: 18px;
    line-height: 1;
    padding: 2px 4px;
    cursor: pointer;
    outline: none;
}

.cu-teaser-close:hover {
    color: #555;
}

@keyframes cu-teaser-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- پنل چت ---------- */
#contactus .cu-chat-panel {
    width: 340px;
    max-height: none;
    height: 460px;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border-radius: 14px;
    direction: rtl;
}

.cu-chat-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: linear-gradient(135deg, #0041c2, #1a63ea);
    color: #fff;
}

.cu-chat-avatar {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #ff8a00;
    border: 2px solid rgba(255, 255, 255, .85);
    font-weight: 700;
    font-size: 16px;
    line-height: 34px;
    text-align: center;
}

.cu-chat-head-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    line-height: 1.5;
}

.cu-chat-head-text strong {
    font-size: 14px;
}

.cu-chat-head-text span {
    font-size: 12px;
    opacity: .9;
}

.cu-online-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-left: 5px;
    border-radius: 50%;
    background: #3ddc84;
    box-shadow: 0 0 0 2px rgba(61, 220, 132, .3);
}

#contactus .cu-chat-close {
    color: #fff;
    opacity: .8;
    font-size: 26px;
}

#contactus .cu-chat-close:hover {
    opacity: 1;
}

#contactus .cu-chat-messages {
    flex: 1;
    max-height: none;
    min-height: 0;
    overflow-y: auto;
    padding: 14px 12px;
    background: #f4f6fa;
    border-radius: 0;
}

#contactus .cu-bubble {
    max-width: 85%;
    border-radius: 14px;
    padding: 8px 12px;
    font-size: 14px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
}

#contactus .cu-me .cu-bubble {
    background: #0041c2;
    border: 0;
    color: #fff;
    border-bottom-right-radius: 4px;
}

#contactus .cu-me .cu-bubble .cu-bubble-time {
    color: rgba(255, 255, 255, .7);
}

#contactus .cu-them .cu-bubble {
    background: #fff;
    border: 0;
    color: #333;
    border-bottom-left-radius: 4px;
}

#contactus .cu-chat-error {
    margin: 0 10px 6px;
}

#contactus .cu-chat-input-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin: 0;
    padding: 10px;
    background: #fff;
    border-top: 1px solid #eceff4;
}

#contactus .cu-chat-input-row textarea {
    flex: 1;
    resize: none;
    max-height: 96px;
    padding: 8px 12px;
    font-size: 14px;
    line-height: 1.5;
    border: 1px solid #dde2ea;
    border-radius: 18px;
    background: #f7f9fc;
    outline: none;
}

#contactus .cu-chat-input-row textarea:focus {
    border-color: #1a63ea;
    background: #fff;
}

.cu-chat-send {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    background: #ff8a00;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    outline: none;
    transition: background .2s ease;
}

.cu-chat-send svg {
    transform: scaleX(-1); /* فلش به سمت چپ در رابط راست‌به‌چپ */
}

.cu-chat-send:hover {
    background: #e67a00;
}

.cu-chat-send:disabled {
    background: #ccc;
    cursor: default;
}

/* ---------- موبایل ---------- */
@media (max-width: 575px) {
    #contactus .cu-chat-panel {
        width: min(92vw, 340px);
        height: min(70vh, 460px);
        right: -10px;
    }

    #contactus .cu-teaser {
        width: min(70vw, 230px);
    }
}
