/* ─── RESET & BASE ─────────────────────────────────────────────────────────── */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #313338;
    color: #dbdee1;
    overflow: hidden;
    height: 100vh;
}

/* ─── SCROLLBAR ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #1a1b1e; border-radius: 3px; }

/* ─── AUTH SCREEN ──────────────────────────────────────────────────────────── */
#authScreen {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: radial-gradient(ellipse at center, #2c2f33 0%, #1e1f22 100%);
}

.auth-box {
    background: #313338;
    border-radius: 12px;
    padding: 32px 40px;
    width: 440px;
    box-shadow: 0 20px 60px rgba(0,0,0,.6);
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
}
.auth-logo svg {
    display: flex;
    width: 76px;
}


.auth-logo h1 {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    margin-left: -7px;
}

.auth-box h2 {
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
}

.auth-subtitle {
    text-align: center;
    color: #949ba4;
    font-size: 14px;
    margin-bottom: 24px;
}

.auth-form label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: #b5bac1;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin: 16px 0 4px;
}

.auth-form input {
    width: 100%;
    background: #1e1f22;
    border: 1px solid #26272b;
    border-radius: 4px;
    padding: 10px 12px;
    color: #dbdee1;
    font-size: 14px;
    transition: border-color .2s;
}

.auth-form input:focus {
    outline: none;
    border-color: #5865f2;
}

.auth-btn {
    width: 100%;
    background-color: #3EA05D;
    border: none;
    border-radius: 15px;
    padding: 12px;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 20px;
    transition: background .2s;
}

.auth-btn:hover { background: #47c46e; }

.auth-toggle-btn {
    width: 100%;
    background: none;
    border: none;
    color: #309750;
    font-size: 13px;
    cursor: pointer;
    margin-top: 12px;
    text-align: center;
    padding: 4px;
}

.auth-toggle-btn:hover { text-decoration: underline; }

/* ─── APP LAYOUT ───────────────────────────────────────────────────────────── */
#appScreen {
    display: flex;
    height: 100vh;
}

/* ─── SERVER LIST ──────────────────────────────────────────────────────────── */
.server-list {
    width: 72px;
    min-width: 72px;
    background: #1e1f22;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 0;
    gap: 6px;
    overflow-y: auto;
    overflow-x: hidden;
}

.server-item {
    width: 48px;
    height: 48px;
    background: #313338;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-radius .2s, background .2s, color .2s;
    color: #dbdee1;
    font-size: 18px;
    font-weight: 700;
    position: relative;
    flex-shrink: 0;
    user-select: none;
}

.server-item:hover,
.server-item.active {
    border-radius: 16px;
    background: #5865f2;
    color: #fff;
}

