/* RESET & VARIABLES */
:root {
  --bg-color: #0e0e15;
  --panel-bg: rgba(23, 23, 37, 0.55);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --accent-color: #24A1DE; /* Telegram Blue */
  --accent-hover: #1c8ac2;
  --accent-glow: rgba(36, 161, 222, 0.35);
  --success-color: #10b981;
  --danger-color: #ef4444;
  --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --sidebar-width: 320px;
  
  /* Telegram Style Bubble colors */
  --tg-in-bubble: #182533;
  --tg-out-bubble: #2b5278;
}

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

/* LOCK HORIZONTAL SCROLL AND MOBILE BOUNCE */
html, body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-main);
  height: 100vh;
  height: 100dvh;
  height: var(--vv-height, 100dvh);
  width: 100vw;
  overflow: hidden !important;
  position: fixed; /* Locks scrolling viewport container */
}

/* Ambient glow backgrounds */
.bg-glow-1, .bg-glow-2 {
  position: absolute;
  width: 45vw;
  height: 45vw;
  border-radius: 50%;
  filter: blur(120px);
  z-index: -1;
  opacity: 0.2;
  pointer-events: none;
}

.bg-glow-1 {
  top: -10%;
  left: -10%;
  background: radial-gradient(circle, #24a1de 0%, transparent 70%);
  animation: float-glow 25s ease-in-out infinite alternate;
}

.bg-glow-2 {
  bottom: -10%;
  right: -10%;
  background: radial-gradient(circle, #a855f7 0%, transparent 70%);
  animation: float-glow 30s ease-in-out infinite alternate-reverse;
}

@keyframes float-glow {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(8%, 8%) scale(1.15); }
}

/* Glass effect utility */
.glass {
  background: var(--panel-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--panel-border);
}

/* SCROLLBAR STYLE */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* BUTTONS & INPUTS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  font-family: var(--font-family);
  gap: 0.5rem;
}

.btn-primary {
  background: linear-gradient(135deg, #24a1de 0%, #0088cc 100%);
  color: #fff;
  box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(36, 161, 222, 0.5);
  opacity: 0.95;
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}
.btn-danger:hover {
  background: rgba(239, 68, 68, 0.35);
  transform: translateY(-1px);
}

.btn-success {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #a7f3d0;
}
.btn-success:hover {
  background: rgba(16, 185, 129, 0.35);
  transform: translateY(-1px);
}

.btn-block {
  width: 100%;
  display: flex;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border-radius: 10px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--accent-color);
  border-color: rgba(36, 161, 222, 0.3);
  transform: scale(1.05);
}

