/* =====================================================
   Abara Live Chat Pro - Version 3.0
   فایل: include/abara-live-chat.css
   ===================================================== */

#abara-chat-pro,
#abara-chat-pro * {
    box-sizing: border-box;
}

#abara-chat-pro {
    --ac-primary: #a90e20;
    --ac-customer: #eef1f5;
    --ac-admin: #fcebed;
    --ac-radius: 18px;
    --ac-shadow: 0 18px 60px rgba(16, 24, 40, .18);
    direction: rtl;
    text-align: right;
    color: #263244;
    font-size: 14px;
}

/* دکمه شناور */

#ac-pro-toggle {
    position: fixed;
    z-index: 99998;
    right: 24px;
    bottom: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 52px;
    padding: 13px 21px;
    border: 0;
    border-radius: 50px;
    background: var(--ac-primary);
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(169, 14, 32, .25);
    transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}

#ac-pro-toggle:hover {
    transform: translateY(-3px);
    filter: brightness(1.08);
    box-shadow: 0 12px 30px rgba(169, 14, 32, .3);
}

#ac-pro-toggle i {
    font-size: 19px;
}

/* فقط آیکون */

#abara-chat-pro.ac-button-icon #ac-pro-toggle {
    width: 58px;
    height: 58px;
    padding: 0;
}

#abara-chat-pro.ac-button-icon #ac-pro-toggle span {
    display: none;
}

/* فقط متن */

#abara-chat-pro.ac-button-text #ac-pro-toggle i {
    display: none;
}

/* پنجره اصلی */

#ac-pro-panel {
    position: fixed;
    z-index: 99999;
    right: 24px;
    bottom: 90px;
    display: flex;
    flex-direction: column;
    width: min(390px, calc(100vw - 28px));
    height: 590px;
    max-height: calc(100vh - 110px);
    overflow: hidden;
    border: 1px solid #e9edf2;
    border-radius: var(--ac-radius);
    background: #fff;
    color: #263244;
    box-shadow: var(--ac-shadow);
    line-height: 1.8;
    animation: ac-panel-in .22s ease;
}

#ac-pro-panel[hidden],
#ac-pro-start[hidden],
#ac-pro-send[hidden],
#ac-pro-intro[hidden] {
    display: none !important;
}

@keyframes ac-panel-in {
    from {
        opacity: 0;
        transform: translateY(12px) scale(.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* سربرگ */

#ac-pro-panel header {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 78px;
    padding: 14px 16px;
    background: linear-gradient(
        135deg,
        var(--ac-primary),
        color-mix(in srgb, var(--ac-primary), #ffffff 18%)
    );
    color: #fff;
}

#ac-pro-panel header span {
    flex: 1;
    min-width: 0;
}

#ac-pro-panel header b,
#ac-pro-panel header small {
    display: block;
}

#ac-pro-panel header b {
    font-size: 15px;
    font-weight: 800;
    line-height: 1.7;
}

#ac-pro-panel header small {
    margin-top: 2px;
    color: rgba(255, 255, 255, .8);
    font-size: 11px;
}

#ac-pro-panel header button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .17);
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    transition: background .2s ease;
}

#ac-pro-panel header button:hover {
    background: rgba(255, 255, 255, .3);
}

.ac-pro-avatar {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border: 2px solid rgba(255, 255, 255, .65);
    border-radius: 50%;
    object-fit: cover;
}

/* بخش معرفی */

#ac-pro-intro {
    padding: 13px 17px 10px;
    background: #fff;
}

#ac-pro-intro h3 {
    margin: 2px 0 5px;
    color: #263244;
    font-size: 15px;
    font-weight: 800;
}

#ac-pro-intro p {
    margin: 0;
    color: #7b8795;
    font-size: 12px;
    line-height: 1.9;
}

/* پیام‌ها */

#ac-pro-messages {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 4px;
    min-height: 0;
    overflow-y: auto;
    padding: 14px;
    background: #f8fafc;
    scrollbar-width: thin;
    scrollbar-color: #cbd3df transparent;
}

#ac-pro-messages::-webkit-scrollbar {
    width: 5px;
}

