/* ==========================================================================
   DECAGON - VoIP & Instant Messaging Social Platform Stylesheet
   Modern Obsidian Dark Aesthetics, Glassmorphism, Micro-Animations
   ========================================================================== */

:root {
  /* Core Colors */
  --bg-darkest: #0a0b10;
  --bg-rail: #0e1017;
  --bg-sidebar: #131622;
  --bg-chat: #181b29;
  --bg-chat-composer: #1e2235;
  --bg-hover: #22263b;
  --bg-active: #2b314b;
  --bg-card: #1c2033;
  --bg-popover: #151827;
  --bg-modal: #16192a;

  /* Accent & Brand Colors */
  --accent-primary: #6366f1;       /* Decagon Indigo */
  --accent-primary-hover: #4f46e5;
  --accent-cyan: #06b6d4;          /* Cyan Glow */
  --accent-emerald: #10b981;       /* Speaking / Online Green */
  --accent-amber: #f59e0b;         /* Idle Amber */
  --accent-rose: #f43f5e;          /* DND / Disconnect Red */
  --accent-violet: #8b5cf6;        /* Nitro Violet */

  /* Text Colors */
  --text-normal: #e2e8f0;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --text-header: #ffffff;
  --text-link: #38bdf8;

  /* Borders & Shadows */
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-focus: rgba(99, 102, 241, 0.6);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.6), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.35);

  /* Dimensions */
  --rail-width: 72px;
  --sidebar-width: 240px;
  --members-width: 250px;
  --header-height: 52px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* Typography */
  --font-main: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

/* Theme Variations */
body.theme-synthwave {
  --bg-darkest: #070414;
  --bg-rail: #0e0724;
  --bg-sidebar: #170d38;
  --bg-chat: #1d1045;
  --bg-chat-composer: #28175f;
  --accent-primary: #ec4899;
  --accent-cyan: #06b6d4;
  --shadow-glow: 0 0 25px rgba(236, 72, 153, 0.4);
}

body.theme-cyberpunk {
  --bg-darkest: #050d0a;
  --bg-rail: #071712;
  --bg-sidebar: #0b221b;
  --bg-chat: #0e2b22;
  --bg-chat-composer: #133a2f;
  --accent-primary: #10b981;
  --accent-cyan: #22d3ee;
  --shadow-glow: 0 0 20px rgba(16, 185, 129, 0.4);
}

body.theme-discord {
  --bg-darkest: #1e1f22;
  --bg-rail: #1e1f22;
  --bg-sidebar: #2b2d31;
  --bg-chat: #313338;
  --bg-chat-composer: #383a40;
  --accent-primary: #5865f2;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-darkest);
  color: var(--text-normal);
  font-family: var(--font-main);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  outline: none;
}

input, textarea, select {
  font-family: inherit;
  color: inherit;
  outline: none;
}

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

/* Scrollbar Customization */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ==========================================================================
   APP MAIN GRID LAYOUT
   ========================================================================== */
.app-layout {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* ==========================================================================
   1. GUILD / SERVER RAIL (Far Left)
   ========================================================================== */
.guild-rail {
  width: var(--rail-width);
  height: 100%;
  background-color: var(--bg-rail);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0 16px 0;
  flex-shrink: 0;
  user-select: none;
  z-index: 20;
}

.rail-item-wrapper {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 8px;
}

/* Hover / Active Pill Indicator */
.pill-indicator {
  position: absolute;
  left: 0;
  width: 4px;
  height: 0;
  border-radius: 0 4px 4px 0;
  background-color: #ffffff;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0;
}
.rail-item-wrapper:hover .pill-indicator {
  height: 20px;
  opacity: 1;
}
.pill-indicator.active {
  height: 40px !important;
  opacity: 1 !important;
}

/* Server & Action Buttons */
.guild-btn {
  width: 48px;
  height: 48px;
  border-radius: 24px;
  background-color: var(--bg-sidebar);
  color: var(--text-normal);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.guild-btn:hover {
  border-radius: 16px;
  background-color: var(--accent-primary);
  color: #ffffff;
}

.guild-btn.active {
  border-radius: 16px;
  background-color: var(--accent-primary);
  color: #ffffff;
  box-shadow: var(--shadow-glow);
}

/* Decagon Logo in Home Button */
.decagon-logo-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  transition: transform 0.3s ease;
}
.guild-btn:hover .decagon-logo-img {
  transform: rotate(36deg) scale(1.08);
}

.decagon-logo-svg {
  width: 32px;
  height: 32px;
  transition: transform 0.3s ease;
}
.logo-poly {
  fill: #6366f1;
  stroke: #38bdf8;
  stroke-width: 4;
}
.logo-inner {
  fill: #1e1b4b;
  stroke: #a855f7;
  stroke-width: 3;
}
.logo-core {
  fill: #38bdf8;
}
.guild-btn:hover .decagon-logo-svg {
  transform: rotate(36deg) scale(1.08);
}

.guild-separator {
  width: 32px;
  height: 2px;
  background-color: var(--border-subtle);
  margin: 4px 0 8px 0;
  border-radius: 1px;
}

.servers-scroll-list {
  flex: 1;
  width: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.servers-scroll-list::-webkit-scrollbar {
  display: none;
}

.guild-btn.server-icon {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.guild-btn.action-btn {
  background-color: rgba(255, 255, 255, 0.04);
  color: var(--accent-emerald);
}
.guild-btn.action-btn:hover {
  background-color: var(--accent-emerald);
  color: #ffffff;
}

.unread-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  background-color: var(--accent-rose);
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 10px;
  border: 2px solid var(--bg-rail);
}

.rail-footer {
  margin-top: auto;
  width: 100%;
  display: flex;
  justify-content: center;
}
.persona-switch-btn {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(168, 85, 247, 0.2));
  border: 1px solid var(--border-subtle);
  color: var(--accent-cyan);
}
.persona-switch-btn:hover {
  background: var(--accent-primary);
  color: #ffffff;
}

/* ==========================================================================
   2. SIDEBAR PANEL (Channels or DMs)
   ========================================================================== */
.sidebar-panel {
  width: var(--sidebar-width);
  height: 100%;
  background-color: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-right: 1px solid var(--border-subtle);
  z-index: 15;
}

.sidebar-subview {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Server Header Dropdown */
.server-header {
  height: var(--header-height);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  position: relative;
  transition: background-color 0.15s ease;
  user-select: none;
}
.server-header:hover {
  background-color: rgba(255, 255, 255, 0.03);
}

.server-title-group {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  flex: 1;
}
.verified-icon {
  color: var(--accent-primary);
  font-size: 16px;
  display: flex;
}
.server-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-header);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.server-menu-btn {
  color: var(--text-muted);
  font-size: 16px;
  display: flex;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  transition: color 0.15s ease;
}
.server-menu-btn:hover {
  color: var(--text-header);
}
.server-header-action-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.15s ease;
}
.server-header-action-btn:hover {
  color: var(--text-header);
  background-color: rgba(255, 255, 255, 0.08);
}

