@font-face {
  font-family: 'Yekan';
  src: url('../font/yekan/Yekan.eot');
  src: url('../font/yekan/Yekan.eot?#iefix') format('embedded-opentype'),
       url('../font/yekan/Yekan.woff2') format('woff2'),
       url('../font/yekan/Yekan.woff') format('woff'),
       url('../font/yekan/Yekan.ttf') format('truetype'),
       url('../font/yekan/Yekan.vfc') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

body, html, p, h1,h2,h3,h4,h5,h6, span,input, button, a {
  font-family: 'Yekan', Tahoma, Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Yekan', Tahoma, sans-serif; }
    body { background: #f0f2f5; height: 100vh; display: flex; align-items: center; justify-content: center; }
    #loginScreen { background: #fff; padding: 32px 24px; border-radius: 16px; width: 320px; text-align: center; }
    #loginScreen h2 { margin-bottom: 16px; color: #333; }
    #loginScreen p.desc { font-size: 12px; color: #555; text-align: center; margin-bottom: 15px; }
    #loginScreen input { width: 100%; padding: 12px; margin-top: 12px; border: 1px solid #ddd; border-radius: 8px; font-size: 15px; text-align: right; direction: rtl; }
    #loginScreen button { width: 100%; padding: 12px; margin-top: 16px; background: #955c66; color: #fff; border: none; border-radius: 8px; font-size: 16px; cursor: pointer; }
    #loginScreen button:hover { background: #955c66; }
    #loginError { color: red; font-size: 13px; margin-top: 8px; }
    #appScreen { display: none; width: 100%; max-width: 1000px; height: 100vh; max-height: 700px; background: #fff; box-shadow: 0 4px 20px rgba(0,0,0,0.15); border-radius: 12px; overflow: hidden; flex-direction: row; position: relative; }
    #leftPanel { width: 35%; border-left: 1px solid #eee; display: flex; flex-direction: column; background: #fff; }
    #userPanelHeader { padding: 10px 12px; border-bottom: 1px solid #eee; display: flex; flex-direction: column; gap: 8px; background: #f0f2f5; }
    .header-top { display: flex; justify-content: space-between; align-items: center; }
    .search-row { display: flex; gap: 5px; }
    #userSearch { flex: 1; padding: 8px 10px; border-radius: 8px; border: 1px solid #ddd; font-size: 13px; direction: rtl; }
    .add-btn { background: none; color: #8c8c8c; border: none; border-radius: 8px; width: 35px; cursor: pointer; font-size: 20px; display: flex; align-items: center; justify-content: center; }
    .menu-container { position: relative; display: inline-block; }
    .hamburger { cursor: pointer; font-size: 24px; background: none; border: none; padding: 10px 5px 5px 5px; color: #333; }
    .dropdown-content { display: none; position: absolute; left: 0; top: 100%; background-color: #fff; min-width: 160px; box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); z-index: 1; border-radius: 8px; overflow: hidden; }
    .dropdown-content a { color: black; padding: 12px 16px; text-decoration: none; display: block; font-size: 13px; cursor: pointer; }
    .dropdown-content a:hover { background-color: #f1f1f1; }
    .show { display: block; }
    #usersList { flex: 1; overflow-y: auto; }
    .user-item { display: flex; align-items: center; padding: 10px 12px; cursor: pointer; border-bottom: 1px solid #f5f5f5; transition: background 0.2s; }
    /* .user-item:hover, .user-item.active { background: #ebebeb; } */
    .user-info { flex: 1; }
    .user-name { font-weight: bold; color: #111; font-size: 14px; }
    .user-status { font-size: 11px; color: #999; margin-top: 2px; }
    .user-status.online { color: #955c66; }
    .modal { display: none; position: fixed; z-index: 100; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.5); align-items: center; justify-content: center; }
    .modal-content { background-color: #fefefe; padding: 20px; border-radius: 12px; width: 90%; max-width: 400px; box-shadow: 0 4px 20px rgba(0,0,0,0.2); }
    .modal h3 { margin-bottom: 15px; font-size: 16px; border-bottom: 1px solid #eee; padding-bottom: 10px; }
    .modal input[type="checkbox"]{ width: 20%; display: inline-block; }
    .modal input { width: 100%; padding: 10px; margin-bottom: 10px; border: 1px solid #ddd; border-radius: 6px; }
    .modal button { width: 100%; padding: 10px; background: #955c66; color: #fff; border: none; border-radius: 6px; cursor: pointer; margin-top: 5px; }
    .modal .close-btn { background: #ff4d4f; margin-top: 10px; }
    #globalSearchResults { max-height: 200px; overflow-y: auto; margin-top: 10px; }
    #chatPanel { flex: 1; display: flex; flex-direction: column; height: 100%; background: #e5ddd5; }
    .chat-header { background: #716370; color: #fff; padding: 10px 12px; display: flex; align-items: center; gap: 8px; }
    .chat-back { display: none; background: none; border: none; color: #fff; font-size: 20px; cursor: pointer; }
    .chat-title { font-size: 15px; font-weight: bold; display: flex; align-items: center; gap: 8px; }
    .chat-subtitle { font-size: 11px; opacity: 0.8; }

    .typing-indicator {
        font-size: 12px;
        font-weight: normal;
        opacity: 0.9;
        white-space: nowrap;
    }

    .typing-dots {
        display: inline-flex;
        gap: 2px;
        margin-right: 2px;
    }

    .typing-dots span {
        display: inline-block;
        width: 6px;
        text-align: center;
        opacity: 0.3;
        animation: typingDot 1.2s infinite ease-in-out;
    }
    .typing-dots span:nth-child(2) { animation-delay: 0.2s; }
    .typing-dots span:nth-child(3) { animation-delay: 0.4s; }

    @keyframes typingDot {
        0%, 80%, 100% { opacity: 0.3; }
        40% { opacity: 1; }
    }
    #messagesBox { flex: 1; overflow-y: auto; padding: 10px; position: relative; padding-bottom: 20px; }
    .loader-top { text-align: center; font-size: 11px; color: #666; padding: 4px 0; display: none; }
    .msg { max-width: 75%; margin-bottom: 6px; padding: 6px 10px; border-radius: 12px; font-size: 13px; word-break: break-word; line-height: 1.5; position: relative; }
    .msg-recv { background: #fff; margin-right: auto; border-bottom-left-radius: 2px; }
    .msg-sent { background: #f5f5f5; margin-left: auto; border-bottom-right-radius: 2px; }
    .msg-time { font-size: 9px; color: #999; margin-top: 2px; text-align: left !important; width: 100%; }
    .msg-author { font-size: 10px; font-weight: bold; color: #716370; margin-bottom: 3px; }
    .chat-compose-area { background: #f0f2f5; border-top: 1px solid #e5e5e5; }
    .chat-input-area { display: flex; padding: 8px; background: #f0f2f5; gap: 8px; align-items: flex-end; }
    .chat-input-area input { flex: 1; padding: 10px 12px; border: none; border-radius: 24px; font-size: 13px; direction: rtl; outline: none; }
    .chat-input-area button { color: black; border: none; border-radius: 50%; width: 45px; height: 45px; font-size: 22px; cursor: pointer; flex-shrink: 0; }
    .chat-action-btn { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
    .chat-send-btn { background: #fff; transform: rotate(-180deg); box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
    .voice-btn.recording { background: #c62828; color: #fff; animation: pulseRecord 1s infinite; }
    @keyframes pulseRecord {
        0% { transform: scale(1); }
        50% { transform: scale(1.08); }
        100% { transform: scale(1); }
    }
    .hidden { display: none; }
    @media (max-width: 768px) {
      #appScreen { width: 100%; height: 100vh; max-height: none; border-radius: 0; }
      #leftPanel { width: 100%; }
      #chatPanel { display: none; width: 100%; }
      #chatPanel.active { display: flex; }
      .chat-back { display: inline-block; }
    }
    .unread-dot { width: 10px; height: 10px; background-color: #007bff; border-radius: 50%; display: inline-block; margin-left: 10px; animation: blink 1.5s infinite; }
    @keyframes blink { 0% { opacity: 1; } 50% { opacity: 0.4; } 100% { opacity: 1; } }
    .msg-status { font-size: 10px; margin-right: 4px; display: inline-block; vertical-align: middle; }
    .status-read { color: #4CAF50; font-weight: bold; }
    .status-unread { color: #999; }
    .last-msg {
        font-size: 12px;
        margin-top: 6px;
        margin-right: 22px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: flex;
        align-items: center;
        gap: 5px;
    }

    .msg-gray {
        color: #888;
        font-weight: normal;
        font-size: 12px;
    }

    .msg-bold {
        font-weight: bold;
        color: inherit;
    }

    .blue-dot {
        width: 8px;
        height: 8px;
        background-color: #007bff;
        border-radius: 50%;
        display: inline-block;
        flex-shrink: 0;
        animation: blueBlink 1.5s infinite;
    }

    @keyframes blueBlink {
        0% { opacity: 1; transform: scale(1); }
        50% { opacity: 0.4; transform: scale(0.8); }
        100% { opacity: 1; transform: scale(1); }
    }

    @media(max-width: 1000px){
        .chat-compose-area { position: fixed; bottom: 0; width: 100%; z-index: 998; }
        .chat-input-area { width: 100%; }
        .chat-header { position: fixed; top: 0px; width: 100%; z-index: 999; }
        #messagesBox { padding-top: 100px !important; padding-bottom: 145px !important; scroll-behavior: smooth; }
        #usersList{margin-top: 80px; }
        #userPanelHeader { position:fixed; width: 100%; }
    }
/* Reply functionality styles */
.msg-reply-preview {
    border-right: 3px solid #955c66;
    background: rgba(0, 0, 0, 0.02);
    padding: 4px 6px;
    margin-bottom: 4px;
    font-size: 11px;
    color: #555;
    border-radius: 6px;
    direction: rtl;
    cursor: pointer;
}

.msg-reply-text {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.msg-reply-btn {
    background: none;
    border: none;
    color: #955c66;
    font-size: 11px;
    cursor: pointer;
    padding: 0 4px;
    margin-right: 4px;
}

.msg-reply-btn:hover {
    text-decoration: underline;
}

.reply-bar {
    background: #fff;
    border-bottom: 1px solid #ddd;
    padding: 6px 10px;
    font-size: 12px;
    display: none;
    align-items: center;
    gap: 8px;
    direction: rtl;
}

.reply-bar-text {
    flex: 1;
    color: #555;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.reply-bar-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #999;
}


.reply-bar-text {
    flex: 1;
    color: #555;
}

.reply-bar-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #999;
}

.msg-reply-preview {
    background: rgba(0,0,0,0.05);
    padding: 6px 10px;
    margin-bottom: 6px;
    border-left: 2px solid #955c66;
    font-size: 12px;
    color: #666;
    cursor: pointer;
}

.msg-reply-btn {
    background: none;
    border: none;
    color: #955c66;
    cursor: pointer;
    text-decoration: none !important;
    font-size: 12px;
    padding: 2px 6px;
    margin-right: 8px;
}


#messageInput {
  resize: none;
  overflow-y: auto;
  max-height: 120px;
  min-height: 40px;
  line-height: 24px;
  flex: 1;
  padding: 10px 12px;
  border: none;
  border-radius: 24px;
  font-size: 13px;
  outline: none;
  background: #fff;
}

.msg-body {
    white-space: pre-wrap;
}

.msg-attachment,
.msg-voice {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.msg-file-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #4b2f35;
    text-decoration: none;
    background: rgba(149, 92, 102, 0.08);
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 12px;
}

.msg-file-link:hover {
    background: rgba(149, 92, 102, 0.15);
}

.msg-attachment-image .msg-image-cover-link {
    display: block;
    width: 100%;
    text-decoration: none;
}

.msg-attachment-image .msg-image-cover {
    display: block;
    width: 100%;
    max-width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: 10px;
}

.msg-attachment-image .msg-image-thumb-wrap {
    display: flex;
    align-items: flex-start;
}

.msg-attachment-image .msg-image-thumb {
    width: 46px;
    height: 46px;
    object-fit: cover;
    border-radius: 10px;
}

.msg-file-meta {
    font-size: 11px;
    color: #777;
}

.msg-voice audio {
    width: 100%;
    max-width: 100%;
}

.msg-caption {
    font-size: 12px;
    color: #444;
}

.recording-hint {
    font-size: 11px;
    color: #c62828;
    padding: 0 12px 8px;
    display: none;
}

.recording-hint.active {
    display: block;
}

.message-bubble .msg-text {
  white-space: pre-wrap;
  word-wrap: break-word;
}

.list-section-title {
    padding: 6px 10px;
    background-color: #f2f2f2;
    font-size: 13px;
    color: #706666;
}

span.unread-blink {
    font-size: 12px;
    background-color: #716470;
    padding: 2px 4px;
    color: white;
    border-radius: 50px;
}