* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: fixed;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #313338;
  color: white;
}

/* ========== AUTH SCREENS ========== */

#register-screen,
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  width: 100vw;
  background: #313338;
  padding: 16px;
}

.auth-box {
  background: #2b2d31;
  padding: 24px;
  border-radius: 8px;
  width: 100%;
  max-width: 400px;
}

.auth-box h1 {
  margin-bottom: 20px;
  color: white;
  text-align: center;
  font-size: 22px;
}

.auth-box input {
  width: 100%;
  padding: 12px;
  margin-bottom: 12px;
  background: #1e1f22;
  border: 2px solid transparent;
  border-radius: 4px;
  color: white;
  font-size: 16px;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.auth-box input:focus {
  outline: none;
  border-color: #5865f2;
  box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.2);
}

.avatar-picker {
  margin-bottom: 16px;
}

.avatar-picker p {
  color: #b5bac1;
  margin-bottom: 8px;
  font-size: 13px;
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.color-option,
.group-color-option {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.2s ease, box-shadow 0.2s ease;
}

.color-option:hover,
.group-color-option:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.color-option:active,
.group-color-option:active {
  transform: scale(0.95);
}

.color-option.selected,
.group-color-option.selected {
  border-color: white;
  transform: scale(1.15);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
}

#register-btn,
#login-btn {
  width: 100%;
  padding: 14px;
  background: #5865f2;
  border: none;
  border-radius: 4px;
  color: white;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 12px;
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

#register-btn:hover,
#login-btn:hover {
  background: #4752c4;
  box-shadow: 0 2px 8px rgba(88, 101, 242, 0.4);
}

#register-btn:active,
#login-btn:active {
  background: #3c45a5;
  transform: scale(0.98);
}

.auth-switch {
  text-align: center;
  color: #b5bac1;
  font-size: 13px;
}

.auth-switch a {
  color: #5865f2;
  text-decoration: none;
  transition: color 0.15s ease;
}

.auth-switch a:hover {
  color: #7983f5;
  text-decoration: underline;
}

.error-msg {
  color: #f23f43;
  text-align: center;
  margin-top: 8px;
  font-size: 13px;
}

/* ========== APP LAYOUT ========== */

#app {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ========== SIDEBAR ========== */

.sidebar {
  width: 240px;
  background: #2b2d31;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  padding: 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
  position: relative;
}

.mobile-settings-icon {
  position: absolute;
  top: 12px;
  left: 12px;
  background: transparent;
  border: none;
  color: #b5bac1;
  cursor: pointer;
  padding: 8px;
  border-radius: 4px;
  font-size: 20px;
  display: none;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.mobile-settings-icon:hover {
  background: #35363c;
  color: white;
}

.mobile-settings-icon:active {
  background: #404249;
  color: white;
  transform: scale(0.92);
}

#add-friend-btn {
  width: 100%;
  padding: 12px;
  background: #1e1f22;
  border: none;
  border-radius: 4px;
  color: #b5bac1;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s ease, color 0.15s ease, transform 0.15s ease;
}

#add-friend-btn:hover {
  background: #35363c;
  color: white;
}

#add-friend-btn:active {
  background: #404249;
  transform: scale(0.98);
}

/* ========== TABS ========== */

.tabs {
  display: flex;
  padding: 8px;
  gap: 4px;
  flex-shrink: 0;
}

.tab {
  flex: 1;
  padding: 10px 6px;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: #b5bac1;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  transition: background 0.2s ease, color 0.15s ease, transform 0.15s ease;
}

.tab.active {
  background: #404249;
  color: white;
}

.tab:hover:not(.active) {
  background: #35363c;
  color: #dbdee1;
}

.tab:active {
  transform: scale(0.96);
}

/* ========== CONVERSATIONS LIST ========== */

.conversations {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 8px;
  -webkit-overflow-scrolling: touch;
}

.tab-content {
  display: none;
}

.tab-content.active-tab {
  display: block;
}

.conversation {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 8px;
  border-radius: 4px;
  cursor: pointer;
  margin-bottom: 2px;
  min-height: 56px;
  transition: background 0.15s ease, transform 0.15s ease;
}

.conversation:hover {
  background: #35363c;
}

.conversation:active {
  transform: scale(0.98);
}

.conversation.active {
  background: #404249;
}

.conversation-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.conversation:hover .conversation-avatar {
  transform: scale(1.08);
}

.group-avatar {
  border-radius: 12px;
}

.conversation-info {
  flex: 1;
  min-width: 0;
}