/* Context Menus */
.context-menu {
  position: absolute;
  top: 56px;
  left: 10px;
  right: 10px;
  background-color: var(--bg-popover);
  border-radius: var(--radius-md);
  padding: 6px;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  animation: popoverFadeIn 0.18s ease-out;
}
@keyframes popoverFadeIn {
  from { opacity: 0; transform: translateY(-6px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}
.menu-item:hover {
  background-color: var(--bg-hover);
  color: var(--text-header);
}
.menu-item.highlight {
  color: var(--accent-primary);
  font-weight: 600;
}
.menu-item.highlight:hover {
  background-color: var(--accent-primary);
  color: #ffffff;
}
.menu-item.danger {
  color: var(--accent-rose);
}
.menu-item.danger:hover {
  background-color: var(--accent-rose);
  color: #ffffff;
}
.menu-separator {
  height: 1px;
  background-color: var(--border-subtle);
  margin: 4px 6px;
}

/* Channels Scroller */
.channels-scroller {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
}

/* Server Quick Nav / Events Row */
.server-events-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  margin-bottom: 8px;
  border-radius: 4px;
  color: #949ba4;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  transition: all 0.15s ease;
  user-select: none;
}
.server-events-row:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-header);
}
.server-events-row .events-icon {
  font-size: 17px;
  color: #80848e;
}
.server-events-row:hover .events-icon {
  color: var(--text-header);
}
.events-label {
  flex: 1;
}

.channel-category {
  margin-top: 14px;
}
.channel-category:first-child {
  margin-top: 0;
}
.category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 4px 6px 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: none; /* Exact Discord styling: "Text Channels", "Voice Channels" */
  color: #949ba4;
  letter-spacing: 0.02em;
  user-select: none;
  cursor: pointer;
  transition: color 0.15s ease;
}
.category-header:hover {
  color: #dbdee1;
}
.category-header .left-col {
  display: flex;
  align-items: center;
  gap: 4px;
}
.category-name-text {
  font-size: 12px;
  font-weight: 700;
  color: inherit;
}
.category-chevron {
  font-size: 13px;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  color: inherit;
}
.category-chevron.collapsed {
  transform: rotate(-90deg);
}
.category-add-btn {
  background: none;
  border: none;
  color: #949ba4;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px 4px;
  border-radius: 3px;
  cursor: pointer;
  opacity: 0;
  transition: all 0.15s ease;
}
.category-header:hover .category-add-btn {
  opacity: 1;
}
.category-add-btn:hover {
  color: #ffffff;
}

.channel-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  margin: 1px 0;
  border-radius: 4px;
  color: #949ba4;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
  user-select: none;
  position: relative;
}
.channel-item:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: #dbdee1;
}
.channel-item.active {
  background-color: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font-weight: 600;
}
.channel-item-left {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  flex: 1;
}
.channel-item.active .channel-icon {
  color: #ffffff;
}
.channel-icon {
  font-size: 16px;
  color: #80848e;
  flex-shrink: 0;
}
.channel-name {
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.channel-item-actions {
  display: none;
  align-items: center;
  gap: 3px;
  margin-left: 6px;
}
.channel-item:hover .channel-item-actions,
.channel-item.active .channel-item-actions {
  display: flex;
}
.channel-action-btn {
  background: none;
  border: none;
  color: #949ba4;
  font-size: 14px;
  padding: 2px 3px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.12s ease;
}
.channel-action-btn:hover {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.1);
}
.channel-badge {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 10px;
  background-color: var(--accent-primary);
  color: #fff;
  font-weight: 700;
}

