:root {
    --primary: #00a884;
    --primary-dark: #008f72;
    --primary-light: rgba(0,168,132,0.1);
    --bg: #111b21;
    --bg-secondary: #202c33;
    --bg-tertiary: #2a3942;
    --bg-chat: #0b141a;
    --text: #e9edef;
    --text-secondary: #8696a0;
    --text-light: #667781;
    --border: #2a3942;
    --bubble-out: #005c4b;
    --bubble-in: #202c33;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.4);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-full: 50%;
    --sidebar-width: 380px;
    --header-height: 60px;
    --transition: 0.2s ease;
}

@font-face {
    font-family: 'IRANSans';
    src: url('/assets/font/IRANSansWeb.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'IRANSans', 'Segoe UI', Tahoma, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

/* =================== Auth Pages =================== */
.auth-page {
    background: linear-gradient(135deg, #111b21 0%, #0b141a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    height: 100dvh;
}

.auth-container { width: 100%; max-width: 420px; padding: 20px; padding-top: max(20px, env(safe-area-inset-top)); padding-bottom: max(20px, env(safe-area-inset-bottom)); }

.auth-card {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 40px 32px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo svg { margin-bottom: 16px; }
.auth-logo h1 { font-size: 24px; font-weight: 700; margin-bottom: 4px; color: var(--text); }
.auth-logo p { color: var(--text-secondary); font-size: 14px; }

.auth-form .form-group { margin-bottom: 16px; }

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    transition: border-color var(--transition);
    outline: none;
    background: var(--bg-tertiary);
    color: var(--text);
    direction: rtl;
}

.form-group input:focus { border-color: var(--primary); }

.form-error {
    color: #ea4335;
    font-size: 13px;
    margin-bottom: 12px;
    min-height: 20px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-full { width: 100%; }

.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-secondary);
}

.auth-footer a { color: var(--primary); text-decoration: none; font-weight: 600; }
.auth-footer a:hover { text-decoration: underline; }

.chat-page {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* =================== Chat Page Layout =================== */
.app {
    display: flex;
    height: 100vh;
    height: 100dvh;
    background: var(--bg);
}

/* =================== Sidebar =================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 10;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    min-height: var(--header-height);
    background: var(--bg-secondary);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-username { font-weight: 600; font-size: 15px; }

.sidebar-actions { display: flex; gap: 4px; }

.sidebar-search { padding: 8px 12px; border-bottom: 1px solid var(--border); }

.search-input {
    width: 100%;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    background: var(--bg-tertiary);
    color: var(--text);
    direction: rtl;
}

.search-input::placeholder { color: var(--text-light); }
.search-input:focus { background: #2a3942; }

/* Chat List */
.chat-list {
    flex: 1;
    overflow-y: auto;
}

.chat-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    transition: background var(--transition);
    gap: 12px;
}

.chat-item:hover { background: rgba(255,255,255,0.04); }
.chat-item.active { background: var(--bg-tertiary); }
.chat-item.active .chat-item-time,
.chat-item.active .chat-item-last,
.chat-item.active .chat-item-sender { color: var(--text-secondary); }

.chat-item-info { flex: 1; min-width: 0; }

.chat-item-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.chat-item-name {
    font-weight: 500;
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item-time {
    font-size: 12px;
    color: var(--text-light);
    flex-shrink: 0;
}

.chat-item-bottom {
    display: flex;
    align-items: center;
    gap: 4px;
}

.chat-item-sender { font-size: 13px; color: var(--primary); }
.chat-item-last { font-size: 13px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.chat-item-badge {
    background: var(--primary);
    color: white;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
    min-width: 20px;
    text-align: center;
}

/* =================== Avatar =================== */
.avatar {
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary) 0%, #00a67d 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
    overflow: hidden;
}

.avatar img { width: 100%; height: 100%; object-fit: cover; }

.avatar-sm { width: 40px; height: 40px; font-size: 16px; }
.avatar-md { width: 48px; height: 48px; font-size: 20px; }
.avatar-lg { width: 64px; height: 64px; font-size: 26px; }

/* =================== Chat Main =================== */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: relative;
    background: var(--bg-chat);
}

.chat-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    background-color: #0b141a;
    background-image:
        radial-gradient(circle at 30% 70%, rgba(0,168,132,0.04) 0%, transparent 50%),
        radial-gradient(circle at 70% 30%, rgba(0,168,132,0.04) 0%, transparent 50%);
}

.chat-empty h2 { margin-top: 16px; font-size: 22px; color: var(--text-secondary); }
.chat-empty p { margin-top: 8px; font-size: 14px; }

.chat-active { display: flex; flex-direction: column; height: 100%; }

/* Chat Header */
.chat-header {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    min-height: var(--header-height);
    gap: 12px;
    background: var(--bg-secondary);
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.chat-header-name { font-weight: 600; font-size: 16px; }
.chat-header-status { font-size: 12px; color: var(--text-secondary); }
.chat-header-status.online { color: var(--primary); }

.chat-header-actions { display: flex; gap: 4px; }

/* Header Typing */
.chat-header-typing {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--primary);
}

.chat-header-typing .typing-dots span {
    width: 4px;
    height: 4px;
}

.typing-text-inline {
    font-size: 12px;
    color: var(--primary);
}

/* =================== Messages =================== */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px 60px;
    background-color: #0b141a;
    background-image:
        radial-gradient(circle at 20% 80%, rgba(0,168,132,0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(0,168,132,0.03) 0%, transparent 50%);
}

.messages-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.message {
    max-width: 65%;
    padding: 6px 10px 8px;
    border-radius: 8px;
    position: relative;
    word-wrap: break-word;
    line-height: 1.35;
    font-size: 14.5px;
}

.message-out, .message-in {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    max-width: 70%;
}

.message-out {
    background: var(--bubble-out);
    color: #e9edef;
    border-bottom-right-radius: 3px;
    align-self: flex-start;
}

.message-in {
    background: var(--bubble-in);
    color: #e9edef;
    border-bottom-left-radius: 3px;
    align-self: flex-end;
}

.msg-avatar {
    margin-top: 2px;
    flex-shrink: 0;
}

.msg-avatar + .message-body {
    margin-left: 0;
}

.message-body {
    flex: 1;
    min-width: 0;
}

.message-content { margin-bottom: 2px; }

.mention-link, .hashtag-link, .copy-link {
    font-weight: 500;
    transition: opacity 0.2s;
}
.mention-link:hover, .hashtag-link:hover, .copy-link:hover {
    opacity: 0.8;
}

.message-sender {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 2px;
}

.message-content { margin-bottom: 2px; }

.message-meta {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 4px;
    margin-top: 2px;
    direction: ltr;
}

.message-out .message-meta {
    justify-content: flex-end;
}

.message-time {
    font-size: 11px;
    color: rgba(255,255,255,0.45);
}

.message-out .message-time { color: rgba(255,255,255,0.55); }

.message-edited { font-size: 11px; color: rgba(255,255,255,0.35); }

.message-deleted {
    font-style: italic;
    color: rgba(255,255,255,0.35);
    font-size: 13px;
}

.message-image {
    max-width: 300px;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 4px;
}

.message-file {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(255,255,255,0.06);
    border-radius: 8px;
    margin-bottom: 4px;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

.message-file-icon {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.message-file-info { flex: 1; min-width: 0; }
.message-file-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.message-reply {
    background: rgba(255,255,255,0.06);
    border-right: 3px solid var(--primary);
    padding: 6px 10px;
    border-radius: 4px;
    margin-bottom: 6px;
    font-size: 13px;
}

.message-reply-sender { font-size: 12px; font-weight: 600; color: var(--primary); }
.message-reply-text { color: rgba(255,255,255,0.5); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Date Separator */
.date-separator {
    text-align: center;
    padding: 12px 0;
}

.date-separator span {
    background: rgba(17,27,33,0.9);
    color: var(--text-secondary);
    padding: 5px 14px;
    border-radius: 8px;
    font-size: 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.message-reaction {
    font-size: 18px;
    margin-top: 2px;
    line-height: 1;
}

.message-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.reaction-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    padding: 3px 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all var(--transition);
    color: var(--text);
    font-family: inherit;
}

.reaction-badge:hover {
    background: rgba(0,168,132,0.2);
    border-color: var(--primary);
}

.message-reaction-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    padding: 3px 8px;
    font-size: 16px;
    margin-top: 4px;
}

.reaction-count {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* =================== Delete Modal =================== */
.delete-modal {
    max-width: 360px;
}

.delete-icon {
    margin: 0 auto;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(234,67,53,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-danger {
    background: #ea4335;
    color: white;
    border: none;
}

.btn-danger:hover { background: #d33426; }

/* =================== Reaction Picker =================== */
.reaction-picker {
    position: fixed;
    display: flex;
    gap: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 28px;
    padding: 6px 10px;
    box-shadow: var(--shadow-lg);
    z-index: 200;
}

.reaction-btn {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 8px;
    transition: all var(--transition);
    line-height: 1;
}

.reaction-btn:hover {
    background: rgba(255,255,255,0.08);
    transform: scale(1.2);
}

/* =================== Edit Preview =================== */
.edit-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-tertiary);
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 13px;
    border-right: 3px solid #f0b232;
}

.edit-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #f0b232;
    font-weight: 500;
}

/* =================== Reply Preview Fix =================== */
.reply-info {
    flex: 1;
    min-width: 0;
}

.reply-sender {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 2px;
}

.reply-text {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* =================== Online Dot =================== */
.online-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #25d366;
    border-radius: 50%;
    margin-right: 4px;
}

/* =================== Icon Button =================== */
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: none;
    color: var(--text-secondary);
    border-radius: 50%;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
    flex-shrink: 0;
}

.icon-btn:hover { background: rgba(255,255,255,0.08); color: var(--text); }

.send-btn {
    color: var(--text-secondary);
}

.send-btn:hover { color: var(--primary); }

/* =================== Typing Indicator =================== */
.typing-indicator {
    padding: 4px 16px 8px;
    color: var(--primary);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* =================== Reply Preview =================== */
.reply-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-tertiary);
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 13px;
    border-right: 3px solid var(--primary);
}

.reply-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

.reply-close:hover { color: var(--text); }

/* =================== Message Input Area =================== */
.message-input-area {
    width: 100%;
    padding: 8px 16px 12px;
    background: var(--bg-secondary);
}

.message-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.message-input {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text);
    font-size: 15px;
    outline: none;
    font-family: inherit;
    direction: rtl;
}

.message-input:focus { background: #2a3942; }

.message-input::placeholder { color: var(--text-light); }

/* =================== Modal =================== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 400;
}

.modal {
    background: var(--bg-secondary);
    border-radius: 16px;
    width: 420px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 16px; font-weight: 600; }

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

.modal-close:hover { color: var(--text); }

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

/* =================== Members Panel =================== */
.members-panel {
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 300px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 20;
}

.members-panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.members-panel-header h3 { font-size: 15px; font-weight: 600; flex: 1; }

.members-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.member-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background var(--transition);
}

.member-item:hover { background: rgba(255,255,255,0.04); }

.member-item-name { font-size: 14px; font-weight: 500; }
.member-item-role { font-size: 12px; color: var(--text-secondary); }

/* =================== Profile Panel =================== */
.profile-panel {
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 320px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 20;
}

.profile-panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.profile-panel-header h3 { font-size: 15px; font-weight: 600; flex: 1; }

.profile-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 600;
    margin-bottom: 16px;
    overflow: hidden;
}

