.chat-sidebar { min-width: 240px; background: #fff; display: flex; flex-direction: column;z-index: 1; }
.sidebar-header { display: flex; align-items: center; justify-content: space-between; padding: 22px 20px 10px 20px; font-weight: bold; font-size: 1.14rem; }
.sidebar-header .bi { font-size: 1.6rem; color: #664de5; background: #f5f5ff; border-radius: 50%; padding: 4px; cursor: pointer; }
.sidebar-search { padding: 0 20px 12px 20px;     margin-top: 23px;}
.sidebar-search input { width: 100%; padding: 10px 12px; border: none; border-radius:var(--roundfilter); background: #f6f6f8; font-size: 1rem; outline: none; margin-top: 2px; }
.chat-list { flex: 1; overflow-y: auto; padding: 0 0 10px 0; }
.chat-list-user { display: flex; align-items: flex-start; gap: 12px; padding: 14px 20px; cursor: pointer; transition: background .16s; border: none; background: transparent; border-left: 4px solid transparent; position: relative; }
.chat-list-user.active, .chat-list-user:hover { background: #f6f6fa; }
.chat-list-user img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; margin-top: 2px; }
.chat-list-user .sidebar-user-content { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.chat-list-user .sidebar-user-content .user-name { font-weight: 600; font-size: 1rem; margin-bottom: 1px; }
.chat-list-user .sidebar-user-content .user-last-message { font-size: .97rem; color: #757575; line-height: 1.2; }
.chat-list-user .sidebar-user-content .user-labels { margin-top: 6px; display: flex; gap: 4px; }
.user-label { display: inline-block; font-size: .83rem; padding: 2px 8px 2px 8px; border-radius: 8px; background: #f5f5ff; color: #664de5; font-weight: 500; }
.user-label.green { background: #eafbf4; color: #22a27b;}
.user-label.yellow { background: #fffbe5; color: #c7a600;}
.user-label.pink   { background: #ffe5f3; color: #c766a0;}
.user-label.blue   { background: #e7f1ff; color: #2276c7;}
.user-label.gray   { background: #eee; color: #888;}
.sidebar-user-time { font-size: .93rem; color: #bababa; margin-left: 2px; margin-top: 2px; min-width: 56px; text-align: right;}
.chat-main { display: flex; flex-direction: column; background: #fafbfc; }
.chat-main-header { display: flex; align-items: center; justify-content: space-between; padding: 7px 15px 4px 23px; border-bottom: 1px solid #f1f1f1; min-height: 72px; gap: 14px;background: white; }
.chat-main-header .chat-main-user { display: flex; align-items: center; gap: 10px; }
.chat-main-header .chat-main-user img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.chat-main-header .user-name { font-weight: 600; font-size: 1.1rem; margin-bottom: 1px; }
.chat-main-header .user-online { font-size: .93rem; color: #22a27b; font-weight: 500; display: flex; align-items: center; gap: 3px; }
.chat-messages { flex: 1; padding: 18px 28px 16px 28px; overflow-y: auto; display: flex; flex-direction: column; gap: 9px; }
.chat-message-row { display: flex; align-items: flex-end; margin-bottom: 3px; }
.chat-message-row.me { flex-direction: row-reverse; justify-content: flex-end; }
.chat-message-row.you { flex-direction: row; justify-content: flex-end; }
.chat-message {     background: #ffffff;
    color: #1a1a1a; border-radius: 14px; padding: 3px 16px; max-width: 60%; font-size: 1rem; position: relative; margin-bottom: 3px; word-break: break-word; box-shadow: 0 1px 2px 0 #e5e5e5; }
.chat-message-row.me .chat-message {     background: #dfffdf;
    color: #000000; align-items: flex-end; text-align: right;
    /* margin-right: 8px;  */
}
.chat-message-row.me .avatar { margin-left: 8px; margin-right: 0; }
.chat-message-row.you .chat-message { margin-left: 8px; }
.chat-message-row .avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.chat-message.attach {
    padding: 7px 12px !important; background: #f7fff7b5 !important; color: #14532d; border: 1.5px dashed #6ee7b7; display: flex; align-items: center; gap: 8px; border-radius: 10px; font-size: .97rem;
}
.chat-message.attach img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; }
.chat-message.attach .file-info { flex:1; overflow:hidden;}
.chat-message.attach .file-name { font-weight: 600; text-overflow:ellipsis; white-space:nowrap; overflow: hidden; }
.chat-message.attach .file-type { font-size: .90rem; color: #999; }
.chat-input-row { display: flex; align-items: center; border-top: 1px solid #f1f1f1; background: #fff; padding: 12px 22px; gap: 9px; min-height: 60px; }
.chat-input-row input[type="text"] { flex: 1; padding: 10px 16px; border: none; border-radius: 14px; background: #f6f6f8; font-size: 1rem; outline: none; margin-left: 4px; }
.chat-input-row .bi-paperclip { color: black; font-size: 1.4rem; cursor: pointer; transition: color .18s; }
.dark-theme .chat-input-row .bi-paperclip{
    color: white;
}
.chat-input-row .send-btn { color: #ffffff; background: none; border: none; font-size: 1.45rem; padding: 4px 8px; border-radius: 50%; cursor: pointer; transition: background .17s; }
.chat-input-row .send-btn i{ position: relative;top: 4px;}
.chat-input-row .send-btn{
background: #00a884;
}
/* .chat-input-row .send-btn:hover { background: #f5f5ff;} */
/* دکمه بستن سفارشی */
.btn-close-custom {
    background: #f6626b !important;
    width: 35px;
    height: 35px;
    line-height: 1px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    box-shadow: 0 2px 12px #ffebeb;
    /* font-size: 1.7rem; */
    z-index: 9999;
    transition: background .18s;
}
#chatMessengerModal{
    z-index: 9999;
}
.btn-close-custom i { color: #fff; font-size: 1.5em; }
.btn-close-custom:hover { background: #ee1e43 !important;}
@media (max-width: 950px) {
    .chat-sidebar { width: 200px; min-width: 145px; }
    .chat-main-header { padding-left: 12px; padding-right: 12px;}
    .chat-messages { padding-left: 8px; padding-right: 8px;}
}
@media (max-width: 700px) {
    .modal-fullscreen { padding: 0 !important;}
    .chat-sidebar { position: fixed; right: 0; top: 0; height: 100vh; width: 100vw; max-width: 100vw; z-index: 2; background: #fff; transition: all .3s; box-shadow:0 0 12px #ececec;}
    .chat-sidebar.hide { display:none !important;}
    .chat-main { flex: 1; width: 100vw;}
    #mainChatCol { display: none; }
    #mainChatCol.active { display: flex; }
}
.chat-input-row{ position:relative; }
/* منوی لیست آگهی‌ها */
.agahi-dropdown a.agahi-chat{
    display:flex;gap:10px;padding:8px;border-radius:10px;
    text-decoration:none;color:inherit;transition:background .15s;
}
.agahi-dropdown a.agahi-chat:hover{background:var(--surface-soft);}
.agahi-dropdown img{width:48px;height:48px;object-fit:cover;border-radius:6px;}
.agahi-dropdown .file-name{font-weight:600;font-size:.93rem;color: black;}
.agahi-dropdown .file-type{font-size:.88rem;color:var(--text-muted);}
.dark-theme .agahi-dropdown .file-name{color: white;}
.chat-main {
    height: 85vh; /* یا 100% اگر در container محدود داری */
    max-height: 100vh;
    border-top: 1px solid #dee2e6;
}
.dark-theme .chat-main {

    border-top: 1px solid #414141;
}

#chatMessagesWrap {
    flex: 1;
    overflow-y: auto;
    min-height: 0; /* این نکته‌ی طلاییه برای جلوگیری از کش اومدن flex */
    background: linear-gradient(to top left, #d7dbb9db, #87b489e6,#87b489e6, #d2d78ded);
    /* background: linear-gradient(to top left, #d7dbb9db, #87b489e6,#87b489e6, #d2d78ded), url(/assets/images/space.svg); */
}


.dark-theme .chat-sidebar::after{
    content: "";
    /* background: url(/assets/images/space.svg); */
    display: block;
    background-image: url(/assets/images/space.svg);
    /* background-size: cover; */
    filter: invert(1);
    background-position: center;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0.05;
    z-index: 0;

}
.chat-sidebar::after {
    content: "";
    /* background: url(/assets/images/space.svg); */
    display: block;
    background-image: url(/assets/images/space.svg);
    /* background-size: cover; */
    background-position: center;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0.08;
    z-index: 0;
}
#chatMessagesWrap::after {
    content: "";
    /* background: url(/assets/images/space.svg); */
    display: block;
    background-image: url(/assets/images/space.svg);
    /* background-size: cover; */
    background-position: center;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0.1;
    z-index: 0;
}

.dark-theme #chatMessagesWrap{
    background: linear-gradient(to top left, #000000, #0e061c, #110c1b, #000000);
}
.dark-theme #chatMessagesWrap::after{
    content: "";
    /* background: url(/assets/images/space.svg); */
    display: block;
    background-image: url(/assets/images/space.svg);
    /* background-size: cover; */
    filter: invert(1);
    background-position: center;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0.1;
    z-index: 0;
}
#online-status{
    font-size: 14px;
}
#siteFooter {
  
    margin-top: 0px !important;
}
.dark-theme .border-end {
    border-left: var(--bs-border-width) var(--bs-border-style) #414141 !important;
}