/* ========================================
   VoxCord - Discord-like Theme
   ======================================== */

:root {
  --bg-primary: #313338;
  --bg-secondary: #2b2d31;
  --bg-tertiary: #1e1f22;
  --bg-modifier-hover: rgba(79, 84, 92, 0.16);
  --bg-modifier-active: rgba(79, 84, 92, 0.24);
  --bg-modifier-selected: rgba(79, 84, 92, 0.32);
  --bg-floating: #111214;
  --text-normal: #dbdee1;
  --text-muted: #949ba4;
  --text-link: #00a8fc;
  --text-positive: #23a559;
  --text-danger: #f23f43;
  --header-primary: #f2f3f5;
  --header-secondary: #b5bac1;
  --brand-500: #5865f2;
  --brand-560: #4752c4;
  --brand-600: #3c45a5;
  --green-360: #23a559;
  --red-400: #f23f43;
  --yellow-300: #fee75c;
  --channel-icon: #80848e;
  --input-bg: #383a40;
  --scrollbar-thin: #1a1b1e;
  --scrollbar-auto: #2b2d31;
  --font-primary: 'DM Sans', 'Segoe UI', sans-serif;
  --font-code: 'JetBrains Mono', 'Consolas', monospace;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --shadow-high: 0 8px 16px rgba(0,0,0,0.24);
  --transition: 150ms ease;
}

/* Theme presets */
[data-theme="midnight"] {
  --bg-primary: #1a1a2e;
  --bg-secondary: #16213e;
  --bg-tertiary: #0f0f23;
  --bg-floating: #0a0a1a;
  --input-bg: #1f1f3a;
  --scrollbar-thin: #0a0a1a;
  --scrollbar-auto: #16213e;
  --bg-modifier-hover: rgba(60, 60, 120, 0.2);
  --bg-modifier-active: rgba(60, 60, 120, 0.3);
  --bg-modifier-selected: rgba(60, 60, 120, 0.4);
}

[data-theme="amoled"] {
  --bg-primary: #000000;
  --bg-secondary: #0a0a0a;
  --bg-tertiary: #000000;
  --bg-floating: #0a0a0a;
  --input-bg: #1a1a1a;
  --scrollbar-thin: #000000;
  --scrollbar-auto: #0a0a0a;
  --bg-modifier-hover: rgba(255, 255, 255, 0.05);
  --bg-modifier-active: rgba(255, 255, 255, 0.08);
  --bg-modifier-selected: rgba(255, 255, 255, 0.12);
}

[data-theme="light"] {
  --bg-primary: #ffffff;
  --bg-secondary: #f2f3f5;
  --bg-tertiary: #e3e5e8;
  --bg-floating: #ffffff;
  --text-normal: #2e3338;
  --text-muted: #6d6f78;
  --text-link: #0068e0;
  --header-primary: #060607;
  --header-secondary: #4f5660;
  --channel-icon: #6d6f78;
  --input-bg: #ebedef;
  --scrollbar-thin: #d4d6da;
  --scrollbar-auto: #e3e5e8;
  --bg-modifier-hover: rgba(79, 84, 92, 0.08);
  --bg-modifier-active: rgba(79, 84, 92, 0.16);
  --bg-modifier-selected: rgba(79, 84, 92, 0.2);
  --shadow-high: 0 8px 16px rgba(0,0,0,0.1);
}

/* Theme presets UI */
.theme-presets {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.theme-preset {
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  background: var(--bg-modifier-hover);
  color: var(--text-normal);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.15s;
}
.theme-preset:hover { background: var(--bg-modifier-active); }
.theme-preset.active { border-color: var(--brand-500); background: var(--bg-modifier-selected); }

/* Accent color picker UI */
.accent-colors {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.accent-color {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
}
.accent-color:hover { transform: scale(1.15); }
.accent-color.active { border-color: var(--header-primary); box-shadow: 0 0 0 2px var(--bg-primary); }

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

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-primary);
  background: var(--bg-tertiary);
  color: var(--text-normal);
  font-size: 15px;
  line-height: 1.375;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thin); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-auto); }

a { color: var(--text-link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ========================================
   AUTH SCREEN
   ======================================== */

.auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #1e1f22 0%, #2b2d31 50%, #1e1f22 100%);
  animation: authBgShift 20s ease-in-out infinite alternate;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

@keyframes authBgShift {
  0% { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}

.auth-screen.hidden { display: none; }

.auth-container {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 480px;
  max-width: 95vw;
  box-shadow: var(--shadow-high);
  animation: authSlideUp 0.4s ease-out;
}

@keyframes authSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

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

.auth-logo-icon {
  font-size: 48px;
  margin-bottom: 8px;
  animation: logoPulse 2s ease-in-out infinite;
}

@keyframes logoPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.auth-logo h1 {
  color: var(--header-primary);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.auth-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 4px;
}

.auth-form { display: none; }
.auth-form.active { display: block; }

.auth-form h2 {
  color: var(--header-primary);
  font-size: 24px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 4px;
}

.auth-desc {
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 20px;
  font-size: 14px;
}

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

.form-group label {
  display: block;
  color: var(--header-secondary);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-bottom: 8px;
}

.form-group input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-normal);
  font-size: 15px;
  font-family: var(--font-primary);
  outline: none;
  transition: box-shadow var(--transition);
}

.form-group input:focus {
  box-shadow: 0 0 0 2px var(--brand-500);
}

.form-error {
  color: var(--text-danger);
  font-size: 13px;
  margin-bottom: 12px;
  min-height: 18px;
}

.btn-primary {
  width: 100%;
  padding: 12px;
  background: var(--brand-500);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-primary);
  cursor: pointer;
  transition: background var(--transition);
  margin-bottom: 8px;
}

.btn-primary:hover { background: var(--brand-560); }
.btn-primary:active { background: var(--brand-600); }

.auth-switch {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.auth-switch a { font-size: 13px; }

/* ========================================
   MAIN APP LAYOUT
   ======================================== */

.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.app.hidden { display: none; }

/* Server Sidebar (leftmost icons) */
.server-sidebar {
  width: 72px;
  background: var(--bg-tertiary);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  gap: 8px;
  flex-shrink: 0;
  overflow-y: auto;
}

.server-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 20px;
  position: relative;
}

.server-icon:hover, .server-icon.active {
  border-radius: 16px;
  background: var(--brand-500);
}

.server-icon.active::before {
  content: '';
  position: absolute;
  left: -16px;
  width: 4px;
  height: 40px;
  background: var(--header-primary);
  border-radius: 0 4px 4px 0;
}

.server-separator {
  width: 32px;
  height: 2px;
  background: var(--bg-modifier-active);
  border-radius: 1px;
}

/* Channel Sidebar */
.channel-sidebar {
  width: 240px;
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.channel-header {
  height: 48px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--bg-tertiary);
  box-shadow: 0 1px 0 rgba(0,0,0,0.1);
  flex-shrink: 0;
}

.channel-header h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--header-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-header-btn {
  background: none;
  border: none;
  color: var(--channel-icon);
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: color var(--transition);
}

.channel-header-btn:hover { color: var(--text-normal); }

/* Channel List */
.channel-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px;
}

.channel-category {
  padding: 16px 0 4px 2px;
}

.channel-category-header {
  display: flex;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  padding: 0 4px;
}

.channel-category-header h3 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--channel-icon);
  flex: 1;
}

.channel-category-header .arrow {
  font-size: 10px;
  color: var(--channel-icon);
  transition: transform var(--transition);
}

.channel-item {
  display: flex;
  align-items: center;
  padding: 6px 8px;
  margin: 1px 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--channel-icon);
  font-weight: 500;
  transition: all var(--transition);
  gap: 6px;
  font-size: 15px;
  position: relative;
}

.channel-item:hover {
  background: var(--bg-modifier-hover);
  color: var(--text-normal);
}

.channel-item.active {
  background: var(--bg-modifier-selected);
  color: var(--header-primary);
}

.channel-item .channel-icon {
  font-size: 18px;
  opacity: 0.7;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.channel-item .channel-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-item .voice-users {
  font-size: 11px;
  color: var(--text-muted);
}

.voice-connected-users {
  padding-left: 30px;
}

.voice-connected-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.voice-connected-user .mini-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
}

/* User Panel (bottom of channel sidebar) */
.user-panel {
  height: 52px;
  background: rgba(17, 18, 20, 0.3);
  display: flex;
  align-items: center;
  padding: 0 8px;
  flex-shrink: 0;
}

.user-panel-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
  position: relative;
}

.user-avatar::after {
  content: '';
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 10px;
  height: 10px;
  background: #3ba55c;
  border: 2px solid var(--bg-tertiary);
  border-radius: 50%;
}
.user-avatar[data-presence="idle"]::after { background: #faa61a; }
.user-avatar[data-presence="dnd"]::after { background: #ed4245; }
.user-avatar[data-presence="invisible"]::after { background: #747f8d; }

.user-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--header-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-status {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-panel-controls {
  display: flex;
  gap: 2px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--channel-icon);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.icon-btn:hover {
  background: var(--bg-modifier-hover);
  color: var(--text-normal);
}

.icon-btn.active { color: var(--header-primary); }

/* ========================================
   MAIN CONTENT
   ======================================== */

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--bg-primary);
}

.chat-header {
  height: 48px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--bg-tertiary);
  box-shadow: 0 1px 0 rgba(0,0,0,0.1);
  flex-shrink: 0;
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-header-left .channel-icon {
  color: var(--channel-icon);
  font-size: 20px;
  font-weight: 700;
}

.chat-header-left .channel-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--header-primary);
}

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

.content-body {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

/* ========================================
   TEXT CHAT VIEW
   ======================================== */

.chat-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.chat-view.hidden { display: none; }

.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 8px;
  min-height: 0;
}

.channel-welcome {
  padding: 16px 0 24px;
}

.channel-welcome-icon {
  width: 68px;
  height: 68px;
  background: var(--bg-modifier-active);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  color: var(--header-primary);
  font-weight: 700;
  margin-bottom: 8px;
}

.channel-welcome h2 {
  color: var(--header-primary);
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
}

.channel-welcome p {
  color: var(--text-muted);
  font-size: 14px;
}

/* Messages */
.message {
  padding: 2px 16px 2px 72px;
  position: relative;
  min-height: 2.75rem;
  margin: 0 -16px;
  transition: background var(--transition);
}

.message:hover {
  background: var(--bg-modifier-hover);
}

.message.has-header {
  margin-top: 16px;
  padding-top: 4px;
}

