:root {
  --bg-primary: #17212b;
  --bg-secondary: #0e1621;
  --bg-sidebar: #242f3d;
  --bg-input: #17212b;
  --bg-active: #2b5278;
  --accent-color: #5288c1;
  --accent-hover: #4578b0;
  --accent-glow: rgba(82, 136, 193, 0.6);
  --text-main: #f5f5f5;
  --text-muted: #7f91a4;
  --border-color: #10161e;
  --bubble-in: #182533;
  --bubble-out: #2b5278;
  --bubble-in-text: #f5f5f5;
  --bubble-out-text: #ffffff;
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.6);
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.6);
  --warning: #f59e0b;
  --warning-glow: rgba(245, 158, 11, 0.6);
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body.light-theme {
  --bg-primary: #ffffff;
  --bg-secondary: #f4f4f5;
  --bg-sidebar: #ffffff;
  --bg-input: #f4f4f5;
  --bg-active: #3390ec;
  --accent-color: #3390ec;
  --accent-hover: #267fd9;
  --accent-glow: rgba(51, 144, 236, 0.6);
  --text-main: #000000;
  --text-muted: #707579;
  --border-color: #dfe1e5;
  --bubble-in: #ffffff;
  --bubble-out: #eeffde;
  --bubble-in-text: #000000;
  --bubble-out-text: #000000;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background: var(--bg-secondary);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
}

#app {
  height: 100vh;
  display: flex;
}

/* ----------------------------------------------------
   3D VOLUMETRIC BUTTONS & GLOWING HOVER EFFECTS
---------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  position: relative;
  overflow: hidden;
  user-select: none;
}

.btn:active {
  transform: translateY(1.5px) scale(0.98) !important;
}

.btn-primary {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #60a5fa, #2563eb);
  box-shadow: 0 0 18px rgba(59, 130, 246, 0.7), 0 6px 16px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  transform: translateY(-2px);
}

.btn-secondary {
  background: linear-gradient(135deg, #374151, #1f2937);
  color: #f9fafb;
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn-secondary:hover {
  background: linear-gradient(135deg, #4b5563, #374151);
  box-shadow: 0 0 14px rgba(255, 255, 255, 0.25), 0 4px 12px rgba(0, 0, 0, 0.4);
  transform: translateY(-2px);
}

.btn-success {
  background: linear-gradient(135deg, #10b981, #047857);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn-success:hover {
  background: linear-gradient(135deg, #34d399, #059669);
  box-shadow: 0 0 18px rgba(16, 185, 129, 0.75), 0 6px 16px rgba(0, 0, 0, 0.4);
  transform: translateY(-2px);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn-danger:hover {
  background: linear-gradient(135deg, #f87171, #dc2626);
  box-shadow: 0 0 18px rgba(239, 68, 68, 0.75), 0 6px 16px rgba(0, 0, 0, 0.4);
  transform: translateY(-2px);
}

.btn-warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn-warning:hover {
  background: linear-gradient(135deg, #fbbf24, #b45309);
  box-shadow: 0 0 18px rgba(245, 158, 11, 0.75), 0 6px 16px rgba(0, 0, 0, 0.4);
  transform: translateY(-2px);
}

.btn-outline {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--accent-color);
  box-shadow: 0 0 14px var(--accent-glow);
  transform: translateY(-2px);
}

.btn-bronze-invite {
  background: linear-gradient(135deg, #9a7330, #6e4e1a);
  color: #ffffff;
  border: 1px solid #d4af37;
  box-shadow: 0 4px 12px rgba(184, 134, 11, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  font-weight: 700;
  padding: 7px 14px;
  border-radius: 9px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  transition: all 0.22s ease;
}

.btn-bronze-invite:hover {
  background: linear-gradient(135deg, #b8860b, #7e5621);
  box-shadow: 0 0 18px rgba(212, 175, 55, 0.75), 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  transform: translateY(-2px);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12.5px;
  border-radius: 8px;
}

.btn-xs {
  padding: 4px 9px;
  font-size: 11.5px;
  border-radius: 6px;
}

.btn-block {
  width: 100%;
}

/* ICON BUTTONS */
.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 17px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.icon-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.15);
  transform: scale(1.08);
}

.icon-btn:active {
  transform: scale(0.94);
}

/* AUTH OVERLAY */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
}

.auth-card {
  background: var(--bg-sidebar);
  width: 100%;
  max-width: 440px;
  border-radius: 18px;
  padding: 32px 28px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08);
  animation: fadeIn 0.3s ease;
}

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

.logo-icon {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, var(--accent-color), #2094fa);
  color: #fff;
  font-size: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  box-shadow: 0 6px 20px rgba(51, 144, 236, 0.5);
  transition: all 0.3s ease;
}

.logo-ninja-wrap {
  width: 80px;
  height: 80px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px auto;
  background: transparent;
  transition: transform 0.3s ease;
}

.ninja-auth-logo {
  width: 76px;
  height: 76px;
  object-fit: contain;
  filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.7));
  transition: all 0.3s ease;
}

.logo-ninja-wrap:hover .ninja-auth-logo {
  transform: scale(1.1) rotate(-3deg);
  filter: drop-shadow(0 6px 20px rgba(0, 229, 255, 0.5));
}

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

.auth-tabs {
  display: flex;
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 20px;
}

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