.icon-btn.small {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.circle-btn {
  border-radius: 50% !important;
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

/* APP MAIN CONTAINER */
.app-container {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  height: var(--vv-height, 100dvh);
  max-width: 100%;
  max-height: 100%;
  border-radius: 0;
  overflow: hidden;
  position: relative;
  border: none;
}

/* SCREENS: FIXING CLICKABLE BUG WITH DISPLAY NONE */
.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  display: none; /* Hide completely when not active */
  transition: opacity 0.4s ease;
}

.screen.active {
  opacity: 1;
  display: flex; /* Show only when active */
}

/* LOGIN SCREEN & TABS */
#login-screen {
  justify-content: center;
  align-items: center;
  background: rgba(10, 10, 15, 0.85);
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 2.25rem 2rem;
  border-radius: 20px;
  box-shadow: var(--card-shadow);
  text-align: center;
  animation: card-appear 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes card-appear {
  0% { transform: scale(0.92) translateY(20px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

.logo {
  margin-bottom: 1.5rem;
}

.logo-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.75rem;
  box-shadow: inset 0 0 15px rgba(36, 161, 222, 0.2);
}

.logo-icon svg {
  width: 32px;
  height: 32px;
}

.logo h1 {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #0088cc 0%, #24a1de 50%, #c084fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

/* Auth Tabs switcher */
.auth-tabs {
  display: flex;
  padding: 4px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.3);
  margin-bottom: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.auth-tab-btn {
  flex: 1;
  padding: 0.5rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s ease;
  font-family: var(--font-family);
}

.auth-tab-btn.active {
  background: var(--accent-color);
  color: #fff;
  box-shadow: 0 2px 10px rgba(36, 161, 222, 0.25);
}

/* Error Alerts */
.error-alert {
  padding: 0.65rem 1rem;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #f87171;
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
  text-align: left;
  animation: shake 0.3s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.input-group {
  margin-bottom: 1.25rem;
  text-align: left;
}

.input-group label {
  display: block;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  font-weight: 500;
}

.input-group input {
  width: 100%;
  padding: 0.8rem 0.95rem;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
  font-family: var(--font-family);
  font-size: 0.92rem;
  transition: all 0.3s ease;
}

.input-group input:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.avatar-setup {
  margin-bottom: 1.5rem;
  text-align: left;
}

.avatar-setup label {
  display: block;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
  font-weight: 500;
}

.avatar-preview-container {
  display: flex;
  justify-content: center;
  margin-bottom: 0.85rem;
}

.avatar-preview-badge {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.55rem;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
  transition: all 0.3s ease;
}

.color-picker {
  display: flex;
  justify-content: space-between;
  gap: 0.4rem;
}

.color-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border: 2px solid transparent;
}

.color-dot:hover {
  transform: scale(1.15);
}

.color-dot.active {
  border-color: #fff;
  transform: scale(1.2);
  box-shadow: 0 0 8px var(--accent-glow);
}


/* CHAT SCREEN */
#chat-screen {
  overflow: hidden;
}

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-width);
  height: 100%;
  border-right: 1px solid var(--panel-border);
  display: flex;
  flex-direction: column;
  background: var(--panel-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  z-index: 10;
}

.sidebar-header {
  padding: 1.15rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--panel-border);
}

.current-user-info {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  overflow: hidden;
}

.avatar-badge {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: #fff;
  font-size: 0.9rem;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
  flex-shrink: 0;
}

.avatar-badge.small {
  width: 34px;
  height: 34px;
  font-size: 0.8rem;
}

.user-details {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-details .username {
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-indicator {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.status-indicator::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--text-muted);
}

.status-indicator.online::before {
  background-color: var(--success-color);
  box-shadow: 0 0 5px var(--success-color);
}

.sidebar-search {
  padding: 0.85rem 1.15rem;
}

.search-input-wrapper {
  position: relative;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-input-wrapper input {
  width: 100%;
  padding: 0.6rem 1rem 0.6rem 2.25rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: #fff;
  font-family: var(--font-family);
  font-size: 0.85rem;
  transition: all 0.3s ease;
}

.search-input-wrapper input:focus {
  outline: none;
  border-color: var(--accent-color);
  background: rgba(0, 0, 0, 0.35);
}

.sidebar-menu-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: 0 0.65rem 1.25rem;
}

.menu-section {
  margin-top: 1.15rem;
}

.section-header {
  padding: 0 0.65rem 0.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.menu-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.menu-list-item {
  padding: 0.6rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
  border: 1px solid transparent;
  border-left: 3px solid transparent;
}

.menu-list-item:hover {
  background: rgba(255, 255, 255, 0.03);
  transform: translateX(3px);
}

.menu-list-item.active {
  background: var(--accent-glow);
  border-color: var(--panel-border);
  border-left-color: var(--accent-color);
  transform: translateX(3px);
}

.item-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  overflow: hidden;
}

.channel-hash {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 0.2s ease;
}

.menu-list-item.active .channel-hash {
  background: var(--accent-color);
  color: #fff;
  border-color: var(--accent-color);
}

.item-details {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.item-name {
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.unread-badge {
  background-color: var(--accent-color);
  color: #fff;
  border-radius: 10px;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 6px;
  box-shadow: 0 2px 8px var(--accent-glow);
}

/* CHAT AREA */
.chat-area {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  background: #0f1721;
  overflow: hidden;
}

/* Welcome Placeholder */
.chat-placeholder-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.chat-placeholder-container.active {
  opacity: 1;
  pointer-events: auto;
}

.welcome-box {
  text-align: center;
  max-width: 400px;
  padding: 2rem;
  animation: fade-up 0.5s ease;
}

.welcome-badge {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.welcome-box h2 {
  font-size: 1.35rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.welcome-box p {
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

/* Active Chat Window */
.chat-window-container {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  z-index: 2;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.chat-window-container.active {
  opacity: 1;
  pointer-events: auto;
}

/* Header */
.chat-header {
  padding: 0.95rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--panel-border);
  background: var(--panel-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.chat-title-wrapper {
  display: flex;
  flex-direction: column;
}

.chat-title-wrapper h3 {
  font-size: 0.98rem;
  font-weight: 600;
}

.chat-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
  max-width: 350px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.success-text {
  color: var(--accent-color);
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Messages List with Telegram Grid Wallpapers */
.messages-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.tg-wallpaper {
  background-color: #0e1621;
  background-image: 
    radial-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 0),
    radial-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 0);
  background-size: 24px 24px;
  background-position: 0 0, 12px 12px;
}

/* Message Item */
.message-item {
  display: flex;
  gap: 0.65rem;
  max-width: 70%;
  animation: message-slide 0.25s cubic-bezier(0.34, 1.3, 0.64, 1);
  align-self: flex-start;
}

.message-item.own {
  align-self: flex-end;
  flex-direction: row-reverse;
}

@keyframes message-slide {
  0% { transform: translateY(12px) scale(0.98); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

.message-avatar {
  flex-shrink: 0;
  align-self: flex-end;
}

.message-content-wrapper {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 100%;
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: #708499;
  padding: 0 4px;
}

.message-meta .sender-name {
  font-weight: 600;
  color: #538bb4;
}

/* TG-style bubbles */
.message-bubble {
  padding: 0.45rem 0.75rem;
  border-radius: 14px 14px 14px 4px;
  background-color: var(--tg-in-bubble);
  border: 1px solid var(--panel-border);
  font-size: 0.88rem;
  line-height: 1.4;
  color: var(--text-main);
  word-break: break-word;
  position: relative;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  align-self: flex-start; /* Shrink-wrap to content width */
  max-width: 100%;
}

.message-item.own .message-bubble {
  border-radius: 14px 14px 4px 14px;
  background-color: var(--tg-out-bubble);
  border: 1px solid rgba(255, 255, 255, 0.06);
  align-self: flex-end; /* Shrink-wrap to content width */
}

.message-text {
  padding-bottom: 4px;
}

/* Time display inside bubbles */
.msg-time-status {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.4);
  float: right;
  margin-left: 10px;
  margin-top: 5px;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 3px;
}

.msg-status-check {
  display: inline-flex;
  align-items: center;
  color: rgba(255, 255, 255, 0.45);
}

.msg-status-check.read {
  color: #4ade80; /* Elegant pastel green checkmarks for viewed status */
}

/* Code Formatting */
.message-bubble code {
  background: rgba(0, 0, 0, 0.25);
  padding: 2px 5px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.82em;
  color: #ff94b8;
}

.message-bubble pre {
  background: rgba(0, 0, 0, 0.3);
  padding: 0.65rem;
  border-radius: 8px;
  overflow-x: auto;
  margin: 0.4rem 0;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.message-bubble pre code {
  background: transparent;
  padding: 0;
  font-size: 0.78rem;
  color: #e2e8f0;
}

/* Telegram Кружочки (Circular Video notes) */
.video-note-wrapper {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  border: 3px solid var(--tg-in-bubble);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  background-color: #000;
  cursor: pointer;
}

.message-item.own .video-note-wrapper {
  border-color: var(--tg-out-bubble);
}

.video-note-player {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  -webkit-mask-image: -webkit-radial-gradient(circle, white 100%, black 100%);
}

/* System message styling */
.message-item.system {
  align-self: center;
  max-width: 90%;
  animation: fade-up 0.2s ease;
}

.message-item.system .message-bubble {
  background: rgba(16, 24, 34, 0.6) !important;
  border: 1px solid rgba(255, 255, 255, 0.03) !important;
  color: #8fa0b0;
  font-size: 0.78rem;
  padding: 0.35rem 0.75rem;
  border-radius: 10px;
  box-shadow: none;
  text-align: center;
}

/* Reactions Panel */
.reactions-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.reaction-badge {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 1px 5px;
  font-size: 0.72rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transition: all 0.2s ease;
}

.reaction-badge:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.reaction-badge.active {
  background: rgba(36, 161, 222, 0.15);
  border-color: rgba(36, 161, 222, 0.4);
}

.reaction-count {
  font-weight: 600;
  color: var(--text-muted);
}
.reaction-badge.active .reaction-count {
  color: var(--accent-color);
}

/* Message Hover Reactions Panel */
.message-actions-trigger {
  position: absolute;
  top: -12px;
  right: 8px;
  background: #17212b;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  padding: 2px 5px;
  display: flex;
  gap: 3px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  transform: translateY(4px);
  z-index: 5;
}

.message-item.own .message-actions-trigger {
  right: auto;
  left: 8px;
}

.message-bubble:hover .message-actions-trigger,
.message-actions-trigger:hover {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.msg-reaction-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 0.8rem;
  padding: 1px 3px;
  border-radius: 4px;
  transition: transform 0.15s ease;
}

.msg-reaction-btn:hover {
  transform: scale(1.35);
}

/* Typing Indicator Bar */
.typing-indicator-bar {
  padding: 0.4rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  color: var(--accent-color);
  animation: fade-up 0.2s ease;
}

.typing-dots {
  display: flex;
  align-items: center;
  gap: 3px;
}

.typing-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: var(--accent-color);
  animation: typing-bounce 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing-bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Input Bar (Telegram-style) */
.chat-input-bar {
  padding: 0.85rem 1.25rem;
  display: flex;
  gap: 0.65rem;
  position: relative;
  align-items: center;
  border-top: 1px solid var(--panel-border);
  background: var(--panel-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.message-form {
  flex: 1;
  display: flex;
  gap: 0.5rem;
}

.chat-input-bar input {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 0.75rem 1.15rem;
  color: #fff;
  font-family: var(--font-family);
  font-size: 0.92rem;
  transition: all 0.25s ease;
}

.chat-input-bar input:focus {
  outline: none;
  border-color: var(--accent-color);
  background: rgba(0, 0, 0, 0.4);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.send-btn {
  background: var(--accent-color);
  color: #fff;
  border: none;
  border-radius: 8px;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.send-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.send-btn:active {
  transform: translateY(0);
}

/* Video Note Button */
#video-note-btn {
  background: rgba(255,255,255,0.03);
  border-color: rgba(255,255,255,0.05);
}
#video-note-btn:hover {
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.08);
}

/* Emoji Popup Panel */
.emoji-popup {
  position: absolute;
  bottom: 70px;
  left: 1.25rem;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
  padding: 0.75rem;
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  width: 200px;
}

.emoji-popup.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.emoji-item {
  font-size: 1.2rem;
  cursor: pointer;
  text-align: center;
  padding: 3px;
  border-radius: 6px;
  transition: all 0.15s ease;
}

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


/* CAMERA RECORDING OVERLAY (Telegram Кружочки) */
.camera-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fade-in 0.3s ease;
}

.camera-card {
  padding: 2.25rem 2.5rem;
  border-radius: 24px;
  text-align: center;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.camera-circle-wrapper {
  width: 250px;
  height: 250px;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  border: 4px solid var(--accent-color);
  box-shadow: 0 0 25px rgba(36, 161, 222, 0.4);
  background-color: #000;
}

#camera-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.recording-timer-badge {
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.7);
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.78rem;
  color: #fff;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}

.rec-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--danger-color);
}

.animate-blink {
  animation: blink 1s infinite alternate;
}

@keyframes blink {
  0% { opacity: 0.2; }
  100% { opacity: 1; }
}

.camera-actions {
  display: flex;
  gap: 1rem;
}


/* WebRTC CALLING OVERLAYS */

/* 1. Incoming Call Overlay */
.incoming-call-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(10, 10, 18, 0.85);
  backdrop-filter: blur(15px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  animation: fade-in 0.3s ease;
}

.incoming-call-card {
  width: 90%;
  max-width: 380px;
  padding: 3rem 2rem;
  border-radius: 24px;
  text-align: center;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  animation: card-appear 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.big-avatar {
  width: 96px !important;
  height: 96px !important;
  font-size: 2.2rem !important;
  border: 3px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.incoming-call-actions {
  display: flex;
  gap: 2.5rem;
  margin-top: 1rem;
}

.pulse-button {
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse-green 1.5s infinite;
}

@keyframes pulse-green {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    transform: scale(1.08);
    box-shadow: 0 0 0 15px rgba(16, 185, 129, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

/* 2. Active Call Overlay */
.active-call-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  height: var(--vv-height, 100dvh);
  background: #09090d;
  display: flex;
  flex-direction: column;
  z-index: 2900;
  animation: fade-in 0.3s ease;
}

.active-call-status-pill {
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #fff;
  background: rgba(23, 23, 37, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  pointer-events: none;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

@media (max-width: 768px) {
  .active-call-status-pill {
    top: 70px; /* Shift down to avoid overlaying mobile header */
    font-size: 0.76rem;
    padding: 4px 10px;
  }
}

.active-call-main {
  flex: 1;
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* DISCORD STYLE CALL GRID */
.call-grid-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  width: 100%;
  height: 100%;
  padding: 80px 24px 110px 24px; /* Space for top-bar/status-pill and bottom controls */
  background: #08080c;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .call-grid-container {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
    padding: 110px 12px 100px 12px;
    gap: 12px;
  }
}

.call-tile {
  background: #111214;
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid transparent;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease, width 0.3s ease, height 0.3s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.call-tile:hover {
  border-color: rgba(255, 255, 255, 0.08);
}

.call-tile.speaking {
  border-color: #10b981;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.video-wrapper {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0b0b0f;
}

.video-wrapper video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
  display: none; /* Controlled by JS updateTilesMediaState */
}

video.video-contain {
  object-fit: contain !important;
}

.tile-avatar-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  background: #111214;
}

.tile-meta {
  position: absolute;
  bottom: 16px;
  left: 16px;
  z-index: 5;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  padding: 4px 10px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

.tile-username {
  font-size: 0.82rem;
  font-weight: 600;
  color: #fff;
}

.tile-icon-status {
  color: #ef4444;
  display: flex;
  align-items: center;
}

/* Red Live badge for streams */
.tile-live-badge {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 5;
  background: #ef4444;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.5px;
  box-shadow: 0 3px 10px rgba(239, 68, 68, 0.4);
  pointer-events: none;
}

/* Local Video Container styles inside the tile */
.local-video-container-tile {
  width: 100%;
  height: 100%;
  position: relative;
}

/* Focus / Theatre Mode */
.call-grid-container.focus-mode {
  grid-template-columns: 1fr !important;
  grid-template-rows: 1fr !important;
  position: relative;
}

.call-grid-container.focus-mode .call-tile.floating-tile {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 180px;
  height: 135px;
  z-index: 100;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  border: 2px solid rgba(255, 255, 255, 0.15);
  pointer-events: auto;
}

.call-grid-container.focus-mode .call-tile.focused-tile {
  width: 100%;
  height: 100%;
  pointer-events: auto;
}

@media (max-width: 768px) {
  .call-grid-container.focus-mode .call-tile.floating-tile {
    top: 70px; /* Push down to avoid mobile status pill */
    right: 16px;
    width: 100px;
    height: 130px;
  }
}

.local-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Active Call Controls bar */
.active-call-controls {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 1.5rem;
  z-index: 200;
  background: rgba(23, 23, 37, 0.4);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.85rem 2rem;
  border-radius: 40px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.active-call-controls .circle-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
  width: 50px;
  height: 50px;
  transition: all 0.25s ease;
}

.active-call-controls .circle-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: scale(1.05);
}

.active-call-controls #hangup-call-btn {
  background: var(--danger-color);
  border-color: var(--danger-color);
  color: #fff;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.active-call-controls #hangup-call-btn:hover {
  background: #dc2626;
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
}


/* MODALS */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 4000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: 90%;
  max-width: 440px;
  border-radius: 20px;
  padding: 1.75rem 2rem;
  box-shadow: var(--card-shadow);
  animation: card-appear 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 600;
}

/* UTILITY CLASSES */
.hidden {
  display: none !important;
}

.mobile-only {
  display: none;
}

.sidebar-overlay {
  display: none;
}

/* RESPONSIVE DESIGN */
@media (max-width: 768px) {
  --sidebar-width: 280px;

  .app-container {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
    border: none;
  }

  /* Discord-like dark sidebars on mobile */
  #chat-screen.layout-discord .sidebar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 240px !important;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: #2f3136 !important; /* Discord dark panel */
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    z-index: 12;
  }

  #chat-screen.layout-discord .sidebar.active {
    transform: translateX(72px);
  }

  #chat-screen.layout-discord .servers-sidebar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 72px;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: #202225 !important; /* Solid Discord dark color */
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    z-index: 13;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 0;
    gap: 8px;
    box-sizing: border-box;
    overflow-y: auto;
  }

  #chat-screen.layout-discord .servers-sidebar.active {
    transform: translateX(0);
  }

  .mobile-only {
    display: flex;
  }

  .chat-subtitle {
    max-width: 200px;
  }

  /* Overlay cover when sidebar open on mobile */
  .sidebar-overlay {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }
  .sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
  }

  /* Calling responsiveness */
  .active-call-controls {
    bottom: 24px !important;
    padding: 0.5rem 1rem !important;
    gap: 0.75rem !important;
    border-radius: 30px !important;
    background: rgba(10, 10, 15, 0.85) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5) !important;
  }
  
  .active-call-controls .circle-btn {
    width: 44px !important;
    height: 44px !important;
  }
  
  /* Redundant absolute local-video-container removed (now local-video-container-tile) */

  /* Discord mobile message improvements */
  .message-item {
    max-width: 90% !important;
    gap: 0.5rem !important;
  }

  .message-avatar {
    width: 32px !important;
    height: 32px !important;
    font-size: 0.8rem !important;
  }

  .messages-container {
    padding: 0.75rem !important;
    gap: 0.85rem !important;
  }

  .message-bubble {
    padding: 0.45rem 0.75rem !important;
    font-size: 0.85rem !important;
  }

  /* Discord-style floating mobile input bar */
  .chat-input-bar {
    padding: 0.5rem 0.75rem calc(0.5rem + env(safe-area-inset-bottom)) 0.75rem !important;
    background: transparent !important;
    border-top: none !important;
  }
  
  .message-form {
    background: rgba(47, 49, 54, 0.7) !important; /* Discord mobile input style */
    border: 1px solid rgba(255, 255, 255, 0.04) !important;
    border-radius: 24px !important;
    padding: 0.25rem 0.5rem !important;
    align-items: center !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
  }
  
  .chat-input-bar input {
    background: transparent !important;
    border: none !important;
    padding: 0.45rem 0.65rem !important;
    font-size: 0.88rem !important;
    height: auto !important;
    box-shadow: none !important;
  }
  
  .chat-input-bar input:focus {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
  }
  
  .send-btn, #emoji-btn, #video-note-btn {
    width: 34px !important;
    height: 34px !important;
    border-radius: 50% !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: var(--text-muted) !important;
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  
  .send-btn {
    color: var(--accent-color) !important;
  }
  
  .send-btn:hover, #emoji-btn:hover, #video-note-btn:hover {
    background: rgba(255, 255, 255, 0.05) !important;
    color: var(--text-main) !important;
  }
}

/* Animations */
@keyframes fade-up {
  0% { transform: translateY(8px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

@keyframes fade-in {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

.active-call-controls #toggle-screen-btn.active-sharing {
  background: #10b981 !important; /* Premium green */
  border-color: #10b981 !important;
  color: #fff !important;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4) !important;
}

/* CALL TOP BAR & GLASS BUTTONS */
.active-call-top-bar {
  position: absolute;
  top: 24px;
  left: 24px;
  display: flex;
  gap: 0.85rem;
  z-index: 300;
  align-items: center;
}

.glass-btn {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 0.5rem 1rem;
  height: 38px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.25s ease;
  width: auto !important;
}

.glass-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.18);
}

.glass-btn svg {
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.glass-btn:hover svg {
  transform: rotate(30deg);
}

/* QUALITY DROPDOWN */
.quality-selector-container {
  position: relative;
}

.quality-dropdown {
  position: absolute;
  top: 46px;
  left: 0;
  min-width: 240px;
  background: rgba(17, 17, 27, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 400;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
  animation: dropdown-fade-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dropdown-fade-in {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}

.dropdown-section {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.dropdown-section-title {
  font-size: 0.65rem;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  opacity: 0.8;
  margin-left: 2px;
}

.settings-btn-grid {
  display: flex;
  gap: 4px;
  width: 100%;
}

.settings-option-btn {
  flex: 1;
  text-align: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.35rem 0.2rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

.settings-option-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.settings-option-btn:active {
  transform: translateY(0);
}

.settings-option-btn.active {
  background: rgba(36, 161, 222, 0.15);
  color: var(--accent-color);
  border-color: rgba(36, 161, 222, 0.35);
  font-weight: 700;
  box-shadow: inset 0 0 8px rgba(36, 161, 222, 0.1);
}

/* NOISE SUPPRESSION ACTIVE indicator */
.glass-btn.active-filter {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.08);
  color: #a7f3d0;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

.glass-btn.active-filter .sound-wave-icon {
  color: #10b981;
  animation: wave-bounce 1.5s infinite ease-in-out;
}

@keyframes wave-bounce {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(1.3); }
}

/* CONNECTION HUD PANEL */
.call-hud {
  position: absolute;
  top: 24px;
  right: 24px;
  padding: 0.65rem 0.95rem;
  border-radius: 16px;
  font-size: 0.72rem;
  font-family: monospace;
  background: rgba(10, 10, 15, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  gap: 3px;
  z-index: 300;
  min-width: 140px;
  color: rgba(255, 255, 255, 0.8);
  pointer-events: none;
}

.hud-row {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.hud-row span:last-child {
  font-weight: bold;
  color: var(--accent-color);
}

/* AVATAR VOLUME PULSATION GLOW */
.avatar-glow-wrapper {
  position: relative;
  width: 96px;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.5rem;
}

.volume-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid var(--accent-color);
  opacity: 0;
  transform: scale(1);
  pointer-events: none;
  box-shadow: 0 0 15px var(--accent-glow);
  /* Use dynamic CSS variables for volume levels */
  --scale-val: calc(1 + var(--volume-level, 0) * 0.4);
  --opacity-val: calc(var(--volume-level, 0) * 0.8);
  transform: scale(var(--scale-val));
  opacity: var(--opacity-val);
  transition: transform 0.08s ease-out, opacity 0.08s ease-out;
}

#remote-volume-ring-2 {
  border-color: #a855f7;
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.35);
  --scale-val: calc(1 + var(--volume-level, 0) * 0.75);
  --opacity-val: calc(var(--volume-level, 0) * 0.4);
}

/* LOCAL MIC VOLUME BAR */
.local-volume-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: rgba(0, 0, 0, 0.4);
  z-index: 110;
  overflow: hidden;
}

.local-volume-fill {
  height: 100%;
  width: calc(var(--local-volume, 0) * 100%);
  background: linear-gradient(90deg, var(--accent-color) 0%, #10b981 100%);
  transition: width 0.08s ease-out;
}

/* FLOATING IN-CALL CHAT PANEL */
.in-call-chat {
  position: absolute;
  top: 80px;
  right: 24px;
  bottom: 110px;
  width: 300px;
  border-radius: 20px;
  background: rgba(17, 17, 27, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 250;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
  transform: translateX(350px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
}

.in-call-chat.active {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.in-call-chat-header {
  padding: 0.95rem 1.15rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.in-call-chat-header h4 {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
}

.in-call-messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.in-call-messages-container::-webkit-scrollbar {
  width: 4px;
}

/* Mini message items */
.in-call-msg {
  padding: 0.45rem 0.65rem;
  border-radius: 10px;
  font-size: 0.78rem;
  max-width: 85%;
  line-height: 1.3;
  word-break: break-word;
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.05);
}

.in-call-msg.own {
  align-self: flex-end;
  background: var(--accent-color);
  color: #fff;
}

.in-call-msg-sender {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent-color);
  margin-bottom: 2px;
  display: block;
}

.in-call-msg.own .in-call-msg-sender {
  color: rgba(255, 255, 255, 0.8);
}

.in-call-message-form {
  padding: 0.65rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  gap: 0.35rem;
}

.in-call-message-form input {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 0.45rem 0.75rem;
  color: #fff;
  font-family: var(--font-family);
  font-size: 0.82rem;
  height: 32px;
}

.in-call-message-form input:focus {
  outline: none;
  border-color: var(--accent-color);
}

.small-send {
  width: 32px !important;
  height: 32px !important;
  border-radius: 10px !important;
  flex-shrink: 0;
  padding: 0;
}

/* MOBILE RESPONSIVE TWEAKS */
@media (max-width: 768px) {
  .active-call-top-bar {
    top: 16px;
    left: 16px;
    gap: 0.5rem;
  }
  
  .glass-btn {
    padding: 0.4rem 0.75rem;
    height: 34px;
    font-size: 0.76rem;
  }
  
  .call-hud {
    top: 16px;
    right: 16px;
    min-width: 110px;
    padding: 0.45rem 0.65rem;
    font-size: 0.65rem;
  }
  
  .in-call-chat {
    top: 70px;
    right: 16px;
    bottom: 110px;
    left: 16px;
    width: auto;
  }
}

/* TWO-MODE INTERFACE STYLES (DISCORD / TELEGRAM) */
.sidebar-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.item-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex-shrink: 0;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
  transition: all 0.2s ease;
}

.item-badge.badge-group {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.item-badge.badge-dm {
  background: rgba(36, 161, 222, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(36, 161, 222, 0.3);
}

.menu-list-item.active .item-badge.badge-group {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
}

.menu-list-item.active .item-badge.badge-dm {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
}

/* Animations for mode switching */
.menu-section {
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.menu-section.hidden {
  display: none !important;
  opacity: 0;
  transform: translateY(10px);
}

/* COLOR THEMES */
/* Graphite Theme */
body[data-theme="cosmic"] {
  --bg-color: #0b0b0f;
  --panel-bg: rgba(18, 18, 26, 0.65);
  --panel-border: rgba(255, 255, 255, 0.05);
  --accent-color: #8b5cf6;
  --accent-hover: #7c3aed;
  --accent-glow: rgba(139, 92, 246, 0.15);
  --tg-in-bubble: #1b1b24;
  --tg-out-bubble: #372a54;
}
body[data-theme="cosmic"] .bg-glow-1 {
  background: radial-gradient(circle, rgba(139, 92, 246, 0.12) 0%, transparent 70%);
}
body[data-theme="cosmic"] .bg-glow-2 {
  background: radial-gradient(circle, rgba(99, 102, 241, 0.08) 0%, transparent 70%);
}

/* Obsidian Theme */
body[data-theme="cyberpunk"] {
  --bg-color: #050505;
  --panel-bg: rgba(18, 18, 18, 0.75);
  --panel-border: rgba(255, 255, 255, 0.04);
  --accent-color: #ffffff;
  --accent-hover: #e5e7eb;
  --accent-glow: rgba(255, 255, 255, 0.12);
  --tg-in-bubble: #171717;
  --tg-out-bubble: #2d2d2d;
}
body[data-theme="cyberpunk"] .bg-glow-1 {
  background: radial-gradient(circle, rgba(255, 255, 255, 0.03) 0%, transparent 70%);
}
body[data-theme="cyberpunk"] .bg-glow-2 {
  background: radial-gradient(circle, rgba(255, 255, 255, 0.02) 0%, transparent 70%);
}

/* Malachite Theme */
body[data-theme="emerald"] {
  --bg-color: #060908;
  --panel-bg: rgba(15, 22, 19, 0.65);
  --panel-border: rgba(255, 255, 255, 0.04);
  --accent-color: #0d9488;
  --accent-hover: #0f766e;
  --accent-glow: rgba(13, 148, 136, 0.15);
  --tg-in-bubble: #131c18;
  --tg-out-bubble: #164e43;
}
body[data-theme="emerald"] .bg-glow-1 {
  background: radial-gradient(circle, rgba(13, 148, 136, 0.1) 0%, transparent 70%);
}
body[data-theme="emerald"] .bg-glow-2 {
  background: radial-gradient(circle, rgba(20, 184, 166, 0.05) 0%, transparent 70%);
}

/* Nordic Theme */
body[data-theme="darkblue"] {
  --bg-color: #090e14;
  --panel-bg: rgba(15, 21, 30, 0.65);
  --panel-border: rgba(255, 255, 255, 0.05);
  --accent-color: #38bdf8;
  --accent-hover: #0ea5e9;
  --accent-glow: rgba(56, 189, 248, 0.15);
  --tg-in-bubble: #131a26;
  --tg-out-bubble: #1e3a5f;
}
body[data-theme="darkblue"] .bg-glow-1 {
  background: radial-gradient(circle, rgba(56, 189, 248, 0.12) 0%, transparent 70%);
}
body[data-theme="darkblue"] .bg-glow-2 {
  background: radial-gradient(circle, rgba(99, 102, 241, 0.08) 0%, transparent 70%);
}

/* Bronze Theme */
body[data-theme="sunset"] {
  --bg-color: #0c0b0a;
  --panel-bg: rgba(22, 19, 17, 0.65);
  --panel-border: rgba(255, 255, 255, 0.04);
  --accent-color: #d97706;
  --accent-hover: #b45309;
  --accent-glow: rgba(217, 119, 6, 0.15);
  --tg-in-bubble: #1c1815;
  --tg-out-bubble: #45210c;
}
body[data-theme="sunset"] .bg-glow-1 {
  background: radial-gradient(circle, rgba(217, 119, 6, 0.08) 0%, transparent 70%);
}
body[data-theme="sunset"] .bg-glow-2 {
  background: radial-gradient(circle, rgba(245, 158, 11, 0.04) 0%, transparent 70%);
}

/* THEME & LAYOUT CARD SELECTORS */
.theme-card-option, .layout-card-option, .welcome-layout-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 0.75rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-main);
  transition: all 0.25s ease;
  font-family: var(--font-family);
}

.theme-card-option:hover, .layout-card-option:hover, .welcome-layout-card:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.theme-card-option.active, .layout-card-option.active, .welcome-layout-card.active {
  background: rgba(36, 161, 222, 0.1);
  border-color: var(--accent-color);
  box-shadow: 0 0 12px var(--accent-glow);
}

.theme-color-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-block;
  border: 2px solid rgba(255, 255, 255, 0.15);
}

.theme-card-option.active .theme-color-dot {
  border-color: #fff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

.theme-card-label {
  font-size: 0.72rem;
  font-weight: 600;
}

/* SINGLE-COLUMN MESSENGER LAYOUT */
#chat-screen.layout-messenger .sidebar {
  width: 100% !important;
  border-right: none;
}

#chat-screen.layout-messenger .chat-area {
  width: 100% !important;
  flex: none;
}

/* Hide/Show logic for messenger */
#chat-screen.layout-messenger.sidebar-visible .sidebar {
  display: flex !important;
}
#chat-screen.layout-messenger.sidebar-visible .chat-area {
  display: none !important;
}

#chat-screen.layout-messenger.chat-visible .sidebar {
  display: none !important;
}
#chat-screen.layout-messenger.chat-visible .chat-area {
  display: flex !important;
}

/* Back button in messenger mode */
#chat-screen.layout-messenger #chat-back-btn {
  display: flex !important;
  margin-right: 0.5rem;
}

#chat-screen.layout-messenger #sidebar-toggle {
  display: none !important;
}

