.tgu-channel-wrap{
    direction: rtl;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    border-radius: 0;
    overflow: hidden;
    background: #0f0f10;
    position: relative;
    box-sizing: border-box;

    /* برای جلوگیری از فضای خالی و مدیریت درست ارتفاع */
    display: flex;
    flex-direction: column;
}

/* نوار لود بالایی */
.tgu-load-top{
    display: none;
    text-align: center;
    padding: 10px 12px;
    font-size: 12px;
    color: #cfcfcf;
    background: rgba(255,255,255,0.05);
    position: sticky;
    top: 0;
    z-index: 5;
    backdrop-filter: blur(6px);
    flex: 0 0 auto;
}

.tgu-load-top.is-visible{
    display: block;
}

/* بدنه اصلی چت */
.tgu-channel{
    height: 75vh;
    min-height: 420px;
    max-height: 78vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 14px 10px 18px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 8px;

    /* برای اینکه داخل فلکس درست جمع شود و فضای خالی نسازد */
    flex: 1 1 auto;
    min-height: 0;

    /* بک گراند شبیه تلگرام */
    background-color: #0e1621;
    background-image:
        radial-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
        radial-gradient(rgba(255,255,255,0.02) 1px, transparent 1px);
    background-size: 24px 24px, 48px 48px;
    background-position: 0 0, 12px 12px;

    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.18) transparent;
}

.tgu-channel::-webkit-scrollbar{
    width: 8px;
}
.tgu-channel::-webkit-scrollbar-track{
    background: transparent;
}
.tgu-channel::-webkit-scrollbar-thumb{
    background: rgba(255,255,255,0.16);
    border-radius: 999px;
}
.tgu-channel::-webkit-scrollbar-thumb:hover{
    background: rgba(255,255,255,0.28);
}

/* هر پیام */
.tgu-message{
    display: flex;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* حباب پیام مثل تلگرام */
.tgu-bubble{
    position: relative;
    margin-left: auto;
    margin-right: 0;
    display: inline-block;
    width: fit-content;
    max-width: min(78%, 620px);
    min-width: 160px;
    background: linear-gradient(180deg, #1f2c3a 0%, #1a2632 100%);
    color: #ffffff;
    border-radius: 18px 18px 6px 18px;
    padding: 10px 12px 10px;
    box-sizing: border-box;
    box-shadow:
        0 1px 1px rgba(0,0,0,0.25),
        0 6px 18px rgba(0,0,0,0.18);
    border: 1px solid rgba(255,255,255,0.05);
}

/* نوک حباب در سمت راست */
.tgu-bubble::after{
    content: "";
    position: absolute;
    right: -6px;
    bottom: 0;
    width: 14px;
    height: 14px;
    background: #1a2632;
    border-bottom-left-radius: 12px;
    clip-path: polygon(0 0, 100% 100%, 0 100%);
}

/* محتوای پیام */
.tgu-content{
    color: #ffffff;
    font-size: 15px;
    line-height: 1.75;
    font-weight: 400;
    text-align: right;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.tgu-content p{
    margin: 0 0 8px;
}
.tgu-content p:last-child{
    margin-bottom: 0;
}

.tgu-content a{
    color: #7cc7ff;
    text-decoration: none;
}
.tgu-content a:hover{
    text-decoration: underline;
}

.tgu-content img{
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin-top: 8px;
}

.tgu-content video,
.tgu-content iframe{
    display: block;
    max-width: 100%;
    border-radius: 12px;
    margin-top: 8px;
}

/* اگر هنوز از PHP حذف نشده باشند، با CSS هم مخفی شوند */
.tgu-meta,
.tgu-reactions,
.tgu-react-btn,
.tgu-emoji,
.tgu-count{
    display: none !important;
}

/* موبایل */
@media (max-width: 768px){
    .tgu-channel-wrap{
        border-radius: 0;
    }

    .tgu-channel{
        height: 72vh;
        min-height: 360px;
        max-height: 72vh;
        padding: 10px 8px 14px;
        gap: 7px;
    }

    .tgu-bubble{
        max-width: 86%;
        min-width: 120px;
        padding: 9px 11px;
        border-radius: 16px 16px 6px 16px;
    }

    .tgu-content{
        font-size: 14px;
        line-height: 1.7;
    }
}

/* موبایل خیلی کوچک */
@media (max-width: 480px){
    .tgu-channel{
        height: 70vh;
        min-height: 320px;
        padding: 8px 6px 12px;
    }

    .tgu-bubble{
        max-width: 90%;
        min-width: 100px;
        padding: 8px 10px;
    }

    .tgu-content{
        font-size: 13.5px;
        line-height: 1.65;
    }
}