.tab-btn.active {
  background: var(--bg-sidebar);
  color: var(--text-main);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* FORMS */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.form-group input,
.form-group textarea,
.form-select {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-select:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 12px var(--accent-glow);
}

.input-with-prefix {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  overflow: hidden;
  transition: all 0.2s;
}

.input-with-prefix:focus-within {
  border-color: var(--accent-color);
  box-shadow: 0 0 12px var(--accent-glow);
}

.input-with-prefix .prefix {
  padding-left: 12px;
  color: var(--text-muted);
  font-weight: 700;
}

.input-with-prefix input {
  border: none;
  background: transparent;
}

.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-input-wrapper input {
  padding-right: 42px;
}

.toggle-password-btn {
  position: absolute;
  right: 6px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.toggle-password-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
}

.badge-hint {
  font-size: 11px;
  color: var(--accent-color);
  font-weight: normal;
  margin-left: 4px;
}

.form-hint {
  font-size: 11.5px;
  color: var(--text-muted);
}

.alert-box {
  display: none;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.4;
  margin-top: 8px;
}

.alert-box.show { display: block; }
.alert-box.error { background: rgba(239, 68, 68, 0.15); border: 1px solid var(--danger); color: #fca5a5; }
.alert-box.success { background: rgba(16, 185, 129, 0.15); border: 1px solid var(--success); color: #86efac; }

.auth-footer-docs {
  margin-top: 24px;
  text-align: center;
  border-top: 1px solid var(--border-color);
  padding-top: 18px;
}

.btn-github-docs {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent-color);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
}

.btn-github-docs:hover {
  color: #fff;
  text-shadow: 0 0 10px var(--accent-glow);
}

/* BRAND SIGNATURE */
.brand-signature {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  padding: 10px 0;
  letter-spacing: 1px;
  font-weight: 700;
  opacity: 0.75;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.brand-signature:hover {
  opacity: 1;
  color: var(--accent-color);
  text-shadow: 0 0 10px var(--accent-glow, rgba(82, 136, 193, 0.4));
  transform: translateY(-1px);
}

/* MAIN LAYOUT */
.main-layout {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* SIDEBAR */
.sidebar {
  width: 360px;
  background: linear-gradient(180deg, #180a2b 0%, #130c22 35%, #0f131c 70%, #0a0e16 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  position: relative;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(23, 11, 40, 0.4);
  backdrop-filter: blur(8px);
}

.search-bar {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border-radius: 20px;
  padding: 0 12px;
  gap: 8px;
  height: 38px;
  border: 1px solid transparent;
  transition: all 0.2s;
}

.search-bar:focus-within {
  border-color: var(--accent-color);
  box-shadow: 0 0 10px var(--accent-glow);
}

.search-bar i {
  color: var(--text-muted);
  font-size: 13px;
}

.search-bar input {
  background: transparent;
  border: none;
  color: var(--text-main);
  outline: none;
  font-size: 13.5px;
  width: 100%;
}

.clear-search-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
}

/* MAIN MENU DROPDOWN */
.main-menu-dropdown {
  position: absolute;
  top: 60px;
  left: 12px;
  width: 270px;
  background: var(--bg-sidebar);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  z-index: 1000;
  padding: 8px;
  animation: fadeIn 0.2s ease;
}

.menu-user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
}

.menu-user-profile:hover {
  background: rgba(255, 255, 255, 0.06);
}

.menu-user-info .user-fullname {
  font-weight: 700;
  font-size: 14px;
}

.menu-user-info .user-handle {
  font-size: 12px;
  color: var(--accent-color);
}

.menu-divider {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 6px 0;
}

.menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: var(--text-main);
  font-size: 13.5px;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}

.menu-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.menu-item i {
  width: 18px;
  text-align: center;
  font-size: 15px;
}

.menu-item.text-danger { color: var(--danger); }
.menu-item.text-danger:hover { background: rgba(239, 68, 68, 0.15); }

/* CHAT FILTER TABS */
.chat-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-sidebar);
}

.chat-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.chat-tab.active {
  color: var(--accent-color);
  border-bottom-color: var(--accent-color);
}

/* CHATS LIST */
.chats-list {
  flex: 1;
  overflow-y: auto;
}

.chat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  transition: all 0.15s;
  border-bottom: 1px solid rgba(255, 255, 255, 0.22) !important;
}

.chat-item:last-child {
  border-bottom: none !important;
}

.chat-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.chat-item.active {
  background: var(--bg-active);
}

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

.chat-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3px;
}

.chat-item-name {
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-item-time {
  font-size: 11.5px;
  color: var(--text-muted);
}

.chat-item-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-item-preview {
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 210px;
}

.unread-badge {
  background: var(--accent-color);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 12px;
}

/* FAB BUTTONS */
.fab-wrapper {
  position: absolute;
  bottom: 24px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 100;
}

.fab-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.fab-btn:hover {
  transform: translateY(-3px) scale(1.06);
  box-shadow: 0 0 22px rgba(59, 130, 246, 0.8), 0 8px 20px rgba(0, 0, 0, 0.4);
}

.fab-btn.fab-secondary {
  width: 44px;
  height: 44px;
  font-size: 16px;
  background: linear-gradient(135deg, #10b981, #047857);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.5);
}

.fab-btn.fab-secondary:hover {
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.8);
}

/* ----------------------------------------------------
   AVATARS: PURE BLACK BACKGROUND (#000000)
---------------------------------------------------- */
.avatar {
  border-radius: 50%;
  background: #000000 !important;
  color: #ffffff !important;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
  border: 1px solid rgba(255, 255, 255, 0.15);
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.avatar-xs { width: 24px; height: 24px; font-size: 10px; }
.avatar-sm { width: 38px; height: 38px; font-size: 13.5px; }
.avatar-md { width: 46px; height: 46px; font-size: 16px; }
.avatar-lg { width: 72px; height: 72px; font-size: 24px; }

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
  background: #000000;
}

.avatar-edit-wrapper {
  position: relative;
  display: inline-block;
}

.avatar-edit-btn {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-color);
  color: #fff;
  border: 2px solid var(--bg-sidebar);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  transition: transform 0.2s, background 0.2s;
}

.avatar-edit-btn:hover {
  background: var(--accent-hover);
  transform: scale(1.15);
  box-shadow: 0 0 10px var(--accent-glow);
}

.profile-avatar-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

/* ----------------------------------------------------
   CHAT VIEW
---------------------------------------------------- */
.chat-view {
  flex: 1;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  position: relative;
}

.empty-chat-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}

.empty-icon {
  font-size: 54px;
  color: var(--text-muted);
  margin-bottom: 16px;
  opacity: 0.6;
}

.empty-chat-state h3 {
  font-size: 20px;
  margin-bottom: 8px;
}

.empty-chat-state p {
  color: var(--text-muted);
  font-size: 13.5px;
  max-width: 420px;
  margin-bottom: 22px;
  line-height: 1.5;
}

.active-chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-primary);
  transition: background 0.3s ease;
}