.message-avatar {
  position: absolute;
  left: 16px;
  top: 4px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.message-content {
  min-width: 0;
  font-size: var(--msg-font-size, 15px);
}

.message-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.message-author {
  font-size: 15px;
  font-weight: 600;
  color: var(--header-primary);
  cursor: pointer;
}

.message-author:hover { text-decoration: underline; }

.message-timestamp {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

.message-text {
  color: var(--text-normal);
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: pre-wrap;
}

.message-text a {
  color: var(--text-link);
}

/* Attachments */
.message-attachment {
  margin-top: 4px;
  max-width: 550px;
}

.message-attachment img:hover { opacity: 0.9; }

.message-attachment video {
  max-width: 100%;
  max-height: 350px;
  border-radius: var(--radius-md);
}

.message-attachment audio {
  display: block;
  margin-top: 4px;
}

.message-file {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--bg-modifier-active);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  max-width: 420px;
}

.message-file-icon {
  font-size: 32px;
  flex-shrink: 0;
}

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

.message-file-name {
  color: var(--text-link);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}

.message-file-size {
  font-size: 12px;
  color: var(--text-muted);
}

.message-file-download {
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  transition: color var(--transition);
}

.message-file-download:hover { color: var(--text-normal); }

/* GIF attachment */
.message-gif {
  margin-top: 4px;
  max-width: 350px;
  overflow: hidden;
}

.message-gif img {
  display: block;
  width: 100%;
  max-width: 350px;
  max-height: 300px;
  min-height: 80px;
  border-radius: var(--radius-md);
  object-fit: contain;
  background: var(--bg-secondary);
}

/* Regular image attachments */
.message-attachment img {
  display: block;
  max-width: 100%;
  max-height: 350px;
  min-height: 40px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: opacity var(--transition);
  background: var(--bg-secondary);
}

/* Typing indicator */
.typing-indicator {
  padding: 0 16px;
  height: 24px;
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.typing-dots span {
  width: 4px;
  height: 4px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-4px); }
}

/* Chat Input */
.chat-input-container {
  padding: 0 16px 24px;
  flex-shrink: 0;
  position: relative;
}

.chat-input-wrapper {
  display: flex;
  align-items: flex-end;
  background: var(--input-bg);
  border-radius: var(--radius-md);
  padding: 2px 4px;
}

.chat-input-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--channel-icon);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color var(--transition);
  flex-shrink: 0;
  font-family: var(--font-primary);
}

.chat-input-btn:hover { color: var(--text-normal); }

.chat-input {
  flex: 1;
  min-height: 40px;
  max-height: 300px;
  padding: 10px 0;
  color: var(--text-normal);
  font-size: 15px;
  font-family: var(--font-primary);
  line-height: 1.375;
  outline: none;
  overflow-y: auto;
  word-break: break-word;
}

.chat-input:empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  pointer-events: none;
}
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg-tertiary);
  border-top: 1px solid var(--bg-modifier-active);
}
.search-bar input[type="text"] {
  background: var(--input-bg);
  border: none;
  color: var(--text-normal);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
  flex: 1;
}
.search-bar.hidden { display: none; }
.search-option { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.search-channel-tag { background: var(--bg-modifier-active); padding: 1px 6px; border-radius: 3px; font-size: 11px; color: var(--text-muted); margin-left: 4px; }
.search-result-item:hover { background: var(--bg-modifier-hover); }
.search-result-item mark { background: var(--yellow-300); color: #000; padding: 0 2px; border-radius: 2px; }

.sb-fav-badge {
  position: absolute;
  top: 2px;
  left: 2px;
  font-size: 12px;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity 0.15s;
  cursor: pointer;
  z-index: 2;
}
.soundboard-btn:hover .sb-fav-badge { opacity: 0.7; }
.sb-fav-badge.active { opacity: 1; color: #fee75c; }
.sb-fav-badge:hover { opacity: 1 !important; transform: scale(1.2); }

.sb-edit-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  font-size: 11px;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
  transition: opacity 0.15s;
}
.soundboard-btn:hover .sb-edit-badge { opacity: 0.7; }
.sb-edit-badge:hover { opacity: 1 !important; transform: scale(1.2); }

/* Keybinds */
.keybind-list { display: flex; flex-direction: column; gap: 8px; }
.keybind-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--bg-modifier-active); }
.keybind-row:last-child { border-bottom: none; }
.keybind-row span { color: var(--text-normal); font-size: 14px; }
kbd { background: var(--bg-tertiary); border: 1px solid var(--bg-modifier-active); border-radius: 4px; padding: 3px 8px; font-size: 12px; font-family: var(--font-code); color: var(--text-muted); }

/* Compact mode */
.compact-mode .message { padding: 2px 16px; }
.compact-mode .message-avatar { display: none; }
.compact-mode .message.has-header { margin-top: 2px; }
.compact-mode .message.has-header .message-avatar { display: none; }

/* Reduced motion */
.reduce-motion, .reduce-motion * { animation: none !important; transition: none !important; }

/* Push-to-Talk */
#btn-ptt {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
#btn-ptt.active { color: var(--brand-500); }
.ptt-transmitting {
  color: var(--green-360) !important;
  animation: ptt-pulse 0.5s ease infinite alternate;
}
@keyframes ptt-pulse {
  from { opacity: 0.7; }
  to { opacity: 1; box-shadow: 0 0 8px var(--green-360); }
}

/* Game activity */
.member-activity {
  display: block;
  font-size: 11px;
  color: var(--brand-500);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* New messages banner */
.new-messages-banner {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--brand-500);
  color: #fff;
  text-align: center;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.new-messages-banner.hidden { display: none; }
.new-messages-banner button {
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  padding: 2px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  margin-left: 8px;
}
.new-messages-banner button:hover { background: rgba(255,255,255,0.3); }

/* Bookmarks */
.msg-action-btn.bookmarked { color: var(--yellow-300) !important; opacity: 1 !important; }

/* Spoiler tags */
.spoiler {
  background: var(--bg-tertiary);
  color: transparent;
  padding: 0 4px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}
.spoiler.revealed { color: var(--text-normal); background: var(--bg-modifier-active); }
.spoiler:hover:not(.revealed) { background: var(--bg-modifier-hover); }

/* Code blocks */
.code-block {
  background: var(--bg-tertiary);
  border: 1px solid var(--bg-modifier-active);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin: 6px 0;
  overflow-x: auto;
  font-family: var(--font-code);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-normal);
  white-space: pre;
}
.code-block code { background: none; padding: 0; }
.inline-code {
  background: var(--bg-tertiary);
  padding: 2px 4px;
  border-radius: 3px;
  font-family: var(--font-code);
  font-size: 13px;
}
del { color: var(--text-muted); text-decoration: line-through; }

/* Mini-games */
.game-widget {
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-top: 6px;
  max-width: 360px;
}
.game-title { font-weight: 700; font-size: 14px; color: var(--header-primary); margin-bottom: 6px; }
.game-info { font-size: 12px; color: var(--text-muted); margin: 4px 0; }
.game-result { font-size: 14px; font-weight: 700; color: var(--brand-500); margin-top: 8px; }
.game-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.game-btn {
  padding: 6px 14px; border-radius: var(--radius-sm); border: 1px solid var(--bg-modifier-active);
  background: var(--bg-secondary); color: var(--text-normal); cursor: pointer; font-size: 13px;
  transition: all 0.15s;
}
.game-btn:hover { background: var(--brand-500); color: #fff; border-color: var(--brand-500); }
.game-btn.active { background: var(--brand-500); color: #fff; border-color: var(--brand-500); }
.game-btn-sm {
  padding: 3px 7px; border-radius: 3px; border: 1px solid var(--bg-modifier-active);
  background: var(--bg-secondary); color: var(--text-normal); cursor: pointer; font-size: 11px; min-width: 24px;
  transition: all 0.1s;
}
.game-btn-sm:hover:not(:disabled) { background: var(--brand-500); color: #fff; }
.game-btn-sm.used, .game-btn-sm:disabled { opacity: 0.3; cursor: default; }
.game-hangman-word { font-family: var(--font-code); font-size: 20px; letter-spacing: 4px; color: var(--header-primary); margin: 8px 0; }
.game-hangman-keys { display: flex; flex-wrap: wrap; gap: 3px; max-width: 340px; }
.game-ttt-grid { display: grid; grid-template-columns: repeat(3, 48px); gap: 3px; margin: 8px 0; }
.game-ttt-cell {
  width: 48px; height: 48px; border-radius: 4px; border: 1px solid var(--bg-modifier-active);
  background: var(--bg-secondary); font-size: 22px; display: flex; align-items: center; justify-content: center; cursor: default;
}
.game-ttt-cell.clickable { cursor: pointer; }
.game-ttt-cell.clickable:hover { background: var(--bg-modifier-hover); }
.game-c4-cols { display: flex; gap: 2px; margin-bottom: 4px; }
.game-c4-grid { display: grid; grid-template-columns: repeat(7, 32px); gap: 2px; }
.game-c4-cell {
  width: 32px; height: 32px; border-radius: 50%; background: var(--bg-secondary);
  display: flex; align-items: center; justify-content: center; font-size: 16px;
}

.member-level {
  font-size: 10px;
  font-weight: 700;
  color: var(--brand-500);
  background: var(--bg-modifier-active);
  padding: 1px 5px;
  border-radius: 8px;
  margin-left: 4px;
  vertical-align: middle;
}

.chat-input.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  user-select: none;
}

.chat-input-actions {
  display: flex;
  flex-shrink: 0;
}

/* Attachment Preview */
.attachment-preview {
  display: flex;
  gap: 8px;
  padding: 8px;
  flex-wrap: wrap;
}

.attachment-preview-item {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--bg-modifier-active);
  border-radius: var(--radius-md);
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 200px;
}

.attachment-preview-item img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.attachment-preview-item .remove-attachment {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  background: var(--text-danger);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.attachment-preview-name {
  font-size: 12px;
  color: var(--text-muted);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ========================================
   VOICE VIEW
   ======================================== */

/* Column wrapper for voice panel + chat */
.main-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.voice-view {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--bg-modifier-active);
  padding: 0;
}

.voice-view.hidden { display: none; }

.voice-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  gap: 12px;
}

.voice-room-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.voice-room-info h3 {
  color: var(--header-primary);
  font-size: 15px;
  font-weight: 600;
  margin: 0;
}

.voice-room-status {
  color: var(--text-muted);
  font-size: 12px;
}

.voice-members-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 10px;
}

.voice-member {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: var(--bg-modifier-hover);
  border-radius: var(--radius-md);
}

.voice-member-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #fff;
  font-weight: 700;
  position: relative;
  transition: box-shadow 0.2s;
}

.voice-member-avatar.speaking {
  box-shadow: 0 0 0 3px var(--green-360), 0 0 12px rgba(59, 165, 93, 0.5);
}

.voice-member-name {
  font-size: 13px;
  color: var(--header-primary);
  font-weight: 500;
}

/* Speaking indicator for sidebar mini-avatars */
.mini-avatar {
  transition: box-shadow 0.15s ease;
}
.mini-avatar.speaking {
  box-shadow: 0 0 0 2px var(--green-360), 0 0 8px rgba(59, 165, 93, 0.5);
}