.server-item.dm-home { color: #47c46e; background: #313338; }
.server-item.dm-home svg {
    width: 40px;
	transition: .2s ;
}
.server-item.dm-home:hover,
.server-item.dm-home.active {
    background-color: #114B23;
    color: #fff;
}
.server-item.dm-home:hover svg  {
    width: 50px;
}
.server-item.add-server-btn  color: #23a559; 
.server-item.add-server-btn:hover { background: #23a559; color: #fff; }

.server-divider {
    width: 32px;
    height: 2px;
    background: #35363c;
    border-radius: 1px;
    flex-shrink: 0;
}

/* badge روی server item */
.server-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    background: #f23f43;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    border: 2px solid #1e1f22;
}

/* ─── CHANNELS SIDEBAR ─────────────────────────────────────────────────────── */
.channels-sidebar {
    width: 240px;
    min-width: 240px;
    background: #2b2d31;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.server-header {
    height: 48px;
    padding: 0 16px;
    border-bottom: 1px solid #1e1f22;
    display: flex;
    align-items: center;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
}

.channel-category {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 8px 4px;
    font-size: 11px;
    font-weight: 700;
    color: #949ba4;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.channel-category svg { opacity: 0; transition: opacity .2s; cursor: pointer; }
.channel-category:hover svg { opacity: 1; }

.channel-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    margin: 1px 0;
    border-radius: 4px;
    cursor: pointer;
    color: #949ba4;
    font-size: 15px;
    transition: background .1s, color .1s;
}

.channel-item:hover  { background: #35363c; color: #dbdee1; }
.channel-item.active { background: #35363c; color: #fff; }

.channel-icon { font-size: 14px; }

/* DM List */
.dm-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    margin: 1px 0;
    border-radius: 4px;
    cursor: pointer;
    color: #949ba4;
    transition: background .1s, color .1s;
}

.dm-item:hover  { background: #35363c; color: #dbdee1; }
.dm-item.active { background: #35363c; color: #fff; }

.dm-item-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.dm-item-name { flex: 1; font-size: 15px; font-weight: 500; }

.dm-badge {
    background: #f23f43;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* User Panel */
.user-panel {
    height: 52px;
    background: #232428;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    flex-shrink: 0;
    margin-top: auto;
}

.user-info-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    flex: 1;
    overflow: hidden;
    transition: background .1s;
}

.user-info-wrap:hover { background: #35363c; }

.user-avatar-wrap { flex-shrink: 0; }
.user-avatar-wrap img { width:32px; height:32px; border-radius:50%; object-fit:cover; }

.user-text { overflow: hidden; }
.user-name   { font-size:14px; font-weight:600; color:#fff; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.user-status { font-size:12px; color:#949ba4; }

.logout-btn {
    background: none;
    border: none;
    color: #949ba4;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    transition: background .1s, color .1s;
}

.logout-btn:hover { background: #35363c; color: #f23f43; }

/* ─── CHAT AREA ────────────────────────────────────────────────────────────── */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #313338;
    min-width: 0;
}

.chat-header {
    height: 48px;
    border-bottom: 1px solid #26272b;
    padding: 0 16px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.chat-title {
    font-weight: 700;
    font-size: 16px;
    color: #fff;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.welcome-msg {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #949ba4;
    font-size: 16px;
}

/* Messages */
.message {
    display: flex;
    gap: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background .1s;
}

.message:hover { background: #2e3035; }

.msg-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    cursor: pointer;
    flex-shrink: 0;
    margin-top: 2px;
}

.message-content { flex: 1; min-width: 0; }

.message-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 2px;
}

.message-author    { font-weight: 600; color: #fff; font-size: 15px; }
.message-timestamp { font-size: 11px; color: #949ba4; }
.message-text      { color: #dbdee1; font-size: 15px; line-height: 1.4; word-break: break-word; }

/* Input */
.message-input-bar {
    padding: 0 16px 16px;
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.message-input-bar input {
    flex: 1;
    background: #383a40;
    border: none;
    border-radius: 8px;
    padding: 11px 16px;
    color: #dbdee1;
    font-size: 15px;
    transition: background .1s;
}

.message-input-bar input:focus { outline: none; background: #404249; }
.message-input-bar input::placeholder { color: #6d6f78; }

.message-input-bar svg {
    color: rgba(255,255,255,1.00);
    height: 25px;
}


.message-input-bar button {
    background-color: #2EA453;
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background .2s;
}

.message-input-bar button:hover {
    background-color: #278243;
}

/* ─── MEMBERS SIDEBAR ──────────────────────────────────────────────────────── */
.members-sidebar {
    width: 240px;
    min-width: 240px;
    background: #2b2d31;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
}

.members-header {
    padding: 16px;
    font-size: 11px;
    font-weight: 700;
    color: #949ba4;
    text-transform: uppercase;
    letter-spacing: .5px;
    flex-shrink: 0;
}

.members-list { padding: 0 8px 8px; }

.member-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    margin: 1px 0;
    border-radius: 4px;
    cursor: pointer;
    color: #949ba4;
    transition: background .1s, color .1s;
}

.member-item:hover { background: #35363c; color: #dbdee1; }

.member-avatar-wrap {
    position: relative;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.member-avatar-img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.member-name { font-size: 15px; font-weight: 500; }

/* ─── AVATAR PLACEHOLDER ───────────────────────────────────────────────────── */
.avatar-placeholder {
    background: #5865f2;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.avatar-placeholder.small { width:32px; height:32px; font-size:14px; }
.avatar-placeholder.large { width:80px; height:80px; font-size:32px; }

/* ─── STATUS DOTS ──────────────────────────────────────────────────────────── */
.status-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid #2b2d31;
}

.status-dot.status-online     { background: #23a559; }
.status-dot.status-idle       { background: #f0b232; }
.status-dot.status-dnd        { background: #f23f43; }
.status-dot.status-invisible  { background: #80848e; }
.status-dot.status-offline    { background: #80848e; }

.status-text { font-size:13px; font-weight:600; }
.status-text.status-online    { color: #23a559; }
.status-text.status-idle      { color: #f0b232; }
.status-text.status-dnd       { color: #f23f43; }
.status-text.status-invisible { color: #80848e; }

/* ─── CONTEXT MENU ─────────────────────────────────────────────────────────── */
.context-menu {
    position: fixed;
    z-index: 9999;
    background: #111214;
    border-radius: 6px;
    padding: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,.5);
    min-width: 160px;
}

.ctx-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: #dbdee1;
    transition: background .1s;
}

.ctx-item:hover      { background: #35363c; }
.ctx-item.danger     { color: #f23f43; }
.ctx-item.danger:hover { background: #f23f43; color: #fff; }

/* ─── MODALS ───────────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0,0,0,.75);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-box {
    background: #313338;
    border-radius: 8px;
    width: 440px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,.6);
}

.modal-head {
    padding: 20px 20px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-head h3 { font-size: 20px; font-weight: 700; color: #fff; }

.modal-close {
    background: none;
    border: none;
    color: #949ba4;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background .1s, color .1s;
}

.modal-close:hover { background: #35363c; color: #fff; }

.modal-body {
    padding: 16px 20px;
}

.modal-body label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: #b5bac1;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin: 14px 0 4px;
}

.modal-body label:first-child { margin-top: 0; }

.modal-body input,
.modal-body textarea,
.modal-body select {
    width: 100%;
    background: #1e1f22;
    border: 1px solid #26272b;
    border-radius: 4px;
    padding: 10px 12px;
    color: #dbdee1;
    font-size: 14px;
    font-family: inherit;
    transition: border-color .2s;
}

.modal-body input:focus,
.modal-body textarea:focus,
.modal-body select:focus {
    outline: none;
    border-color: #5865f2;
}

.modal-body textarea { resize: vertical; }

.modal-foot {
    padding: 16px 20px;
    background: #2b2d31;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    border-radius: 0 0 8px 8px;
}

/* Buttons */
.btn-primary {
    background: #5865f2;
    border: none;
    border-radius: 4px;
    padding: 10px 20px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
}

.btn-primary:hover { background: #4752c4; }

.btn-ghost {
    background: none;
    border: none;
    border-radius: 4px;
    padding: 10px 16px;
    color: #dbdee1;
    font-size: 14px;
    cursor: pointer;
    transition: background .2s;
}

.btn-ghost:hover { background: #35363c; }

/* ─── USER SELECT LIST (New DM) ────────────────────────────────────────────── */
.user-select-list { max-height: 300px; overflow-y: auto; }

.user-select-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
    color: #dbdee1;
    transition: background .1s;
}

.user-select-item:hover { background: #35363c; }

/* ─── PROFILE MODAL ────────────────────────────────────────────────────────── */
.profile-box { width: 480px; overflow: hidden; }

.profile-banner {
    height: 120px;
    background: linear-gradient(135deg, #5865f2, #7289da);
    background-size: cover;
    background-position: center;
}

.profile-body {
    padding: 60px 20px 20px;
    position: relative;
}

.profile-avatar-wrap {
    position: absolute;
    top: -40px;
    left: 20px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 6px solid #313338;
    overflow: hidden;
    background: #5865f2;
}

.profile-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-body h2 { font-size: 20px; font-weight: 800; color: #fff; margin-bottom: 4px; }

.profile-divider {
    height: 1px;
    background: #26272b;
    margin: 16px 0;
}

.profile-bio-label {
    font-size: 11px;
    font-weight: 700;
    color: #b5bac1;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 6px;
}

.profile-bio { color: #dbdee1; font-size: 14px; line-height: 1.5; min-height: 20px; }

/* ─── SETTINGS MODAL ───────────────────────────────────────────────────────── */
.settings-box { width: 560px; }

.settings-banner-preview {
    height: 100px;
    background: linear-gradient(135deg, #5865f2, #7289da);
    background-size: cover;
    background-position: center;
    border-radius: 8px 8px 0 0;
}

.settings-avatar-preview {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 5px solid #313338;
    overflow: hidden;
    margin: -36px 0 12px 16px;
    background: #5865f2;
    position: relative;
}

.settings-avatar-preview img { width:100%; height:100%; object-fit:cover; }

/* ─── INPUT TYPE FILE ──────────────────────────────────────────────────────── */
input[type="file"] {
    padding: 6px;
    font-size: 13px;
    color: #949ba4;
    cursor: pointer;
}

input[type="file"]::-webkit-file-upload-button {
    background: #5865f2;
    border: none;
    border-radius: 4px;
    padding: 4px 10px;
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    margin-right: 8px;
}

/* پیدا کن و جایگزین کن */
.message-avatar {
    max-width: 400px;
    max-height: 300px;
    width: auto;
    height: auto;
    border-radius: 8px;
    object-fit: contain;
    display: block;
    margin-top: 8px;
    cursor: pointer;
}

.context-menu {
    background: #1e1f22;
    border: 1px solid #3a3b3e;
    border-radius: 8px;
    padding: 6px;
    min-width: 180px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.context-item {
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: #dcddde;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.15s;
}

.context-item:hover {
    background: #5865f2;
    color: white;
}

.context-item.danger:hover {
    background: #ed4245;
}

.member-id {
    display: none;
    font-size: 11px;
    color: #aaa;
}
.member-item:hover .member-id {
    display: block;
}