/* Override mobile absolute sidebar layout in Messenger mode */
#chat-screen.layout-messenger .sidebar {
  position: relative !important;
  transform: none !important;
  width: 100% !important;
  box-shadow: none !important;
  transition: none !important;
}

#chat-screen.layout-messenger .sidebar-overlay {
  display: none !important;
}

/* DISCORD-STYLE SERVERS SIDEBAR */
.servers-sidebar {
  width: 72px;
  height: 100%;
  background: rgba(0, 0, 0, 0.35);
  border-right: 1px solid var(--panel-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  gap: 8px;
  flex-shrink: 0;
  overflow-y: auto;
  z-index: 15;
}

#chat-screen.layout-messenger .servers-sidebar {
  display: none !important;
}

.servers-separator {
  width: 32px;
  height: 2px;
  background: var(--panel-border);
  border-radius: 1px;
  margin: 4px 0;
  flex-shrink: 0;
}

.servers-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  align-items: center;
}

.server-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
  position: relative;
  flex-shrink: 0;
  padding: 0;
}

.server-btn:hover, .server-btn.active {
  border-radius: 14px;
  background: var(--accent-color);
  color: #fff;
  border-color: var(--accent-color);
}

/* Side indicator pill */
.server-btn::before {
  content: '';
  position: absolute;
  left: -12px;
  width: 4px;
  height: 0;
  background: var(--text-main);
  border-radius: 0 4px 4px 0;
  transition: all 0.2s ease;
}