/* Voice Channel Live Users List in Sidebar */
.voice-channel-users {
  padding-left: 28px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 6px;
}
.voice-user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-muted);
}
.voice-user-pill .v-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
}
.voice-user-pill.speaking {
  color: var(--accent-emerald);
}
.voice-user-pill.speaking .v-avatar {
  outline: 2px solid var(--accent-emerald);
}

/* DM View Elements */
.dm-search-bar {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
}
.search-trigger-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-darkest);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 12.5px;
  color: var(--text-muted);
  transition: border-color 0.15s ease;
}
.search-trigger-btn:hover {
  border-color: rgba(255, 255, 255, 0.15);
}
.search-trigger-btn kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  background-color: rgba(255, 255, 255, 0.08);
  padding: 2px 5px;
  border-radius: 3px;
}
.dm-nav-links {
  padding: 10px 8px 4px 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.dm-nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 500;
  transition: all 0.15s ease;
}
.dm-nav-btn:hover {
  background-color: rgba(255, 255, 255, 0.04);
  color: var(--text-header);
}
.dm-nav-btn.active {
  background-color: var(--bg-active);
  color: #ffffff;
}
.icon-nitro {
  color: var(--accent-violet);
}
.dm-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 12px 6px 12px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}
.dm-create-btn {
  color: var(--text-dim);
  font-size: 15px;
}
.dm-create-btn:hover {
  color: var(--text-header);
}

/* DM Item Card */
.dm-user-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  margin-bottom: 2px;
}
.dm-user-item:hover {
  background-color: rgba(255, 255, 255, 0.04);
  color: var(--text-normal);
}
.dm-user-item.active {
  background-color: var(--bg-active);
  color: #ffffff;
}
.dm-avatar-wrap {
  position: relative;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
}
.dm-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}
.status-indicator {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--bg-sidebar);
}
.status-indicator.online { background-color: var(--accent-emerald); }
.status-indicator.idle { background-color: var(--accent-amber); }
.status-indicator.dnd { background-color: var(--accent-rose); }
.status-indicator.offline { background-color: var(--text-dim); }

.dm-user-meta {
  flex: 1;
  overflow: hidden;
}
.dm-user-name {
  font-size: 13.5px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dm-user-status {
  font-size: 11px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Voice Connection Status Bar (Active Voice Call) */
.voice-connection-status {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(6, 182, 212, 0.1));
  border-top: 1px solid rgba(16, 185, 129, 0.3);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.voice-status-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.voice-pulse-indicator {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: rgba(16, 185, 129, 0.2);
  color: var(--accent-emerald);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  animation: pulseGreen 1.8s infinite;
}
@keyframes pulseGreen {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
.voice-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-emerald);
}
.voice-channel-info {
  font-size: 10.5px;
  color: var(--text-muted);
}
.voice-status-controls {
  display: flex;
  gap: 4px;
}
.v-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all 0.15s ease;
}
.v-btn:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--text-header);
}
.v-btn.danger {
  color: var(--accent-rose);
}
.v-btn.danger:hover {
  background-color: var(--accent-rose);
  color: #fff;
}

/* User Profile Panel at Bottom of Sidebar */
.current-user-panel {
  height: 54px;
  background-color: rgba(0, 0, 0, 0.2);
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-subtle);
}
.user-avatar-group {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex: 1;
  overflow: hidden;
  transition: background-color 0.15s ease;
}
.user-avatar-group:hover {
  background-color: rgba(255, 255, 255, 0.06);
}
.avatar-wrap {
  position: relative;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}