.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }

.profile-name {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.profile-status {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.profile-status.online { color: var(--primary); }

.profile-info {
    width: 100%;
}

.profile-info-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.profile-info-label { font-size: 13px; color: var(--text-secondary); }
.profile-info-value { font-size: 13px; font-weight: 500; }

/* =================== Member Search Results =================== */
.member-search-results {
    max-height: 200px;
    overflow-y: auto;
    margin-top: 8px;
}

.member-search-result {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background var(--transition);
}

.member-search-result:hover { background: rgba(255,255,255,0.06); }

.selected-members {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.selected-member {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--primary);
    color: white;
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 12px;
}

.selected-member button {
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    font-size: 14px;
    padding: 0;
    line-height: 1;
}

.selected-member button:hover { color: white; }

/* =================== Search Results =================== */
.search-results-header {
    padding: 10px 16px 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background var(--transition);
    border-bottom: 1px solid var(--border);
}

.search-result-item:hover {
    background: var(--bg-tertiary);
}
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        right: 0;
        width: 100%;
        height: 100%;
        height: 100dvh;
        z-index: 100;
        transform: translateX(0);
        transition: transform var(--transition);
    }

    .sidebar.hidden { transform: translateX(100%); }

    .sidebar-toggle { display: flex !important; }

    .message { max-width: 85%; }
    .messages-container { padding: 16px 12px; }
    .message-out, .message-in { max-width: 90%; }

    .members-panel { width: 100%; }

    .chat-header { padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); position: sticky; top: 0; z-index: 5; }
    .message-input-area { padding: 6px 10px 8px; padding-bottom: max(8px, env(safe-area-inset-bottom)); }
    .chat-empty svg { width: 80px; height: 80px; }
    .chat-empty h2 { font-size: 18px; }
    .modal { width: 95%; }
}