/* Atmospheric Subtle Dark Gradients per Chat/Group */
.active-chat-container.chat-theme-0 { background: linear-gradient(165deg, #1d0e2e 0%, #131221 40%, #0e141d 100%); }
.active-chat-container.chat-theme-1 { background: linear-gradient(165deg, #091f2b 0%, #0e1924 40%, #0e141d 100%); }
.active-chat-container.chat-theme-2 { background: linear-gradient(165deg, #08261e 0%, #0d1e1a 40%, #0e141d 100%); }
.active-chat-container.chat-theme-3 { background: linear-gradient(165deg, #2b1708 0%, #1f1611 40%, #0e141d 100%); }
.active-chat-container.chat-theme-4 { background: linear-gradient(165deg, #2a091e 0%, #1e0e18 40%, #0e141d 100%); }
.active-chat-container.chat-theme-5 { background: linear-gradient(165deg, #0b1a30 0%, #0e1724 40%, #0e141d 100%); }
.active-chat-container.chat-theme-6 { background: linear-gradient(165deg, #210d29 0%, #171120 40%, #0e141d 100%); }
.active-chat-container.chat-theme-7 { background: linear-gradient(165deg, #182310 0%, #131c12 40%, #0e141d 100%); }

.chat-header {
  padding: 10px 18px;
  background: rgba(20, 26, 38, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 10;
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  flex: 1;
  min-width: 0;
}

.chat-titles .chat-title-text {
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-titles .chat-subtitle-text {
  font-size: 12px;
  color: var(--text-muted);
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mobile-back-btn {
  display: none;
}

/* PINNED BAR */
.pinned-bar {
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-color);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.pinned-content {
  flex: 1;
  cursor: pointer;
}

.pinned-label {
  font-size: 11px;
  color: var(--accent-color);
  font-weight: 700;
}

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

/* MESSAGES CONTAINER */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
}

.messages-scroll {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.msg-row {
  display: flex;
  flex-direction: column;
  max-width: 70%;
  position: relative;
}

.msg-row.out {
  align-self: flex-end;
}

.msg-row.in {
  align-self: flex-start;
}

.msg-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  position: relative;
  word-break: break-word;
  transition: all 0.2s ease;
}

.msg-row.out .msg-bubble {
  background: linear-gradient(135deg, #1b3858 0%, #254d77 100%);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  border: 1.5px solid rgba(56, 189, 248, 0.55);
  box-shadow: 0 0 14px rgba(14, 165, 233, 0.35), 0 3px 8px rgba(0, 0, 0, 0.25);
}

.msg-row.in .msg-bubble {
  background: #141e2c;
  color: #f1f5f9;
  border-bottom-left-radius: 4px;
  border: 1.5px solid rgba(56, 189, 248, 0.35);
  box-shadow: 0 0 12px rgba(14, 165, 233, 0.2), 0 3px 8px rgba(0, 0, 0, 0.2);
}

.msg-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 4px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
}

.msg-edited-badge {
  font-size: 10px;
  opacity: 0.75;
  margin-right: 4px;
  font-style: italic;
}

/* MESSAGE ACTION BAR (Hover / Actions) */
/* MESSAGE ACTION BAR (2X BIGGER HOVER EMOJIS) */
.msg-action-bar {
  position: absolute;
  top: -24px;
  display: none;
  align-items: center;
  gap: 4px;
  background: rgba(18, 24, 38, 0.96);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 24px;
  padding: 3px 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 16px rgba(0, 229, 255, 0.15);
  z-index: 10;
}

.msg-row.out .msg-action-bar { right: 8px; }
.msg-row.in .msg-action-bar { left: 8px; }

.msg-row:hover .msg-action-bar {
  display: flex;
}

.msg-act-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

.msg-act-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.16);
  transform: scale(1.2);
}

/* 2X LARGER REACTION EMOJIS ON MESSAGE HOVER */
.msg-act-btn.msg-act-emoji {
  font-size: 24px; /* 2x size from original 12px */
  width: 36px;
  height: 36px;
  line-height: 1;
}

.msg-act-btn.msg-act-emoji:hover {
  transform: scale(1.35) translateY(-2px);
  background: rgba(255, 255, 255, 0.22);
  box-shadow: 0 4px 14px rgba(255, 255, 255, 0.35);
}

.msg-act-btn.delete:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.2);
}

.msg-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.reaction-tag {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 3px 10px;
  border-radius: 14px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.reaction-tag:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
  border-color: #00e5ff;
}

.msg-media-img {
  max-width: 100%;
  max-height: 340px;
  border-radius: 12px;
  cursor: pointer;
  display: block;
}

/* GIF MEDIA MESSAGE IN CHAT */
.msg-gif-wrapper {
  position: relative;
  display: inline-block;
  max-width: 100%;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.msg-media-gif {
  max-width: 100%;
  max-height: 320px;
  min-height: 140px;
  object-fit: cover;
  border-radius: 14px;
  cursor: pointer;
  display: block;
  transition: transform 0.25s ease;
}

.msg-media-gif:hover {
  transform: scale(1.02);
}

.gif-badge {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  letter-spacing: 0.8px;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
}
  border-radius: 10px;
  cursor: pointer;
  display: block;
}

/* ----------------------------------------------------
   FILE ATTACHMENT CARD & OPEN BUTTON
---------------------------------------------------- */
.msg-file-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 10px 14px;
  margin-top: 5px;
  min-width: 250px;
  max-width: 100%;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.msg-file-card:hover {
  background: rgba(0, 0, 0, 0.4);
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
}

.msg-file-badge {
  width: 44px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  gap: 2px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}

.msg-file-badge i {
  font-size: 20px;
}

.msg-file-ext-tag {
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.msg-file-details {
  flex: 1;
  min-width: 0;
}

.msg-file-title {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}

.msg-file-meta-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.msg-file-size-badge {
  font-size: 11.5px;
  color: var(--text-muted);
}

.btn-file-open {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #ffffff !important;
  font-size: 12px;
  font-weight: 700;
  border-radius: 9px;
  text-decoration: none;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-file-open:hover {
  background: linear-gradient(135deg, #60a5fa, #2563eb);
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.75), 0 4px 12px rgba(0, 0, 0, 0.4);
  transform: translateY(-1.5px);
}

.btn-file-open:active {
  transform: translateY(1px) scale(0.97);
}

.msg-reply-box {
  background: rgba(0, 0, 0, 0.2);
  border-left: 3px solid var(--accent-color);
  padding: 4px 8px;
  border-radius: 4px;
  margin-bottom: 6px;
  cursor: pointer;
  font-size: 12px;
}

.msg-reply-sender {
  font-weight: 700;
  color: var(--accent-color);
}

.msg-reply-snippet {
  color: rgba(255, 255, 255, 0.8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* REPLY / EDIT PREVIEW BAR */
.reply-preview-bar {
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border-color);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.reply-preview-content {
  flex: 1;
}

.reply-to-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-color);
}

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

/* UPLOAD PROGRESS BAR */
.upload-progress-bar {
  position: relative;
  background: var(--bg-sidebar);
  border: 1px solid var(--accent-color);
  border-radius: 10px;
  padding: 8px 14px;
  margin: 0 16px 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
  box-shadow: 0 0 14px rgba(82, 136, 193, 0.35);
}

.upload-progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 0%;
  background: linear-gradient(90deg, rgba(82, 136, 193, 0.45), rgba(16, 185, 129, 0.6));
  transition: width 0.15s ease;
  z-index: 1;
}

.upload-progress-text {
  position: relative;
  z-index: 2;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.upload-cancel-btn {
  position: relative;
  z-index: 2;
  font-size: 13px;
}

/* CHAT INPUT AREA */
.chat-input-area {
  padding: 12px 18px;
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: flex-end;
  gap: 10px;
  position: relative;
}

.input-wrapper {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  transition: all 0.2s;
}

.input-wrapper:focus-within {
  border-color: var(--accent-color);
  box-shadow: 0 0 12px var(--accent-glow);
}

.input-wrapper textarea {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-family: inherit;
  font-size: 14px;
  resize: none;
  max-height: 140px;
  line-height: 1.4;
}

.send-btn {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8) !important;
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.send-btn:hover {
  box-shadow: 0 0 18px rgba(59, 130, 246, 0.8);
  transform: scale(1.08);
}

/* EMOJI PICKER POPUP (SCROLLBAR-FREE 5x5 GRID) */
.emoji-picker-popup {
  position: absolute;
  bottom: 64px;
  left: 20px;
  background: rgba(22, 28, 42, 0.98);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 10px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.75);
  z-index: 100;
  width: 250px;
  box-sizing: border-box;
  overflow: hidden; /* Strict no scroll */
}

.emoji-tabs {
  display: flex;
  justify-content: space-around;
  gap: 2px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 6px;
}

.emoji-category {
  cursor: pointer;
  font-size: 20px;
  padding: 4px 6px;
  border-radius: 8px;
  transition: all 0.15s ease;
  user-select: none;
  line-height: 1;
}

.emoji-category:hover, .emoji-category.active {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.1);
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 3px;
  overflow: hidden; /* Strict no scroll */
  box-sizing: border-box;
  width: 100%;
}

.emoji-grid span {
  font-size: 22px;
  cursor: pointer;
  text-align: center;
  height: 38px;
  line-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: transform 0.15s ease, background 0.15s ease;
  user-select: none;
}

.emoji-grid span:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.2);
}

/* ----------------------------------------------------
   GIF & TELEGRAM PREMIUM ANIMATED STICKERS (/gif)
---------------------------------------------------- */
.gif-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.5px;
  color: #38bdf8;
  padding: 0 6px;
  transition: all 0.2s ease;
}

.gif-btn:hover, .gif-btn.active {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  color: #fff;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.5);
  transform: scale(1.08);
}

.gif-picker-popup {
  position: absolute;
  bottom: 64px;
  left: 20px;
  background: rgba(18, 24, 38, 0.98);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 18px;
  padding: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8), 0 0 20px rgba(56, 189, 248, 0.2);
  z-index: 105;
  width: 380px;
  max-width: calc(100vw - 40px);
  box-sizing: border-box;
}

.gif-picker-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.gif-search-box {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 6px 10px;
  color: #fff;
}

.gif-search-box i {
  color: #38bdf8;
  font-size: 13px;
}

.gif-search-box input {
  flex: 1;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 13px;
  outline: none;
}

.gif-search-box input::placeholder {
  color: var(--text-muted);
}

.gif-clear-btn, .gif-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.gif-clear-btn:hover, .gif-close-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.gif-categories-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 10px;
  scrollbar-width: none;
}

.gif-categories-chips::-webkit-scrollbar {
  display: none;
}

.gif-chip {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  user-select: none;
}

.gif-chip:hover, .gif-chip.active {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #fff;
  border-color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

.gif-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
}

.gif-grid::-webkit-scrollbar {
  width: 5px;
}
.gif-grid::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.gif-grid-item {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  height: 120px;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.gif-grid-item:hover {
  transform: scale(1.04);
  border-color: #38bdf8;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6), 0 0 12px rgba(56, 189, 248, 0.4);
  z-index: 2;
}

.gif-grid-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gif-empty-notice {
  grid-column: 1 / -1;
  text-align: center;
  padding: 30px 10px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ----------------------------------------------------
   ATTACHMENT MENU (3D BUTTONS & GLOWING NEON HOVER)
---------------------------------------------------- */
.attachment-menu {
  position: absolute;
  bottom: 66px;
  left: 18px;
  background: rgba(20, 26, 40, 0.95);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 8px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.7), 0 0 20px rgba(56, 189, 248, 0.2);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 240px;
  animation: fadeIn 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

.attach-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 15px;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: left;
  position: relative;
  overflow: hidden;
}

.attach-item i {
  font-size: 17px;
  width: 24px;
  text-align: center;
  transition: transform 0.2s ease;
}

.attach-item:first-child {
  border-color: rgba(56, 189, 248, 0.35);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.attach-item:first-child i {
  color: #38bdf8;
}

.attach-item:first-child:hover {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  border-color: #38bdf8;
  color: #ffffff;
  box-shadow: 0 0 22px rgba(56, 189, 248, 0.7), 0 6px 18px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  transform: translateY(-2px);
}

.attach-item:last-child {
  border-color: rgba(52, 211, 153, 0.35);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.attach-item:last-child i {
  color: #34d399;
}

.attach-item:last-child:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  border-color: #34d399;
  color: #ffffff;
  box-shadow: 0 0 22px rgba(52, 211, 153, 0.7), 0 6px 18px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  transform: translateY(-2px);
}

.attach-item:hover i {
  transform: scale(1.18);
  color: #ffffff !important;
}

/* ----------------------------------------------------
   5x5 (25 EMOJIS) REACTION POPOVER (NO SCROLLBAR)
---------------------------------------------------- */
.reaction-popover {
  position: fixed;
  background: rgba(18, 22, 34, 0.96);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  padding: 10px 12px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.8), 0 0 24px rgba(82, 136, 193, 0.3);
  z-index: 10000;
  width: 250px;
  animation: fadeIn 0.18s ease-out;
}

.reaction-popover-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  text-align: center;
}

.reaction-grid-25 {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: 6px;
  overflow: hidden;
}

.reaction-grid-25 .emoji-btn-25 {
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  width: 38px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.16s cubic-bezier(0.4, 0, 0.2, 1);
  background: rgba(255, 255, 255, 0.04);
  user-select: none;
}

.reaction-grid-25 .emoji-btn-25:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: scale(1.25);
  box-shadow: 0 0 14px rgba(255, 255, 255, 0.5);
}

.reaction-grid-25 .emoji-btn-25:active {
  transform: scale(0.95);
}

/* ----------------------------------------------------
   FORWARD MODAL (COMPACT VERTICAL & BRIGHT GREEN GLOW)
---------------------------------------------------- */
.forward-recipients-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
}

.forward-recipient-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border: 2px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

.forward-recipient-row:hover {
  background: rgba(255, 255, 255, 0.06);
}

.forward-recipient-row.selected {
  background: rgba(0, 230, 118, 0.12);
  border-color: #00e676 !important;
  box-shadow: 0 0 16px rgba(0, 230, 118, 0.5);
}

.forward-recipient-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.forward-recipient-name {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.forward-recipient-handle {
  font-size: 11.5px;
  color: var(--accent-color);
  margin-top: 1px;
}

.forward-checkbox {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  font-size: 12px;
  transition: all 0.18s;
  flex-shrink: 0;
}

.forward-recipient-row.selected .forward-checkbox {
  background: #00e676;
  border-color: #00e676;
  color: #000000;
  font-weight: 900;
  box-shadow: 0 0 10px #00e676;
}

/* ----------------------------------------------------
   MODALS & CONTACT GRIDS (3 COLUMNS & GREEN GLOW)
---------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
  backdrop-filter: blur(4px);
}

.modal-box {
  background: var(--bg-sidebar);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  width: 100%;
  max-width: 500px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.65);
  animation: fadeIn 0.25s ease;
  overflow: hidden;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-lg { max-width: 860px; }
.modal-xl { max-width: 980px; }

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  overflow-x: hidden;
}

.modal-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
  line-height: 1.4;
}

/* 3-COLUMN USER SELECTOR GRID */
.user-select-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 12px;
  max-height: 460px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px;
}

@media (max-width: 840px) {
  .user-select-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 540px) {
  .user-select-grid {
    grid-template-columns: 1fr;
  }
}

.user-select-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  position: relative;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.user-select-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.22);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

/* BRIGHT GREEN ACTIVE GLOWING OUTLINE */
.user-select-card.selected {
  border-color: #00e676 !important;
  background: rgba(0, 230, 118, 0.12) !important;
  box-shadow: 0 0 16px rgba(0, 230, 118, 0.65), inset 0 0 8px rgba(0, 230, 118, 0.25) !important;
  transform: translateY(-1px) scale(1.02);
}

.user-card-avatar {
  flex-shrink: 0;
}

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

.user-card-name {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.user-card-login {
  font-size: 11.5px;
  color: #10b981;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-card-check {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--border-color);
  background: var(--bg-secondary);
  color: #fff;
  font-size: 11px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.user-select-card.selected .user-card-check {
  background: #00e676;
  border-color: #00e676;
  box-shadow: 0 0 8px rgba(0, 230, 118, 0.8);
}

/* CONTACT CARD FOR "ВСЕ КОНТАКТЫ" */
.user-contact-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  min-width: 0;
}

.user-contact-card:hover {
  border-color: #00e676;
  background: rgba(0, 230, 118, 0.08);
  box-shadow: 0 0 16px rgba(0, 230, 118, 0.45);
  transform: translateY(-2px);
}

.contact-card-avatar {
  flex-shrink: 0;
}

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

.contact-card-name {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-card-login {
  font-size: 11.5px;
  color: #10b981;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-card-btn {
  flex-shrink: 0;
  padding: 5px 10px;
  font-size: 11.5px;
}

/* ----------------------------------------------------
   REPORT / COMPLAINTS SYSTEM STYLES
---------------------------------------------------- */
.report-user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 12px;
  padding: 12px 14px;
}

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

.report-user-name {
  font-weight: 700;
  font-size: 14.5px;
  color: var(--text-main);
}

.report-user-handle {
  font-size: 12px;
  color: #ef4444;
  margin-top: 1px;
}

.report-chat-context {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 3px;
}

.report-reasons-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.report-reason-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border: 2px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.report-reason-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.report-reason-item.selected {
  background: rgba(0, 230, 118, 0.12);
  border-color: #00e676 !important;
  box-shadow: 0 0 16px rgba(0, 230, 118, 0.45);
}

.report-reason-icon {
  font-size: 22px;
  flex-shrink: 0;
}

.report-reason-text {
  flex: 1;
  min-width: 0;
}

.report-reason-title {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text-main);
}

.report-reason-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.report-reason-check {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  font-size: 12px;
  transition: all 0.18s;
  flex-shrink: 0;
}

.report-reason-item.selected .report-reason-check {
  background: #00e676;
  border-color: #00e676;
  color: #000000;
  font-weight: 900;
  box-shadow: 0 0 10px #00e676;
}

.btn-report {
  color: var(--danger) !important;
  border-color: rgba(239, 68, 68, 0.4) !important;
}

.btn-report:hover {
  background: rgba(239, 68, 68, 0.2) !important;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.5) !important;
}

/* ----------------------------------------------------
   SINGLE-ROW COMPACT GROUP INVITE LINK BOX
---------------------------------------------------- */
.invite-link-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px 16px;
  margin: 16px 0;
}

.invite-link-box label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.invite-link-row-compact {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.invite-link-row-compact .invite-link-input {
  flex: 1;
  min-width: 0;
  height: 38px;
  font-size: 13px;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  outline: none;
}

.invite-link-row-compact .btn {
  height: 38px;
  padding: 0 14px;
  white-space: nowrap;
  font-size: 13px;
}

/* ----------------------------------------------------
   ADMIN PANEL (COMPACT 2-ROW USER LIST WITHOUT OVERFLOW)
---------------------------------------------------- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

@media (max-width: 768px) {
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.stat-val {
  font-size: 24px;
  font-weight: 800;
  color: var(--accent-color);
}

.stat-label {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

.admin-section {
  margin-bottom: 24px;
}

.admin-section h4 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--bg-secondary);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table th {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-weight: 700;
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
}

.admin-table td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-primary { background: rgba(59, 130, 246, 0.2); color: #60a5fa; border: 1px solid #3b82f6; }
.badge-success { background: rgba(16, 185, 129, 0.2); color: #34d399; border: 1px solid #10b981; }
.badge-warning { background: rgba(245, 158, 11, 0.2); color: #fbbf24; border: 1px solid #f59e0b; }
.badge-danger { background: rgba(239, 68, 68, 0.2); color: #f87171; border: 1px solid #ef4444; }

/* TOAST NOTIFICATION */
.toast-notification {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: #10b981;
  color: #ffffff;
  padding: 12px 24px;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 28px rgba(16, 185, 129, 0.5);
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastFade 0.3s ease;
  pointer-events: none;
}

@keyframes toastFade {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* UTILITY */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--accent-color); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.mt-2 { margin-top: 8px; }

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

/* ====================================================
   PWA INSTALL & ABOUT APP BUTTONS
   ==================================================== */
.btn-pwa-install {
  width: 100%;
  margin-top: 12px;
  padding: 10px 16px;
  background: linear-gradient(135deg, #7928ca 0%, #a855f7 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(121, 40, 202, 0.35);
}
.btn-pwa-install:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(121, 40, 202, 0.5);
}

.btn-sidebar-pwa {
  margin: 10px 16px;
  padding: 8px 12px;
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}
.btn-sidebar-pwa:hover {
  background: rgba(168, 85, 247, 0.25);
  border-color: rgba(168, 85, 247, 0.5);
  color: #fff;
}

.modal-about-app {
  max-width: 440px !important;
}

.about-logo-wrap img {
  border-radius: 20px;
}

/* ====================================================
   COMPREHENSIVE FULL LIGHT THEME (ДНЕВНАЯ ТЕМА)
   ==================================================== */
body.light-theme {
  --bg-primary: #ffffff;
  --bg-secondary: #f0f2f5;
  --bg-sidebar: #ffffff;
  --bg-input: #f1f5f9;
  --bg-active: #e0f2fe;
  --accent-color: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-glow: rgba(37, 99, 235, 0.4);
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --bubble-in: #ffffff;
  --bubble-out: #e0f2fe;
  --bubble-in-text: #0f172a;
  --bubble-out-text: #075985;
  background: #f0f2f5 !important;
  color: #0f172a !important;
}

body.light-theme .sidebar {
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 45%, #faf5ff 100%) !important;
  border-right: 1px solid #e2e8f0 !important;
  box-shadow: 2px 0 16px rgba(0, 0, 0, 0.04);
}

body.light-theme .sidebar-header {
  background: rgba(248, 250, 252, 0.85) !important;
  backdrop-filter: blur(10px);
  border-bottom: 1px solid #e2e8f0 !important;
}

body.light-theme .search-bar {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

body.light-theme .search-bar input {
  color: #0f172a !important;
}

body.light-theme .search-bar input::placeholder {
  color: #94a3b8 !important;
}

body.light-theme .search-bar i {
  color: #64748b !important;
}

body.light-theme .chat-tabs {
  background: rgba(248, 250, 252, 0.9) !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

body.light-theme .chat-tab {
  color: #64748b !important;
}

body.light-theme .chat-tab.active {
  color: #2563eb !important;
  border-bottom-color: #2563eb !important;
  background: rgba(37, 99, 235, 0.08) !important;
}

body.light-theme .chat-tab:hover {
  color: #0f172a !important;
  background: #f1f5f9 !important;
}

body.light-theme .chat-item {
  border-bottom: 1px solid rgba(0, 0, 0, 0.22) !important;
  color: #0f172a !important;
}

body.light-theme .chat-item:last-child {
  border-bottom: none !important;
}

body.light-theme .user-select-item {
  border-bottom: 1px solid rgba(0, 0, 0, 0.20) !important;
}

body.light-theme .member-item {
  border-bottom: 1px solid rgba(0, 0, 0, 0.20) !important;
}

body.light-theme .user-contact-card {
  border: 1px solid rgba(0, 0, 0, 0.22) !important;
  background: #ffffff !important;
}

body.light-theme .admin-table tbody tr {
  border-bottom: 1px solid rgba(0, 0, 0, 0.18) !important;
}

body.light-theme .chat-item:hover {
  background: rgba(241, 245, 249, 0.8) !important;
}

body.light-theme .chat-item.active {
  background: #e0f2fe !important;
  border-left: 3px solid #2563eb !important;
}

body.light-theme .chat-item-name {
  color: #0f172a !important;
  font-weight: 600;
}

body.light-theme .chat-item-preview {
  color: #64748b !important;
}

body.light-theme .chat-item-time {
  color: #94a3b8 !important;
}

body.light-theme .chat-view {
  background: #f8fafc !important;
}

body.light-theme .active-chat-container,
body.light-theme .chat-messages {
  background: var(--chat-wallpaper-bg, linear-gradient(45deg, #dbeafe 0%, #e0e7ff 35%, #f3e8ff 70%, #fae8ff 100%));
}

body.light-theme .empty-chat-state {
  background: var(--chat-wallpaper-bg, linear-gradient(45deg, #dbeafe 0%, #e0e7ff 35%, #f3e8ff 70%, #fae8ff 100%));
  color: #64748b !important;
}

body.light-theme .chat-header {
  background: rgba(255, 255, 255, 0.92) !important;
  border-bottom: 1px solid #e2e8f0 !important;
  backdrop-filter: blur(12px);
}

body.light-theme .chat-header-info .chat-title-text {
  color: #0f172a !important;
}

body.light-theme .chat-subtitle {
  color: #64748b !important;
}

body.light-theme .msg-row.out .msg-bubble {
  background: linear-gradient(135deg, #e0f2fe 0%, #dbeafe 100%) !important;
  color: #075985 !important;
  border: 1.5px solid rgba(2, 132, 199, 0.65) !important;
  box-shadow: 0 0 12px rgba(2, 132, 199, 0.35), 0 2px 6px rgba(0, 0, 0, 0.05) !important;
}

body.light-theme .msg-row.in .msg-bubble {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1.5px solid rgba(14, 165, 233, 0.5) !important;
  box-shadow: 0 0 10px rgba(14, 165, 233, 0.22), 0 2px 6px rgba(0, 0, 0, 0.04) !important;
}

body.light-theme .msg-meta {
  color: #64748b !important;
}

body.light-theme .pinned-bar {
  background: #e0f2fe !important;
  border-bottom: 1px solid #bae6fd !important;
  color: #0369a1 !important;
}

body.light-theme .pinned-text {
  color: #0f172a !important;
}

body.light-theme .chat-input-area {
  background: #ffffff !important;
  border-top: 1px solid #e2e8f0 !important;
}

body.light-theme .input-wrapper textarea {
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
}

body.light-theme .input-wrapper textarea::placeholder {
  color: #94a3b8 !important;
}

body.light-theme .icon-btn {
  color: #64748b !important;
}

body.light-theme .icon-btn:hover {
  color: #2563eb !important;
  background: #e2e8f0 !important;
}

body.light-theme .main-menu-dropdown {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.12) !important;
}

body.light-theme .menu-user-profile {
  background: #f8fafc !important;
}

body.light-theme .menu-user-info .user-fullname {
  color: #0f172a !important;
}

body.light-theme .menu-user-info .user-handle {
  color: #64748b !important;
}

body.light-theme .menu-item {
  color: #334155 !important;
}

body.light-theme .menu-item:hover {
  background: #f1f5f9 !important;
  color: #0f172a !important;
}

body.light-theme .menu-divider {
  border-color: #e2e8f0 !important;
}

body.light-theme .modal-box {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.15) !important;
  color: #0f172a !important;
}

body.light-theme .modal-header {
  border-bottom: 1px solid #e2e8f0 !important;
  color: #0f172a !important;
}

body.light-theme .modal-header h3 {
  color: #0f172a !important;
}

body.light-theme .auth-card {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.12) !important;
  color: #0f172a !important;
}

body.light-theme .auth-card h2 {
  color: #0f172a !important;
}

body.light-theme .auth-form input {
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
}

body.light-theme .auth-form input:focus {
  background: #ffffff !important;
  border-color: #2563eb !important;
}

body.light-theme .form-group label {
  color: #334155 !important;
}

body.light-theme .form-group input,
body.light-theme .form-group textarea,
body.light-theme .form-group select {
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
}

body.light-theme .brand-signature {
  color: #64748b !important;
}

body.light-theme .brand-signature:hover {
  color: #2563eb !important;
  text-shadow: 0 0 10px rgba(37, 99, 235, 0.3) !important;
}

body.light-theme .btn-sidebar-pwa {
  background: rgba(37, 99, 235, 0.1) !important;
  color: #2563eb !important;
  border-color: rgba(37, 99, 235, 0.3) !important;
}

body.light-theme .btn-sidebar-pwa:hover {
  background: rgba(37, 99, 235, 0.2) !important;
  color: #1d4ed8 !important;
}

body.light-theme .user-card {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
}

body.light-theme .user-card:hover {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
}

body.light-theme .user-card-name {
  color: #0f172a !important;
}

body.light-theme .user-card-handle {
  color: #64748b !important;
}

body.light-theme .context-menu {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15) !important;
}

body.light-theme .context-menu-item {
  color: #334155 !important;
}

body.light-theme .context-menu-item:hover {
  background: #f1f5f9 !important;
  color: #0f172a !important;
}

body.light-theme .reaction-popover {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15) !important;
}

body.light-theme .reaction-popover-title {
  color: #64748b !important;
}

body.light-theme .emoji-picker-popup,
body.light-theme .gif-picker-popup {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.15) !important;
}

body.light-theme .emoji-categories,
body.light-theme .gif-picker-header {
  border-bottom: 1px solid #e2e8f0 !important;
}

body.light-theme .gif-search-box {
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
}

body.light-theme .gif-search-box input {
  color: #0f172a !important;
}

body.light-theme .gif-chip {
  background: #f1f5f9 !important;
  color: #475569 !important;
  border: 1px solid #e2e8f0 !important;
}

body.light-theme .gif-chip.active {
  background: #2563eb !important;
  color: #ffffff !important;
}

body.light-theme .msg-sender-name {
  color: #2563eb !important;
}

body.light-theme .msg-time {
  color: #64748b !important;
}

body.light-theme .invite-link-box {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
}

body.light-theme .about-info-table {
  background: #f1f5f9 !important;
}

/* ====================================================
   TELEGRAM-STYLE CHAT WALLPAPER SELECTOR
   ==================================================== */
.modal-wallpaper-box {
  max-width: 640px !important;
}

.wallpaper-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  max-height: 480px;
  overflow-y: auto;
  padding: 4px;
}

.wallpaper-card {
  height: 140px;
  border-radius: 14px;
  border: 2px solid transparent;
  padding: 10px;
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.22s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.wallpaper-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  border-color: rgba(56, 189, 248, 0.6);
}

.wallpaper-card.active {
  border-color: #38bdf8 !important;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.7) !important;
}

.wallpaper-card-inner {
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}

.wallpaper-mock-msg {
  font-size: 10px;
  padding: 4px 8px;
  border-radius: 8px;
  max-width: 82%;
  font-weight: 500;
}

.wallpaper-mock-msg.out {
  align-self: flex-end;
  background: #2563eb;
  color: #fff;
  border: 1px solid rgba(56, 189, 248, 0.5);
}

.wallpaper-mock-msg.in {
  align-self: flex-start;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

body.light-theme .wallpaper-mock-msg.in {
  background: rgba(255, 255, 255, 0.85);
  color: #0f172a;
  border-color: rgba(0, 0, 0, 0.1);
}

.wallpaper-card-name {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  background: rgba(0, 0, 0, 0.45);
  padding: 3px 6px;
  border-radius: 6px;
  backdrop-filter: blur(4px);
  width: fit-content;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

body.light-theme .wallpaper-card-name {
  color: #0f172a;
  text-shadow: none;
  background: rgba(255, 255, 255, 0.85);
}

.wallpaper-check {
  position: absolute;
  top: 6px;
  right: 6px;
  background: #38bdf8;
  color: #000;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 900;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* ====================================================
   MOBILE RESPONSIVE & SMARTPHONE OPTIMIZATIONS
   ==================================================== */
@media (max-width: 768px) {
  #app {
    height: 100dvh;
    width: 100vw;
    overflow: hidden;
  }

  .sidebar {
    width: 100vw !important;
    max-width: 100% !important;
    height: 100dvh !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .chat-view {
    display: none !important;
    width: 100vw !important;
    max-width: 100% !important;
    height: 100dvh !important;
  }

  /* When a chat is opened on mobile */
  body.mobile-chat-open .sidebar {
    display: none !important;
  }

  body.mobile-chat-open .chat-view {
    display: flex !important;
    width: 100vw !important;
    height: 100dvh !important;
  }

  /* Chat Header on Mobile */
  .chat-header {
    padding: 8px 12px !important;
    height: 60px !important;
    min-height: 60px !important;
  }

  .mobile-back-btn {
    display: inline-flex !important;
    width: 42px !important;
    height: 42px !important;
    font-size: 18px !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
    flex-shrink: 0 !important;
    margin-right: 4px !important;
  }

  .chat-header-info {
    gap: 8px !important;
  }

  .chat-titles .chat-title-text {
    font-size: 16px !important;
  }

  .chat-subtitle {
    font-size: 12px !important;
  }

  /* Chat Items in Sidebar */
  .chat-item {
    padding: 12px 16px !important;
    min-height: 68px !important;
  }

  .chat-item .avatar {
    width: 50px !important;
    height: 50px !important;
    font-size: 18px !important;
  }

  .chat-item-name {
    font-size: 16px !important;
  }

  .chat-item-preview {
    font-size: 14px !important;
  }

  /* Message List & Bubbles on Mobile */
  .chat-messages {
    padding: 12px 10px !important;
  }

  .msg-row {
    margin-bottom: 8px !important;
  }

  .msg-bubble {
    max-width: 86% !important;
    font-size: 15px !important;
    line-height: 1.45 !important;
    padding: 9px 13px !important;
    border-radius: 16px !important;
  }

  /* Chat Input on Mobile */
  .chat-input-area {
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px)) 10px !important;
    min-height: 56px !important;
    gap: 6px !important;
  }

  .input-wrapper textarea {
    font-size: 16px !important; /* Prevents auto-zoom in iOS Safari */
    padding: 10px 14px !important;
    border-radius: 20px !important;
    min-height: 42px !important;
  }

  .chat-input-area .icon-btn {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    font-size: 18px !important;
  }

  /* Modals on Mobile (Bottom Sheet / Full width card) */
  .modal-overlay {
    padding: 10px !important;
    align-items: flex-end !important;
  }

  .modal-box {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 88vh !important;
    border-radius: 20px 20px 0 0 !important;
    margin: 0 !important;
    padding: 20px 16px !important;
  }

  .modal-header h3 {
    font-size: 17px !important;
  }

  .main-menu-dropdown {
    width: 84vw !important;
    max-width: 320px !important;
    top: 56px !important;
    left: 8px !important;
  }

  /* Auth Card on Mobile */
  .auth-overlay {
    padding: 12px !important;
  }

  .auth-card {
    padding: 24px 18px !important;
    border-radius: 18px !important;
  }

  .auth-logo h2 {
    font-size: 24px !important;
  }
}

/* ====================================================
   WEBRTC P2P VOICE & VIDEO CALL UI
   ==================================================== */
.modal-call-box {
  max-width: 440px !important;
  width: 90% !important;
  background: rgba(15, 23, 42, 0.96) !important;
  backdrop-filter: blur(20px) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  border-radius: 24px !important;
  padding: 32px 24px !important;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6) !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

body.light-theme .modal-call-box {
  background: rgba(255, 255, 255, 0.96) !important;
  border-color: rgba(0, 0, 0, 0.12) !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2) !important;
}

.call-user-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.call-avatar {
  width: 88px !important;
  height: 88px !important;
  font-size: 32px !important;
  box-shadow: 0 0 24px rgba(56, 189, 248, 0.4);
  animation: pulseCallAvatar 2s infinite ease-in-out;
}

@keyframes pulseCallAvatar {
  0% { transform: scale(1); box-shadow: 0 0 16px rgba(56, 189, 248, 0.4); }
  50% { transform: scale(1.05); box-shadow: 0 0 32px rgba(56, 189, 248, 0.8); }
  100% { transform: scale(1); box-shadow: 0 0 16px rgba(56, 189, 248, 0.4); }
}

.call-user-name {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}

body.light-theme .call-user-name {
  color: #0f172a;
}

.call-status-text {
  font-size: 14px;
  color: #94a3b8;
}

.call-timer {
  font-size: 15px;
  font-weight: 700;
  color: #38bdf8;
  letter-spacing: 1px;
}

.call-video-container {
  width: 100%;
  height: 260px;
  background: #000;
  border-radius: 16px;
  position: relative;
  overflow: hidden;
}

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

.local-video {
  position: absolute;
  bottom: 12px;
  right: 12px;
  width: 90px;
  height: 120px;
  border-radius: 10px;
  object-fit: cover;
  border: 2px solid #38bdf8;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.call-controls-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
  margin-top: 8px;
}

.call-ctrl-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

body.light-theme .call-ctrl-btn {
  background: rgba(0, 0, 0, 0.08);
  color: #0f172a;
}

.call-ctrl-btn:hover {
  transform: scale(1.1);
}

.call-ctrl-btn.active-off {
  background: #ef4444 !important;
  color: #fff !important;
}

.call-btn-accept {
  background: #22c55e !important;
  color: #fff !important;
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.6);
  animation: pulseAccept 1.5s infinite;
}

@keyframes pulseAccept {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.call-btn-end {
  background: #ef4444 !important;
  color: #fff !important;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.6);
}


/* GitHub Docs Green Button */
.btn-docs-github {
  width: 100%;
  margin-top: 10px;
  padding: 10px 16px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff !important;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
  box-sizing: border-box;
}
.btn-docs-github:hover {
  transform: translateY(-1px);
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
  color: #ffffff !important;
}