.server-btn:hover::before {
  height: 20px;
}

.server-btn.active::before {
  height: 40px;
  background: var(--accent-color);
}

.server-icon {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.5px;
  border-radius: inherit;
  transition: border-radius 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
  overflow: hidden;
}

.server-btn.add-server-btn:hover, .server-btn.join-server-btn:hover {
  background: var(--success-color);
  border-color: var(--success-color);
}

.server-btn.add-server-btn:hover::before, .server-btn.join-server-btn:hover::before {
  display: none;
}

/* SERVER INFO BANNER */
.server-info-banner {
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.01);
  flex-shrink: 0;
}

.server-banner-details {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  text-align: left;
  width: calc(100% - 24px);
}

#active-server-name {
  font-weight: 600;
  font-size: 0.92rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-main);
}

.server-banner-code {
  font-size: 0.7rem;
  color: var(--text-muted);
}

#active-server-code {
  font-family: monospace;
  font-weight: 600;
  color: var(--accent-color);
}

/* USER PROFILE CARD POPUP STYLE */
.status-badge {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid var(--panel-border);
}
.status-badge.online {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.25);
}
.status-badge.offline {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.25);
}

.message-avatar, .sender-name, #chat-header-icon, #chat-title {
  cursor: pointer;
}
.message-avatar:hover, .sender-name:hover {
  opacity: 0.85;
}