@media (min-width: 769px) {
    .sidebar-toggle { display: flex !important; }
}

/* =================== Context Menu =================== */
.context-menu {
    position: fixed;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    z-index: 300;
    min-width: 180px;
    padding: 6px 0;
    overflow: hidden;
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    background: none;
    border: none;
    color: var(--text);
    padding: 10px 16px;
    font-size: 13.5px;
    cursor: pointer;
    transition: background var(--transition);
    font-family: inherit;
}

.context-menu-item:hover { background: rgba(255,255,255,0.06); }
.context-menu-danger { color: #ea4335; }
.context-menu-danger:hover { background: rgba(234,67,53,0.1); }
.context-menu-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* =================== Media Viewer =================== */
.media-viewer {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
}

.media-viewer-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.92);
}

.media-viewer-content {
    position: relative;
    z-index: 1;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.media-viewer-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 32px;
    cursor: pointer;
    z-index: 2;
    padding: 4px 8px;
    line-height: 1;
}

.media-viewer-body img {
    max-width: 90vw;
    max-height: 85vh;
    border-radius: 8px;
    object-fit: contain;
}

.media-viewer-body video {
    max-width: 90vw;
    max-height: 85vh;
    border-radius: 8px;
    outline: none;
}

.media-viewer-caption {
    margin-top: 12px;
    color: white;
    font-size: 14px;
    text-align: center;
    max-width: 80vw;
    background: rgba(0,0,0,0.5);
    padding: 8px 16px;
    border-radius: 8px;
}

