/* --- Fonts --- */
@font-face {
    font-family: 'Dana';
    src: url('/assets/fonts/dana.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* --- Base --- */
html, body { 
    height: 100%; 
    margin: 0; 
    overscroll-behavior-y: contain; 
}
body { background: #e3e8f3; font-family: 'Dana', sans-serif; }

@media(min-width:768px) { body { overflow: hidden; } }

/* --- نوار اسکرول سفید و قرارگیری در سمت چپ --- */
#box, #recentList {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.8) transparent;
    unicode-bidi: bidi-override;
    direction: ltr;
    overscroll-behavior-y: contain;
}

#box > *, #recentList > * {
    direction: rtl;
}

#box::-webkit-scrollbar, #recentList::-webkit-scrollbar { width: 6px; }
#box::-webkit-scrollbar-track, #recentList::-webkit-scrollbar-track { background: transparent; }
#box::-webkit-scrollbar-thumb, #recentList::-webkit-scrollbar-thumb { 
    background-color: rgba(255, 255, 255, 0.9); 
    border-radius: 10px; 
}

/* --- Sidebar & Conversation List --- */
.sidebar-head {
    padding: 10px;
    border-bottom: 1px solid #e6e6e6;
    background: #e2eefd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.conv {
    padding: 14px 16px;
    background: #ffffffc7;
    cursor: pointer;
    position: relative;
    transition: background .2s ease;
    border-bottom: 1px dashed #d6d6d6;
    color: #333;
    overflow: hidden;
}

.conv:hover { background: #f5f7fa; }
.conv.active { background: #eef3ff !important; border-right: 4px solid #001b5e; }
.conv.unread { background: #eef3ff; }

.badge-unread {
    background: #2ecc71;
    color: white;
    border-radius: 50%;
    padding: 2px 7px;
    font-size: 0.75rem;
    font-weight: bold;
    min-width: 22px;
    text-align: center;
}

.conv .small {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

/* --- Chat Header --- */
.chat-head {
    background: #f7f7f7;
    padding: 0;
    border-bottom: 1px solid #ddd;
    display: flex;
    align-items: stretch;
}

#backBtn {
    width: 60px;
    min-width: 60px;
    align-self: stretch; /* کل ارتفاع */
    background-color: rgba(0, 0, 0, 0.03);
    border: none;
    border-left: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    cursor: pointer;
    padding: 0;
    margin: 0;
}

#backBtn:hover {
    background-color: rgba(0, 0, 0, 0.08);
}

#backBtn:active {
    background-color: rgba(0, 0, 0, 0.12);
}

#backBtn i {
    font-size: 28px;
    color: #333;
}

/* بخش آواتار و اطلاعات */
.chat-head > div:first-child {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
        min-height: 72px;
}

.chat-info {
    display: flex;
    flex-direction: column;
    justify-content: center;

    
}

/* دکمه تنظیمات گروه */
#groupActions {
    padding: 0 15px;
    display: flex;
    align-items: center;
}

#groupActions button {
    border-radius: 6px;
    transition: all 0.2s ease;
}

#groupActions button:hover {
    background-color: rgba(0, 0, 0, 0.05);
    border-color: #aaa;
}
@media (min-width: 768px) {

    .chat-head > div:first-child {
        padding: 0 10px;
    }
}


/* --- Chat Box & Bubbles --- */
.form-control:focus {
    box-shadow: none !important;
    outline: none !important;
    border-color: #e5e3e3 !important;
}
.input-group>:not(:first-child):not(.dropdown-menu):not(.valid-tooltip):not(.valid-feedback):not(.invalid-tooltip):not(.invalid-feedback) {
    margin-right: 0 !important;
}