/* Soundboard playing indicator — orange pulsing ring */
.mini-avatar.sb-active {
  box-shadow: 0 0 0 2px #faa61a, 0 0 10px rgba(250, 166, 26, 0.6);
  animation: sbPulse 0.8s ease infinite;
}
@keyframes sbPulse {
  0%, 100% { box-shadow: 0 0 0 2px #faa61a, 0 0 10px rgba(250, 166, 26, 0.6); }
  50% { box-shadow: 0 0 0 3px #faa61a, 0 0 16px rgba(250, 166, 26, 0.4); }
}
/* Also highlight in the member list */
.member-avatar.sb-active {
  box-shadow: 0 0 0 2px #faa61a, 0 0 10px rgba(250, 166, 26, 0.6);
  animation: sbPulse 0.8s ease infinite;
}

.voice-member-muted {
  position: absolute;
  bottom: 0;
  right: 0;
  background: var(--bg-tertiary);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

/* Screen Share */
.screen-share-container {
  width: 100%;
  max-width: 900px;
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #000;
}

.screen-share-container.hidden { display: none; }

.screen-share-container video {
  width: 100%;
  display: block;
}

.screen-share-label {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
}

/* Voice Controls */
.voice-controls {
  display: flex;
  gap: 8px;
}

.voice-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--bg-modifier-active);
  color: var(--header-primary);
  border: none;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-primary);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.voice-btn:hover { background: var(--bg-modifier-selected); }

.voice-btn.active {
  background: var(--green-360);
  color: #fff;
}

.voice-btn.danger {
  background: var(--red-400);
  color: #fff;
}

.voice-btn.danger:hover {
  background: #d83c3e;
}

.voice-btn.hidden { display: none; }

/* ========================================
   MEMBERS SIDEBAR
   ======================================== */

.members-sidebar {
  width: 240px;
  background: var(--bg-secondary);
  padding: 16px 8px;
  overflow-y: auto;
  flex-shrink: 0;
  transition: width var(--transition);
}

.members-sidebar.hidden {
  width: 0;
  padding: 0;
  overflow: hidden;
}

.members-section h3 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--channel-icon);
  padding: 8px 8px 4px;
}

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

.member-item:hover { background: var(--bg-modifier-hover); }

.member-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
  position: relative;
}

.member-avatar .status-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 10px;
  height: 10px;
  border: 2px solid var(--bg-secondary);
  border-radius: 50%;
}

.status-dot.online { background: var(--green-360); }
.status-dot.offline { background: var(--channel-icon); }
.status-dot.away { background: #faa61a; }

.member-details {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.member-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--channel-icon);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-status-text {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-item:hover .member-name { color: var(--text-normal); }

.member-item.offline { opacity: 0.4; }

/* ========================================
   GIF PICKER
   ======================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.5);
}

.modal-overlay.hidden { display: none; }

.gif-picker {
  width: 480px;
  max-width: 95vw;
  height: 500px;
  background: var(--bg-floating);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-high);
  animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.gif-picker-header {
  display: flex;
  align-items: center;
  padding: 12px;
  gap: 8px;
  border-bottom: 1px solid var(--bg-modifier-active);
}

.gif-picker-header input {
  flex: 1;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-normal);
  font-size: 14px;
  font-family: var(--font-primary);
  outline: none;
}

.gif-close {
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition);
}

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

.gif-results {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-content: flex-start;
}

.gif-results img {
  width: calc(50% - 2px);
  height: 140px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: opacity var(--transition);
}

.gif-results img:hover { opacity: 0.8; }

.gif-placeholder {
  width: 100%;
  text-align: center;
  color: var(--text-muted);
  padding: 40px;
}

.gif-powered {
  padding: 8px;
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--bg-modifier-active);
}

/* ========================================
   EMOJI PICKER
   ======================================== */

.emoji-picker {
  position: fixed;
  bottom: 80px;
  right: 280px;
  width: 352px;
  height: 300px;
  background: var(--bg-floating);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-high);
  overflow-y: auto;
  padding: 8px;
  z-index: 1000;
  animation: modalSlideIn 0.2s ease-out;
}

.emoji-picker.hidden { display: none; }

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
}

.emoji-item {
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

.emoji-item:hover { background: var(--bg-modifier-hover); }

/* ========================================
   CONTEXT MENU
   ======================================== */

.context-menu {
  position: fixed;
  background: var(--bg-floating);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-high);
  padding: 6px 8px;
  min-width: 188px;
  z-index: 2000;
}

.context-menu.hidden { display: none; }

.context-menu-item {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  color: var(--text-normal);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background var(--transition);
}

.context-menu-item:hover {
  background: var(--brand-500);
  color: #fff;
}

.context-menu-item.danger { color: var(--text-danger); }
.context-menu-item.danger:hover { background: var(--text-danger); color: #fff; }

/* ========================================
   IMAGE LIGHTBOX
   ======================================== */

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  cursor: pointer;
  animation: fadeIn 0.2s ease;
}

.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-high);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ========================================
   VOICE CONNECTED BAR (in channel sidebar)
   ======================================== */

.voice-connected-bar {
  background: var(--bg-tertiary);
  padding: 8px 12px;
  border-top: 1px solid rgba(0,0,0,0.2);
  flex-shrink: 0;
}

.voice-connected-info {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.voice-connected-status {
  font-size: 13px;
  font-weight: 600;
  color: var(--green-360);
}

.voice-connected-channel {
  font-size: 12px;
  color: var(--text-muted);
}

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

.voice-connected-actions .icon-btn {
  width: 28px;
  height: 28px;
}

/* ========================================
   RESPONSIVE
   ======================================== */

/* ========================================
   MOBILE / RESPONSIVE
   ======================================== */

/* Hide mobile-only elements on desktop */
.mobile-only { display: none !important; }

@media (max-width: 1200px) {
  .members-sidebar { width: 0; padding: 0; overflow: hidden; }
}

@media (max-width: 768px) {
  /* Show mobile menu button */
  .mobile-only { display: flex !important; }

  /* Hide server sidebar on mobile */
  .server-sidebar { display: none; }

  /* Channel sidebar — slides in from left */
  .channel-sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    bottom: 0;
    width: 280px;
    z-index: 1000;
    transition: left 0.25s ease;
    background: var(--bg-secondary);
    box-shadow: 4px 0 20px rgba(0,0,0,0.5);
  }
  .channel-sidebar.mobile-open { left: 0; }

  /* Members sidebar — slides in from right */
  .members-sidebar {
    position: fixed;
    right: -260px;
    top: 0;
    bottom: 0;
    width: 260px !important;
    padding: 16px !important;
    z-index: 1000;
    transition: right 0.25s ease;
    background: var(--bg-secondary);
    box-shadow: -4px 0 20px rgba(0,0,0,0.5);
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  .members-sidebar.mobile-open { right: 0; }

  /* Dark overlay behind open sidebars */
  .channel-sidebar.mobile-open::after,
  .members-sidebar.mobile-open::after {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: -1;
  }

  /* Main content fills full width */
  .main-content { width: 100%; }
  .content-body { width: 100%; }

  /* Chat header compact */
  .chat-header { padding: 8px 12px; }

  /* Messages scrollable with touch */
  .messages-container {
    -webkit-overflow-scrolling: touch;
    padding: 12px 10px 8px;
  }

  /* Chat input compact */
  .chat-input-container { padding: 0 8px 8px; }
  .chat-input-wrapper { padding: 6px 8px; }
  .chat-input { font-size: 16px; } /* Prevents iOS zoom on focus */

  /* User panel — show as fixed bottom bar on mobile */
  .user-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 900;
    background: var(--bg-tertiary);
    padding: 6px 12px;
    border-top: 1px solid var(--bg-modifier-accent, #3f4147);
    height: auto;
  }
  .user-panel-info { display: none; } /* Hide avatar/name on mobile bar — save space */
  .user-panel-controls { gap: 4px; justify-content: center; width: 100%; }
  .icon-btn { width: 36px; height: 36px; }

  /* Make room for the fixed bottom bar */
  .chat-view { padding-bottom: 80px !important; }

  /* Now playing bar */
  .now-playing-bar {
    right: 8px;
    left: 8px;
    width: auto;
    bottom: 0;
  }
  .queue-widget {
    right: 8px;
    left: 8px;
    width: auto;
    bottom: 76px;
  }

  /* Side panels (search, pins, roles) */
  .side-panel { width: 100% !important; }

  /* Settings dialog */
  .settings-overlay .settings-container {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
  }
  .settings-nav { width: 160px; min-width: 160px; }

  /* Soundboard panel */
  .soundboard-panel { width: 95vw; max-width: none; }

  /* Music player */
  .music-player { padding: 10px; }

  /* Profile modal */
  .profile-modal { width: 90vw; }

  /* Voice view buttons */
  .voice-controls { flex-wrap: wrap; gap: 6px; }
  .voice-controls button { font-size: 12px; padding: 6px 10px; }
}

@media (max-width: 480px) {
  .now-playing-info .now-playing-title { max-width: 100px; }
  .eq-canvas { width: 60px; }
  .music-thumbnail { display: none; }

  /* Settings even more compact */
  .settings-overlay .settings-container {
    flex-direction: column;
  }
  .settings-nav {
    width: 100%;
    min-width: 100%;
    flex-direction: row;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-right: none;
    border-bottom: 1px solid var(--bg-modifier-active);
  }
  .settings-nav-item { white-space: nowrap; font-size: 12px; }
  .settings-content { padding: 16px; }

  /* Auth screen scrollable */
  .auth-screen {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 20px;
    align-items: flex-start;
  }
  .auth-container {
    width: 100%;
    padding: 20px;
  }
}

/* Ensure touch scrolling works everywhere */
.messages-container,
.channel-list,
.members-sidebar,
.soundboard-grid,
.settings-content,
.admin-content,
.emoji-grid {
  -webkit-overflow-scrolling: touch;
}

/* ========================================
   MUSIC PLAYER
   ======================================== */

.music-player {
  width: 100%;
  max-width: 620px;
  background: var(--bg-secondary);
  border: 1px solid var(--bg-modifier-active);
  border-radius: var(--radius-lg);
  overflow: hidden;
  animation: musicSlideUp 0.3s ease-out;
}

.music-player.hidden { display: none; }

@keyframes musicSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.music-player-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
}

.music-thumbnail {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.music-thumbnail-placeholder {
  font-size: 28px;
  animation: musicSpin 3s linear infinite;
}

.music-player.paused .music-thumbnail-placeholder {
  animation-play-state: paused;
}

@keyframes musicSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

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

.music-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--header-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.music-meta {
  display: flex;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.music-channel {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.music-requested {
  white-space: nowrap;
  color: var(--brand-500);
}

.music-progress-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.music-time {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-code);
  min-width: 32px;
  text-align: center;
}

.music-progress-bar {
  flex: 1;
  height: 4px;
  background: var(--bg-modifier-active);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
  transition: height 0.1s;
}

.music-progress-bar:hover {
  height: 6px;
}

.music-progress-fill {
  height: 100%;
  background: var(--brand-500);
  border-radius: 2px;
  width: 0%;
  position: relative;
  transition: width 0.3s linear;
}

/* Scrubber thumb — appears on hover */
.music-progress-fill::after {
  content: '';
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%) scale(0);
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
  transition: transform 0.1s;
}

.music-progress-bar:hover .music-progress-fill::after {
  transform: translateY(-50%) scale(1);
}

/* Remove transition during drag for responsive feel */
.music-progress-bar:active .music-progress-fill {
  transition: none;
}

.music-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.music-ctrl-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--header-secondary);
  cursor: pointer;
  border-radius: 50%;
  transition: all var(--transition);
}