/* Hide discord channel sidebar triggers when in home mode */
.sidebar-section-hide {
  display: none !important;
}

/* GROUP CALL VOICE GRID STYLES */
.voice-tile {
  width: 100%;
  aspect-ratio: 16/9;
  max-width: 420px;
  background: #2b2d31;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  border: 2px solid rgba(255, 255, 255, 0.05);
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.voice-tile:hover {
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
}

.voice-tile.speaking {
  border-color: #23a55a !important; /* Discord green border when speaking */
  box-shadow: 0 0 16px rgba(35, 165, 90, 0.5), inset 0 0 8px rgba(35, 165, 90, 0.2);
}

.voice-tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
}

.voice-tile video.video-contain {
  object-fit: contain;
  background: #111214;
}

.voice-avatar-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  z-index: 2;
  transition: transform 0.3s ease;
}

.voice-tile.speaking .voice-avatar-placeholder {
  transform: scale(1.05);
}

.voice-tile-name {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(17, 18, 20, 0.75);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 500;
  color: #f2f3f5;
  z-index: 5;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.voice-tile-mic-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(239, 68, 68, 0.9);
  color: #fff;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* Floating controls bar at the bottom overlaying the video grid */
.group-call-controls {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  background: rgba(30, 31, 34, 0.55) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 28px;
  padding: 10px 24px !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  display: flex;
  gap: 16px;
  align-items: center;
  flex-shrink: 0;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.group-call-controls:hover {
  background: rgba(30, 31, 34, 0.8) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}

.group-call-controls .circle-btn {
  background: rgba(255, 255, 255, 0.08);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.group-call-controls .circle-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: scale(1.08);
}

.group-call-controls .circle-btn:active {
  transform: scale(0.95);
}

#group-disconnect-btn {
  background: #f23f43 !important;
}

#group-disconnect-btn:hover {
  background: #da373c !important;
  box-shadow: 0 0 15px rgba(242, 63, 67, 0.4);
}