#box {
    flex: 1;
    min-height: 0;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    -webkit-overflow-scrolling: touch;

    background-image: url('/assets/img/bg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}


textarea[id="msg"] {
  max-height: 100px;
}

/* استایل پایه (دسکتاپ و تبلت) */
.msg {
    width: fit-content;
    min-width: 30%;
    max-width: 75%;
    padding: 8px 12px;
    border-radius: 12px;
    margin: 8px 0;
    position: relative;
    transition: all 0.2s ease;
    word-break: break-word;
    overflow-wrap: break-word;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.me { 
    background: #d9fdd3; 
    align-self: flex-end; 
    margin-left: auto; 
    margin-right: 0; 
    border-bottom-right-radius: 2px; 
}

.other { 
    background: #fff; 
    align-self: flex-start; 
    margin-right: auto; 
    margin-left: 0; 
    border-bottom-left-radius: 2px; 
}

/* --- تنظیمات مخصوص موبایل (صفحه‌های کوچکتر از 576 پیکسل) --- */
@media (max-width: 576px) {
    .msg {
        max-width: 90%;    /* در موبایل پیام‌ها عریض‌تر شوند */
        min-width: 45%;    /* جلوگیری از خیلی کوچک شدن حباب پیام */
        padding: 6px 10px; /* پدینگ کمتر برای فضای بیشتر */
        font-size: 14px;   /* اندازه فونت بهینه برای موبایل */
    }

    /* اگر از کارت‌های تصویر یا ویدیو استفاده می‌کنید */
    .msg-image-card, .msg-video-card {
        max-width: 100% !important; /* کارت‌ها کل عرض مجاز پیام را پر کنند */
        width: 100%;
    }
    
    #box {
  scrollbar-width: none;
}

}


/* ---------------- Message ---------------- */

.mobile-inline-actions {
    display: none;
}

@media (max-width: 768px) {

    /* منوی قدیمی hover کاملاً حذف */
    .msg-actions {
        display: none !important;
    }

    /* پیش‌فرض: مخفی */
    .mobile-inline-actions {
        display: none;
    }

    /* فقط وقتی show-actions روی msg باشه، نمایش بده */
    .msg.show-actions .mobile-inline-actions {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        margin: 0 6px;
        background: rgba(255, 255, 255, 0.08);
        border: 1px solid rgba(0, 0, 0, 0.1);
        border-radius: 20px;
        padding: 3px 6px;
    }

    .msg-action-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 28px;
        height: 28px;
        border-radius: 50% !important;
        cursor: pointer;
        transition: background 0.15s ease, transform 0.1s ease;
        border: none !important;
        background: transparent !important;
    }

    .msg-action-btn:active {
        transform: scale(0.88);
        background: rgba(0, 0, 0, 0.1) !important;
    }

    .msg-action-btn i {
        font-size: 15px !important;
        line-height: 1;
    }

    .msg-action-btn + .msg-action-btn {
        border-right: 1px solid rgba(0, 0, 0, 0.08) !important;
        border-radius: 0 !important;
        padding-right: 4px;
    }

    [data-bs-theme="dark"] .msg.show-actions .mobile-inline-actions {
        background: rgba(255, 255, 255, 0.06);
        border-color: rgba(255, 255, 255, 0.12);
    }

    [data-bs-theme="dark"] .msg-action-btn + .msg-action-btn {
        border-right-color: rgba(255, 255, 255, 0.1) !important;
    }
}


/* ---------------- Message Actions Container ---------------- */

.msg-actions{
    position:absolute;
    top:50%;
    transform:translateY(-50%);

    display:flex;
    flex-direction:column;
    gap:6px;

    z-index:10;

    opacity:0;
    transition:opacity .2s ease;

    /* مهم‌ترین تغییر */
    pointer-events:auto;
}

/* position */

.me .msg-actions{
    left:-40px;
}

.other .msg-actions{
    right:-40px;
}


/* show on hover (desktop) */

.msg:hover .msg-actions{
    opacity:1;
}


/* ---------------- Buttons ---------------- */

/* Buttons */
.btn-reply-msg,
.btn-delete-msg{
    background:#fff;
    border:1px solid #ddd;
    border-radius:50%;
    width:30px;
    height:30px;
    display:flex;
    align-items:center;
    justify-content:center;
    cursor:pointer;
}

/* hover effect */

.btn-reply-msg:hover,
.btn-delete-msg:hover{
    transform:scale(1.08);
    box-shadow:0 3px 6px rgba(0,0,0,0.18);
}


/* colors */

.btn-reply-msg{
    color:#0d6efd;
}

.btn-delete-msg{
    color:#dc3545;
}


/* ---------------- Mobile ---------------- */

@media (max-width: 768px) {

    .msg {
        position: relative !important;
        cursor: pointer;
        display: block !important;
    }

    .msg-actions {
        display: none !important;
    }

    .me { margin-left: auto !important; margin-right: 5px !important; }
    .other { margin-right: auto !important; margin-left: 5px !important; }

    .msg .msg-content {
        transition: all 0.2s ease;
    }

    .msg.show-actions .msg-content {
        opacity: 0.3;
        filter: blur(1.5px);
    }

}