.music-ctrl-btn:hover {
  background: var(--bg-modifier-hover);
  color: var(--header-primary);
}

.music-ctrl-btn.hidden { display: none; }

.music-volume-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  margin-left: 4px;
}

.music-volume {
  width: 70px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--bg-modifier-active);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.music-volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  background: var(--header-primary);
  border-radius: 50%;
  cursor: pointer;
}

.music-volume::-moz-range-thumb {
  width: 12px;
  height: 12px;
  background: var(--header-primary);
  border-radius: 50%;
  border: none;
  cursor: pointer;
}

.music-status-msg {
  padding: 0 16px 10px;
  font-size: 12px;
  color: var(--text-muted);
  display: none;
}

.music-status-msg.visible {
  display: block;
}

/* Music command messages in chat */
.message-music-cmd {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-secondary);
  border-left: 3px solid var(--brand-500);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 10px 14px;
  margin-top: 4px;
  max-width: 480px;
}

.message-music-cmd.searching {
  border-left-color: var(--yellow-300);
}

.message-music-cmd.error {
  border-left-color: var(--red-400);
}

.message-music-cmd .music-cmd-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.message-music-cmd .music-cmd-text {
  font-size: 13px;
  color: var(--text-normal);
}

.message-music-cmd .music-cmd-text strong {
  color: var(--header-primary);
}

/* ========================================
   MUSIC SEARCH WIDGET
   ======================================== */

.music-search-widget {
  margin: 12px 0;
  background: var(--bg-secondary);
  border-radius: 8px;
  border: 1px solid var(--bg-modifier-active);
  overflow: hidden;
  max-width: 520px;
}

.music-search-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--bg-modifier-active);
}

.music-search-icon {
  font-size: 24px;
  width: 36px;
  height: 36px;
  background: var(--brand-500);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.music-search-title {
  color: var(--header-primary);
  font-size: 15px;
  font-weight: 700;
}

.music-search-meta {
  color: var(--text-muted);
  font-size: 12px;
}

.music-search-tracks {
  display: flex;
  flex-direction: column;
}

.music-search-track {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  cursor: pointer;
  transition: background 0.15s;
}

.music-search-track:hover {
  background: var(--bg-modifier-hover);
}

.music-search-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-modifier-active);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.music-search-track:hover .music-search-num {
  background: var(--brand-500);
  color: #fff;
}

.music-search-thumb {
  width: 48px;
  height: 36px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-tertiary);
}

.music-search-thumb-placeholder {
  width: 48px;
  height: 36px;
  border-radius: 4px;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.music-search-track-info {
  flex: 1;
  min-width: 0;
}

.music-search-track-title {
  color: var(--header-primary);
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.music-search-track-channel {
  color: var(--text-muted);
  font-size: 12px;
}

.music-search-play-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--green-360);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s, transform 0.15s;
}

.music-search-track:hover .music-search-play-btn {
  opacity: 1;
}

.music-search-play-btn:hover {
  transform: scale(1.1);
}

.music-search-actions {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--bg-modifier-active);
}

.music-search-action-btn {
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--bg-modifier-active);
  color: var(--text-normal);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-primary);
  cursor: pointer;
  transition: background 0.15s;
}

.music-search-action-btn:hover {
  background: var(--bg-modifier-hover);
}

.music-search-cancel-btn {
  margin-left: auto;
  color: var(--text-muted);
}

.music-search-cancel-btn:hover {
  color: var(--text-danger);
  background: rgba(237, 66, 69, 0.1);
}

/* ========================================
   NOW PLAYING BAR (bottom-right)
   ======================================== */

.now-playing-bar {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-floating);
  border-radius: 10px;
  padding: 14px 16px 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  z-index: 800;
  min-width: 320px;
  max-width: 460px;
  border: 1px solid var(--bg-modifier-active);
  animation: np-slide-in 0.3s ease-out;
  overflow: hidden;
}

.now-playing-bar.hidden { display: none; }

/* NP Seek Bar (thin bar along top of Now Playing) */
.np-seek-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255,255,255,0.1);
  cursor: pointer;
  z-index: 2;
  transition: height 0.1s;
}
.np-seek-bar:hover { height: 6px; }
.np-seek-fill {
  height: 100%;
  background: var(--brand-500);
  width: 0%;
  position: relative;
  transition: width 0.3s linear;
}
.np-seek-bar:active .np-seek-fill { transition: none; }
.np-seek-fill::after {
  content: '';
  position: absolute;
  right: -5px;
  top: 50%;
  transform: translateY(-50%) scale(0);
  width: 10px;
  height: 10px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
  transition: transform 0.1s;
}
.np-seek-bar:hover .np-seek-fill::after {
  transform: translateY(-50%) scale(1);
}

/* Queue Widget */
.queue-widget {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 320px;
  background: var(--bg-floating);
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  border: 1px solid var(--bg-modifier-active);
  z-index: 799;
  overflow: hidden;
}
.queue-widget.hidden { display: none; }

.queue-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--bg-modifier-active);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.queue-widget-count {
  background: var(--brand-500);
  color: #fff;
  font-size: 11px;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

.queue-widget-list {
  max-height: 200px;
  overflow-y: auto;
}

.queue-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  transition: background 0.1s;
}
.queue-item:hover { background: var(--bg-modifier-hover); }

.queue-item-num {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.queue-item-thumb {
  width: 36px;
  height: 27px;
  border-radius: 3px;
  object-fit: cover;
  background: var(--bg-tertiary);
  flex-shrink: 0;
}

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

.queue-item-title {
  font-size: 13px;
  color: var(--header-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-item-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.queue-item-remove {
  width: 22px;
  height: 22px;
  border: none;
  background: rgba(255,255,255,0.05);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}
.queue-item-remove:hover { color: #fff; background: var(--text-danger); }

/* Search queue button */
.music-search-queue-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--brand-500);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s, transform 0.15s;
}
.music-search-track:hover .music-search-queue-btn { opacity: 1; }
.music-search-queue-btn:hover { transform: scale(1.1); background: var(--brand-560); }
.music-search-queue-btn:disabled { background: var(--green-360); cursor: default; transform: none; }

@keyframes np-slide-in {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.eq-wrap {
  position: relative;
  flex-shrink: 0;
  cursor: pointer;
}

.eq-canvas {
  width: 120px;
  height: 40px;
  border-radius: 6px;
  background: var(--bg-tertiary);
  display: block;
}

.eq-enable-btn {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  border-radius: 6px;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}

.eq-wrap:hover .eq-enable-btn {
  opacity: 1;
}

.eq-enable-btn.hidden { display: none; }

.now-playing-info {
  flex: 1;
  min-width: 0;
}

.now-playing-title {
  color: var(--header-primary);
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.now-playing-artist {
  color: var(--text-muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.now-playing-volume {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.np-vol-icon {
  color: var(--text-muted);
  flex-shrink: 0;
}

.np-vol-slider {
  width: 80px;
  accent-color: var(--brand-500);
  cursor: pointer;
}

.np-vol-pct {
  color: var(--text-muted);
  font-size: 11px;
  min-width: 30px;
  text-align: right;
}

/* ========================================
   DIRECT MESSAGES
   ======================================== */

.dm-section {
  border-top: 1px solid var(--bg-modifier-active);
  padding: 8px 0;
  flex-shrink: 0;
}

.dm-section-header {
  padding: 6px 16px;
  color: var(--channel-icon);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
}
.dm-section-header:hover { color: var(--text-normal); }

.dm-list {
  max-height: 180px;
  overflow-y: auto;
}

.dm-empty {
  padding: 8px 16px;
  color: var(--text-muted);
  font-size: 13px;
  font-style: italic;
}

.dm-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  cursor: pointer;
  border-radius: 4px;
  margin: 0 8px;
  transition: background 0.1s;
}
.dm-item:hover { background: var(--bg-modifier-hover); }
.dm-item.active { background: var(--bg-modifier-selected); }

.dm-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
}

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

.dm-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-normal);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dm-preview {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dm-badge {
  background: var(--red-400);
  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;
  flex-shrink: 0;
}

/* Profile modal DM button */
.profile-dm-btn {
  display: block;
  width: calc(100% - 32px);
  margin: 4px 16px 16px;
  padding: 8px;
  background: var(--brand-500);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-primary);
  cursor: pointer;
  transition: background 0.15s;
}
.profile-dm-btn:hover { background: var(--brand-560); }
.profile-dm-btn.hidden { display: none; }

/* ========================================
   @MENTION SYSTEM
   ======================================== */

/* Mention highlight in messages */
.mention {
  background: rgba(88, 101, 242, 0.15);
  color: var(--brand-500);
  padding: 0 2px;
  border-radius: 3px;
  font-weight: 600;
  cursor: pointer;
}
.mention:hover {
  background: rgba(88, 101, 242, 0.3);
  text-decoration: underline;
}

/* Self-mention — brighter highlight */
.mention.mention-self {
  background: rgba(88, 101, 242, 0.3);
  color: #dee0fc;
}

/* Mentioned message row highlight */
.message.mentioned {
  background: rgba(250, 166, 26, 0.06);
  border-left: 3px solid #faa61a;
  margin-left: -19px;
  padding-left: 75px;
}

/* Autocomplete popup */
.mention-autocomplete {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: var(--bg-floating);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  max-height: 220px;
  overflow-y: auto;
  padding: 8px;
  z-index: 100;
  margin-bottom: 4px;
}
.mention-autocomplete.hidden { display: none; }

.mention-ac-header {
  padding: 4px 8px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.mention-ac-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.1s;
}
.mention-ac-item:hover,
.mention-ac-item.selected {
  background: var(--brand-500);
}
.mention-ac-item:hover *,
.mention-ac-item.selected * {
  color: #fff;
}

.mention-ac-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
}

.mention-ac-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--header-primary);
}

.mention-ac-status {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: auto;
}

/* Toast notifications */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-floating);
  border-radius: 8px;
  padding: 12px 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  border-left: 4px solid var(--brand-500);
  max-width: 360px;
  pointer-events: auto;
  animation: toast-in 0.3s ease-out;
}

.toast.toast-out {
  animation: toast-out 0.3s ease-in forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(40px); }
}

.toast-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
}

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

.toast-title {
  color: var(--header-primary);
  font-size: 14px;
  font-weight: 600;
}

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

.toast-channel {
  color: var(--text-muted);
  font-size: 11px;
}

/* ========================================
   UTILITY
   ========================================*/

.hidden { display: none !important; }

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--bg-modifier-active);
  border-top-color: var(--brand-500);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ========================================
   SETTINGS DIALOG
   ======================================== */

.settings-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  z-index: 1000;
  display: flex;
}
.settings-overlay.hidden { display: none; }