.user-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}
.user-text-info {
  overflow: hidden;
  line-height: 1.25;
}
.user-display-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-header);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-custom-status {
  font-size: 10.5px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-audio-controls {
  display: flex;
  align-items: center;
  gap: 2px;
}
.audio-btn-dropdown {
  display: flex;
  align-items: center;
  border-radius: var(--radius-sm);
  transition: background-color 0.15s ease;
}
.audio-btn-dropdown:hover {
  background-color: rgba(255, 255, 255, 0.08);
}
.audio-btn {
  width: 28px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 17px;
  background: none;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}
.audio-btn:hover {
  color: var(--text-header);
}
.audio-btn.muted {
  color: #f23f43; /* Discord muted red */
  background-color: rgba(242, 63, 67, 0.15);
}
.audio-chevron-btn {
  width: 14px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 12px;
  background: none;
  border: none;
  cursor: pointer;
  padding-right: 3px;
  transition: color 0.15s ease;
}
.audio-chevron-btn:hover {
  color: var(--text-header);
}

/* ==========================================================================
   3. MAIN VIEWPORT & CHAT TIMELINE
   ========================================================================== */
.main-chat-viewport {
  flex: 1;
  height: 100%;
  background-color: var(--bg-chat);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Top Header Bar */
.chat-top-header {
  height: var(--header-height);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  background-color: var(--bg-chat);
  z-index: 10;
  flex-shrink: 0;
}
.header-left-col {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  flex: 1;
}
.mobile-toggle-btn {
  display: none;
  font-size: 20px;
  color: var(--text-muted);
}
.channel-heading-icon {
  font-size: 20px;
  color: var(--text-dim);
  display: flex;
}
.channel-heading-title {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--text-header);
  white-space: nowrap;
}
.header-divider {
  width: 1px;
  height: 18px;
  background-color: var(--border-subtle);
  margin: 0 4px;
}
.channel-topic {
  font-size: 12.5px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-right-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.action-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text-muted);
  transition: all 0.15s ease;
}
.action-icon-btn:hover {
  background-color: rgba(255, 255, 255, 0.07);
  color: var(--text-header);
}
.action-icon-btn.active {
  color: var(--accent-primary);
}
.header-search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.header-search-wrapper input {
  background-color: var(--bg-darkest);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 5px 28px 5px 10px;
  font-size: 12.5px;
  width: 140px;
  transition: all 0.25s ease;
}
.header-search-wrapper input:focus {
  width: 220px;
  border-color: var(--accent-primary);
}
.header-search-wrapper i {
  position: absolute;
  right: 8px;
  color: var(--text-dim);
  pointer-events: none;
}

/* ==========================================================================
   VOIP STAGE & VIDEO CALL GRID
   ========================================================================== */
.voip-stage-container {
  flex-shrink: 0;
  height: 340px;
  background-color: var(--bg-darkest);
  border-bottom: 2px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  animation: stageSlideDown 0.3s ease-out;
}
@keyframes stageSlideDown {
  from { height: 0; opacity: 0; }
  to { height: 340px; opacity: 1; }
}

.stage-participants-grid {
  flex: 1;
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
}

/* Participant Video / Avatar Card */
.participant-card {
  position: relative;
  height: 100%;
  min-height: 160px;
  background: linear-gradient(135deg, #161928, #10121d);
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Green Glow when Speaking */
.participant-card.speaking {
  border-color: var(--accent-emerald);
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.5);
}

.participant-card video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background-color: #000;
}

.participant-avatar-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.p-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255, 255, 255, 0.15);
  transition: transform 0.2s ease;
}
.participant-card.speaking .p-avatar {
  transform: scale(1.08);
  border-color: var(--accent-emerald);
}

.speaking-waves-bar {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 16px;
}
.speaking-waves-bar span {
  width: 3px;
  height: 4px;
  background-color: var(--accent-emerald);
  border-radius: 2px;
  transition: height 0.1s ease;
}
.participant-card.speaking .speaking-waves-bar span {
  animation: waveBar 0.5s ease-in-out infinite alternate;
}
.participant-card.speaking .speaking-waves-bar span:nth-child(2) { animation-delay: 0.1s; }
.participant-card.speaking .speaking-waves-bar span:nth-child(3) { animation-delay: 0.2s; }
.participant-card.speaking .speaking-waves-bar span:nth-child(4) { animation-delay: 0.3s; }
.participant-card.speaking .speaking-waves-bar span:nth-child(5) { animation-delay: 0.4s; }

@keyframes waveBar {
  0% { height: 4px; }
  100% { height: 16px; }
}

.participant-overlay-meta {
  position: absolute;
  bottom: 8px;
  left: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  color: #fff;
}
.p-meta-left {
  display: flex;
  align-items: center;
  gap: 6px;
}
.p-meta-status-icons {
  display: flex;
  gap: 6px;
  font-size: 13px;
}
.p-badge-screen {
  background: var(--accent-rose);
  color: #fff;
  font-size: 9.5px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 3px;
  letter-spacing: 0.05em;
}

/* Stage Bottom Control Bar */
.stage-control-bar {
  height: 56px;
  background-color: rgba(14, 16, 23, 0.95);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-top: 1px solid var(--border-subtle);
}
.stage-info-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-normal);
}
.stage-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-rose);
  box-shadow: 0 0 8px var(--accent-rose);
}
.stage-quality-pill {
  font-size: 10.5px;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 7px;
  border-radius: var(--radius-full);
  color: var(--accent-cyan);
}
.stage-center-buttons {
  display: flex;
  align-items: center;
  gap: 12px;
}
.stage-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text-header);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.stage-btn:hover {
  background-color: rgba(255, 255, 255, 0.16);
  transform: translateY(-2px);
}
.stage-btn.active {
  background-color: var(--accent-primary);
  color: #fff;
  box-shadow: var(--shadow-glow);
}
.stage-btn.muted {
  background-color: var(--accent-rose);
  color: #fff;
}
.stage-btn.danger.end-call-btn {
  background-color: var(--accent-rose);
  color: #fff;
  width: 48px;
  border-radius: var(--radius-lg);
}
.stage-btn.danger.end-call-btn:hover {
  background-color: #e11d48;
}
.stage-right-actions {
  display: flex;
  gap: 8px;
}
.stage-btn.small {
  width: 32px;
  height: 32px;
  font-size: 15px;
}

/* ==========================================================================
   CHAT MESSAGES TIMELINE
   ========================================================================== */