/* ---------------- Reply Bubble ---------------- */

.reply-in-msg{
    background:rgba(0,0,0,0.06);
    border-right:3px solid #0d6efd;
    padding:6px 10px;
    border-radius:8px;
    margin-bottom:6px;
    font-size:0.8rem;
    cursor:pointer;
    max-width:100%;
    color:#555;
}

.reply-name{
    font-weight:bold;
    color:#0d6efd;
    font-size:0.75rem;
    display:block;
    margin-bottom:2px;
}


/* --- انیمیشن هایلایت حرفه‌ای و نرم --- */
.highlight-msg { 
    animation: smooth-highlight 3s ease-in-out forwards; 
}

@keyframes smooth-highlight {
    0% { background-color: rgba(255, 213, 79, 0.9); box-shadow: 0 0 15px rgba(255, 213, 79, 0.5); transform: scale(1.02); }
    30% { background-color: rgba(255, 213, 79, 0.4); transform: scale(1); }
    100% { background-color: transparent; box-shadow: 0 0 0px transparent; }
}

.time {
    font-size: 10px;
    opacity: .6;
    margin-top: 4px;
    display: flex;
    gap: 4px;
    justify-content: flex-end;
}

.tick { font-size: 11px; }
.tick.seen { color: #0d6efd; }

/* --- Input Area & Preview --- */
#reply-preview {
    display: none;
    background: #ffffff;
    border-right: 5px solid #0d6efd;
    padding: 10px 15px;
    border-top: 1px solid #ddd;
}

.chat-input {
    border-top: 1px solid #ccc;
    background: #f7f7f7;
    position: relative;
    flex-shrink: 0;
    bottom: 0;
    z-index: 20;
}

/* --- Components --- */
#welcomeScreen { display: flex; flex-direction: column; align-items: center; justify-content: center; flex-grow: 1; text-align: center; color: #888; background: #ffffff; }
#welcomeScreen i { font-size: 5rem; color: #f0f0f0; margin-bottom: 15px; }

/* یکپارچه‌سازی وضعیت آنلاین */
.online-indicator-me { 
    width: 10px; height: 10px; border-radius: 50%; 
    display: inline-block; transition: all 0.3s ease; 
}
.online-indicator-me.online { 
    background-color: #2ecc71; 
    box-shadow: 0 0 8px #2ecc71; 
    animation: pulse-me 2s infinite; 
}
.online-indicator-me.offline { 
    background-color: #95a5a6; 
    box-shadow: none; 
    animation: none; 
}