#ac-pro-messages::-webkit-scrollbar-thumb {
    border-radius: 10px;
    background: #cbd3df;
}

.ac-pro-message {
    display: flex;
    align-items: flex-end;
    gap: 7px;
    margin: 5px 0;
}

.ac-pro-message.customer {
    justify-content: flex-start;
}

.ac-pro-message.admin {
    justify-content: flex-end;
}

.ac-pro-msg-avatar {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    border-radius: 50%;
    object-fit: cover;
}

.ac-pro-bubble {
    max-width: 82%;
    padding: 10px 13px;
    border-radius: 14px;
    background: var(--ac-customer);
    color: #303b4b;
    font-size: 13px;
    line-height: 1.9;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.ac-pro-message.customer .ac-pro-bubble {
    border-bottom-right-radius: 4px;
}

.ac-pro-message.admin .ac-pro-bubble {
    border-bottom-left-radius: 4px;
    background: var(--ac-admin);
    color: #651923;
}

.ac-pro-bubble a {
    color: #1769aa;
    text-decoration: underline;
    overflow-wrap: anywhere;
}

.ac-pro-bubble small {
    display: block;
    margin-top: 5px;
    color: #8993a0;
    font-size: 10px;
    text-align: left;
}

.ac-file-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #1769aa;
    font-weight: 700;
    text-decoration: none !important;
}

.ac-file-link::before {
    content: "\f15b";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
}

.ac-file-link:hover {
    text-decoration: underline !important;
}

/* فرم شروع گفتگو */

#ac-pro-start {
    display: flex;
    flex-direction: column;
    gap: 11px;
    padding: 14px 16px;
    border-top: 1px solid #edf0f4;
    background: #fff;
}

#ac-pro-panel label {
    display: block;
    color: #4c5868;
    font-size: 12px;
    font-weight: 600;
}

#ac-pro-panel input:not([type="file"]) {
    display: block;
    width: 100%;
    min-width: 0;
    height: 43px;
    margin-top: 5px;
    padding: 9px 12px;
    border: 1px solid #dfe4eb;
    border-radius: 10px;
    outline: none;
    background: #fff;
    color: #263244;
    font: inherit;
    font-size: 13px;
    transition: border-color .2s ease, box-shadow .2s ease;
}

#ac-pro-panel input:not([type="file"]):focus {
    border-color: var(--ac-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ac-primary), transparent 88%);
}

#ac-pro-panel input::placeholder {
    color: #a2aab5;
}

#ac-pro-start button {
    width: 100%;
    min-height: 43px;
    padding: 10px 15px;
    border: 0;
    border-radius: 10px;
    background: var(--ac-primary);
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: filter .2s ease, transform .2s ease;
}

#ac-pro-start button:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

/* فرم ارسال پیام */

#ac-pro-send {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 12px;
    border-top: 1px solid #edf0f4;
    background: #fff;
}

#ac-pro-send input[name="message"] {
    flex: 1;
    width: 100%;
    min-width: 0;
    height: 43px;
    margin: 0 !important;
    padding: 9px 12px !important;
    border: 1px solid #e0e5ec !important;
    border-radius: 12px !important;
    background: #f9fafb !important;
    font-size: 13px !important;
}

#ac-pro-send input[name="message"]:focus {
    border-color: var(--ac-primary) !important;
    background: #fff !important;
}

/* دکمه پیوست */

#ac-pro-send .ac-attach {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    margin: 0;
    border-radius: 11px;
    background: #f1f3f6;
    color: #667085;
    font-size: 17px;
    cursor: pointer;
    transition: all .2s ease;
}

#ac-pro-send .ac-attach:hover {
    background: #e8ebf0;
    color: var(--ac-primary);
}

/* دکمه ارسال */

#ac-pro-send button[type="submit"] {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 43px;
    height: 43px;
    flex: 0 0 43px;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: var(--ac-primary);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    transition: transform .2s ease, filter .2s ease;
}

#ac-pro-send button[type="submit"]:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

/* وضعیت و خطا */

#ac-pro-error {
    min-height: 0;
    padding: 0 14px;
    color: #b42332;
    font-size: 11px;
    line-height: 1.8;
}