/* Custom CSS to animate voice waves for speaking indicator */
@keyframes speaking-pulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(35, 165, 90, 0.5); }
  70% { transform: scale(1.04); box-shadow: 0 0 0 8px rgba(35, 165, 90, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(35, 165, 90, 0); }
}

.voice-tile.speaking .avatar-badge {
  animation: speaking-pulse 1.5s infinite ease-in-out;
  border: 2px solid #23a55a !important;
  box-shadow: 0 0 12px rgba(35, 165, 90, 0.6);
}

/* Custom modifications for voice connection panel and mobile layouts */
.voice-connection-panel {
  border-top: 1px solid var(--panel-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.voice-connection-panel .btn {
  transition: all 0.2s ease;
}

.voice-user-item {
  animation: slide-in-down 0.15s ease-out;
}

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

@media (max-width: 768px) {
  /* Prevent servers sidebar overlap on mobile sidebar */
  #chat-screen.layout-discord .sidebar {
    left: 0 !important;
    width: calc(100% - 72px) !important;
    max-width: 280px;
  }
  
  #chat-screen.layout-discord .sidebar-overlay {
    left: 0;
  }

  /* Make voice connection buttons more compact on mobile */
  .voice-connection-panel {
    padding: 0.5rem 0.75rem !important;
  }
  
  .voice-connection-panel .btn {
    padding: 0.4rem 0.2rem !important;
    font-size: 0.7rem !important;
    gap: 0.15rem !important;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .voice-connection-panel .btn span {
    display: none !important; /* hide button texts "Микро", "Видео", "Экран" on mobile */
  }
  
  .voice-connection-panel .btn svg {
    width: 16px !important;
    height: 16px !important;
    margin: 0 !important;
  }
  
  #welcome-open-menu-btn {
    display: inline-block !important;
  }
}