.online-dot { width: 9px; height: 9px; background-color: #2ecc71; border-radius: 50%; display: inline-block; border: 1px solid #fff; }
.sel-user { background: #0d6efd; color: #fff; padding: 2px 8px; border-radius: 12px; font-size: 0.8rem; margin: 2px; display: inline-block; }

/* --- دکمه پایین‌بر --- */
.go-down-btn {
    position: absolute;
    bottom: 95px;
    left: 20px;
    width: 50px; 
    height: 50px;
    background: #0d6efd;
    color: #fff;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    border: 3px solid #fff;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.go-down-btn i { font-size: 1.8rem; line-height: 0; display: block; }
.go-down-btn:hover { transform: scale(1.15) translateY(-5px); background: #0b5ed7; }

@media (max-width: 768px) {
    .go-down-btn { bottom: 85px; left: 15px; width: 45px; height: 45px; }
}

/* --- Admin Settings & Invitation UI --- */
.settings-item { 
    display: flex; justify-content: space-between; align-items: center; 
    padding: 15px; background: #f8f9fa; border-radius: 10px; margin-bottom: 15px; border: 1px solid #eee; 
}
.settings-label { font-size: 0.9rem; font-weight: bold; color: #333; }

.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { 
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; 
    background-color: #ccc; transition: .4s; border-radius: 24px; 
}
.slider:before { 
    position: absolute; content: ""; height: 18px; width: 18px; 
    left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; 
}
input:checked + .slider { background-color: #0d6efd; }
input:checked + .slider:before { transform: translateX(20px); }

#invitation-popup { 
    position: fixed; bottom: 30px; left: 20px; width: 320px; 
    background: #ffffff; border-right: 5px solid #0d6efd; border-radius: 12px; 
    box-shadow: 0 15px 50px rgba(0,0,0,0.2); z-index: 9999; padding: 18px; 
    transform: translateX(-150%); transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
}
#invitation-popup.active { transform: translateX(0); }
.invite-btn-group { display: flex; gap: 10px; margin-top: 15px; }
.invite-btn { flex: 1; border: none; padding: 8px; border-radius: 8px; font-size: 0.85rem; cursor: pointer; font-weight: bold; }

/* --- Animations --- */
.connection-flash { animation: flash-confirm 0.6s ease-out !important; }

@keyframes pulse-me {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(46, 204, 113, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(46, 204, 113, 0); }
}

@keyframes flash-confirm {
    0% { filter: brightness(1); transform: scale(1); }
    50% { filter: brightness(1.8); transform: scale(1.4); box-shadow: 0 0 15px #2ecc71; }
    100% { filter: brightness(1); transform: scale(1); }
}

#activeTokenBox{
    word-break: break-all;
    overflow-wrap: anywhere;
    white-space: normal;
    direction: ltr;
    text-align: left;
    font-family: monospace;
}
/* wrapper */
.emoji-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
}

/* emoji picker */
.emoji-picker {
    width: 100%;
    background: #fff;
    border: 1px solid #dee2e6;
    border-bottom: 0;
    overflow: hidden;
    animation: emojiOpen .15s ease;
}

/* open animation */
@keyframes emojiOpen {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* tabs */
.emoji-tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    padding: 6px 8px;
    background: #fff;
    border-bottom: 1px solid #eee;
    overflow-x: auto;
    overflow-y: hidden;
}

/* scrollbar tabs */
.emoji-tabs::-webkit-scrollbar {
    height: 4px;
}

.emoji-tabs::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 10px;
}

/* tab */
.emoji-tab {
    flex-shrink: 0;
    font-size: 20px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 8px;
    transition: .15s;
}

/* hover */
.emoji-tab:hover {
    background: #f1f3f5;
}

/* active */
.emoji-tab.active {
    background: #e9ecef;
}

/* emoji body */
.emoji-body {
    max-height: 140px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* scrollbar body */
.emoji-body::-webkit-scrollbar {
    width: 4px;
}

.emoji-body::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

/* groups */
.emoji-group {
    display: none;
    flex-wrap: wrap;
    gap: 6px;
}

.emoji-group.active {
    display: flex;
}

/* emoji item */
.emoji-item {
    font-size: 22px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 8px;
    transition: .15s;
}

/* hover effect */
.emoji-item:hover {
    background: #f1f3f5;
    transform: scale(1.15);
}

/* mobile */
@media (max-width: 768px) {
    .emoji-body {
        max-height: 140px;
        overflow-y: auto;
        overflow-x: hidden;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .emoji-body::-webkit-scrollbar {
        display: none;
    }

    .emoji-tabs {
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .emoji-tabs::-webkit-scrollbar {
        display: none;
    }

    .emoji-item {
        font-size: 24px;
        width: 36px;
        height: 36px;
    }
}


.app-version{
    font-size: 12px;
    color: #6c757d;
    background: #f1f3f5;
    padding: 2px 6px;
    border-radius: 6px;
    font-weight: 500;
}


.new-msg-divider{
    position: relative;
    text-align: center;
    margin: 18px 0;
    font-size: 12px;
    color: #6c757d;
    opacity: .9;
    animation: dividerFade 0.6s ease;
}

.new-msg-divider span{
    background: #fff;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
}

.new-msg-divider::before,
.new-msg-divider::after{
    content: "";
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: #dee2e6;
}

.new-msg-divider::before{
    left: 0;
}

.new-msg-divider::after{
    right: 0;
}

@keyframes dividerFade{
    from{
        opacity:0;
        transform:translateY(5px);
    }
    to{
        opacity:.9;
        transform:translateY(0);
    }
}


.copy-icon-btn {
    cursor: pointer;
    font-size: 11px;
    opacity: 0.5;
    transition: opacity 0.2s;
    vertical-align: middle;
}

.copy-icon-btn:hover {
    opacity: 1;
}

/* در صورت تمایل برای پنهان کردن آیکون در موبایل تا زمانی که روی پیام کلیک نشده */
.msg .time {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}


/* جلوگیری از انتخاب شدن متن */
.no-select {
    -webkit-user-select: none; /* Safari */
    -ms-user-select: none;     /* IE 10+ */
    user-select: none;         /* Standard syntax */
}

.fw-backdrop {
    position: fixed; z-index: 9999; left: 0; top: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center;
}
.fw-modal-card {
    background: #fff; width: 95%; max-width: 400px; border-radius: 18px; padding: 20px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.2); animation: fw-slideUp 0.3s ease;
}
.fw-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.fw-close-btn { border: none; background: #f1f3f5; width: 30px; height: 30px; border-radius: 50%; font-size: 20px; cursor: pointer; }

.fw-tags-container { display: flex; flex-wrap: wrap; gap: 6px; max-height: 90px; overflow-y: auto; margin-bottom: 10px; }
.fw-tag { 
    background: #e7f1ff; color: #0d6efd; padding: 4px 10px; border-radius: 50px; 
    font-size: 12px; font-weight: 500; display: flex; align-items: center; gap: 5px; border: 1px solid #cfe2ff;
}

.fw-search-wrapper { position: relative; margin-bottom: 12px; }
.fw-search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #adb5bd; }
.fw-input { 
    width: 100%; padding: 10px 15px 10px 35px; border-radius: 12px; border: 1px solid #dee2e6; 
    background: #f8f9fa; outline: none; transition: 0.2s;
}
.fw-input:focus { border-color: #0d6efd; background: #fff; box-shadow: 0 0 0 3px rgba(13,110,253,0.1); }

.fw-user-list { max-height: 200px; overflow-y: auto; border: 1px solid #f1f3f5; border-radius: 12px; }
.fw-user-item { 
    display: flex; justify-content: space-between; align-items: center; padding: 10px 15px; 
    cursor: pointer; border-bottom: 1px solid #f8f9fa; transition: 0.2s;
}
.fw-user-item:hover { background: #f0f7ff; }
.fw-user-item.active { background: #e7f1ff; color: #0d6efd; font-weight: 600; }

.fw-footer { display: flex; justify-content: space-between; margin-top: 15px; }
.fw-btn-primary { 
    background: #0d6efd; color: #fff; border: none; padding: 8px 20px; border-radius: 10px; 
    font-weight: 600; transition: 0.3s;
}
.fw-btn-primary:disabled { background: #dee2e6; cursor: not-allowed; }
.fw-btn-secondary { background: none; border: none; color: #6c757d; font-weight: 500; cursor: pointer; }

.fw-placeholder { padding: 20px; text-align: center; color: #adb5bd; font-size: 13px; }

@keyframes fw-slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* Modal Box */
.conn-error-content{
border:none;
border-radius:16px;
box-shadow:0 15px 40px rgba(0,0,0,0.2);
text-align:center;
padding:10px;
animation:connErrorPopup .35s ease;
}

/* Header */
.conn-error-header{
border:none;
justify-content:center;
font-weight:700;
color:#dc3545;
font-size:18px;
}

/* Body */
.conn-error-body{
padding:10px 25px;
}

.conn-error-icon{
font-size:50px;
margin-bottom:10px;
}

.conn-error-text{
color:#666;
font-size:14px;
line-height:1.7;
}

/* Footer */
.conn-error-footer{
border:none;
justify-content:center;
gap:10px;
padding-bottom:20px;
}

/* Retry Button */
.conn-error-retry{
background:#198754;
color:white;
padding:8px 20px;
border-radius:10px;
font-weight:600;
transition:.3s;
}

.conn-error-retry:hover{
transform:scale(1.05);
box-shadow:0 6px 15px rgba(0,0,0,0.2);
color:#622222;
}

/* Exit Button */
.conn-error-exit{
border:2px solid #dc3545;
color:#dc3545;
padding:8px 20px;
border-radius:10px;
font-weight:600;
transition:.3s;
text-decoration:none;
}

.conn-error-exit:hover{
background:#dc3545;
color:white;
transform:scale(1.05);
}

/* Animation */
@keyframes connErrorPopup{
from{
opacity:0;
transform:scale(.85);
}
to{
opacity:1;
transform:scale(1);
}
}

/* Responsive */
@media (max-width:576px){

.conn-error-content{
margin:15px;
}

.conn-error-text{
font-size:13px;
}

.conn-error-icon{
font-size:42px;
}

}


.btn-send{
    background: #001b5e;
    color: aliceblue;
}
.btn-send:hover {
    background: #0a40c6;
    color: aliceblue;

}

#net-warning-bar{

display:none;

background:#fff3cd;
color:#856404;

padding:6px 10px;

font-size:12px;

align-items:center;
justify-content:space-between;

opacity:0;
transition:opacity .2s ease;
}

#net-warning-bar.show{
display:flex;
opacity:1;
}

#my-online-status{
display:inline-block;
width:8px;
height:8px;
border-radius:50%;
background:#28a745;
margin-right:6px;
animation:netBlink 3s infinite;
}

@keyframes netBlink{
0%{opacity:1}
50%{opacity:.4}
100%{opacity:1}
}



.search-box {
background: #edf1ff;
}

.search-box .clear-btn{
    position:absolute;
    top:50%;
    left:20px;
    transform:translateY(-50%);
    font-size:22px;
    color:#999;
    cursor:pointer;
    display:none;
    line-height:1;
}

.search-box .clear-btn:hover{
    color:#333;
}

.search-box input:not(:placeholder-shown) + .clear-btn{
    display:block;
}


.date-divider {
    text-align: center;
    margin: 16px 0;
    position: relative;
}

.date-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, #dee2e6 20%, #dee2e6 80%, transparent);
}

.date-divider span {
    position: relative;
    display: inline-block;
    background: #f8f9fa;
    padding: 4px 16px;
    border-radius: 12px;
    font-size: 11px;
    color: #6c757d;
    font-weight: 500;
    z-index: 1;
}
.new-msg-badge {
    position: absolute;
    top: -8px;
    left: -8px;
    background: #5b6af0;
    color: #fff;
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 10px;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(91,106,240,0.35);
    pointer-events: none;
    white-space: nowrap;
}


#personalChatMenu {
    padding: 0 5px;
    align-items: center;
}

#personalChatMenu button {
    border-radius: 6px;
    transition: all 0.2s ease;
}

#personalChatMenu button:hover {
    background-color: rgba(0, 0, 0, 0.05);
    border-color: #aaa;
}
@media (min-width: 768px) {

    .chat-head > div:first-child {
        padding: 0 10px;
    }
}

#pendingFilePreview {
    display: none;
    background: #f3faff;
    border-right: 5px solid #0dd6fd;
    padding: 10px 15px;
    border-top: 1px solid #ddd;
}



/* ── Wrapper ── */
.conv-tabs-wrapper {
    padding: 8px 10px;
    background: #edf1ff;
    border-bottom: 1px solid #e8e8e8;
    flex-shrink: 0;
}

/* ── تب‌ها ── */
.conv-tabs {
    display: flex;
    gap: 6px;
    width: 100%;
}

.conv-tab {
    flex: 1;
    position: relative;
    padding: 7px 6px;
    border: 1.5px solid #dee2e6;
    border-radius: 20px;
    background: transparent;
    font-size: 12px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    color: #6c757d;
    transition: all 0.18s ease;
    white-space: nowrap;
    line-height: 1.3;
    text-align: center;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.conv-tab:hover {
    border-color: #0d6efd;
    color: #0d6efd;
    background: #f0f5ff;
}

.conv-tab.active {
    background: #0d6efd;
    border-color: #0d6efd;
    color: #fff;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(13,110,253,0.25);
}

/* ── بج روی تب ── */
.tab-badge {
    position: absolute;
    top: -6px;
    left: -5px;
    background: #dc3545;
    color: #fff;
    border-radius: 50px;
    font-size: 9px;
    min-width: 17px;
    height: 17px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    font-weight: 700;
    border: 2px solid #fff;
    line-height: 1;
    pointer-events: none;
}

/* ── پیام خالی بودن تب ── */
.empty-tab-msg {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #adb5bd;
    gap: 12px;
    user-select: none;
}

.empty-tab-msg .empty-icon {
    font-size: 40px;
    opacity: 0.45;
    line-height: 1;
}

.empty-tab-msg .empty-text {
    font-size: 13px;
    text-align: center;
    color: #adb5bd;
}

/* ── ریسپانسیو موبایل ── */
@media (max-width: 400px) {
    .conv-tab {
        font-size: 11px;
        padding: 6px 4px;
    }

    .conv-tabs {
        gap: 4px;
    }

    .tab-badge {
        min-width: 15px;
        height: 15px;
        font-size: 8px;
        top: -5px;
        left: -4px;
    }
}






#search-msg-loader {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 999;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.28s ease;
    pointer-events: none;
}

.sml-backdrop {
    position: absolute;
    inset: 0;
background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
-webkit-backdrop-filter: blur(4px);

}

.sml-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    background: #fff;
    border-radius: 18px;
    padding: 24px 32px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    min-width: 180px;
}

.sml-icon-wrap {
    width: 46px;
    height: 46px;
    animation: sml-spin 1.2s linear infinite;
}

.sml-icon-wrap svg {
    width: 100%;
    height: 100%;
}

@keyframes sml-spin {
    to { transform: rotate(360deg); }
}

.sml-lines {
    display: flex;
    flex-direction: column;
    gap: 7px;
    width: 130px;
}

.sml-lines span {
    display: block;
    height: 8px;
    border-radius: 99px;
    background: #eef0f7;
    position: relative;
    overflow: hidden;
}

.sml-lines span:nth-child(2) { width: 75%; }
.sml-lines span:nth-child(3) { width: 50%; }

.sml-lines span::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, #c7d0f8 50%, transparent);
    animation: sml-shimmer 1.3s infinite;
}

.sml-lines span:nth-child(2)::after { animation-delay: 0.15s; }
.sml-lines span:nth-child(3)::after { animation-delay: 0.3s;  }

@keyframes sml-shimmer {
    from { transform: translateX(-100%); }
    to   { transform: translateX(200%);  }
}

.sml-text {
    font-size: 12.5px;
    color: #7a8499;
    margin: 0;
    white-space: nowrap;
}


.typing-indicator {
    font-size: 11px;
    color: #0d6efd;
    font-style: italic;
    animation: typingBlink 1.4s infinite;
}

@keyframes typingBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}



/* --- استایل نوار ضبط صدا (Recording Bar) --- */
#recordingBar {
    display: none; /* پیش‌فرض مخفی */
    align-items: center;
    gap: 15px;
    background: #fff5f5; /* تم قرمز بسیار ملایم */
    border-top: 1px solid #ffe3e3;
    padding: 10px 20px;
    transition: all 0.3s ease;
}

/* انیمیشن فقط برای نقطه قرمز */
.recording-dot {
    width: 12px;
    height: 12px;
    background-color: #ff4d4d;
    border-radius: 50%;
    box-shadow: 0 0 5px rgba(255, 77, 77, 0.5);
    animation: blink-dot 1s infinite ease-in-out;
}

@keyframes blink-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(1.1); }
}
#recordingBar {
    display: none; /* توسط JS مدیریت می‌شود */
    align-items: center;
    gap: 12px;
    background: #fdfdfd;
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
}