.settings-dialog {
  display: flex;
  width: 100%;
  height: 100%;
}

.settings-sidebar {
  width: 220px;
  background: var(--bg-secondary);
  padding: 60px 8px 20px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.settings-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  margin-bottom: 8px;
}

.settings-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}

.settings-user-name {
  color: var(--header-primary);
  font-weight: 600;
  font-size: 14px;
}

.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-nav-item {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.settings-nav-item:hover {
  background: var(--bg-modifier-hover);
  color: var(--text-normal);
}
.settings-nav-item.active {
  background: var(--bg-modifier-selected);
  color: var(--header-primary);
}
.settings-nav-item.danger { color: var(--text-danger); }
.settings-nav-item.danger:hover { background: rgba(237, 66, 69, 0.1); }
.settings-nav-separator {
  height: 1px;
  background: var(--bg-modifier-active);
  margin: 8px 12px;
}

.settings-content {
  flex: 1;
  padding: 60px 40px 40px;
  overflow-y: auto;
  max-width: 740px;
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.settings-header h2 {
  color: var(--header-primary);
  font-size: 20px;
  font-weight: 600;
}

.settings-close {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--text-muted);
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.settings-close:hover {
  border-color: var(--header-primary);
  color: var(--header-primary);
}

.settings-section { margin-bottom: 32px; }
.settings-section.hidden { display: none; }
.settings-section h3 {
  color: var(--header-primary);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.settings-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
}

.settings-field {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--bg-modifier-active);
}
.settings-field:last-child { border-bottom: none; }
.settings-field label {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  min-width: 140px;
}
.settings-field span {
  color: var(--text-normal);
  font-size: 14px;
}
.settings-field input[type="text"],
.settings-field select {
  flex: 1;
  background: var(--bg-tertiary);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-normal);
  padding: 8px 12px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
.settings-field input[type="range"] {
  flex: 1;
  accent-color: var(--brand-500);
}
.settings-field select {
  cursor: pointer;
}

.btn-small {
  padding: 6px 16px;
  background: var(--brand-500);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.btn-small:hover { background: var(--brand-560); }

.btn-settings-action {
  padding: 8px 20px;
  background: var(--bg-modifier-active);
  color: var(--text-normal);
  border: 1px solid var(--bg-modifier-active);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-primary);
  cursor: pointer;
  white-space: nowrap;
  min-width: 80px;
  text-align: center;
  transition: all var(--transition);
}
.btn-settings-action:hover {
  background: var(--bg-modifier-hover);
  border-color: var(--text-muted);
}
.btn-settings-action.active {
  background: var(--red-400);
  border-color: var(--red-400);
  color: #fff;
}

.btn-secondary {
  padding: 8px 20px;
  background: transparent;
  color: var(--text-normal);
  border: 1px solid var(--text-muted);
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: pointer;
}
.btn-secondary:hover { border-color: var(--header-primary); color: var(--header-primary); }

.audio-meter {
  flex: 1;
  height: 10px;
  min-width: 120px;
  background: var(--bg-tertiary);
  border-radius: 5px;
  overflow: hidden;
}
.audio-meter-bar {
  height: 100%;
  width: 0%;
  background: var(--green-360);
  border-radius: 5px;
  transition: width 0.08s ease-out;
}

/* ========================================
   USER PROFILE MODAL
   ======================================== */

.profile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}
.profile-overlay.hidden { display: none; }

.profile-card {
  width: 340px;
  background: var(--bg-floating);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.profile-banner {
  height: 60px;
  background: var(--brand-500);
}

.profile-avatar-large {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 6px solid var(--bg-floating);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: #fff;
  font-weight: 700;
  position: absolute;
  top: 20px;
  left: 20px;
}

.profile-body {
  padding: 48px 16px 16px;
}

.profile-body h2 {
  color: var(--header-primary);
  font-size: 20px;
  font-weight: 700;
}

.profile-displayname {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 2px;
}

.profile-divider {
  height: 1px;
  background: var(--bg-modifier-active);
  margin: 12px 0;
}

.profile-section h3 {
  color: var(--header-primary);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.profile-section {
  margin-bottom: 12px;
}

.profile-status-text {
  color: var(--text-muted);
  font-size: 14px;
}

.profile-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0,0,0,0.3);
  border: none;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ========================================
   CHANNEL MANAGEMENT MODAL
   ======================================== */

.channel-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}
.channel-modal-overlay.hidden { display: none; }

.channel-modal {
  width: 420px;
  background: var(--bg-floating);
  border-radius: 8px;
  padding: 24px;
}

.channel-modal h2 {
  color: var(--header-primary);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
}

.channel-type-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.channel-type-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-normal);
  font-size: 14px;
}
.channel-type-option:hover { background: var(--bg-modifier-hover); }
.channel-type-option input { accent-color: var(--brand-500); }

.channel-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
}

/* ========================================
   CONTEXT MENU (enhanced)
   ======================================== */

.context-menu {
  position: fixed;
  background: var(--bg-floating);
  border-radius: var(--radius-md);
  padding: 6px 8px;
  min-width: 180px;
  box-shadow: var(--shadow-high);
  z-index: 1100;
}
.context-menu.hidden { display: none; }

.context-menu-item {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-normal);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}
.context-menu-item:hover {
  background: var(--brand-500);
  color: #fff;
}
.context-menu-item.danger { color: var(--text-danger); }
.context-menu-item.danger:hover { background: var(--text-danger); color: #fff; }

.context-menu-separator {
  height: 1px;
  background: var(--bg-modifier-active);
  margin: 4px 0;
}

/* ========================================
   STATUS INDICATORS (enhanced)
   ======================================== */

.voice-connected-user .status-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
}

/* ========================================
   NEW FEATURES CSS
   ======================================== */

/* ---- UNREAD BADGES ---- */
.channel-item.unread .channel-name {
  color: var(--header-primary);
  font-weight: 700;
}
.unread-badge {
  background: var(--text-danger);
  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 4px;
  margin-left: auto;
  flex-shrink: 0;
}

/* ---- MESSAGE HOVER ACTIONS ---- */
.message {
  position: relative;
}
.msg-actions {
  display: none;
  gap: 2px;
  background: var(--bg-floating);
  border: 1px solid var(--bg-modifier-active);
  border-radius: 6px;
  padding: 2px;
  position: absolute;
  right: 16px;
  top: 4px;
  z-index: 5;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.message:hover .msg-actions { display: flex; }
.msg-action-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 4px;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s;
}
.msg-action-btn:hover { background: var(--bg-modifier-hover); }

/* ---- REACTIONS ---- */
.reactions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.reaction-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid var(--bg-modifier-active);
  background: var(--bg-secondary);
  color: var(--text-normal);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.reaction-pill:hover { background: var(--bg-modifier-hover); border-color: var(--text-muted); }
.reaction-pill.mine { border-color: var(--brand-500); background: rgba(88,101,242,0.15); }
.reaction-add-btn {
  width: 26px;
  height: 26px;
  border-radius: 12px;
  border: 1px dashed var(--bg-modifier-active);
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.reaction-add-btn:hover { background: var(--bg-modifier-hover); border-style: solid; color: var(--text-normal); }

/* ---- REACTION PICKER ---- */
.reaction-picker {
  display: flex;
  gap: 2px;
  padding: 6px;
  background: var(--bg-floating);
  border: 1px solid var(--bg-modifier-active);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.reaction-pick-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  border-radius: 6px;
  font-size: 18px;
  cursor: pointer;
  transition: background 0.1s, transform 0.1s;
}
.reaction-pick-btn:hover { background: var(--bg-modifier-hover); transform: scale(1.2); }

/* ---- EDIT INPUT ---- */
.edit-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.edit-input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--brand-500);
  background: var(--bg-secondary);
  color: var(--text-normal);
  font-size: 14px;
  font-family: inherit;
}
.edit-input:focus { outline: none; border-color: var(--brand-560); }
.edit-actions {
  display: flex;
  gap: 6px;
}
.edit-actions button {
  padding: 3px 12px;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
}
.edit-save { background: var(--brand-500); color: #fff; }
.edit-save:hover { background: var(--brand-560); }
.edit-cancel { background: var(--bg-modifier-active); color: var(--text-muted); }
.edit-cancel:hover { background: var(--bg-modifier-hover); }

/* ---- EDITED TAG ---- */
.msg-edited {
  color: var(--text-muted);
  font-size: 11px;
  font-style: italic;
}

/* ---- ROLE BADGE ---- */
.role-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255,255,255,0.06);
  border: 1px solid transparent;
  margin-left: 2px;
  vertical-align: middle;
  white-space: nowrap;
}
.member-roles {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-top: 1px;
}

/* ---- SIDE PANELS (Pins, Search, Files) ---- */
.side-panel {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 340px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--bg-modifier-active);
  z-index: 50;
  overflow-y: auto;
  animation: slideInRight 0.15s ease;
}
@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}
.side-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--bg-modifier-active);
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
  z-index: 1;
}
.side-panel-header h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--header-primary);
  margin: 0;
}
.side-panel-close {
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.side-panel-close:hover { background: var(--bg-modifier-hover); color: var(--text-normal); }
.side-panel-item {
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.1s;
}
.side-panel-item:hover { background: var(--bg-modifier-hover); }
.side-panel-item-header {
  font-size: 13px;
  margin-bottom: 4px;
}
.side-panel-item-body {
  font-size: 13px;
  color: var(--text-normal);
  word-break: break-word;
}
.side-panel-empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* ---- FILE ITEMS ---- */
.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
}
.file-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
}
.file-icon {
  width: 48px;
  height: 48px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.file-info {
  flex: 1;
  min-width: 0;
}
.file-info a {
  color: var(--brand-500);
  font-size: 13px;
  text-decoration: none;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-info a:hover { text-decoration: underline; }

/* ---- IMAGE LIGHTBOX ---- */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
.lightbox-overlay.hidden { display: none; }
.lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  cursor: default;
}
.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-close:hover { background: rgba(255,255,255,0.2); }

/* ---- LINK PREVIEWS ---- */
.link-previews {
  margin-top: 4px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-left: 3px solid var(--brand-500);
  border-radius: 0 4px 4px 0;
  max-width: 400px;
}
.link-previews:empty { display: none; }

/* ---- MENTIONED HIGHLIGHT ---- */
.message.mentioned {
  border-left: 3px solid #faa61a;
  background: rgba(250,166,26,0.06);
}

/* ---- TEXT MUTED UTILITY ---- */
.text-muted { color: var(--text-muted); font-size: 12px; }

/* ========================================
   MOBILE RESPONSIVE
   ======================================== */
/* Pin action buttons */
.pin-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.pin-jump-btn, .pin-unpin-btn {
  padding: 3px 10px;
  border: none;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  font-weight: 600;
}
.pin-jump-btn {
  background: var(--brand-500);
  color: #fff;
}
.pin-jump-btn:hover { background: var(--brand-560); }
.pin-unpin-btn {
  background: var(--bg-modifier-active);
  color: var(--text-muted);
}
.pin-unpin-btn:hover { background: var(--text-danger); color: #fff; }

/* ---- POLL WIDGET ---- */
.poll-widget {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  max-width: 400px;
}
.poll-option {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border: 1px solid var(--bg-modifier-active);
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text-normal);
  cursor: pointer;
  font-size: 14px;
  text-align: left;
  overflow: hidden;
  transition: border-color 0.15s;
}
.poll-option:hover { border-color: var(--brand-500); }
.poll-option.voted { border-color: var(--brand-500); border-width: 2px; }
.poll-option-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: rgba(88, 101, 242, 0.15);
  border-radius: 7px;
  transition: width 0.4s ease;
  z-index: 0;
}
.poll-option.voted .poll-option-bar {
  background: rgba(88, 101, 242, 0.25);
}
.poll-option-label {
  position: relative;
  z-index: 1;
  font-weight: 500;
}
.poll-option-count {
  position: relative;
  z-index: 1;
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-left: 8px;
}
.poll-total {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  padding-left: 4px;
}