/* Volume Control on Video Tiles */
.voice-tile-volume-control {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(30, 31, 34, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 6px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.voice-tile-volume-control:hover {
  background: rgba(30, 31, 34, 0.95);
  border-color: rgba(255, 255, 255, 0.12);
}

.voice-tile-volume-control .volume-btn {
  background: none;
  border: none;
  color: #f2f3f5;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.voice-tile-volume-control .volume-btn:hover {
  color: #fff;
}

.voice-tile-volume-control .volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 0;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  outline: none;
  margin: 0;
  opacity: 0;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
  cursor: pointer;
}

.voice-tile-volume-control:hover .volume-slider {
  width: 60px;
  opacity: 1;
  margin-left: 4px;
}

.voice-tile-volume-control .volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #5865f2;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.voice-tile-volume-control .volume-slider::-webkit-slider-thumb:hover {
  background: #4752c4;
  transform: scale(1.2);
}

/* ==========================================
   CUSTOM ELECTRON APP STYLES
   ========================================== */

/* Custom Draggable Title Bar */
.custom-title-bar {
  display: none;
  height: 32px;
  background: #111214;
  color: #949ba4;
  align-items: center;
  justify-content: space-between;
  padding: 0;
  user-select: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
  font-family: 'Outfit', sans-serif;
  font-size: 0.75rem;
  -webkit-app-region: drag;
  box-sizing: border-box;
  position: relative;
  z-index: 9999;
}