.chat-messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Channel Welcome Banner at top of chat */
.channel-welcome-banner {
  margin: 16px 0 24px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.welcome-icon-box {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  color: var(--text-header);
  margin-bottom: 8px;
}
.welcome-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-header);
}
.welcome-desc {
  font-size: 14px;
  color: var(--text-muted);
}

/* Date Divider */
.chat-date-divider {
  display: flex;
  align-items: center;
  margin: 12px 0;
}
.chat-date-divider::before,
.chat-date-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background-color: var(--border-subtle);
}
.chat-date-divider span {
  padding: 0 10px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
}

/* Message Item */
.message-item {
  display: flex;
  gap: 14px;
  position: relative;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  transition: background-color 0.12s ease;
}
.message-item:hover {
  background-color: var(--bg-hover);
}

.msg-avatar-col {
  flex-shrink: 0;
}
.msg-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  cursor: pointer;
}

.msg-body-col {
  flex: 1;
  overflow: hidden;
}
.msg-author-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
}
.msg-author-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-header);
  cursor: pointer;
}
.msg-author-name:hover {
  text-decoration: underline;
}

/* Role Badges */
.role-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: 0.03em;
}
.role-badge.owner { background-color: rgba(245, 158, 11, 0.2); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.4); }
.role-badge.admin { background-color: rgba(139, 92, 246, 0.2); color: #a78bfa; border: 1px solid rgba(139, 92, 246, 0.4); }
.role-badge.bot { background-color: rgba(99, 102, 241, 0.25); color: #818cf8; border: 1px solid rgba(99, 102, 241, 0.4); }
.role-badge.nitro { background-color: rgba(236, 72, 153, 0.2); color: #f472b6; border: 1px solid rgba(236, 72, 153, 0.4); }

.msg-timestamp {
  font-size: 11px;
  color: var(--text-dim);
}

.msg-content-text {
  font-size: 14px;
  color: var(--text-normal);
  line-height: 1.45;
  word-break: break-word;
}

/* Rich Markdown & Spoilers */
.msg-content-text code {
  font-family: var(--font-mono);
  background-color: rgba(0, 0, 0, 0.35);
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 12px;
  color: #38bdf8;
}
.msg-content-text pre {
  font-family: var(--font-mono);
  background-color: rgba(0, 0, 0, 0.4);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin: 6px 0;
  font-size: 12.5px;
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
}
.spoiler-text {
  background-color: #2b314b;
  color: transparent;
  border-radius: 3px;
  padding: 1px 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}
.spoiler-text.revealed {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--text-normal);
  user-select: text;
}

/* Media Attachments */
.msg-media-preview {
  margin-top: 8px;
  max-width: 440px;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  border: 1px solid var(--border-subtle);
}
.msg-media-preview img,
.msg-media-preview video {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  display: block;
  transition: transform 0.25s ease;
}
.msg-media-preview:hover img {
  transform: scale(1.02);
}

/* Voice Memo Player in Chat */
.voice-memo-card {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background-color: var(--bg-card);
  padding: 8px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  max-width: 320px;
}
.voice-memo-play-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: var(--accent-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: transform 0.15s ease;
}
.voice-memo-play-btn:hover {
  transform: scale(1.08);
}
.voice-memo-waveform {
  display: flex;
  align-items: center;
  gap: 2.5px;
  height: 20px;
}
.waveform-bar {
  width: 3px;
  height: 8px;
  background-color: var(--text-muted);
  border-radius: 2px;
}
.waveform-bar.active {
  background-color: var(--accent-cyan);
}
.voice-memo-time {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-dim);
}

/* Emoji Reactions Pill Bar */
.msg-reactions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}
.reaction-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}
.reaction-pill:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}
.reaction-pill.reacted {
  background-color: rgba(99, 102, 241, 0.2);
  border-color: var(--accent-primary);
  color: #ffffff;
}

/* Hover Action Bar on Message */
.msg-hover-actions {
  position: absolute;
  top: -14px;
  right: 14px;
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  display: none;
  align-items: center;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 5;
}
.message-item:hover .msg-hover-actions {
  display: flex;
}
.msg-action-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 14px;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.msg-action-btn:hover {
  background-color: var(--bg-hover);
  color: var(--text-header);
}

/* Typing Indicators Bar */
.typing-indicator-bar {
  height: 24px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.typing-dots {
  display: flex;
  gap: 3px;
}
.typing-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: var(--accent-cyan);
  animation: typingBounce 1.2s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-4px); opacity: 1; }
}

/* Attachment Preview Tray (Above Composer) */
.attachment-preview-tray {
  padding: 8px 16px;
  background-color: var(--bg-chat-composer);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  gap: 10px;
  overflow-x: auto;
}
.tray-card {
  position: relative;
  width: 90px;
  height: 70px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-darkest);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tray-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.tray-remove-btn {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-color: var(--accent-rose);
  color: #fff;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Chat Input Composer */
.chat-input-composer {
  padding: 0 16px 20px 16px;
  flex-shrink: 0;
}
.composer-box {
  background-color: var(--bg-chat-composer);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  padding: 8px 12px;
  gap: 8px;
  border: 1px solid var(--border-subtle);
  transition: border-color 0.15s ease;
}
.composer-box:focus-within {
  border-color: var(--border-focus);
}
.composer-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 19px;
  transition: all 0.15s ease;
}
.composer-btn:hover {
  color: var(--text-header);
  background-color: rgba(255, 255, 255, 0.08);
}
.composer-btn.recording {
  color: var(--accent-rose);
  animation: pulseRecording 1s infinite alternate;
}
@keyframes pulseRecording {
  from { transform: scale(1); }
  to { transform: scale(1.2); }
}

