/* ===================== FONTS ===================== */

/* ایران‌یکان فَنام - وزن نرمال */
@font-face {
    font-family: 'IRANYekanFaNum';
    src: url('../../assets/fonts/iranyekanwebregularfanum.woff') format('woff');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* ایران‌یکان فَنام - بولد */
@font-face {
    font-family: 'IRANYekanFaNum';
    src: url('../../assets/fonts/iranyekanwebboldfanum.woff') format('woff');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* ایران‌سنس فَنام - بلک */
@font-face {
    font-family: 'IRANSansFaNum';
    src: url('../../assets/fonts/IRANSansWeb(FaNum)_Black.woff2') format('woff2');
    font-weight: 900;
    font-style: normal;
    font-display: swap;
}


/* ===================== GLOBAL ===================== */

body,input,select,button {
    margin: 0;
    font-family: 'IRANYekanFaNum', 'IRANSansFaNum', tahoma, sans-serif;
    background: #edf1f7;
    overflow: auto;
}

.chat-container {
    display: flex;
    height: 100vh;
}


/* ===================== SIDEBAR ===================== */

.sidebar {
    width: 330px;
    background: #ffffff;
    border-left: 1px solid #dcdfe6;
    box-shadow: 0 0 15px rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 14px 16px;
    border-bottom: 1px solid #eee;
    background: #0d6efd;
}

.sidebar-header-title {
    text-align:center;
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 8px;
}

#searchAll {
    border-radius: 10px;
    font-size: 14px;
    padding: 7px 10px;
    border: 1px solid #d9d9d9;
    transition: .2s;
}

#searchAll:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 3px rgba(13,110,253,0.15);
}

.channel-list {
    overflow-y: auto;
    flex: 1;
}

.channel-item {
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    border-bottom: 1px solid #f3f3f3;
    border-right: 3px solid transparent;
    background: #fff;
    transition: 0.2s;
}

.channel-item:hover {
    background: #eef5ff;
}

.channel-item.active {
    background: #e6f2ff;
    border-right: 4px solid #0d6efd;
    box-shadow: inset 0 0 4px rgba(13,110,253,0.2);
}

.channel-info {
    display: flex;
    flex-direction: column;
    max-width: 65%;
}

.channel-title {
    font-weight: 700;
    font-size: 15px;
    color: #222;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hashtag {
    color: #1da1f2;
    font-weight: 600;
    cursor: pointer;
}
.mention {
    color: #1da1f2;
    font-weight: 600;
    cursor: pointer;
}
.last-msg {
   
    margin-top:10px;
    font-size: 13px;

     white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.channel-meta {
    text-align: left;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
}

.channel-time {
    font-size: 11px;
    color: #999;
    white-space: nowrap;
}

.channel-meta .badge {
    background-color: rgb(10, 198, 48);
    color: #fff;
    border-radius: 999px;
    padding: 2px 7px;
    font-size: 13px;
    min-width: 18px;
    text-align: center;
    display: inline-block;
}


/* نتایج جستجو */
.search-result-msg {
    padding: 8px 14px 8px 28px;
    background: #f5f7ff;
    border-bottom: 1px dashed #e0e3ff;
}

.search-result-msg .msg-box {
    font-size: 12px;
    color: #333;
    line-height: 1.7;
}


/* ===================== CHAT AREA ===================== */

.chat-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f2f4f8;
}

.chat-header {
    height: 65px;
    background: #0d6efd;
    color: #fff;
    display: flex;
    align-items: center;
    padding: 0 15px;
    gap: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.chat-header-title {
    font-weight: 600;
    font-size: 16px;
    margin-left: auto;
}

.chat-header .back-btn {
    display: none;
    font-size: 20px;
    cursor: pointer;
}

.chat-header input {
    max-width: 210px;
    font-size: 13px;
    height: 34px;
    border-radius: 8px;
    border: none;
}

.chat-header input:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.4);
}

.messages-area {
    flex: 1;
    overflow-y: auto;
    background: #e8edf3;
    padding: 20px 15px !important;
    box-sizing: border-box !important;
}

.msg {
    width: 60vw;
    background: #fff;
    padding: 10px 13px;
    border-radius: 10px;
    margin-bottom: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    line-height: 1.7;
    position: relative;
}

.msg.unread {
    border-right: 4px solid #0d6efd;
    background: #f9fbff;
}

.msg-text {
    font-size: 16px;
    color: #222;
    white-space: pre-wrap;
}

.from-channel {
    font-size: 11px;
    color: #0d6efd;
    margin-bottom: 4px;
}

.msg-date {
    font-size: 11px;
    color: #666;
    margin-top: 5px;
    text-align: left;
}


/* ===================== MOBILE ===================== */

@media (max-width: 768px) {

    .sidebar {
        background: #ffffff !important;
        position: fixed !important;
        width: 100vw;
        top: 0;
        bottom: 0;
        height: 100vh;
    }

    body,
    .chat-container {
        overflow: hidden !important;
    }

    .messages-area {
        width: 100% !important;
        margin: 0 !important;
        padding: 15px !important;
    }

    .msg {
        width: 92vw;
    }

    .sidebar.closed {
        transform: translateX(100%);
    }

    .chat-header .back-btn {
        display: block;
    }

    .chat-header-title {
        font-size: 16px;
    }

    .chat-header input {
        max-width: 150px;
    }
}


/* ===================== LOADER ===================== */

.loader {
    width: 36px;
    height: 36px;
    border: 4px solid #e3e3e3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    margin: 15px auto;
    animation: spin 0.8s linear infinite;
}

.hidden {
    display: none !important;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}


/* ===================== HASHTAG ===================== */