body.is-electron .custom-title-bar {
  display: flex;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background: transparent;
  border-bottom: none;
}

body.is-electron .custom-title-bar .title-bar-left {
  display: none !important;
}

body.is-electron .app-container {
  height: 100vh;
  height: 100dvh;
}

body.is-electron .servers-sidebar {
  padding-top: calc(12px + 32px) !important;
}

body.is-electron .sidebar-header {
  padding-top: 32px !important;
  height: calc(48px + 32px) !important;
}

body.is-electron .chat-header {
  padding-top: calc(0.95rem + 32px) !important;
}

.custom-title-bar .title-bar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 12px;
}

.custom-title-bar .window-controls {
  display: flex;
  align-items: center;
  height: 100%;
  -webkit-app-region: no-drag;
  margin-left: auto;
}

.custom-title-bar .win-btn {
  background: none;
  border: none;
  color: inherit;
  width: 46px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.custom-title-bar .win-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.custom-title-bar .win-btn.close-btn:hover {
  background: #f23f43;
  color: #fff;
}

/* Custom Screen Picker Grid Items */
.source-selection-card {
  background: #2b2d31 !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.source-tabs .tab-btn {
  transition: color 0.15s, background-color 0.15s;
}

.source-tabs .tab-btn.active {
  background: rgba(255, 255, 255, 0.05) !important;
  color: #fff !important;
}

.source-tabs .tab-btn:not(.active):hover {
  color: #dbdee1 !important;
  background: rgba(255, 255, 255, 0.02) !important;
}

.source-grid {
  padding: 4px;
}

.source-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.source-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: #5865f2;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.source-item .thumbnail-container {
  aspect-ratio: 1.5;
  background: #111214;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.source-item .thumbnail-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.2s ease;
}

.source-item:hover .thumbnail-container img {
  transform: scale(1.03);
}

.source-item .source-name {
  padding: 8px 12px;
  font-size: 0.75rem;
  color: #f2f3f5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  font-weight: 500;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

/* User Context Popover */
.user-context-popover {
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.user-context-popover.hidden {
  display: none !important;
}

.user-context-popover input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  border-radius: 2px;
}

.user-context-popover input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #5865f2;
  cursor: pointer;
  transition: background 0.1s;
}

.user-context-popover input[type="range"]::-webkit-slider-thumb:hover {
  background: #4752c4;
}

/* Deafen Action Styling */
.deafen-icon {
  transition: color 0.2s;
}

.sidebar-footer .icon-btn.active {
  color: #f23f43 !important;
}

/* Discord Connection Panel Button Styles */
.sidebar-voice-btn {
  background: #2b2d31 !important;
  color: #b5bac1 !important;
  transition: background-color 0.15s, color 0.15s;
}

.sidebar-voice-btn:hover {
  background: #35373c !important;
  color: #f2f3f5 !important;
}

.sidebar-voice-btn.active {
  background: #23a55a !important;
  color: #ffffff !important;
}

.sidebar-voice-btn.danger {
  background: #f23f43 !important;
  color: #ffffff !important;
}

/* User profile footer controls hover styling */
.sidebar-user-action-btn:hover {
  background-color: rgba(255, 255, 255, 0.06) !important;
  color: #f2f3f5 !important;
}

/* Sticky welcome settings button at the bottom of the screen */
.chat-placeholder-container #welcome-settings-btn {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 4rem);
  max-width: 360px;
  margin-top: 0 !important;
  z-index: 10;
}

@media (max-height: 620px) {
  .chat-placeholder-container #welcome-settings-btn {
    position: relative;
    bottom: auto;
    left: auto;
    transform: none;
    width: 100%;
    margin-top: 1.5rem !important;
  }
}