.composer-input-wrapper {
  flex: 1;
}
.composer-input-wrapper textarea {
  width: 100%;
  background: transparent;
  border: none;
  resize: none;
  max-height: 140px;
  font-size: 14px;
  color: var(--text-normal);
  line-height: 1.4;
  padding: 4px 0;
}

.composer-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.send-btn {
  color: var(--accent-primary);
}
.send-btn:hover {
  background-color: var(--accent-primary);
  color: #fff;
}

/* ==========================================================================
   4. MEMBERS SIDEBAR PANEL (Right Side)
   ========================================================================== */
.members-sidebar-panel {
  width: var(--members-width);
  height: 100%;
  background-color: var(--bg-sidebar);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 10;
}
.members-scroller {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
}
.member-role-group {
  margin-bottom: 16px;
}
.role-heading {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 0.05em;
  padding: 4px 6px;
  margin-bottom: 4px;
}
.member-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.12s ease;
}
.member-card:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-normal);
}
.member-avatar-box {
  position: relative;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}
.member-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}
.member-details {
  flex: 1;
  overflow: hidden;
}
.member-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-header);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.member-activity {
  font-size: 11px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==========================================================================
   5. FRIENDS DASHBOARD VIEW
   ========================================================================== */
.friends-dashboard-view {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.friends-nav-bar {
  height: var(--header-height);
  padding: 0 20px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
  background-color: var(--bg-chat);
}
.friends-filter-group {
  display: flex;
  align-items: center;
  gap: 12px;
}
.f-icon {
  font-size: 20px;
  color: var(--text-dim);
}
.f-title {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--text-header);
}
.tab-divider {
  width: 1px;
  height: 20px;
  background-color: var(--border-subtle);
}
.f-tab-btn {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.15s ease;
}
.f-tab-btn:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-normal);
}
.f-tab-btn.active {
  background-color: var(--bg-active);
  color: #fff;
}
.f-tab-btn.add-friend-tab {
  background-color: var(--accent-emerald);
  color: #fff;
}
.f-tab-btn.add-friend-tab:hover {
  background-color: #059669;
}

.friends-content-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}
.friends-list-table {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.friend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  transition: all 0.15s ease;
}
.friend-row:hover {
  background-color: var(--bg-hover);
  border-color: var(--border-subtle);
}
.friend-row-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.friend-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.friend-action-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--bg-sidebar);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 16px;
  transition: all 0.15s ease;
}
.friend-action-btn:hover {
  background-color: var(--accent-primary);
  color: #fff;
}

/* ==========================================================================
   MODALS, POPOVERS & OVERLAYS
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: modalFadeIn 0.2s ease-out;
}
@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-dialog {
  width: 100%;
  max-width: 480px;
  background-color: var(--bg-modal);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalScaleUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes modalScaleUp {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  padding: 24px 24px 12px 24px;
  text-align: center;
  position: relative;
}
.modal-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-header);
}
.modal-subtitle {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-top: 6px;
}
.modal-close-btn {
  position: absolute;
  top: 16px;
  right: 18px;
  font-size: 24px;
  color: var(--text-muted);
  transition: color 0.15s ease;
}
.modal-close-btn:hover {
  color: var(--text-header);
}

.modal-body {
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.modal-footer {
  padding: 16px 24px;
  background-color: var(--bg-darkest);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

/* Forms */
.form-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 0.05em;
  margin-bottom: 6px;
  display: block;
}
.form-input {
  width: 100%;
  background-color: var(--bg-darkest);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text-header);
  transition: border-color 0.15s ease;
}
.form-input:focus {
  border-color: var(--accent-primary);
}
.form-select {
  width: 100%;
  background-color: var(--bg-darkest);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text-header);
}
.input-prefix-wrap {
  display: flex;
  align-items: center;
  background-color: var(--bg-darkest);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding-left: 10px;
}
.prefix-icon {
  color: var(--text-dim);
  font-size: 16px;
  font-weight: 700;
}
.input-prefix-wrap input {
  border: none;
  background: transparent;
  padding: 10px;
  width: 100%;
}

.form-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background-color: var(--bg-darkest);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}
.toggle-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-header);
  display: flex;
  align-items: center;
  gap: 6px;
}
.toggle-desc {
  font-size: 11.5px;
  color: var(--text-dim);
  margin-top: 2px;
}

/* Switch Toggle Component */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #334155;
  transition: 0.3s;
  border-radius: 24px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}
input:checked + .slider {
  background-color: var(--accent-primary);
}
input:checked + .slider:before {
  transform: translateX(20px);
}

