/* ==========================================================
   ویجت چت مشتری — «از ما بپرسید»
   ========================================================== */

:root {
    --chat-primary: rgba(33, 64, 154, 1);
    --chat-bg: #f5f5f5;
}

#aral-chat-widget {
    position: fixed;
    bottom: 115px;
    right: 50px;
    z-index: 9999;
    font-family: inherit;
    direction: rtl;
}

/* دکمه شناور — دایره‌ی بزرگ (با سه نقطه) روی پیل متنی */
.aral-chat-toggle {
    position: relative;
    display: flex;
    align-items: center;
    direction: ltr; /* چیدمان ثابت گرافیکی، مستقل از جهت صفحه */
    height: 78px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    transition: transform 0.2s ease;
}

.aral-chat-toggle:hover {
    transform: scale(1.03);
}

.aral-chat-pill {
    direction: rtl;
    display: flex;
    align-items: center;
    height: 45px;
    background: #142C71DE;
    color: #fff;
    font-size: 15px;
    font-weight: 400;
    white-space: nowrap;
    padding: 0 40px 0 30px;
    border-radius: 20px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
}

.aral-chat-toggle:hover .aral-chat-pill {
    background: #585858;
}

.aral-chat-icon-circle {
    position: relative;
    margin-left: -34px;
    z-index: 2;
    width: 82px;
    height: 82px;
    flex-shrink: 0;
}

.aral-bubble {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.22));
}

.aral-bubble-shape {
    fill: #1A3D7C;
    stroke: #fff;
    stroke-width: 4;
    stroke-linejoin: miter;
    stroke-miterlimit: 10;
}

.aral-bubble-dot {
    fill: #fff;
}

/* هاور: بردر گرادیانت */
.aral-chat-toggle:hover .aral-bubble-shape {
    stroke: url(#aralBubbleGrad);
}




.aral-chat-toggle .aral-chat-badge {
    position: absolute;
    top: 2px;
    left: 2px;
    z-index: 3;
    background: #e8442f;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.aral-chat-toggle .aral-chat-badge.is-visible {
    display: flex;
}

/* پنل چت */
.aral-chat-panel {
    position: absolute;
    bottom: 92px;
    right: 0;
    width: 320px;
    max-width: calc(100vw - 32px);
    height: 480px;
    max-height: calc(100vh - 140px);
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.aral-chat-panel.is-open {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

/* هدر */
.aral-chat-header {
    background: #1A3D7C;
    color: #fff;
    padding: 0px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.aral-chat-header-title {
    font-size: 15px;
}

.aral-chat-header-status {
    font-size: 11.5px;
    opacity: 0.85;
}

.aral-chat-close {
    background: #1A3D7C;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
}

/* بدنه پیام‌ها */
.aral-chat-messages {
    flex: 1;
    overflow-y: auto;
    background: var(--chat-bg);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.aral-chat-empty {
    margin: auto;
    text-align: center;
    color: #999;
    font-size: 13px;
    padding: 0 20px;
}

.aral-msg {
    max-width: 78%;
    padding: 9px 12px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.6;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.aral-msg.from-visitor {
    align-self: flex-end;
    background: var(--chat-primary);
    color: #fff;
    border-bottom-left-radius: 4px;
}

.aral-msg.from-admin {
    align-self: flex-start;
    background: #fff;
    color: #222;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border-bottom-right-radius: 4px;
}

.aral-msg-time {
    display: block;
    font-size: 10px;
    opacity: 0.65;
    margin-top: 4px;
}

/* فوتر / اینپوت */
.aral-chat-footer {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #eee;
    background: #fff;
}

.aral-chat-icon-btn {
    background: transparent;
    border: none;
    color: #999;
    font-size: 16px;
    cursor: pointer;
    flex-shrink: 0;
    padding: 4px;
}

.aral-chat-icon-btn:hover {
    color: var(--chat-primary);
}

/* پنل ایموجی */
.aral-chat-emoji-wrap {
    position: relative;
    flex-shrink: 0;
}

.aral-chat-emoji-panel {
    position: absolute;
    bottom: 38px;
    right: -8px;
    width: 220px;
    max-height: 180px;
    overflow-y: auto;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
    padding: 8px;
    display: none;
    grid-template-columns: repeat(6, 1fr);
    gap: 2px;
    z-index: 10;
}

.aral-chat-emoji-panel.is-open {
    display: grid;
}

.aral-chat-emoji-panel button {
    background: transparent;
    border: none;
    font-size: 19px;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    line-height: 1;
}

.aral-chat-emoji-panel button:hover {
    background: #f0f1f3;
}

/* پیوست داخل حباب پیام */
.aral-msg-attachment-img {
    display: block;
    max-width: 100%;
    border-radius: 10px;
    margin-bottom: 6px;
}

.aral-msg-attachment-file {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: inherit;
    text-decoration: underline;
    font-size: 12.5px;
    margin-bottom: 4px;
}

.aral-chat-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 13px;
    padding: 8px 4px;
    background: transparent;
    font-family: inherit;
}

.aral-chat-send {
    background: var(--chat-primary);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: opacity 0.2s ease;
}

.aral-chat-send:disabled {
    opacity: 0.5;
    cursor: default;
}

@media (max-width: 400px) {
    #aral-chat-widget {
        right: 12px;
        bottom: 12px;
    }

    .aral-chat-panel {
        width: calc(100vw - 24px);
    }
}