/* ========================================
   YOUTUBE VIDEO PLAYER
   ======================================== */
.yt-container {
  position: fixed;
  z-index: 1500;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
}

/* Hidden = audio-only mode */
.yt-container.yt-hidden {
  position: fixed;
  top: -9999px; left: -9999px;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* Small mode (PiP corner) */
.yt-container.yt-small {
  bottom: 90px;
  right: 20px;
  width: 360px;
  height: auto;
  cursor: move;
}
.yt-container.yt-small #yt-player-wrap {
  width: 360px;
  height: 203px;
}
.yt-container.yt-small iframe {
  width: 360px !important;
  height: 203px !important;
}

/* Large mode (center overlay) */
.yt-container.yt-large {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 854px;
  height: auto;
}
.yt-container.yt-large #yt-player-wrap {
  width: 854px;
  height: 480px;
}
.yt-container.yt-large iframe {
  width: 854px !important;
  height: 480px !important;
}

/* Minimized = just the header bar */
.yt-container.yt-minimized #yt-player-wrap {
  display: none;
}
.yt-container.yt-minimized {
  bottom: 90px;
  right: 20px;
  width: 300px;
  height: auto;
}

.yt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: rgba(30, 30, 30, 0.95);
  gap: 8px;
  min-height: 32px;
}

.yt-title {
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.yt-header-btns {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.yt-btn {
  width: 26px;
  height: 26px;
  border: none;
  background: none;
  color: rgba(255,255,255,0.7);
  font-size: 14px;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.yt-btn:hover { background: rgba(255,255,255,0.15); color: #fff; }
#yt-btn-close:hover { background: rgba(237,66,69,0.6); color: #fff; }

#yt-player-wrap {
  background: #000;
  line-height: 0;
}

/* Backdrop for large mode */
.yt-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1499;
}
.yt-backdrop.hidden { display: none; }

@media (max-width: 768px) {
  .yt-container.yt-large {
    width: 95vw;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
  }
  .yt-container.yt-large #yt-player-wrap,
  .yt-container.yt-large iframe {
    width: 95vw !important;
    height: 53vw !important;
  }
  .yt-container.yt-small {
    width: 200px;
    bottom: 80px; right: 8px;
  }
  .yt-container.yt-small #yt-player-wrap,
  .yt-container.yt-small iframe {
    width: 200px !important;
    height: 113px !important;
  }
}

/* ---- VIDEO PLAYER CONTROLS BAR ---- */
.yt-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(30, 30, 30, 0.95);
}
.yt-ctrl-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.yt-ctrl-btn:hover { background: rgba(255,255,255,0.2); }
#yt-ctrl-stop:hover { background: rgba(237,66,69,0.5); }

.yt-ctrl-seek {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}
.yt-ctrl-time {
  font-size: 11px;
  color: rgba(255,255,255,0.6);
  font-family: var(--font-code);
  min-width: 32px;
  text-align: center;
}
.yt-ctrl-seekbar {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
  transition: height 0.1s;
}
.yt-ctrl-seekbar:hover { height: 6px; }
.yt-ctrl-seekfill {
  height: 100%;
  background: var(--brand-500);
  border-radius: 2px;
  width: 0%;
  position: relative;
}
.yt-ctrl-seekfill::after {
  content: '';
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%) scale(0);
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
  transition: transform 0.1s;
}
.yt-ctrl-seekbar:hover .yt-ctrl-seekfill::after {
  transform: translateY(-50%) scale(1);
}
.yt-ctrl-seekbar:active .yt-ctrl-seekfill { transition: none; }

.yt-container.yt-minimized .yt-controls { display: none; }

/* ---- PROFILE ACTIONS ---- */
.profile-actions {
  margin-top: 10px;
}
.profile-actions:empty { display: none; }
.profile-actions-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 0 4px;
  letter-spacing: 0.5px;
}
.profile-action-btn {
  display: block;
  width: 100%;
  padding: 8px 12px;
  margin-top: 4px;
  border: none;
  border-radius: 6px;
  background: var(--bg-modifier-hover);
  color: var(--text-normal);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}
.profile-action-btn:hover { background: var(--bg-modifier-active); }
.profile-action-btn:disabled { opacity: 0.5; cursor: default; }
.profile-action-btn.danger-btn { color: var(--text-danger); }
.profile-action-btn.danger-btn:hover { background: rgba(237,66,69,0.15); }

/* Profile role badge */
.profile-role-badge {
  position: absolute;
  top: 72px;
  right: 16px;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(0,0,0,0.4);
}

/* NP Close Button */
.np-close-btn {
  width: 24px;
  height: 24px;
  border: none;
  background: rgba(255,255,255,0.08);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: 4px;
  transition: all 0.15s;
}
.np-close-btn:hover { background: rgba(237,66,69,0.4); color: #fff; }

/* ---- MENTION BAR ---- */
.mention-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--brand-500);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  animation: mentionBarSlide 0.2s ease;
}
.mention-bar.hidden { display: none; }
@keyframes mentionBarSlide {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.mention-bar-icon {
  width: 22px;
  height: 22px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}
.mention-bar-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mention-bar-jump {
  padding: 3px 10px;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 4px;
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}
.mention-bar-jump:hover { background: rgba(255,255,255,0.25); }
.mention-bar-dismiss {
  width: 20px;
  height: 20px;
  border: none;
  background: none;
  color: rgba(255,255,255,0.6);
  font-size: 14px;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.mention-bar-dismiss:hover { color: #fff; background: rgba(255,255,255,0.15); }

/* ---- MENTION BADGE (channel list) ---- */
.mention-badge {
  background: var(--text-danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  margin-left: auto;
  flex-shrink: 0;
}

/* ---- ROLE MANAGEMENT ---- */
.role-card {
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.role-card:hover { background: var(--bg-modifier-hover); }
.role-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
}
.role-card-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.role-card-name {
  font-weight: 600;
  font-size: 14px;
}
.role-card-count {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
}
.role-card-perms {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  padding-left: 20px;
}
.role-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  padding-left: 20px;
}
.role-edit-btn, .role-delete-btn {
  padding: 2px 10px;
  border: none;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
}
.role-edit-btn { background: var(--bg-modifier-active); color: var(--text-normal); }
.role-edit-btn:hover { background: var(--brand-500); color: #fff; }
.role-delete-btn { background: none; color: var(--text-muted); }
.role-delete-btn:hover { color: var(--text-danger); }

/* Role editor */
.role-editor {
  padding: 12px 16px;
}
.role-editor-field {
  margin-bottom: 10px;
}
.role-editor-field label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.role-editor-field input[type="text"],
.role-editor-field input[type="color"] {
  padding: 6px 10px;
  border-radius: 4px;
  border: 1px solid var(--bg-modifier-active);
  background: var(--bg-tertiary);
  color: var(--text-normal);
  font-size: 14px;
  width: 100%;
  box-sizing: border-box;
}
.role-editor-field input[type="color"] {
  width: 48px;
  height: 32px;
  padding: 2px;
  cursor: pointer;
}
.role-editor-section {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 12px 0 6px;
  border-top: 1px solid var(--bg-modifier-active);
  margin-top: 8px;
}
.role-perm-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  cursor: pointer;
  font-size: 13px;
}
.role-perm-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--brand-500);
  flex-shrink: 0;
}
.role-perm-name {
  color: var(--text-normal);
  font-weight: 500;
}
.role-perm-desc {
  color: var(--text-muted);
  font-size: 11px;
}

/* Profile role checkboxes */
.profile-role-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-normal);
}
.profile-role-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--brand-500);
}

/* ========================================
   SOUNDBOARD
   ======================================== */
.soundboard-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease;
}
.soundboard-overlay.hidden { display: none; }

.soundboard-panel {
  background: var(--bg-secondary);
  border-radius: 12px;
  width: 90vw;
  max-width: 720px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  animation: scaleIn 0.2s ease;
}
@keyframes scaleIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.soundboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.soundboard-header h3 {
  margin: 0;
  font-size: 16px;
  color: var(--text-normal);
}
.soundboard-close {
  width: 28px;
  height: 28px;
  border: none;
  background: rgba(255,255,255,0.06);
  color: var(--text-muted);
  font-size: 16px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.soundboard-close:hover { background: rgba(237,66,69,0.3); color: #fff; }

.soundboard-grid {
  padding: 16px;
  overflow-y: auto;
  max-height: 60vh;
}


.soundboard-empty, .soundboard-loading {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-muted);
  padding: 40px 20px;
  font-size: 14px;
}

/* Soundboard tabs */
.soundboard-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding: 0 16px;
}
.sb-tab {
  padding: 10px 16px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}
.sb-tab:hover { color: var(--text-normal); }
.sb-tab.active { color: var(--brand-500); border-bottom-color: var(--brand-500); }

/* Upload button */
.soundboard-upload-btn {
  border: 2px dashed rgba(255,255,255,0.15) !important;
  background: transparent !important;
}
.soundboard-upload-btn:hover {
  border-color: var(--brand-500) !important;
  background: rgba(88,101,242,0.1) !important;
}

/* Delete badge */
.sb-delete-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: var(--text-muted);
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
  cursor: pointer;
  z-index: 2;
}
.soundboard-btn:hover .sb-delete-badge { opacity: 1; }
.sb-delete-badge:hover { background: var(--text-danger); color: #fff; }

/* Upload form */
.sb-upload-form {
  grid-column: 1 / -1;
  padding: 8px;
}
.sb-upload-form h4 {
  margin: 0 0 12px;
  color: var(--text-normal);
}
.sb-upload-field {
  margin-bottom: 10px;
}
.sb-upload-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.sb-upload-field input[type="text"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--bg-modifier-active);
  border-radius: 6px;
  background: var(--bg-tertiary);
  color: var(--text-normal);
  font-size: 14px;
  box-sizing: border-box;
}
.sb-upload-field input[type="file"] {
  font-size: 12px;
  color: var(--text-muted);
}
.sb-upload-actions {
  display: flex;
  gap: 8px;
}