/* Template Choice Cards in Create Server */
.template-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.template-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background-color: var(--bg-darkest);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.15s ease;
}
.template-card:hover {
  background-color: var(--bg-hover);
  color: #fff;
}
.template-card.active {
  border-color: var(--accent-primary);
  background-color: rgba(99, 102, 241, 0.15);
  color: #fff;
}

/* Server Icon Preview in Create Modal */
.avatar-picker-row {
  display: flex;
  align-items: center;
  gap: 16px;
}
.server-icon-preview {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  border: 2px dashed rgba(255, 255, 255, 0.3);
}
.icon-presets {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.preset-btn {
  padding: 6px 10px;
  background-color: var(--bg-darkest);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 12px;
}
.preset-btn:hover {
  background-color: var(--bg-hover);
}

/* Buttons */
.btn {
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  transition: all 0.15s ease;
}
.btn-primary {
  background-color: var(--accent-primary);
  color: #fff;
}
.btn-primary:hover {
  background-color: var(--accent-primary-hover);
  box-shadow: var(--shadow-glow);
}
.btn-secondary {
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--text-normal);
}
.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.15);
}
.btn-ghost {
  color: var(--text-muted);
}
.btn-ghost:hover {
  color: var(--text-header);
}
.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

/* Fullpage Settings Modal */
.modal-backdrop.fullpage {
  background-color: var(--bg-sidebar);
}
.settings-layout {
  display: flex;
  width: 100vw;
  height: 100vh;
}
.settings-sidebar {
  width: 240px;
  background-color: var(--bg-darkest);
  padding: 48px 16px 20px 32px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.settings-category-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 10px 10px 4px 10px;
}
.settings-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: left;
}
.settings-nav-item:hover {
  background-color: rgba(255, 255, 255, 0.04);
  color: var(--text-header);
}
.settings-nav-item.active {
  background-color: var(--bg-hover);
  color: #fff;
}
.settings-nav-item.danger {
  color: var(--accent-rose);
}
.settings-separator {
  height: 1px;
  background-color: var(--border-subtle);
  margin: 12px 0;
}

.settings-content-wrapper {
  flex: 1;
  padding: 48px 48px 48px 40px;
  overflow-y: auto;
  position: relative;
  background-color: var(--bg-chat);
}
.settings-close-x {
  position: fixed;
  top: 40px;
  right: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 26px;
  color: var(--text-muted);
  cursor: pointer;
}
.settings-close-x span {
  font-size: 11px;
  font-weight: 700;
}
.settings-close-x:hover {
  color: var(--text-header);
}

.settings-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-header);
  margin-bottom: 24px;
}
.account-card {
  background-color: var(--bg-darkest);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}
.account-banner {
  height: 100px;
  background: linear-gradient(135deg, #4338ca, #06b6d4);
}
.account-details-row {
  padding: 0 20px 16px 20px;
  display: flex;
  align-items: flex-end;
  gap: 16px;
  position: relative;
  margin-top: -36px;
}
.account-avatar-wrapper {
  position: relative;
}
.account-avatar-wrapper img {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 4px solid var(--bg-darkest);
  object-fit: cover;
}
.change-avatar-btn {
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background-color: rgba(0, 0, 0, 0.6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.account-avatar-wrapper:hover .change-avatar-btn {
  opacity: 1;
}
.account-meta {
  flex: 1;
  margin-bottom: 6px;
}
.account-meta h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-header);
}
.user-handle {
  font-size: 12.5px;
  color: var(--text-dim);
}

.account-field-box {
  padding: 16px 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.field-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.field-label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-dim);
}
.field-val {
  font-size: 13.5px;
  color: var(--text-header);
}

/* Mic Test & Camera Preview in Settings */
.mic-test-wrapper {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 8px;
}
.mic-level-meter {
  flex: 1;
  height: 10px;
  background-color: var(--bg-darkest);
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}
.mic-level-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-emerald), var(--accent-cyan));
  transition: width 0.08s ease;
}
.camera-preview-container {
  width: 380px;
  height: 220px;
  border-radius: var(--radius-md);
  background-color: var(--bg-darkest);
  overflow: hidden;
  position: relative;
  margin-top: 8px;
  border: 1px solid var(--border-subtle);
}
.camera-preview-container video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.camera-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-dim);
  font-size: 14px;
}
.camera-placeholder i {
  font-size: 36px;
}