.hashtag {
    color: #007bff;
    cursor: pointer;
    font-weight: 500;
}

.hashtag:hover {
    text-decoration: underline;
}
.msg-link{
    color:#0d6efd;
    text-decoration:none;
    font-weight:500;
    word-break: break-all;
    overflow-wrap: anywhere;
    display:inline-block;
    max-width:100%;
}

.msg-link:hover{
    text-decoration:underline;
}

.container {
    width: 80%;
    margin: 40px auto;
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}
h2 {
    margin-bottom: 25px;
}
.add-box {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
}
.input {
    flex: 1;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #aaa;
}
.btn {
    background: #1a73e8;
    border: none;
    padding: 12px 18px;
    border-radius: 8px;
    color: white;
    cursor: pointer;
}
.btn:hover {
    background: #0f5bd8;
}

.filters {
    margin-bottom: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table {
    width: 100%;
    border-collapse: collapse;
}
.table th {
    background: #1a73e8;
    color: white;
    padding: 12px;
    text-align: center;
}
.table td {
    padding: 12px;
    border-bottom: 1px solid #ddd;
    text-align: center;
}

.delete-btn {
    background: #d32f2f;
    padding: 8px 14px;
    color: white;
    border-radius: 7px;
    text-decoration: none;
}
.delete-btn:hover {
    background: #b71c1c;
}
.search-icon {
    position: absolute;
    right: 10px;
    left: auto;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    color: #888;
    pointer-events: none;
}
.search-wrapper{
    position: relative;
    width: 100%;
    margin-top:10px; 
}

.search-wrapper .search-input {
     text-align:center;
    width: 100%;
    padding-right: 32px;
    box-sizing: border-box;
}
.sidebar-header{
    position: relative;
}

.search-icon{
    position:absolute;
    right:10px;
    top:50%;
    transform:translateY(-50%);
}

#searchAll{
    padding-right:30px;
}
@media (max-width:768px){

    .chat-header{
       
        flex-wrap: wrap;
        height: auto;
        padding:10px;
        gap:8px;
    }

    .back-btn{
        position:absolute;
        
        top:10px;
        
    }

    .chat-header-title{
        width:100%;
        text-align:center;
        font-size:15px;
    }

   
  .chat-body{
        position: fixed;
        inset: 0;
        width:100vw;
        height:100vh;
        background:#f2f4f8;
        z-index:5;
    }

    .sidebar{
        z-index:10;
        transition: transform .25s ease;
    }

    .sidebar.closed{
        transform: translateX(100%);
    }


    .chat-header .search-wrapper{
        width:calc(50% - 5px);
        max-width:calc(50%);
    }
.chat-header input {
        max-width: 450px;
    }


    .msg-link{
        word-break: break-all;
        overflow-wrap: anywhere;
        max-width:100%;
    }

    .chat-body {
        max-height: 95vh;
        
    }
}
.clear-icon{
    position:absolute;
    left:8px;
    top:50%;
    transform:translateY(-50%);
    font-size:15px;
    color:#777;
    cursor:pointer;
    display:none; /* در حالت عادی مخفی */
}
.chat-header .search-wrapper{
    position:relative;
    max-width:210px;

}

.chat-header .search-wrapper input{
    width:100%;
    height:34px;
    border-radius:8px;
    border:none;
    padding-right:30px;
    font-size:13px;
}

.chat-header .search-wrapper .search-icon{
    position:absolute;
    right:8px;
    top:50%;
    transform:translateY(-50%);
    font-size:13px;
    color:#666;
    pointer-events:none;
}

/* ساختار جدید و ایزوله */
.sidebar-header{
    padding:15px;
}

/* ردیف بالا */
.header-top{
    display:flex;
    justify-content:space-between;
    align-items:center;
}

/* عنوان */
.header-title{
    color:#ffffff;
    font-weight:bold;
    font-size:15px;
}

/* دکمه خروج */
.logout-wrapper {
    text-align: right;
    margin-top: 6px;
}

.logout-btn {
    background: #f2f4f8;
    color: #333;
    border: none;
    font-size: 12px;
    padding: 4px;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.2s ease;
}

.logout-btn i {
    margin-top:3px;
    color:#e63946;
}

.logout-btn:hover {
    background: #e63946;
    color: white;
}

/* سرچ */
.header-search{
    margin-top:12px;
    position:relative;
}

.header-search input{
    width:100%;
    padding:8px 35px 8px 10px;
    border-radius:8px;
    border:1px solid #ddd;
}

.header-search i{
    position:absolute;
    right:10px;
    top:50%;
    transform:translateY(-50%);
    color:#888;
}

.title-box{
    display:flex;
    flex-direction:column;
}

.logged-user{
    font-size:12px;
    color:#333;
    cursor:pointer;
    margin-top:6px;
}

.logged-user i{
    margin-left:4px;
}
.ts-control {
    border-radius:8px !important;
    border:1px solid #ddd !important;
    padding:6px !important;
}

.ts-dropdown {
    border-radius:8px !important;
}

.ts-control .item {
    background:#4caf50 !important;
    color:#fff !important;
    border-radius:6px !important;
}
.center-image{
    display:block;
    margin-top:15vh;
    margin-right:auto;
    margin-left:auto;
    max-width:350px;
    opacity:0.9;
}
.request-fab{
    position: fixed;
    left: 20px;
    bottom: 20px;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: none;
    background: #0d6efd;
    color: #fff;
    font-size: 22px;
    z-index: 9999;
    box-shadow: 0 4px 15px rgba(0,0,0,.2);
    transition: .2s;
}

.request-fab:hover{
    transform: scale(1.08);
    background: #0b5ed7;
}