/* ========================================
   ADMIN PANEL
   ======================================== */
.admin-section {
  margin-bottom: 24px;
}
.admin-section h3 {
  font-size: 14px;
  color: var(--text-normal);
  margin: 0 0 12px;
}
.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.admin-stat {
  background: var(--bg-tertiary);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}
.admin-stat-num {
  display: block;
  font-size: 24px;
  font-weight: 700;
  color: var(--text-normal);
}
.admin-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
}
.admin-card {
  background: var(--bg-tertiary);
  border-radius: 8px;
  padding: 16px;
}
.admin-field { margin-bottom: 8px; }
.admin-field label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.admin-field select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--bg-modifier-active);
  border-radius: 6px;
  background: var(--bg-secondary);
  color: var(--text-normal);
  font-size: 13px;
}
.admin-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin: 6px 0 0;
}
.admin-user-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border-radius: 8px;
  margin-bottom: 6px;
}
.admin-user-card.pending { border-left: 3px solid #E67E22; }
.admin-user-info { display: flex; align-items: center; gap: 10px; }
.admin-user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 15px; flex-shrink: 0;
}
.admin-user-name { font-weight: 600; color: var(--text-normal); font-size: 14px; }
.admin-user-detail { font-size: 12px; color: var(--text-muted); }
.admin-user-actions { display: flex; gap: 6px; }
.admin-btn {
  padding: 6px 14px; border: none; border-radius: 4px;
  font-size: 12px; font-weight: 600; cursor: pointer;
}
.admin-btn.approve { background: #57F287; color: #000; }
.admin-btn.approve:hover { background: #3dd170; }
.admin-btn.deny { background: #ED4245; color: #fff; }
.admin-btn.deny:hover { background: #d63638; }

/* Users table */
.admin-table-wrap { overflow-x: auto; }
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.admin-table th {
  text-align: left;
  padding: 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--bg-modifier-active);
}
.admin-table td {
  padding: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  color: var(--text-normal);
}
.admin-table tr:hover td { background: var(--bg-modifier-hover); }
.admin-user-cell { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.admin-user-avatar-sm {
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 11px; flex-shrink: 0;
}
.admin-email-cell { font-size: 12px; color: var(--text-muted); }
.admin-status { font-weight: 600; font-size: 12px; }
.admin-action-select {
  padding: 3px 6px;
  border: 1px solid var(--bg-modifier-active);
  border-radius: 4px;
  background: var(--bg-tertiary);
  color: var(--text-normal);
  font-size: 11px;
  cursor: pointer;
}

/* Turnstile CAPTCHA */
.turnstile-wrap { margin: 8px 0; min-height: 0; }
.turnstile-wrap:empty { display: none; }
.turnstile-wrap iframe { border-radius: 6px; }

/* ========================================
   PRESENCE PICKER
   ======================================== */
#user-panel-info-click { cursor: pointer; position: relative; }
.presence-picker {
  position: absolute;
  bottom: 100%;
  left: 0;
  background: var(--bg-secondary);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 6px;
  min-width: 180px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 100;
}
.presence-picker.hidden { display: none; }
.presence-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-normal);
}
.presence-option:hover { background: var(--bg-modifier-hover); }
.presence-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.presence-dot.online, .status-dot.online { background: #3ba55c; }
.presence-dot.idle, .status-dot.idle { background: #faa61a; }
.presence-dot.dnd, .status-dot.dnd { background: #ed4245; }
.presence-dot.invisible, .status-dot.invisible { background: #747f8d; }
.status-dot.offline { background: #747f8d; }

/* ========================================
   REPLY SYSTEM
   ======================================== */
.reply-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-tertiary);
  border-radius: 8px 8px 0 0;
  font-size: 13px;
  color: var(--text-muted);
  border-bottom: 2px solid var(--brand-500);
}
.reply-bar.hidden { display: none; }
.reply-bar-text { flex: 1; }
.reply-bar-close {
  width: 20px; height: 20px; border: none;
  background: none; color: var(--text-muted);
  cursor: pointer; border-radius: 50%; font-size: 14px;
}
.reply-bar-close:hover { color: #fff; background: rgba(255,255,255,0.1); }

.reply-quote {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 12px;
  margin-bottom: 2px;
  border-left: 2px solid var(--brand-500);
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 0 4px 4px 0;
  background: rgba(88,101,242,0.05);
}
.reply-quote:hover { background: rgba(88,101,242,0.1); }
.reply-quote-user { font-weight: 600; color: var(--brand-500); }
.reply-quote-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Message hover action bar */
.msg-actions-bar {
  position: absolute;
  top: -12px;
  right: 16px;
  display: none;
  background: var(--bg-secondary);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 4px;
  overflow: hidden;
  z-index: 5;
}
.message { position: relative; }
.message:hover .msg-actions-bar { display: flex; }
.msg-action-btn {
  width: 28px; height: 24px; border: none;
  background: none; color: var(--text-muted);
  cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.msg-action-btn:hover { background: var(--bg-modifier-hover); color: var(--text-normal); }

/* ========================================
   COLLAPSIBLE CATEGORIES
   ======================================== */
.channel-category-header {
  cursor: pointer;
  user-select: none;
}
.channel-category-header:hover h3 { color: var(--text-normal); }
.channel-items.collapsed { display: none; }

/* ========================================
   ADMIN - MAINTENANCE / IP BANS
   ======================================== */
.admin-toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-normal);
}
.admin-toggle-row input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: var(--brand-500);
}
.maintenance-banner {
  background: #E67E22;
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 13px;
  text-align: center;
}

/* ========================================
   CUSTOM EMOJIS
   ======================================== */
.custom-emoji {
  width: 22px;
  height: 22px;
  object-fit: contain;
  vertical-align: middle;
  margin: 0 1px;
}
.emoji-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 8px;
}
.emoji-tab {
  padding: 6px 12px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.emoji-tab:hover { color: var(--text-normal); }
.emoji-tab.active { color: var(--brand-500); border-bottom-color: var(--brand-500); }
.emoji-tab-content.hidden { display: none; }
.custom-emoji-item {
  padding: 4px !important;
  display: flex;
  align-items: center;
  justify-content: center;
}
.custom-emoji-item .custom-emoji {
  width: 28px;
  height: 28px;
}

/* Admin emoji grid */
.admin-emoji-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.admin-emoji-item {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-tertiary);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--text-muted);
  position: relative;
}
.admin-emoji-item .custom-emoji {
  width: 20px;
  height: 20px;
}
.admin-emoji-delete {
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  padding: 0 2px;
}
.admin-emoji-delete:hover { color: var(--text-danger); }

/* ========================================
   SOUNDBOARD CATEGORIES
   ======================================== */
.sb-search-wrap {
  padding: 0 16px 8px;
}
.sb-search-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  background: var(--bg-tertiary);
  color: var(--text-normal);
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
}
.sb-search-input:focus {
  border-color: var(--brand-500);
}
.sb-search-input::placeholder {
  color: var(--text-muted);
}
.sb-category {
  margin-bottom: 12px;
}
.sb-category-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 4px 0;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}
.sb-category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 8px;
}
.soundboard-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 4px;
  min-height: 70px;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  background: var(--bg-tertiary);
  color: var(--text-normal);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  overflow: hidden;
}
.soundboard-btn:hover {
  background: var(--bg-modifier-hover);
  transform: scale(1.03);
}
.soundboard-btn-playing {
  background: var(--brand-500) !important;
  transform: scale(0.95) !important;
}
.soundboard-btn-icon {
  font-size: 20px;
  opacity: 0.6;
}
.soundboard-btn-img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
}
.soundboard-btn-label {
  font-size: 10px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  color: var(--text-muted);
}

/* ========================================
   ADMIN BROADCAST
   ======================================== */
/* Broadcast button - red when active */
#btn-broadcast.broadcasting {
  background: #ed4245 !important;
  color: #fff !important;
  animation: broadcastPulse 1s ease infinite;
  box-shadow: 0 0 12px rgba(237, 66, 69, 0.6);
}
@keyframes broadcastPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(237, 66, 69, 0.6); }
  50% { box-shadow: 0 0 16px rgba(237, 66, 69, 0.3); }
}