/* =================== File Preview =================== */
.message-file-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: rgba(255,255,255,0.06);
    border-radius: 8px;
    margin-bottom: 4px;
    cursor: pointer;
    transition: background var(--transition);
}

.message-file-preview:hover { background: rgba(255,255,255,0.1); }

.message-file-preview-icon {
    width: 42px;
    height: 42px;
    background: rgba(255,255,255,0.08);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.message-file-preview-info { flex: 1; min-width: 0; }

.message-file-preview-name {
    font-size: 13.5px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-file-preview-size {
    font-size: 11.5px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* =================== Video Thumbnail =================== */
.message-video {
    position: relative;
    max-width: 320px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    margin-bottom: 4px;
}

.message-video video {
    display: block;
    width: 100%;
    border-radius: 8px;
}

.message-video-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition);
}

.message-video:hover .message-video-overlay { opacity: 1; }

.message-video-play {
    width: 48px;
    height: 48px;
    background: rgba(255,255,255,0.25);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

/* iPhone zoom fix - inputs must be 16px+ */
input, textarea, select {
    font-size: 16px !important;
}

/* =================== Call Modal =================== */
.call-modal {
    align-items: center;
    justify-content: center;
}

.call-modal-content {
    text-align: center;
    padding: 40px;
    width: 320px;
}

.call-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    overflow: hidden;
}

.call-name {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.call-status {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.call-actions {
    display: flex;
    justify-content: center;
}

.call-action-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform var(--transition);
}

.call-action-btn:hover { transform: scale(1.1); }

.call-end {
    background: #ea4335;
}

.call-end svg { fill: white; }

/* =================== Channel Join/Leave Bar =================== */
.channel-join-bar,
.channel-leave-bar {
    padding: 8px 16px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
}

/* =================== Eye View Count =================== */
.message-view-count {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    color: var(--text-light);
    margin-right: 6px;
}

/* =================== Slug Input =================== */
.slug-available { color: var(--primary); }
.slug-unavailable { color: #ea4335; }

/* =================== Radio Group =================== */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background var(--transition);
    border: 1px solid var(--border);
}

.radio-label:hover { background: rgba(255,255,255,0.06); }

.radio-label input[type="radio"] {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
}

.radio-label span {
    font-size: 14px;
}

/* =================== Invite Link =================== */
.invite-link-box {
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
}

/* =================== Group Search Result =================== */
.group-search-result {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background var(--transition);
    border-bottom: 1px solid var(--border);
}

.group-search-result:hover {
    background: var(--bg-tertiary);
}

.group-search-info {
    flex: 1;
}

.group-search-name {
    font-weight: 500;
    font-size: 14px;
}

.group-search-meta {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* =================== Members Panel Footer =================== */
.members-panel-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}

/* =================== Online Dot =================== */
.online-dot {
    width: 10px;
    height: 10px;
    background: var(--primary);
    border-radius: 50%;
    border: 2px solid var(--bg);
    position: absolute;
    bottom: 0;
    right: 0;
}

/* =================== Member Item =================== */
.member-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    border-bottom: 1px solid var(--border);
}

.member-item-name {
    font-size: 14px;
    font-weight: 500;
}

.member-item-role {
    font-size: 12px;
    color: var(--text-secondary);
}

/* =================== Chat Type Badge =================== */
.chat-type-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 6px;
    font-weight: 500;
    vertical-align: middle;
}