.conversation-name {
  font-size: 15px;
  font-weight: 500;
  color: white;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-username {
  font-size: 13px;
  color: #b5bac1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ========== EMPTY STATES ========== */

.empty-state {
  padding: 20px;
  text-align: center;
  color: #b5bac1;
  animation: empty-appear 0.4s ease;
}

@keyframes empty-appear {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========== FRIEND REQUESTS ========== */

.friend-request {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 8px;
  border-radius: 4px;
  margin-bottom: 4px;
  background: #35363c;
  min-height: 56px;
  transition: background 0.15s ease, transform 0.15s ease, opacity 0.3s ease, max-height 0.3s ease;
  overflow: hidden;
}

.friend-request:hover {
  background: #3e3f45;
}

.accept-btn {
  background: #57f287;
  color: #1e1f22;
  border: none;
  padding: 10px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.accept-btn:hover {
  background: #3ba55d;
  box-shadow: 0 2px 6px rgba(87, 242, 135, 0.3);
}

.accept-btn:active {
  transform: scale(0.93);
}

/* ========== USER PANEL ========== */

.user-panel {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: #232428;
  border-top: 1px solid rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
  min-height: 64px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.user-avatar:hover {
  transform: scale(1.1);
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-username {
  font-size: 12px;
  color: #b5bac1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-icon {
  background: transparent;
  border: none;
  color: #b5bac1;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 18px;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease, transform 0.3s ease;
}

.settings-icon:hover {
  background: #35363c;
  color: white;
  transform: rotate(60deg);
}

.settings-icon:active {
  transform: rotate(120deg) scale(0.9);
}

/* ========== PROFILE PANEL (Mobile) ========== */

.profile-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #313338;
  z-index: 150;
  display: none;
}

.profile-panel.active {
  display: flex;
}

.profile-main {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
}

.profile-back-btn {
  position: absolute;
  top: 16px;
  left: 16px;
  background: transparent;
  border: none;
  color: white;
  font-size: 28px;
  cursor: pointer;
  padding: 8px;
  z-index: 10;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.profile-back-btn:active {
  opacity: 0.6;
  transform: translateX(-4px);
}

.profile-content-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.profile-avatar-large {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  font-weight: 600;
  color: white;
  margin-bottom: 24px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.profile-avatar-large:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.profile-name {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
  text-align: center;
}

.profile-username {
  font-size: 18px;
  color: #b5bac1;
  text-align: center;
}

.profile-actions {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.profile-action-btn {
  width: 52px;
  height: 52px;
  background: #5865f2;
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}

.profile-action-btn:hover {
  background: #4752c4;
  transform: scale(1.1);
  box-shadow: 0 4px 15px rgba(88, 101, 242, 0.4);
}

.profile-action-btn:active {
  background: #3c45a5;
  transform: scale(0.92);
}

/* ========== CHAT AREA ========== */

.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.chat-header {
  height: 56px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(0, 0, 0, 0.2);
  font-weight: 600;
  font-size: 16px;
  flex-shrink: 0;
}

#chat-title {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 8px;
}

.chat-title-username {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-member-count {
  font-size: 12px;
  color: #b5bac1;
  font-weight: 400;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.group-member-count:hover {
  color: white;
}

.unadd-btn {
  background: transparent;
  border: 1px solid #f23f43;
  color: #f23f43;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
  transition: background 0.2s ease, color 0.15s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.unadd-btn:hover {
  background: #f23f43;
  color: white;
  box-shadow: 0 2px 8px rgba(242, 63, 67, 0.3);
}

.unadd-btn:active {
  background: #d83639;
  color: white;
  transform: scale(0.95);
}

/* ========== MESSAGES ========== */

.messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}

.message {
  display: flex;
  gap: 12px;
  padding: 4px 0;
  margin-bottom: 8px;
  border-radius: 4px;
  transition: background 0.15s ease;
}

.message:hover {
  background: rgba(46, 48, 53, 0.5);
  margin: 0 -16px;
  padding: 4px 16px;
}

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.message:hover .message-avatar {
  transform: scale(1.06);
}

.message-content {
  flex: 1;
  min-width: 0;
}

.message-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}

.message-sender {
  font-weight: 500;
  font-size: 15px;
}

.message-time {
  font-size: 11px;
  color: #949ba4;
  transition: color 0.15s ease;
}

.message:hover .message-time {
  color: #b5bac1;
}

.message-text {
  font-size: 15px;
  color: #dbdee1;
  line-height: 1.4;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.message-image {
  max-width: 300px;
  max-height: 300px;
  border-radius: 8px;
  margin-top: 4px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: image-load 0.4s ease;
}

@keyframes image-load {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.message-image:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.message-image:active {
  transform: scale(0.98);
}

/* ========== READ RECEIPTS ========== */

.read-receipt {
  font-size: 11px;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 2px;
  opacity: 0.7;
  animation: receipt-appear 0.3s ease;
}

@keyframes receipt-appear {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 0.7; transform: translateY(0); }
}

.read-receipt .checkmarks {
  font-size: 12px;
  letter-spacing: -3px;
  margin-right: 2px;
}

.read-receipt.read {
  color: #5865f2;
  animation: receipt-read 0.4s ease;
}

@keyframes receipt-read {
  0% { color: #949ba4; transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { color: #5865f2; transform: scale(1); }
}

.read-receipt.delivered {
  color: #949ba4;
}

/* ========== INPUT AREA ========== */

.input-area {
  padding: 16px;
  flex-shrink: 0;
  background: #313338;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.input-container {
  display: flex;
  gap: 8px;
  align-items: center;
}

.image-btn {
  background: #5865f2;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 20px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}

.image-btn:hover {
  background: #4752c4;
  transform: scale(1.1);
  box-shadow: 0 2px 10px rgba(88, 101, 242, 0.4);
}

.image-btn:active {
  background: #3c45a5;
  transform: scale(0.92);
}

#message-input {
  flex: 1;
  padding: 12px 14px;
  background: #383a40;
  border: 2px solid transparent;
  border-radius: 8px;
  color: white;
  font-size: 16px;
  box-sizing: border-box;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

#message-input:focus {
  outline: none;
  background: #40444b;
  border-color: #5865f2;
  box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.15);
}

#message-input.sending {
  animation: input-send 0.3s ease;
}

@keyframes input-send {
  0% { transform: scale(1); }
  30% { transform: scale(0.98); border-color: #57f287; }
  100% { transform: scale(1); border-color: transparent; }
}

/* ========== MODALS ========== */

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0);
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 16px;
}

.modal.active {
  display: flex;
  animation: modal-backdrop-in 0.3s ease forwards;
}

@keyframes modal-backdrop-in {
  from { background: rgba(0, 0, 0, 0); }
  to { background: rgba(0, 0, 0, 0.85); }
}

.modal-content {
  background: #313338;
  padding: 24px;
  border-radius: 8px;
  width: 100%;
  max-width: 440px;
  max-height: 85vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

.modal-content h2 {
  margin-bottom: 20px;
  font-size: 20px;
}

#friend-search-input,
#group-name-input {
  width: 100%;
  padding: 14px;
  background: #1e1f22;
  border: 2px solid transparent;
  border-radius: 4px;
  color: white;
  margin-bottom: 12px;
  font-size: 16px;
  box-sizing: border-box;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

#friend-search-input:focus,
#group-name-input:focus {
  outline: none;
  border-color: #5865f2;
  box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.2);
}

#search-results {
  max-height: 50vh;
  overflow-y: auto;
  margin-bottom: 20px;
  -webkit-overflow-scrolling: touch;
}

.user-search-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 4px;
  background: #2b2d31;
  margin-bottom: 10px;
  min-height: 60px;
  transition: background 0.15s ease, transform 0.15s ease;
}

.user-search-result:hover {
  background: #35363c;
  transform: translateX(4px);
}

.add-btn {
  background: #5865f2;
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.add-btn:hover {
  background: #4752c4;
  box-shadow: 0 2px 8px rgba(88, 101, 242, 0.3);
}

.add-btn:active {
  transform: scale(0.93);
}

.add-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.add-btn.sent {
  background: #57f287;
  color: #1e1f22;
  animation: btn-sent 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes btn-sent {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

/* ========== GROUP SPECIFIC ========== */

.create-group-trigger {
  width: 100%;
  padding: 10px;
  background: #5865f2;
  border: none;
  border-radius: 4px;
  color: white;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.create-group-trigger:hover {
  background: #4752c4;
  box-shadow: 0 2px 10px rgba(88, 101, 242, 0.4);
}

.create-group-trigger:active {
  background: #3c45a5;
  transform: scale(0.97);
}

.group-friend-picker {
  max-height: 200px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #2b2d31;
  border-radius: 4px;
  padding: 4px;
}

.friend-pick-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  color: #dbdee1;
  transition: background 0.15s ease, transform 0.1s ease;
}

.friend-pick-item:hover {
  background: #35363c;
}

.friend-pick-item:active {
  transform: scale(0.98);
}

.friend-pick-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #5865f2;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.friend-pick-item input[type="checkbox"]:checked {
  transform: scale(1.15);
}

.group-member-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 4px;
  background: #2b2d31;
  margin-bottom: 4px;
  transition: background 0.15s ease, transform 0.15s ease;
}

.group-member-item:hover {
  background: #35363c;
  transform: translateX(4px);
}

.owner-badge {
  font-size: 11px;
  color: #fee75c;
  background: rgba(254, 231, 92, 0.15);
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: auto;
  font-weight: 600;
  animation: badge-glow 2s ease-in-out infinite alternate;
}

@keyframes badge-glow {
  from { box-shadow: 0 0 4px rgba(254, 231, 92, 0.1); }
  to { box-shadow: 0 0 8px rgba(254, 231, 92, 0.25); }
}

/* ========== SETTINGS ========== */

.settings-section {
  margin-bottom: 20px;
}

.settings-section h3 {
  margin-bottom: 12px;
  font-size: 16px;
}

.settings-section p {
  font-size: 14px;
  line-height: 1.5;
}

/* ========== BUTTONS ========== */

.primary-btn {
  background: #5865f2;
  color: white;
  border: none;
  padding: 14px 24px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  margin-top: 12px;
  width: 100%;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.primary-btn:hover {
  background: #4752c4;
  box-shadow: 0 2px 8px rgba(88, 101, 242, 0.4);
}

.primary-btn:active {
  background: #3c45a5;
  transform: scale(0.98);
}

.danger-btn {
  background: #f23f43;
  color: white;
  border: none;
  padding: 14px 24px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  margin-top: 12px;
  width: 100%;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.danger-btn:hover {
  background: #d83639;
  box-shadow: 0 2px 8px rgba(242, 63, 67, 0.4);
}

.danger-btn:active {
  background: #c02e31;
  transform: scale(0.98);
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

.modal-actions button {
  padding: 12px 24px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  background: #2b2d31;
  color: white;
  font-size: 14px;
  transition: background 0.15s ease, transform 0.15s ease;
}

.modal-actions button:hover {
  background: #35363c;
}

.modal-actions button:active {
  transform: scale(0.96);
}

.modal-actions-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  background: #2b2d31;
  color: white;
  font-size: 14px;
  transition: background 0.15s ease, transform 0.15s ease;
}

.modal-actions-btn:hover {
  background: #35363c;
}

.modal-actions-btn:active {
  transform: scale(0.96);
}

/* ========== SETTINGS CATEGORIES ========== */

.settings-modal-content {
  max-width: 500px;
}

.settings-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: #1e1f22;
  border-radius: 6px;
  padding: 4px;
}

.settings-tab {
  flex: 1;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: #b5bac1;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.settings-tab.active {
  background: #404249;
  color: white;
}

.settings-tab:hover:not(.active) {
  color: white;
  background: rgba(64, 66, 73, 0.5);
}

.settings-tab:active {
  transform: scale(0.96);
}

.settings-category {
  display: none;
}

.settings-category.active {
  display: block;
}

.settings-desc {
  color: #b5bac1;
  margin: 8px 0 14px;
  font-size: 14px;
  line-height: 1.5;
}

/* ========== ANIMATION PICKER ========== */

.anim-options {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.anim-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 6px;
  background: #2b2d31;
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  color: #b5bac1;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.anim-option:hover {
  background: #35363c;
  color: white;
  transform: translateY(-2px);
}

.anim-option:active {
  transform: translateY(0) scale(0.96);
}

.anim-option.active {
  border-color: #5865f2;
  color: white;
  background: #35363c;
  box-shadow: 0 0 12px rgba(88, 101, 242, 0.2);
}

.anim-preview {
  width: 40px;
  height: 30px;
  background: #1e1f22;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

.anim-box {
  width: 16px;
  height: 20px;
  background: #5865f2;
  border-radius: 2px;
  position: absolute;
  top: 5px;
  left: 12px;
}

.anim-option:hover .anim-preview-slide .anim-box {
  animation: preview-slide 0.6s ease;
}

.anim-option:hover .anim-preview-fade .anim-box {
  animation: preview-fade 0.6s ease;
}

.anim-option:hover .anim-preview-scale .anim-box {
  animation: preview-scale 0.6s ease;
}

.anim-option:hover .anim-preview-flip .anim-box {
  animation: preview-flip 0.6s ease;
}

.anim-option:hover .anim-preview-none .anim-box {
  animation: preview-blink 0.4s step-end;
}

@keyframes preview-slide {
  0% { transform: translateX(-20px); }
  100% { transform: translateX(0); }
}

@keyframes preview-fade {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes preview-scale {
  0% { transform: scale(0); }
  100% { transform: scale(1); }
}

@keyframes preview-flip {
  0% { transform: rotateY(90deg); }
  100% { transform: rotateY(0deg); }
}

@keyframes preview-blink {
  0% { opacity: 0; }
  50% { opacity: 0; }
  51% { opacity: 1; }
}

/* ========== TRANSITION ANIMATIONS ========== */

@keyframes slide-in-right {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

@keyframes slide-out-right {
  from { transform: translateX(0); }
  to { transform: translateX(100%); }
}

@keyframes slide-in-up {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes slide-out-down {
  from { transform: translateY(0); opacity: 1; }
  to { transform: translateY(30px); opacity: 0; }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes scale-in {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes scale-out {
  from { transform: scale(1); opacity: 1; }
  to { transform: scale(0.85); opacity: 0; }
}

@keyframes flip-in {
  from { transform: perspective(600px) rotateY(-90deg); opacity: 0; }
  to { transform: perspective(600px) rotateY(0); opacity: 1; }
}

@keyframes flip-out {
  from { transform: perspective(600px) rotateY(0); opacity: 1; }
  to { transform: perspective(600px) rotateY(90deg); opacity: 0; }
}

/* Chat/Panel animations */
.anim-slide-chat-enter.anim-enter-active,
.anim-slide-panel-enter.anim-enter-active {
  animation: slide-in-right 0.3s ease forwards;
}

.anim-slide-chat-exit,
.anim-slide-panel-exit {
  animation: slide-out-right 0.25s ease forwards;
}

.anim-fade-chat-enter.anim-enter-active,
.anim-fade-panel-enter.anim-enter-active {
  animation: fade-in 0.25s ease forwards;
}

.anim-fade-chat-exit,
.anim-fade-panel-exit {
  animation: fade-out 0.2s ease forwards;
}

.anim-scale-chat-enter.anim-enter-active,
.anim-scale-panel-enter.anim-enter-active {
  animation: scale-in 0.3s ease forwards;
}

.anim-scale-chat-exit,
.anim-scale-panel-exit {
  animation: scale-out 0.25s ease forwards;
}

.anim-flip-chat-enter.anim-enter-active,
.anim-flip-panel-enter.anim-enter-active {
  animation: flip-in 0.4s ease forwards;
}

.anim-flip-chat-exit,
.anim-flip-panel-exit {
  animation: flip-out 0.3s ease forwards;
}

/* Modal content animations */
.modal-slide-in { animation: slide-in-up 0.3s ease forwards; }
.modal-slide-out { animation: slide-out-down 0.2s ease forwards; }
.modal-fade-in { animation: fade-in 0.25s ease forwards; }
.modal-fade-out { animation: fade-out 0.2s ease forwards; }
.modal-scale-in { animation: scale-in 0.3s ease forwards; }
.modal-scale-out { animation: scale-out 0.2s ease forwards; }
.modal-flip-in { animation: flip-in 0.4s ease forwards; }
.modal-flip-out { animation: flip-out 0.3s ease forwards; }

/* ========== DESKTOP CHAT TRANSITION ========== */

.messages.chat-switching {
  animation: chat-content-switch 0.3s ease;
}

@keyframes chat-content-switch {
  0% { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}

.chat-header.header-switching {
  animation: header-switch 0.25s ease;
}

@keyframes header-switch {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

/* ========== PROFILE VIEWER ========== */

.profile-viewer-content {
  padding: 0;
  overflow: hidden;
}

.pv-banner {
  height: 80px;
  width: 100%;
  position: relative;
}

.pv-avatar-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: -30px;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

.pv-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 600;
  color: white;
  border: 4px solid #313338;
  flex-shrink: 0;
  cursor: default;
}

.pv-avatar.has-border {
  border-width: 3px;
}

.pv-avatar.effect-glow {
  box-shadow: 0 0 15px rgba(88, 101, 242, 0.5);
}

.pv-avatar.effect-pulse {
  animation: pulse-effect 2s ease-in-out infinite;
}

.pv-avatar.effect-shimmer {
  animation: shimmer-effect 2s ease infinite;
}

.pv-avatar.effect-rainbow {
  animation: rainbow-border 3s linear infinite;
}

@keyframes pulse-effect {
  0%, 100% { box-shadow: 0 0 0 0 rgba(88, 101, 242, 0.4); }
  50% { box-shadow: 0 0 0 10px rgba(88, 101, 242, 0); }
}

@keyframes shimmer-effect {
  0% { filter: brightness(1); }
  50% { filter: brightness(1.3); }
  100% { filter: brightness(1); }
}

@keyframes rainbow-border {
  0% { border-color: #f23f43; }
  17% { border-color: #f26522; }
  33% { border-color: #fee75c; }
  50% { border-color: #57f287; }
  67% { border-color: #5865f2; }
  83% { border-color: #eb459e; }
  100% { border-color: #f23f43; }
}

.pv-badge {
  font-size: 11px;
  color: white;
  background: #5865f2;
  padding: 3px 10px;
  border-radius: 10px;
  font-weight: 600;
  display: none;
}

.pv-badge.visible {
  display: inline-block;
}

.pv-name {
  padding: 12px 24px 0;
  font-size: 22px;
  font-weight: 700;
}

.pv-name.style-bold { font-weight: 900; }
.pv-name.style-italic { font-style: italic; }
.pv-name.style-underline { text-decoration: underline; }
.pv-name.style-mono { font-family: 'Courier New', monospace; }

.pv-username {
  padding: 2px 24px;
  font-size: 14px;
  color: #b5bac1;
}

.pv-pronouns {
  padding: 2px 24px;
  font-size: 12px;
  color: #949ba4;
  display: none;
}

.pv-pronouns.visible {
  display: block;
}

.pv-status {
  padding: 8px 24px 0;
  font-size: 13px;
  color: #dbdee1;
  display: none;
}

.pv-status.visible {
  display: block;
}

.pv-bio {
  padding: 8px 24px;
  font-size: 13px;
  color: #b5bac1;
  line-height: 1.5;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: 10px;
  display: none;
}

.pv-bio.visible {
  display: block;
}

.pv-actions {
  padding: 0 24px 16px;
  display: flex;
  gap: 8px;
}

/* ========== SETTINGS INPUTS ========== */

.settings-input {
  width: 100%;
  padding: 12px;
  background: #1e1f22;
  border: 2px solid transparent;
  border-radius: 4px;
  color: white;
  font-size: 14px;
  margin-top: 8px;
  box-sizing: border-box;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.settings-input:focus {
  outline: none;
  border-color: #5865f2;
  box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.2);
}

.settings-textarea {
  resize: vertical;
  min-height: 60px;
  max-height: 120px;
}

.profile-option-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.profile-opt-btn {
  padding: 8px 14px;
  background: #2b2d31;
  border: 2px solid transparent;
  border-radius: 6px;
  color: #b5bac1;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s ease;
}

.profile-opt-btn:hover {
  background: #35363c;
  color: white;
}

.profile-opt-btn.active {
  border-color: #5865f2;
  color: white;
  background: #35363c;
}

.emoji-opt-btn {
  padding: 6px 10px;
  font-size: 20px;
  background: #2b2d31;
  border: 2px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.emoji-opt-btn:hover {
  background: #35363c;
  transform: scale(1.15);
}

.emoji-opt-btn.active {
  border-color: #5865f2;
  background: #35363c;
}

/* ========== UNADD ALL BUTTON ========== */

.unadd-all-trigger {
  width: 100%;
  padding: 8px;
  background: transparent;
  border: 1px dashed #f23f43;
  border-radius: 4px;
  color: #f23f43;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  margin-top: 8px;
  transition: all 0.2s ease;
}

.unadd-all-trigger:hover {
  background: rgba(242, 63, 67, 0.1);
}

/* ========== GROUP MEMBER ACTIONS ========== */

.gm-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.gm-add-btn {
  padding: 4px 10px;
  background: #5865f2;
  border: none;
  border-radius: 4px;
  color: white;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.gm-add-btn:hover {
  background: #4752c4;
}

.gm-add-btn.sent {
  background: #57f287;
  color: #1e1f22;
}

.gm-add-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.gm-avatar-clickable {
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.gm-avatar-clickable:hover {
  transform: scale(1.15);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ========== CALL BUTTON ========== */

.call-btn {
  background: #57f287;
  border: none;
  color: #1e1f22;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}

.call-btn:hover {
  background: #3ba55d;
  transform: scale(1.12);
  box-shadow: 0 2px 10px rgba(87, 242, 135, 0.4);
}

.call-btn:active {
  transform: scale(0.92);
}

/* ========== CALL OVERLAYS ========== */

.call-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 5000;
  align-items: center;
  justify-content: center;
}

.call-overlay.active {
  display: flex;
  animation: call-overlay-in 0.3s ease forwards;
}

@keyframes call-overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Incoming call card */
.call-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px;
  position: relative;
}

.call-pulse-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 120px;
  height: 120px;
  margin-top: -100px;
  margin-left: -60px;
  border-radius: 50%;
  border: 3px solid rgba(87, 242, 135, 0.4);
  animation: pulse-ring 1.5s ease-out infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(2); opacity: 0; }
}

.call-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  font-weight: 600;
  color: white;
  position: relative;
  z-index: 1;
}

.call-avatar-active {
  width: 80px;
  height: 80px;
  font-size: 32px;
}

.call-name {
  font-size: 24px;
  font-weight: 700;
  color: white;
}

.call-status {
  font-size: 14px;
  color: #b5bac1;
  animation: status-blink 1.5s ease-in-out infinite;
}

@keyframes status-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.call-status.connected {
  color: #57f287;
  animation: none;
}

.call-actions {
  display: flex;
  gap: 32px;
  margin-top: 20px;
}

.call-action-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}

.call-action-btn:hover {
  transform: scale(1.12);
}

.call-action-btn:active {
  transform: scale(0.92);
}

.call-accept-btn {
  background: #57f287;
  color: #1e1f22;
  animation: accept-bounce 1s ease-in-out infinite;
}

@keyframes accept-bounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.call-accept-btn:hover {
  animation: none;
  box-shadow: 0 0 20px rgba(87, 242, 135, 0.5);
}

.call-decline-btn {
  background: #f23f43;
  color: white;
}

.call-decline-btn:hover {
  box-shadow: 0 0 20px rgba(242, 63, 67, 0.5);
}

/* Active call */
.call-active-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px;
}

.call-timer {
  font-size: 36px;
  font-weight: 300;
  color: white;
  font-variant-numeric: tabular-nums;
  letter-spacing: 2px;
}

.call-wave {
  display: flex;
  gap: 4px;
  align-items: center;
  height: 30px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.call-wave.active {
  opacity: 1;
}

.call-wave span {
  display: block;
  width: 4px;
  height: 8px;
  background: #57f287;
  border-radius: 2px;
  animation: wave-bar 0.8s ease-in-out infinite;
}

.call-wave span:nth-child(1) { animation-delay: 0s; }
.call-wave span:nth-child(2) { animation-delay: 0.1s; }
.call-wave span:nth-child(3) { animation-delay: 0.2s; }
.call-wave span:nth-child(4) { animation-delay: 0.3s; }
.call-wave span:nth-child(5) { animation-delay: 0.4s; }

@keyframes wave-bar {
  0%, 100% { height: 8px; opacity: 0.5; }
  50% { height: 24px; opacity: 1; }
}

.call-controls {
  display: flex;
  gap: 24px;
  margin-top: 24px;
}

.call-control-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #404249;
  color: white;
  transition: transform 0.2s ease, background 0.15s ease, box-shadow 0.2s ease;
}

.call-control-btn:hover {
  background: #4e5058;
  transform: scale(1.08);
}

.call-control-btn:active {
  transform: scale(0.92);
}

.call-control-btn.muted {
  background: #f23f43;
}

.call-hangup-btn {
  background: #f23f43;
  transform: rotate(135deg);
}

.call-hangup-btn:hover {
  background: #d83639;
  box-shadow: 0 0 20px rgba(242, 63, 67, 0.4);
  transform: rotate(135deg) scale(1.08);
}

.call-hangup-btn:active {
  transform: rotate(135deg) scale(0.92);
}

/* ========== SCROLLBAR ========== */

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #1e1f22;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #35363c;
}

/* ========== MOBILE ========== */

@media (max-width: 768px) {
  #app {
    height: 100dvh;
  }

  .sidebar {
    width: 100vw;
  }

  .mobile-settings-icon {
    display: block;
  }

  .settings-icon {
    display: none;
  }

  .chat-area {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    z-index: 100;
    background: #313338;
    display: none;
  }

  .chat-area.active {
    display: flex;
  }

  .tab {
    padding: 12px 8px;
  }

  .tab:active {
    background: #404249;
  }

  .conversation:active {
    background: #404249;
  }

  .conversation:hover {
    background: transparent;
  }

  .conversation:hover .conversation-avatar {
    transform: none;
  }

  .conversation.active,
  .conversation.active:hover {
    background: #404249;
  }

  .message:hover {
    background: transparent;
    margin: 0;
    padding: 4px 0;
  }

  .message:hover .message-avatar {
    transform: none;
  }

  .message-image {
    max-width: 80vw;
  }

  .accept-btn:active {
    background: #3ba55d;
  }

  .friend-pick-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
  }

  .anim-options {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .anim-option {
    padding: 10px 4px;
    font-size: 11px;
  }

  .anim-option:hover {
    transform: none;
  }

  .anim-option:active {
    transform: scale(0.95);
  }

  .settings-tabs {
    gap: 2px;
  }

  .settings-tab {
    padding: 10px 8px;
    font-size: 13px;
  }

  .user-search-result:hover {
    transform: none;
  }
  
  .group-member-item:hover {
    transform: none;
  }

  .settings-icon:hover {
    transform: none;
  }
}

/* ========== COMMUNITIES ========== */

.community-header {
  display: flex;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid #2a2a3a;
  gap: 8px;
}

.community-back-btn {
  background: none;
  border: none;
  color: #b5bac1;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.community-back-btn:hover { background: #2a2a3a; color: #fff; }

.community-view-title {
  flex: 1;
  font-weight: 700;
  color: #fff;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.community-settings-trigger {
  background: none;
  border: none;
  color: #b5bac1;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.community-settings-trigger:hover { background: #2a2a3a; color: #fff; }

.channel-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.channel-category {
  margin-bottom: 4px;
}

.channel-category-name {
  padding: 8px 12px 4px;
  font-size: 11px;
  font-weight: 700;
  color: #72767d;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.channel-item {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  margin: 1px 8px;
  border-radius: 6px;
  cursor: pointer;
  color: #8e9297;
  font-size: 14px;
  gap: 6px;
  transition: background 0.15s, color 0.15s;
}

.channel-item:hover {
  background: #2a2a3a;
  color: #dcddde;
}

.channel-item.channel-active {
  background: #3a3a4a;
  color: #fff;
}

.channel-icon {
  font-size: 16px;
  min-width: 20px;
  text-align: center;
  color: #72767d;
}

.channel-item.channel-active .channel-icon { color: #fff; }

.channel-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.community-footer {
  display: flex;
  gap: 4px;
  padding: 8px;
  border-top: 1px solid #2a2a3a;
}

.community-invite-btn,
.community-members-btn {
  flex: 1;
  background: #2a2a3a;
  border: none;
  color: #b5bac1;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.15s, color 0.15s;
}

.community-invite-btn:hover,
.community-members-btn:hover {
  background: #3a3a4a;
  color: #fff;
}

/* Channel header in chat */
.channel-header-icon {
  color: #72767d;
  font-size: 20px;
  font-weight: 700;
  margin-right: 4px;
}

.channel-topic {
  color: #72767d;
  font-size: 12px;
  margin-left: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pin-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  margin-left: auto;
  padding: 4px 8px;
  border-radius: 4px;
  opacity: 0.6;
}

.pin-btn:hover { opacity: 1; background: #2a2a3a; }

/* Community messages with avatars */
.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
  cursor: pointer;
}

.message-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
}

.message-sender {
  font-weight: 600;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}

.message-sender:hover { text-decoration: underline; }

.message-time {
  font-size: 11px;
  color: #72767d;
}

.edited-tag {
  font-size: 10px;
  color: #72767d;
  font-style: italic;
}

.pinned-tag { font-size: 12px; }

/* Role tags */
.role-tag {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 600;
  margin-left: 4px;
}

.role-owner { background: #fee75c; color: #000; }
.role-admin { background: #ed4245; color: #fff; }
.role-mod { background: #57f287; color: #000; }
.role-member { background: #4f545c; color: #b5bac1; }

/* Invite code display */
.invite-code-display {
  background: #1a1a2e;
  color: #5865f2;
  padding: 8px 16px;
  border-radius: 6px;
  font-family: monospace;
  font-size: 16px;
  letter-spacing: 1px;
  display: inline-block;
  user-select: all;
}

/* Member management */
.members-mgmt-list {
  max-height: 400px;
  overflow-y: auto;
}

.member-mgmt-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.member-mgmt-item:hover { background: #2a2a3a; }

.member-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-shrink: 0;
}

.role-select {
  background: #1a1a2e;
  color: #b5bac1;
  border: 1px solid #3a3a4a;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
  cursor: pointer;
}

.small-btn {
  background: #4f545c;
  color: #fff;
  border: none;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  transition: background 0.15s;
}

.small-btn:hover { background: #5865f2; }

.danger-small {
  background: #ed4245;
}

.danger-small:hover { background: #c03537; }

/* Channel management */
.channel-mgmt-list {
  max-height: 200px;
  overflow-y: auto;
}

.channel-mgmt-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: 4px;
  background: #1a1a2e;
  margin-bottom: 4px;
  color: #b5bac1;
  font-size: 13px;
}

/* Community settings tabs */
.comm-settings-tab {
  background: none;
  border: none;
  color: #b5bac1;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.comm-settings-tab.active {
  color: #fff;
  border-bottom-color: #5865f2;
}

.comm-settings-category {
  display: none;
}

.comm-settings-category.active {
  display: block;
}

/* Pinned messages */
.pinned-list {
  max-height: 400px;
  overflow-y: auto;
}

.pinned-message-item {
  padding: 10px;
  background: #1a1a2e;
  border-radius: 6px;
  margin-bottom: 8px;
  border-left: 3px solid #5865f2;
}

.pinned-message-item .message-text {
  color: #dcddde;
  font-size: 13px;
  margin-top: 4px;
}

/* Community channels view layout fix */
#community-channels-view {
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

#community-channels-view .channel-list {
  flex: 1;
  overflow-y: auto;
}

/* Make community message display more Discord-like */
.message[data-msg-id] {
  display: flex;
  gap: 12px;
  padding: 8px 16px;
  align-items: flex-start;
}

.message[data-msg-id] .message-content {
  flex: 1;
  min-width: 0;
}

.message-image {
  max-width: 300px;
  max-height: 300px;
  border-radius: 6px;
  margin-top: 4px;
}

@media (max-width: 768px) {
  .member-actions { flex-direction: column; gap: 2px; }
  .role-select { font-size: 10px; }
  .channel-topic { display: none; }
}

/* ========== CONTEXT MENU ========== */

.ctx-menu {
  position: fixed;
  z-index: 99999;
  min-width: 200px;
  max-width: 280px;
  background: #111214;
  border: 1px solid #2a2a3a;
  border-radius: 8px;
  padding: 6px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6), 0 2px 8px rgba(0,0,0,0.3);
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.ctx-menu.ctx-visible {
  opacity: 1;
  transform: scale(1);
  pointer-events: all;
}

.ctx-item {
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 4px;
  cursor: pointer;
  color: #dcddde;
  font-size: 13px;
  gap: 10px;
  transition: background 0.1s, color 0.1s;
  user-select: none;
}

.ctx-item:hover {
  background: #5865f2;
  color: #fff;
}

.ctx-item.ctx-danger {
  color: #ed4245;
}

.ctx-item.ctx-danger:hover {
  background: #ed4245;
  color: #fff;
}

.ctx-icon {
  font-size: 15px;
  min-width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.ctx-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ctx-hint {
  font-size: 11px;
  color: #72767d;
  margin-left: auto;
  flex-shrink: 0;
}

.ctx-item:hover .ctx-hint {
  color: rgba(255,255,255,0.5);
}

.ctx-separator {
  height: 1px;
  background: #2a2a3a;
  margin: 4px 8px;
}

/* ========== TOAST ========== */

.ctx-toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #18191c;
  color: #dcddde;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  border: 1px solid #2a2a3a;
  z-index: 999999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.ctx-toast.ctx-toast-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Hover highlight on messages for context menu */
.message[data-msg-id]:hover {
  background: rgba(255,255,255,0.02);
}

/* Category right-click cursor */
.channel-category-name {
  cursor: context-menu;
}