/* Red ring on broadcaster's avatar - voice list + member list + user panel */
.mini-avatar.broadcast-active,
.member-avatar.broadcast-active,
.user-avatar.broadcast-active {
  box-shadow: 0 0 0 3px #ed4245, 0 0 14px rgba(237, 66, 69, 0.6) !important;
  animation: broadcastRing 1s ease infinite;
}
.user-avatar.broadcast-active::after {
  background: #ed4245 !important;
}
@keyframes broadcastRing {
  0%, 100% { box-shadow: 0 0 0 3px #ed4245, 0 0 14px rgba(237, 66, 69, 0.6); }
  50% { box-shadow: 0 0 0 4px #ed4245, 0 0 20px rgba(237, 66, 69, 0.3); }
}

/* ========================================
   AVATAR IMAGES
   ======================================== */
.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
.message-avatar .avatar-img {
  width: 40px;
  height: 40px;
}
.member-avatar .avatar-img {
  width: 32px;
  height: 32px;
}
.settings-user-avatar {
  cursor: pointer;
  position: relative;
}
.settings-user-avatar:hover::after {
  content: '📷';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.6);
  border-radius: 50%;
  font-size: 20px;
}

/* ========================================
   LINK PREVIEWS
   ======================================== */
.link-previews { margin-top: 4px; }
.link-preview-card {
  display: flex;
  gap: 12px;
  background: var(--bg-secondary);
  border-left: 3px solid var(--brand-500);
  border-radius: 4px;
  padding: 10px 12px;
  max-width: 420px;
  text-decoration: none;
  color: inherit;
  margin-top: 4px;
  transition: background 0.15s;
}
.link-preview-card:hover {
  background: var(--bg-modifier-hover);
  text-decoration: none;
}
.link-preview-img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}
.link-preview-body {
  min-width: 0;
  flex: 1;
}
.link-preview-site {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.link-preview-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-link);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.link-preview-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---- THREAD PANEL ---- */
.thread-panel { min-width: 340px; max-width: 400px; display: flex; flex-direction: column; }
.thread-parent-msg { padding: 12px 16px; background: var(--bg-tertiary); border-radius: 8px; margin: 8px 16px; }
.thread-parent-author { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.thread-parent-text { font-size: 13px; color: var(--text-muted); word-break: break-word; }
.thread-divider { height: 1px; background: var(--bg-modifier-accent, #3f4147); margin: 4px 16px; }
.thread-messages { flex: 1; overflow-y: auto; padding: 8px 16px; -webkit-overflow-scrolling: touch; min-height: 0; }
.thread-empty { text-align: center; color: var(--text-muted); padding: 24px 0; font-size: 14px; }
.thread-msg { display: flex; gap: 10px; padding: 6px 0; }
.thread-msg-avatar { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; font-size: 14px; object-fit: cover; }
img.thread-msg-avatar { background: none; }
.thread-msg-body { min-width: 0; flex: 1; }
.thread-msg-header { display: flex; align-items: baseline; gap: 6px; }
.thread-msg-author { font-weight: 600; font-size: 13px; }
.thread-msg-time { font-size: 11px; color: var(--text-muted); }
.thread-msg-text { font-size: 14px; word-break: break-word; margin-top: 2px; }
.thread-input-wrap { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--bg-modifier-accent, #3f4147); }
.thread-input { flex: 1; background: var(--bg-tertiary); border: none; border-radius: 8px; padding: 8px 12px; color: var(--text-normal); font-size: 14px; min-height: 20px; max-height: 120px; overflow-y: auto; outline: none; }
.thread-input:empty:before { content: attr(data-placeholder); color: var(--text-muted); }
.thread-send-btn { background: var(--brand-500); color: white; border: none; border-radius: 8px; padding: 8px 14px; font-size: 16px; cursor: pointer; flex-shrink: 0; }
.thread-send-btn:hover { background: var(--brand-560, #4752c4); }
.thread-count-btn { background: none; border: none; color: var(--brand-500); font-size: 12px; cursor: pointer; padding: 2px 8px; border-radius: 4px; margin-top: 2px; display: block; }
.thread-count-btn:hover { background: rgba(88,101,242,0.1); text-decoration: underline; }

/* ---- QUICK CHANNEL SWITCHER ---- */
.quick-switcher-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 9999; display: flex; align-items: flex-start; justify-content: center; padding-top: 15vh; }
.quick-switcher-modal { background: var(--bg-secondary); border-radius: 8px; width: 540px; max-width: 90vw; box-shadow: 0 8px 32px rgba(0,0,0,0.5); overflow: hidden; }
.quick-switcher-input { width: 100%; padding: 16px 20px; font-size: 16px; background: var(--bg-secondary); border: none; border-bottom: 1px solid var(--bg-tertiary); color: var(--text-normal); outline: none; box-sizing: border-box; }
.quick-switcher-input::placeholder { color: var(--text-muted); }
.quick-switcher-results { max-height: 360px; overflow-y: auto; padding: 8px; }
.qs-result { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 4px; cursor: pointer; }
.qs-result:hover, .qs-result.selected { background: var(--bg-modifier-hover, rgba(79,84,92,0.4)); }
.qs-result.selected { background: var(--brand-500); color: white; }
.qs-result.selected .qs-cat { color: rgba(255,255,255,0.7); }
.qs-icon { font-size: 18px; width: 24px; text-align: center; }
.qs-name { font-weight: 500; font-size: 15px; }
.qs-cat { font-size: 12px; color: var(--text-muted); margin-left: auto; }
.qs-empty { text-align: center; padding: 24px; color: var(--text-muted); }
.quick-switcher-hint { padding: 8px 16px; font-size: 12px; color: var(--text-muted); border-top: 1px solid var(--bg-tertiary); text-align: center; }

/* ---- INVITE BANNER ---- */
.invite-banner { display: flex; align-items: center; gap: 12px; padding: 16px 20px; background: linear-gradient(135deg, var(--brand-500), #3a45a0); border-radius: 8px; margin-bottom: 16px; color: white; }
.invite-banner.invite-expired { background: linear-gradient(135deg, #f23f43, #a02020); }
.invite-banner-icon { font-size: 28px; }
.invite-banner-text { font-size: 15px; }
.invite-banner-text strong { font-weight: 700; }

/* ---- CHANNEL DESCRIPTIONS ---- */
.header-channel-desc { color: var(--text-muted); font-size: 13px; margin-left: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 300px; }

/* ---- DRAG REORDER ---- */
.channel-item[draggable="true"] { cursor: grab; }
.channel-item.dragging { opacity: 0.4; }
.channel-item.drag-over { border-top: 2px solid var(--brand-500); margin-top: -2px; }

/* ---- MUTED CHANNELS ---- */
.channel-muted-icon { font-size: 12px; margin-left: auto; opacity: 0.5; }

/* ---- RECONNECT BANNER ---- */
.reconnect-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 9999; background: #f0b232; color: #000; text-align: center; padding: 6px 16px; font-size: 13px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 8px; }
.reconnect-spinner { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- NOTIFICATION PREFERENCES ---- */
.notif-toggle { display: flex; align-items: center; gap: 10px; padding: 8px 0; cursor: pointer; font-size: 14px; }
.notif-toggle input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--brand-500); }

/* ---- FORWARDED MESSAGES ---- */
.forwarded-tag { font-size: 12px; color: var(--text-muted); padding: 2px 0 4px; }
.forwarded-tag strong { color: var(--text-normal); }

/* ---- LIGHTBOX GALLERY ---- */
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0,0,0,0.6); color: white; border: none; font-size: 48px; padding: 20px 16px; cursor: pointer; z-index: 10; border-radius: 4px; }
.lb-nav:hover { background: rgba(0,0,0,0.8); }
.lb-prev { left: 16px; }
.lb-next { right: 16px; }
.lb-counter { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); color: rgba(255,255,255,0.7); font-size: 14px; }

/* ---- TOAST TYPES ---- */
.toast-error { background: #f23f43 !important; }
.toast-warning { background: #f0b232 !important; color: #000 !important; }
.toast-success { background: #23a559 !important; }

/* ---- VOICE EFFECTS ---- */
.voice-effect-wrap { display: flex; align-items: center; margin-left: 8px; }
.voice-effect-select { background: var(--bg-tertiary); color: var(--text-normal); border: 1px solid var(--bg-modifier-accent, #3f4147); border-radius: 4px; padding: 4px 8px; font-size: 12px; cursor: pointer; outline: none; }
.voice-effect-select:hover { border-color: var(--brand-500); }
.profile-action-row { display: flex; align-items: center; padding: 8px 0; }

/* ---- PER-USER VOLUME SLIDER ---- */
.user-vol-slider { width: 60px; height: 4px; accent-color: var(--brand-500); cursor: pointer; margin-left: auto; flex-shrink: 0; }
.voice-member { display: flex; align-items: center; gap: 8px; }

/* ---- VIEW TABS (Chat / Streams) ---- */
.view-tabs { display: flex; gap: 4px; padding: 4px 16px; background: var(--bg-tertiary); border-bottom: 1px solid var(--bg-modifier-accent, #3f4147); }
.view-tab { background: none; border: none; color: var(--text-muted); font-size: 13px; font-weight: 600; padding: 6px 14px; border-radius: 4px; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.view-tab:hover { background: var(--bg-modifier-hover, rgba(79,84,92,0.4)); color: var(--text-normal); }
.view-tab.active { background: var(--bg-modifier-selected, rgba(79,84,92,0.6)); color: white; }
.stream-count-badge { background: var(--brand-500); color: white; font-size: 11px; padding: 1px 6px; border-radius: 8px; font-weight: 700; }

/* ---- STREAM GRID ---- */
.stream-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 8px; padding: 8px; height: 100%; overflow-y: auto; align-content: start; }
.stream-tile { position: relative; background: #000; border-radius: 8px; overflow: hidden; aspect-ratio: 16/9; }
.stream-tile video { width: 100%; height: 100%; object-fit: contain; }
.stream-tile-label { position: absolute; bottom: 8px; left: 8px; background: rgba(0,0,0,0.7); color: white; padding: 4px 10px; border-radius: 4px; font-size: 12px; font-weight: 600; }
.screen-share-container { flex: 1; min-height: 0; overflow: hidden; background: var(--bg-primary); }

/* ---- AUTOPLAY PROMPT ---- */
.autoplay-prompt { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); background: var(--brand-500); color: white; padding: 10px 24px; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; z-index: 9000; box-shadow: 0 4px 16px rgba(0,0,0,0.4); animation: pulse-glow 1.5s ease infinite; }
.autoplay-prompt:hover { background: var(--brand-560, #4752c4); }
@keyframes pulse-glow { 0%, 100% { box-shadow: 0 4px 16px rgba(88,101,242,0.4); } 50% { box-shadow: 0 4px 24px rgba(88,101,242,0.7); } }

/* ---- REJOIN MUSIC BUTTON ---- */
.rejoin-music-btn { position: fixed; bottom: 80px; right: 20px; background: var(--brand-500); color: white; padding: 8px 18px; border-radius: 20px; font-size: 13px; font-weight: 600; cursor: pointer; z-index: 8000; box-shadow: 0 2px 12px rgba(0,0,0,0.4); transition: background 0.15s; }
.rejoin-music-btn:hover { background: var(--brand-560, #4752c4); }

/* ---- REACTION GIF OVERLAY ---- */
.reaction-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.reaction-overlay.visible { opacity: 1; }
.reaction-overlay.fade-out { opacity: 0; }
.reaction-overlay-img {
  max-width: 40vw;
  max-height: 50vh;
  border-radius: 12px;
  filter: drop-shadow(0 8px 32px rgba(0,0,0,0.6));
  transform: scale(0.8);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.reaction-overlay.visible .reaction-overlay-img { transform: scale(1); }
.reaction-overlay-label {
  position: absolute;
  bottom: max(12%, 40px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.7);
  color: white;
  padding: 6px 16px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

/* ---- REACTION PICKER ---- */
.reaction-picker-btn {
  background: none;
  border: none;
  color: var(--interactive-normal);
  cursor: pointer;
  font-size: 20px;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.reaction-picker-btn:hover {
  color: var(--interactive-hover);
  background: var(--bg-modifier-hover);
}
.reaction-picker-overlay {
  position: fixed;
  inset: 0;
  z-index: 9500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.6);
  animation: fadeIn 0.15s ease;
}
.reaction-picker-overlay.hidden { display: none; }
.reaction-picker-panel {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  max-width: 420px;
  width: 90vw;
  max-height: 320px;
  display: flex;
  flex-direction: column;
  animation: scaleIn 0.15s ease;
}
.reaction-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-weight: 600;
  color: var(--text-normal);
}
.reaction-picker-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  padding: 2px 6px;
  border-radius: 4px;
}
.reaction-picker-close:hover { color: var(--text-normal); background: var(--bg-modifier-hover); }
.reaction-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
  overflow-y: auto;
  flex: 1;
  min-height: 80px;
}
.reaction-picker-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  background: var(--bg-tertiary);
  transition: background 0.15s, transform 0.1s;
}
.reaction-picker-item:hover { background: var(--bg-modifier-hover); transform: scale(1.05); }
.reaction-picker-item img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
}
.reaction-picker-item span {
  font-size: 11px;
  color: var(--text-muted);
  max-width: 68px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}
.reaction-picker-empty {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: 24px;
}

/* ---- ADMIN REACTION GIF SECTION ---- */
.admin-reaction-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.admin-reaction-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 6px;
  background: var(--bg-tertiary);
  border-radius: 8px;
}
.admin-reaction-item img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 6px;
}
.admin-reaction-item span {
  font-size: 12px;
  color: var(--text-muted);
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-reaction-delete {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--status-danger, #ed4245);
  color: white;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
}
.admin-reaction-item:hover .admin-reaction-delete { opacity: 1; }
.admin-reaction-item:hover .admin-reaction-test { opacity: 1; }