.chat-type-badge.group {
    background: rgba(0,168,132,0.2);
    color: var(--primary);
}

.chat-type-badge.channel {
    background: rgba(93,179,235,0.2);
    color: #53bdeb;
}

.chat-type-badge.private {
    background: rgba(234,67,53,0.15);
    color: #ea4335;
}

/* =================== Profile Management =================== */
.profile-management {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.profile-management-header h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.profile-management-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.profile-mgmt-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    justify-content: flex-start;
    padding: 10px 14px;
    font-size: 13px;
}

.profile-mgmt-btn.btn-danger {
    margin-top: 8px;
}

/* =================== Profile Members Section =================== */
.profile-members-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.profile-members-header h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.profile-members-list {
    max-height: 300px;
    overflow-y: auto;
}

.profile-member-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.profile-member-item:last-child {
    border-bottom: none;
}

.profile-member-info {
    flex: 1;
}

.profile-member-name {
    font-size: 13px;
    font-weight: 500;
}

.profile-member-role {
    font-size: 11px;
    color: var(--text-secondary);
}

/* =================== Manage Members Modal =================== */
.manage-members-list {
    max-height: 400px;
    overflow-y: auto;
    margin-top: 12px;
}

.manage-member-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}

.manage-member-item:hover {
    background: rgba(255,255,255,0.04);
}

.manage-member-info {
    flex: 1;
}

.manage-member-name {
    font-size: 13px;
    font-weight: 500;
}

.manage-member-role {
    font-size: 11px;
    color: var(--text-secondary);
}

.manage-member-actions {
    display: flex;
    gap: 6px;
}

.manage-member-actions .icon-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* =================== Avatar Upload =================== */
.avatar-upload-area {
    cursor: pointer;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    transition: border-color var(--transition);
}

.avatar-upload-area:hover {
    border-color: var(--primary);
}

.avatar-upload-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 13px;
}

.avatar-upload-preview img {
    max-width: 100px;
    max-height: 100px;
    border-radius: 50%;
    object-fit: cover;
}

/* =================== Btn Variants =================== */
.btn-danger {
    background: #ea4335;
    color: white;
}

.btn-danger:hover {
    background: #d33426;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text);
}

.btn-secondary:hover {
    background: var(--border);
}

.hamburger-menu {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 6px;
    margin: 0 8px 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    z-index: 100;
}
.hamburger-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    transition: background 0.15s;
    cursor: pointer;
}
.hamburger-item:hover {
    background: var(--bg-primary);
}
.hamburger-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 8px;
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 8px;
}

.context-menu {
    position: fixed;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 6px;
    min-width: 200px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    z-index: 1000;
}
.context-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 8px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    transition: background 0.15s;
    cursor: pointer;
}
.context-menu-item:hover {
    background: var(--bg-primary);
}
.context-menu-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 8px;
}