/* Theme Picker Cards */
.theme-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 14px;
}
.theme-card {
  background-color: var(--bg-darkest);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.theme-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
}
.theme-card.active {
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-glow);
}
.theme-color-preview {
  height: 60px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
.obsidian-preview { background: linear-gradient(135deg, #0a0b10, #6366f1); }
.synthwave-preview { background: linear-gradient(135deg, #070414, #ec4899); }
.cyberpunk-preview { background: linear-gradient(135deg, #050d0a, #10b981); }
.classic-preview { background: linear-gradient(135deg, #1e1f22, #5865f2); }
.theme-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-header);
}

/* Persona Cards List */
.persona-cards-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.persona-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background-color: var(--bg-darkest);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.15s ease;
}
.persona-card:hover {
  border-color: var(--accent-primary);
  background-color: var(--bg-hover);
}
.persona-card.active {
  border-color: var(--accent-primary);
  background-color: rgba(99, 102, 241, 0.12);
}
.persona-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.persona-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
}
.persona-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-header);
}
.persona-bio {
  font-size: 12px;
  color: var(--text-dim);
}

/* Incoming Call Toast Overlay */
.incoming-call-toast {
  position: fixed;
  top: 24px;
  right: 24px;
  background-color: var(--bg-modal);
  border: 1px solid var(--border-focus);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  z-index: 300;
  animation: slideToastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideToastIn {
  from { transform: translateX(100px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.caller-avatar-ring img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  animation: ringPulse 1.2s infinite;
}
@keyframes ringPulse {
  0% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(99, 102, 241, 0); }
  100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}
.caller-name {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}
.call-type-label {
  font-size: 12px;
  color: var(--accent-cyan);
}
.call-actions {
  display: flex;
  gap: 10px;
}
.call-btn-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
  transition: transform 0.15s ease;
}
.call-btn-circle:hover {
  transform: scale(1.1);
}
.accept-call-btn { background-color: var(--accent-emerald); }
.decline-call-btn { background-color: var(--accent-rose); }

/* Floating Popovers (Soundboard, Emoji, GIF) */
.popover {
  position: absolute;
  bottom: 80px;
  right: 30px;
  background-color: var(--bg-popover);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-lg);
  z-index: 120;
  width: 320px;
  overflow: hidden;
  animation: popoverFadeIn 0.2s ease-out;
}
.popover-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  color: var(--text-header);
}
.close-popover-btn {
  font-size: 18px;
  color: var(--text-muted);
}
.popover-search {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
}
.popover-search input {
  width: 100%;
  background-color: var(--bg-darkest);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 12.5px;
}
.soundboard-grid {
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.sfx-btn {
  padding: 10px;
  background-color: var(--bg-darkest);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-normal);
  transition: all 0.15s ease;
  text-align: left;
}
.sfx-btn:hover {
  background-color: var(--bg-hover);
  border-color: var(--accent-primary);
  transform: translateY(-1px);
}

.emoji-categories-list {
  max-height: 280px;
  overflow-y: auto;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}
.emoji-item-btn {
  font-size: 24px;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: transform 0.1s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.emoji-item-btn:hover {
  transform: scale(1.3);
  background-color: rgba(255, 255, 255, 0.1);
}

.gif-grid {
  max-height: 300px;
  overflow-y: auto;
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.gif-card {
  border-radius: var(--radius-sm);
  overflow: hidden;
  height: 90px;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
}
.gif-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}
.gif-card:hover img {
  transform: scale(1.05);
}

/* Lightbox Modal */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(10px);
  z-index: 350;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.lightbox-content img {
  max-width: 100%;
  max-height: 80vh;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}
.lightbox-close-btn {
  position: absolute;
  top: -40px;
  right: 0;
  font-size: 32px;
  color: #fff;
}
.lightbox-bottom-bar {
  margin-top: 12px;
}
.lightbox-link {
  color: var(--text-link);
  font-size: 13px;
}

/* Profile Popout Card */
.user-profile-popout {
  position: absolute;
  width: 290px;
  background-color: var(--bg-darkest);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-lg);
  z-index: 150;
  overflow: hidden;
  animation: popoverFadeIn 0.2s ease-out;
}
.popout-banner {
  height: 64px;
  background: linear-gradient(135deg, #6366f1, #06b6d4);
}
.popout-body {
  padding: 0 16px 16px 16px;
  position: relative;
  margin-top: -30px;
}
.popout-avatar-wrap {
  position: relative;
  width: 64px;
  height: 64px;
}
.popout-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 3px solid var(--bg-darkest);
  object-fit: cover;
}
.popout-name {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  margin-top: 8px;
}
.popout-handle {
  font-size: 12px;
  color: var(--text-dim);
}
.popout-status-box {
  margin-top: 10px;
  padding: 8px 10px;
  background-color: var(--bg-sidebar);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-normal);
}
.popout-roles-box {
  margin-top: 12px;
}
.popout-roles-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 4px;
}
.popout-actions-row {
  margin-top: 14px;
  display: flex;
  gap: 8px;
}

/* Responsive Rules */
@media (max-width: 900px) {
  .members-sidebar-panel {
    display: none;
  }
}

@media (max-width: 700px) {
  .mobile-toggle-btn {
    display: flex;
  }
  .sidebar-panel {
    position: absolute;
    left: 72px;
    top: 0;
    bottom: 0;
    z-index: 50;
    box-shadow: var(--shadow-lg);
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .sidebar-panel.open {
    transform: translateX(0);
  }
}

/* Toast Notifications */
.toast-notification {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background-color: var(--accent-primary);
  color: #ffffff;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  font-weight: 600;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Server Events List in Modal */
.events-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.event-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s ease;
}
.event-card:hover {
  border-color: rgba(99, 102, 241, 0.4);
}
.event-badge-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--accent-emerald);
}
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
}
.event-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-header);
}
.event-card-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}
.event-card-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}
.event-card-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}