#ac-pro-error:not(:empty) {
    padding-top: 5px;
    padding-bottom: 5px;
}

/* پایین پنجره */

#ac-pro-panel p {
  padding: 7px 12px;
  border-top: 1px solid #f0f2f5;
  background: #fff;
  color: #98a1ad;
  font-size: 10px;
  text-align: center;
}

/* =====================================================
   پنل مدیریت
   ===================================================== */

.abara-pro-admin {
    color: #263244;
    font-family: inherit;
}

.abara-pro-admin h1 {
    margin-bottom: 20px;
    font-size: 24px;
    font-weight: 800;
}

.ac-settings,
.ac-pro-card {
    margin: 16px 0;
    padding: 20px;
    border: 1px solid #e7ebf0;
    border-radius: 15px;
    background: #fff;
    box-shadow: 0 5px 22px rgba(23, 43, 69, .04);
}

.ac-settings h2 {
    margin: 12px 0 18px;
    padding-bottom: 10px;
    border-bottom: 1px solid #edf0f4;
    color: #263244;
    font-size: 16px;
    font-weight: 800;
}

.ac-settings p {
    margin: 10px 0;
}

.ac-settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    max-width: 1000px;
}

.ac-setting-field {
    display: flex !important;
    flex-direction: column;
    gap: 6px;
    color: #475467 !important;
    font-size: 12px !important;
}

.ac-setting-field input[type="text"],
.ac-setting-field input[type="number"],
.ac-setting-field textarea,
.ac-setting-field select {
    width: 100%;
    max-width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid #dfe4eb;
    border-radius: 8px;
    background: #fff;
    color: #263244;
    font: inherit;
}

.ac-setting-field textarea {
    resize: vertical;
}

.ac-setting-field input[type="color"] {
    width: 70px;
    height: 40px;
    padding: 3px;
    border: 1px solid #dfe4eb;
    border-radius: 8px;
    background: #fff;
}

.ac-avatar-setting {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 15px 0;
}

#ac-avatar-preview {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
}

/* چیدمان پنل مدیریت */

.ac-pro-grid {
    display: grid;
    grid-template-columns: minmax(250px, 32%) minmax(0, 1fr);
    gap: 16px;
    max-width: 1450px;
}

.ac-pro-card {
    min-width: 0;
}

.ac-pro-card h2 {
    margin: 0 0 14px;
    font-size: 16px;
    font-weight: 800;
}

.ac-pro-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.ac-pro-heading h2 {
    margin: 0;
}

/* فهرست گفتگوها */

#ac-list {
    max-height: 620px;
    overflow-y: auto;
}

.ac-row {
    display: block;
    width: 100%;
    margin: 7px 0;
    padding: 12px;
    border: 1px solid #edf0f4;
    border-radius: 11px;
    background: #fff;
    color: #263244;
    font: inherit;
    text-align: right;
    cursor: pointer;
    transition: background .2s ease, border-color .2s ease;
}

.ac-row:hover,
.ac-row.active {
    border-color: #cbd7e5;
    background: #f7f9fc;
}

.ac-row strong {
    display: block;
    font-size: 13px;
}

.ac-row small,
.ac-row span {
    display: block;
    margin-top: 5px;
    color: #7b8795;
    font-size: 11px;
    overflow-wrap: anywhere;
}

.ac-row .ac-product-label {
    color: #a20f22;
    font-weight: 700;
}

.ac-product-open {
    display: inline-block;
    margin-top: 6px;
    color: #1769aa;
    font-size: 11px;
    text-decoration: none;
}

/* تاریخچه گفتگو */

.ac-pro-thread {
    height: 440px;
    margin-top: 16px;
    padding: 14px;
    overflow-y: auto;
    border: 1px solid #edf0f4;
    border-radius: 12px;
    background: #fafbfd;
}

.ac-admin-message {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin: 10px 0;
}

.ac-admin-message.customer {
    justify-content: flex-start;
}

.ac-admin-message.admin {
    justify-content: flex-end;
}

.ac-admin-message img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
}