.recording-dot {
    width: 10px;
    height: 10px;
    background-color: #ff3b30;
    border-radius: 50%;
    animation: blink-dot 1s infinite ease-in-out;
}

@keyframes blink-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.3; transform: scale(1.2); }
}

/* --- کارت پیام صوتی (Voice Message Card) --- */
.voice-message-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f1f3f4;
    border-radius: 15px 15px 5px 15px;
    padding: 8px 12px;
   width: 100%;
       min-width: 210px;
    direction: ltr; /* جهت ثابت برای پلیر */
    margin: 5px 0;
}

.voice-play-btn {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border: none;
    background: #0084ff;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s;
}

.voice-play-btn:hover { background: #0073e6; }

.voice-progress-container {
    flex-grow: 1;
    height: 4px;
    background: #d1d1d1;
    border-radius: 2px;
    position: relative;
    cursor: pointer;
}

.voice-progress-bar {
    position: absolute;
    left: 0; top: 0; height: 100%;
    background: #0084ff;
    border-radius: 2px;
    width: 0%;
    pointer-events: none;
}

.voice-duration {
    font-size: 11px;
    color: #666;
    font-family: monospace;
    min-width: 32px;
}


.message-action-bar{

    display:none;

    width:100%;

    margin-top:8px;

    border-radius:16px;

    overflow:hidden;

    background:#fff;

    box-shadow:
        0 2px 10px rgba(0,0,0,.06);

    animation:msgActionsShow .16s ease;
}

.msg.mobile-actions-open .message-action-bar{
    display:flex;
}

.msg-action-btn{

    flex:1;

    height:46px;

    border:none;

    background:transparent;

    display:flex;
    align-items:center;
    justify-content:center;

    font-size:18px;

    transition:.15s;

    border-left:1px solid rgba(0,0,0,.06);
}

.msg-action-btn:last-child{
    border-left:none;
}

.msg-action-btn:active{
    background:rgba(0,0,0,.05);
    transform:scale(.96);
}

.msg-action-btn i{
    pointer-events:none;
}

.msg-action-btn.danger{
    color:#dc3545;
}

.msg-action-btn.success{
    color:#198754;
}

@keyframes msgActionsShow{

    from{
        opacity:0;
        transform:translateY(-5px);
    }

    to{
        opacity:1;
        transform:translateY(0);
    }
}

/* دسکتاپ */
@media (min-width:768px){

    .message-action-bar{
        display:none !important;
    }
}



/* ======================================================
 DESKTOP MESSAGE TOOLBAR
====================================================== */

/* wrapper */

.desktop-msg-tools {

  position: absolute;

  top: 50%;

  transform:
    translateY(-50%)
    scale(.96);

  opacity: 0;

  pointer-events: none;

  z-index: 999;

  padding: 10px;

  transition:
    opacity .15s ease,
    transform .15s ease;
}

/* own */

.msg.me .desktop-msg-tools {

  left: -58px;
}

/* other */

.msg.other .desktop-msg-tools {

  right: -58px;
}

/* hover */

.msg:hover .desktop-msg-tools,
.desktop-msg-tools:hover {

  opacity: 1;

  pointer-events: auto;

  transform:
    translateY(-50%)
    scale(1);
}

/* toolbar */

.desktop-msg-toolbar {

  display: flex;

  flex-direction: column;

  gap: 6px;

  padding: 6px;

  border-radius: 16px;

  background:
    rgba(255,255,255,.88);

  backdrop-filter:
    blur(14px);

  -webkit-backdrop-filter:
    blur(14px);

  border:
    1px solid rgba(255,255,255,.65);

  box-shadow:
    0 6px 18px rgba(0,0,0,.10);

  position: relative;
}

/* buttons */

.desktop-msg-tool-btn {

  width: 32px;

  height: 32px;

  border: none;

  outline: none;

  border-radius: 10px;

  background: transparent;

  display: flex;

  align-items: center;

  justify-content: center;

  cursor: pointer;

  position: relative;

  transition:
    background .15s ease,
    transform .15s ease,
    color .15s ease;
}

/* icons */

.desktop-msg-tool-btn i {

  font-size: 13px;
}

/* hover */

.desktop-msg-tool-btn:hover {

  transform: scale(1.06);
}

/* active */

.desktop-msg-tool-btn:active {

  transform: scale(.95);
}

/* reply */

.desktop-msg-tool-reply {

  color: #0d6efd;
}

.desktop-msg-tool-reply:hover {

  background:
    rgba(13,110,253,.12);
}

/* edit */

.desktop-msg-tool-edit {

  color: #d39e00;
}

.desktop-msg-tool-edit:hover {

  background:
    rgba(255,193,7,.14);
}

/* delete */

.desktop-msg-tool-delete {

  color: #dc3545;
}

.desktop-msg-tool-delete:hover {

  background:
    rgba(220,53,69,.12);
}

/* forward */

.desktop-msg-tool-forward {

  color: #198754;
}

.desktop-msg-tool-forward:hover {

  background:
    rgba(25,135,84,.12);
}

/* mobile */

@media (max-width:768px) {

  .desktop-msg-tools {
    display: none !important;
  }
}






.edit-bar {
  display: flex;
  align-items: center;
  gap: 10px;

  padding: 6px 12px;

  background: #fff8e1;
  border-top: 2px solid #ffc107;

  direction: rtl;

  font-family: "Dana";
  font-size: 0.8rem;

  color: #555;
}

.edit-bar-close {
  display: flex;
  align-items: center;
  justify-content: center;

  padding: 0;

  background: none;
  border: none;

  color: #f44336;

  cursor: pointer;

  font-size: 0.9rem;
  line-height: 1;

  transition: opacity 0.15s ease;
}

.edit-bar-close:hover {
  opacity: 0.7;
}

.edit-bar-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.edit-bar-text em {
  font-style: normal;
  color: #333;
}