.ac-bubble {
    max-width: 78%;
    padding: 10px 13px;
    border-radius: 13px;
    background: #f0f2f5;
    color: #263244;
    font-size: 13px;
    line-height: 1.8;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.ac-admin-message.admin .ac-bubble {
    background: #e8f6ed;
}

.ac-bubble a {
    color: #1769aa;
    text-decoration: underline;
    overflow-wrap: anywhere;
}

.ac-bubble small {
    display: block;
    margin-top: 5px;
    color: #8993a0;
    font-size: 10px;
}

.ac-bubble .ac-file-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #1769aa;
    text-decoration: none;
}

/* فرم پاسخ مدیر */

.ac-pro-card #ac-reply {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

.ac-pro-card #ac-reply input[type="text"] {
    flex: 1;
    min-width: 0;
    height: 42px;
    padding: 9px 12px;
    border: 1px solid #dce3ec;
    border-radius: 9px;
    background: #fff;
    font: inherit;
}

.ac-pro-card #ac-reply input:focus {
    border-color: #9aaabd;
    outline: none;
}

.ac-pro-card #ac-reply button {
    min-height: 40px;
    padding: 8px 15px;
    border-radius: 9px;
}

.ac-admin-attach {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    margin: 0;
    border: 1px solid #dce3ec;
    border-radius: 9px;
    background: #f8fafc;
    color: #667085;
    font-size: 17px !important;
    cursor: pointer;
}

.ac-admin-attach:hover {
    background: #edf2f7;
    color: var(--ac-primary, #a90e20);
}

/* دکمه‌ها و حالت غیرفعال */

#ac-pro-panel button:disabled,
.ac-pro-card button:disabled {
    opacity: .55;
    cursor: not-allowed;
}

/* واکنش‌گرایی */

@media (max-width: 782px) {
    .ac-pro-grid {
        grid-template-columns: 1fr;
    }

    .ac-pro-thread {
        height: 55vh;
    }

    .ac-pro-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .ac-settings-grid {
        grid-template-columns: 1fr;
    }
}


@media (max-width: 480px) {
  #ac-pro-toggle {
    right: 12px;
    bottom: 70px;         
    padding: 5px 10px;
    min-height: 45px;
    font-size: 13px;
  }



    #abara-chat-pro.ac-button-icon #ac-pro-toggle {
        width: 54px;
        height: 54px;
    }

    #ac-pro-panel {
        right: 7px;
        bottom: 72px;
        width: calc(100vw - 14px);
        height: min(590px, calc(100vh - 85px));
        max-height: calc(100vh - 85px);
        border-radius: 16px;
    }

    .ac-pro-bubble {
        max-width: 88%;
    }

    .ac-settings,
    .ac-pro-card {
        padding: 13px;
    }

    .ac-pro-card #ac-reply {
        flex-wrap: wrap;
    }
}

/* کاهش انیمیشن برای کاربران حساس به حرکت */

@media (prefers-reduced-motion: reduce) {
    #ac-pro-panel,
    #ac-pro-toggle,
    #ac-pro-panel button {
        animation: none !important;
        transition: none !important;
    }
}


                    .ac-row.has-unread {
                        border-inline-start: 3px solid #1d71d8 !important;
                        background: #f0f6ff;
                    }

                    .ac-unread {
                        display: inline-flex !important;
                        align-items: center !important;
                        gap: 6px !important;
                        background: #1d71d8 !important;
                        color: #fff !important;
                        font-size: 12px !important;
                        line-height: 1.8 !important;
                        padding: 0 10px !important;
                        border-radius: 999px !important;
                        margin-inline-start: 8px !important;
                        white-space: nowrap !important;
                    }

                    .ac-unread::before {
                        content: '';
                        width: 8px !important;
                        height: 8px !important;
                        border-radius: 50% !important;
                        background: #fff !important;
                        flex: none !important;
                    }

                    #ac-total-unread {
                        display: none !important;
                        background: #1d71d8 !important;
                        color: #fff !important !important;
                        font-size: 12px !important;
                        font-weight: 400 !important;
                        padding: 1px 10px !important;
                        border-radius: 999px !important;
                        margin-inline-start: 8px !important;
                        vertical-align: middle !important;
                    }