/* ==================== ChatEbash Design System ==================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  /* Colors - Dark Premium Palette */
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-tertiary: #1a1a2e;
  --bg-card: rgba(26, 26, 46, 0.6);
  --bg-glass: rgba(255, 255, 255, 0.03);
  --bg-glass-hover: rgba(255, 255, 255, 0.06);

  --accent-primary: #6c5ce7;
  --accent-secondary: #a29bfe;
  --accent-gradient: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 50%, #74b9ff 100%);
  --accent-glow: 0 0 20px rgba(108, 92, 231, 0.3);
  --accent-success: #00cec9;
  --accent-danger: #ff6b6b;
  --accent-warning: #feca57;

  --text-primary: #e8e8f0;
  --text-secondary: #8b8ba3;
  --text-muted: #5a5a72;
  --text-accent: #a29bfe;

  --border-color: rgba(255, 255, 255, 0.06);
  --border-active: rgba(108, 92, 231, 0.3);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 30px rgba(108, 92, 231, 0.15);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 50%;

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);

  --sidebar-width: 340px;
  --header-height: 64px;
}

/* ==================== Reset & Base ==================== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

a {
  color: var(--accent-secondary);
  text-decoration: none;
}

a:hover {
  color: var(--accent-primary);
}

/* ==================== Scrollbar ==================== */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* ==================== Auth Page ==================== */
.auth-page {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  position: relative;
  overflow: hidden;
}

.auth-page::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(108, 92, 231, 0.15) 0%, transparent 70%);
  top: -200px;
  right: -200px;
  animation: float 8s ease-in-out infinite;
}

.auth-page::after {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(116, 185, 255, 0.1) 0%, transparent 70%);
  bottom: -150px;
  left: -150px;
  animation: float 10s ease-in-out infinite reverse;
}

@keyframes float {

  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }

  33% {
    transform: translate(30px, -30px) scale(1.05);
  }

  66% {
    transform: translate(-20px, 20px) scale(0.95);
  }
}

.auth-card {
  width: 420px;
  padding: 48px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  z-index: 1;
  animation: slideUp 0.6s var(--transition-slow);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.auth-logo {
  text-align: center;
  margin-bottom: 36px;
}

.auth-logo h1 {
  font-size: 32px;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.auth-logo p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 8px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.form-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  transition: all var(--transition-fast);
  outline: none;
}

.form-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
  background: var(--bg-glass-hover);
}

.form-input::placeholder {
  color: var(--text-muted);
}

/* Fix select dropdown readability on all browsers */
select.form-input {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}

select.form-input option {
  background: #1a1a2e;
  color: #e8e8f0;
  padding: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.btn-primary {
  width: 100%;
  padding: 16px;
  background: var(--accent-gradient);
  color: #fff;
  font-size: 15px;
  box-shadow: var(--accent-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 30px rgba(108, 92, 231, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-active);
}

.btn-danger {
  background: rgba(255, 107, 107, 0.15);
  color: var(--accent-danger);
  border: 1px solid rgba(255, 107, 107, 0.2);
}

.btn-danger:hover {
  background: rgba(255, 107, 107, 0.25);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-full);
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 18px;
}

.btn-icon:hover {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
  border-color: var(--border-active);
}

.auth-error {
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.2);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: var(--accent-danger);
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
  animation: shake 0.4s ease;
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-8px);
  }

  75% {
    transform: translateX(8px);
  }
}

/* ==================== Chat Layout ==================== */
.chat-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Top Navigation Bar */
.top-navbar {
  width: 100%;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  position: relative;
  z-index: 100;
  flex-shrink: 0;
}

.top-navbar::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(108, 92, 231, 0.4), rgba(162, 155, 254, 0.3), rgba(116, 185, 255, 0.4), transparent);
}

.top-navbar-inner {
  display: flex;
  align-items: center;
  padding: 6px 16px;
  gap: 16px;
}

.top-nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding-right: 12px;
  border-right: 1px solid var(--border-color);
}

.top-nav-logo {
  width: 28px;
  height: 28px;
  border-radius: 6px;
}

.top-nav-title {
  font-size: 15px;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.3px;
}

.top-nav-buttons {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}

.top-nav-buttons::-webkit-scrollbar {
  display: none;
}

.top-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 5px 10px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  position: relative;
}

.top-nav-btn:hover {
  background: var(--bg-glass-hover);
}

.top-nav-btn:active {
  transform: scale(0.95);
}

.top-nav-icon {
  font-size: 16px;
  line-height: 1.2;
}

.top-nav-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  font-family: inherit;
  letter-spacing: 0.01em;
}

.top-nav-btn:hover .top-nav-label {
  color: var(--text-secondary);
}

/* Broadcast Live Button */
.btn-broadcast-live {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(255, 56, 56, 0.15);
  border: 1px solid rgba(255, 56, 56, 0.4);
  border-radius: 20px;
  color: #ff4444;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: auto;
}

.btn-broadcast-live:hover {
  background: rgba(255, 56, 56, 0.25);
  border-color: rgba(255, 56, 56, 0.6);
  box-shadow: 0 0 16px rgba(255, 56, 56, 0.2);
}

.btn-broadcast-live:active {
  transform: scale(0.97);
}

.btn-broadcast-dot {
  width: 8px;
  height: 8px;
  background: #ff4444;
  border-radius: 50%;
  animation: pulseDot 1.5s ease-in-out infinite;
}

@keyframes pulseDot {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.4;
    transform: scale(0.7);
  }
}

/* Active state — when broadcasting */
.btn-broadcast-live.broadcasting {
  background: rgba(0, 206, 76, 0.15);
  border-color: rgba(0, 206, 76, 0.4);
  color: #00ce4c;
}

.btn-broadcast-live.broadcasting:hover {
  background: rgba(0, 206, 76, 0.25);
  border-color: rgba(0, 206, 76, 0.6);
  box-shadow: 0 0 16px rgba(0, 206, 76, 0.2);
}

.btn-broadcast-live.broadcasting .btn-broadcast-dot {
  background: #00ce4c;
}

/* CRM Action Buttons Bar */
.crm-actions-bar {
  display: flex;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  align-items: center;
}

.crm-action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid color-mix(in srgb, var(--btn-color) 40%, transparent);
  background: color-mix(in srgb, var(--btn-color) 12%, transparent);
  border-radius: 16px;
  color: var(--btn-color);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.crm-action-btn:hover {
  background: color-mix(in srgb, var(--btn-color) 22%, transparent);
  border-color: color-mix(in srgb, var(--btn-color) 60%, transparent);
  box-shadow: 0 0 12px color-mix(in srgb, var(--btn-color) 20%, transparent);
  transform: translateY(-1px);
}

.crm-action-btn:active,
.crm-action-btn.clicked {
  transform: scale(0.95);
  background: color-mix(in srgb, var(--btn-color) 30%, transparent);
}

.crm-action-icon {
  font-size: 14px;
}

.crm-action-name {
  font-size: 12px;
}

.crm-action-count {
  background: color-mix(in srgb, var(--btn-color) 25%, transparent);
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 11px;
  min-width: 18px;
  text-align: center;
}

/* App Body (sidebar + main side by side) */
.app-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-slow);
}

.sidebar-search {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-color);
}

.search-input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: all var(--transition-fast);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%235a5a72'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 10px center;
  background-size: 18px;
}

.search-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

.chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.chat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  margin-bottom: 2px;
}

.chat-item:hover {
  background: var(--bg-glass-hover);
}

.chat-item.active {
  background: rgba(108, 92, 231, 0.1);
  border: 1px solid rgba(108, 92, 231, 0.15);
}

.chat-item.pinned {
  background: rgba(108, 92, 231, 0.05);
  border-left: 3px solid var(--accent-primary);
}

.chat-item.pinned:hover {
  background: rgba(108, 92, 231, 0.1);
}

.pin-badge {
  font-size: 11px;
  margin-right: 4px;
  vertical-align: middle;
}

/* Chat context menu (right-click pin/unpin) */
.chat-context-menu {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  min-width: 180px;
  animation: fadeIn 0.15s ease;
}

.chat-context-menu .ctx-item {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.chat-context-menu .ctx-item:hover {
  background: var(--bg-glass-hover);
}

.chat-avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  color: #fff;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.chat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  position: absolute;
  top: 0;
  left: 0;
}

.chat-avatar .online-dot {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 12px;
  height: 12px;
  background: var(--accent-success);
  border-radius: var(--radius-full);
  border: 2px solid var(--bg-secondary);
}

.chat-info {
  flex: 1;
  min-width: 0;
}

.chat-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-preview {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.chat-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.chat-time {
  font-size: 11px;
  color: var(--text-muted);
}

.chat-badge {
  background: var(--accent-primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  min-width: 20px;
  text-align: center;
}

/* Main Chat Area */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  position: relative;
}

.chat-header {
  padding: 12px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: var(--header-height);
  background: var(--bg-secondary);
  backdrop-filter: blur(10px);
}

.chat-header-info {
  flex: 1;
}

.chat-header-name {
  font-weight: 600;
  font-size: 16px;
}

.chat-header-status {
  font-size: 12px;
  color: var(--text-secondary);
}

.chat-header-status.online {
  color: var(--accent-success);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Empty state */
.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.chat-empty-icon {
  font-size: 80px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.chat-empty h3 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.chat-empty p {
  font-size: 14px;
}

/* Messages */
.message {
  display: flex;
  gap: 10px;
  max-width: 70%;
  animation: messageIn 0.3s ease;
}

@keyframes messageIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.own {
  flex-direction: row-reverse;
  align-self: flex-end;
}

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}

.message-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  position: absolute;
  top: 0;
  left: 0;
}

.message-content {
  background: var(--bg-tertiary);
  padding: 10px 14px;
  border-radius: 16px 16px 16px 4px;
  position: relative;
}

.own .message-content {
  background: rgba(108, 92, 231, 0.2);
  border: 1px solid rgba(108, 92, 231, 0.15);
  border-radius: 16px 16px 4px 16px;
}

.message-sender {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-secondary);
  margin-bottom: 2px;
}

.message-sender.admin-tag {
  color: var(--accent-warning);
}

.message-text {
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

.message-text img {
  display: block;
  max-width: 280px;
  max-height: 400px;
  width: auto;
  height: auto;
  border-radius: var(--radius-sm);
  margin-top: 4px;
  object-fit: contain;
  cursor: pointer;
}


.message-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  text-align: right;
}

.message-system {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  padding: 8px;
  align-self: center;
  max-width: 100%;
}

/* Typing indicator */
.typing-indicator {
  padding: 4px 24px;
  font-size: 12px;
  color: var(--accent-secondary);
  min-height: 24px;
  font-style: italic;
}

/* Input Area */
.chat-input-area {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.chat-input-wrapper {
  flex: 1;
  position: relative;
}

.chat-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  resize: none;
  max-height: 120px;
  min-height: 48px;
  transition: border-color var(--transition-fast);
}

.chat-input:focus {
  border-color: var(--accent-primary);
}

.chat-input::placeholder {
  color: var(--text-muted);
}

.btn-send {
  width: 48px;
  height: 48px;
  background: var(--accent-gradient);
  border: none;
  border-radius: var(--radius-full);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-normal);
  box-shadow: var(--accent-glow);
  flex-shrink: 0;
}

.btn-send:hover {
  transform: scale(1.05);
  box-shadow: 0 0 25px rgba(108, 92, 231, 0.4);
}

/* ==================== Modal ==================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
  display: none;
}

.modal-overlay.active {
  display: flex;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 32px;
  width: 480px;
  max-width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease;
}

.modal h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 24px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.modal-close {
  float: right;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-primary);
}

/* User list in modal */
.user-select-list {
  max-height: 300px;
  overflow-y: auto;
  margin: 16px 0;
}

.user-select-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.user-select-item:hover {
  background: var(--bg-glass-hover);
}

.user-select-item.selected {
  background: rgba(108, 92, 231, 0.15);
  border: 1px solid rgba(108, 92, 231, 0.2);
}

.user-select-item input[type="checkbox"] {
  accent-color: var(--accent-primary);
  width: 18px;
  height: 18px;
}

/* ==================== Admin Panel ==================== */
.admin-layout {
  display: flex;
  height: 100vh;
}

.admin-sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

.admin-sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
}

.admin-sidebar-header h2 {
  font-size: 20px;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.admin-sidebar-header p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.admin-nav {
  padding: 12px;
  flex: 1;
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
}

.admin-nav-item:hover {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
}

.admin-nav-item.active {
  background: rgba(108, 92, 231, 0.15);
  color: var(--accent-secondary);
  border: 1px solid rgba(108, 92, 231, 0.15);
}

.admin-nav-item .nav-icon {
  font-size: 20px;
  width: 24px;
  text-align: center;
}

.admin-content {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
}

.admin-section {
  display: none;
}

.admin-section.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

.admin-section h3 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 24px;
}

/* Stats cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all var(--transition-normal);
}

.stat-card:hover {
  border-color: var(--border-active);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

.stat-icon {
  font-size: 32px;
  margin-bottom: 12px;
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Admin Table */
.admin-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 4px;
}

.admin-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.admin-table td {
  padding: 14px 16px;
  background: var(--bg-card);
  font-size: 14px;
}

.admin-table tr td:first-child {
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.admin-table tr td:last-child {
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.admin-table tbody tr {
  transition: all var(--transition-fast);
}

.admin-table tbody tr:hover td {
  background: var(--bg-glass-hover);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-admin {
  background: rgba(254, 202, 87, 0.15);
  color: var(--accent-warning);
}

.badge-user {
  background: rgba(0, 206, 201, 0.15);
  color: var(--accent-success);
}

.badge-online {
  background: rgba(0, 206, 201, 0.15);
  color: var(--accent-success);
}

.badge-offline {
  background: rgba(139, 139, 163, 0.15);
  color: var(--text-secondary);
}

.badge-private {
  background: rgba(108, 92, 231, 0.15);
  color: var(--accent-secondary);
}

.badge-group {
  background: rgba(116, 185, 255, 0.15);
  color: #74b9ff;
}

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

/* ==================== Profile Sidebar ==================== */
.profile-panel {
  position: fixed;
  top: 0;
  right: -360px;
  width: 360px;
  height: 100vh;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  z-index: 100;
  transition: right var(--transition-slow);
  display: flex;
  flex-direction: column;
}

.profile-panel.open {
  right: 0;
}

.profile-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.profile-body {
  padding: 24px;
  flex: 1;
  overflow-y: auto;
}

.profile-avatar-large {
  width: 100px;
  height: 100px;
  border-radius: var(--radius-full);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  font-weight: 700;
  color: #fff;
  margin: 0 auto 20px;
  position: relative;
  overflow: hidden;
}

.profile-avatar-large img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ==================== Toast / Notification ==================== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 14px 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  animation: slideInRight 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 360px;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(50px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.toast.success {
  border-left: 3px solid var(--accent-success);
}

.toast.error {
  border-left: 3px solid var(--accent-danger);
}

.toast.info {
  border-left: 3px solid var(--accent-primary);
}

/* ==================== Profile Customization ==================== */
.color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: transform 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

.color-swatch:hover {
  transform: scale(1.15);
}

.color-swatch.selected {
  border-color: #fff;
  transform: scale(1.1);
}

.frame-swatch {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid var(--border-color);
  transition: transform 0.15s, box-shadow 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.frame-swatch:hover {
  transform: scale(1.15);
}

.frame-swatch.selected {
  box-shadow: 0 0 0 3px #fff;
  transform: scale(1.1);
}

/* Avatar frame rings applied to .message-avatar and .chat-avatar */
.avatar-frame-purple {
  box-shadow: 0 0 0 3px #6c5ce7, 0 0 0 5px #a29bfe;
}

.avatar-frame-gold {
  box-shadow: 0 0 0 3px #f9ca24, 0 0 0 5px #f0932b;
}

.avatar-frame-cyan {
  box-shadow: 0 0 0 3px #00cec9, 0 0 0 5px #48dbfb;
}

.avatar-frame-fire {
  box-shadow: 0 0 0 3px #ff6b6b, 0 0 0 5px #ff9f43;
}

.avatar-frame-rainbow {
  border: 3px solid transparent;
  background-clip: padding-box;
  outline: 3px solid transparent;
  position: relative;
  animation: rainbowBorder 3s linear infinite;
}

@keyframes rainbowBorder {
  0% {
    box-shadow: 0 0 0 3px hsl(0, 100%, 60%);
  }

  17% {
    box-shadow: 0 0 0 3px hsl(60, 100%, 60%);
  }

  33% {
    box-shadow: 0 0 0 3px hsl(120, 100%, 60%);
  }

  50% {
    box-shadow: 0 0 0 3px hsl(180, 100%, 60%);
  }

  67% {
    box-shadow: 0 0 0 3px hsl(240, 100%, 60%);
  }

  83% {
    box-shadow: 0 0 0 3px hsl(300, 100%, 60%);
  }

  100% {
    box-shadow: 0 0 0 3px hsl(360, 100%, 60%);
  }
}

.avatar-frame-neon {
  box-shadow: 0 0 0 3px #00ff87, 0 0 12px rgba(0, 255, 135, 0.5);
}

/* ==================== Desktop: hide mobile-only elements ==================== */
.chat-burger-btn,
.chat-mobile-overlay,
.chat-mobile-menu {
  display: none;
}

/* ==================== Responsive ==================== */

@media (max-width: 768px) {

  /* Auth card full width */
  .auth-card {
    width: calc(100% - 32px);
    margin: 16px;
    padding: 32px 24px;
  }

  /* Top navbar compact on mobile */
  .top-nav-brand {
    display: none;
  }

  .top-navbar-inner {
    padding: 4px 8px;
    gap: 0;
  }

  .top-nav-buttons {
    justify-content: space-around;
  }

  .top-nav-btn {
    padding: 4px 6px;
  }

  .top-nav-icon {
    font-size: 14px;
  }

  .top-nav-label {
    font-size: 9px;
  }

  .btn-broadcast-live {
    padding: 6px 10px;
    font-size: 10px;
    gap: 5px;
  }

  /* App body fills remaining space */
  .app-body {
    position: relative;
  }

  /* Sidebar: full width, shown by default on mobile */
  .sidebar {
    position: fixed;
    left: 0;
    top: 48px;
    width: 100vw !important;
    min-width: 100vw !important;
    height: calc(100dvh - 48px);
    z-index: 10;
    transform: translateX(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  /* When chat is open, slide sidebar off-screen to the left */
  .sidebar.mobile-hidden {
    transform: translateX(-100%);
  }

  /* Main chat: full width, start off-screen to the right */
  .chat-main {
    position: fixed;
    left: 0;
    top: 48px;
    width: 100vw;
    height: calc(100dvh - 48px);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
  }

  /* When chat is open, slide main into view */
  .chat-main.mobile-visible {
    transform: translateX(0);
  }

  /* Broadcasts panel also full width */
  #broadcastsPanel {
    position: fixed !important;
    left: 0;
    top: 0;
    width: 100vw !important;
    height: 100dvh !important;
    z-index: 10;
  }

  /* Back button in chat header */
  #btnMobileBack {
    display: flex !important;
  }

  .btn-icon {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }

  /* Larger touch targets for messages */
  .chat-item {
    padding: 14px 16px;
  }

  /* Input area adjustments */
  .chat-input-area {
    padding: 12px 16px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  /* Feedback panel: full screen on mobile */
  #feedbackPanel {
    position: fixed !important;
    left: 0;
    top: 0;
    width: 100vw !important;
    height: 100dvh !important;
    z-index: 10;
  }

  /* AI panel: full screen on mobile */
  #aiPanel {
    position: fixed !important;
    left: 0;
    top: 0;
    width: 100vw !important;
    height: 100dvh !important;
    z-index: 10;
  }

  /* Tests panel: full screen on mobile */
  #testsPanel {
    position: fixed !important;
    left: 0;
    top: 0;
    width: 100vw !important;
    height: 100dvh !important;
    z-index: 10;
  }

  /* Broadcast notification overlay */
  #broadcastOverlay .bcast-card {
    width: 90vw !important;
    max-width: 90vw !important;
    padding: 20px !important;
  }

  /* CRM Modal */
  .crm-panel-overlay .crm-panel-content {
    width: 95vw !important;
    max-width: 95vw !important;
    height: 90dvh !important;
    border-radius: 12px !important;
  }

  /* Profile modal */
  .profile-overlay .profile-card {
    width: 95vw !important;
    max-width: 95vw !important;
    max-height: 90dvh !important;
  }

  /* Message context menu stays within viewport */
  .msg-context-menu {
    max-width: calc(100vw - 20px);
  }

  /* Search modal */
  .search-results-container {
    max-width: 95vw;
    margin: 10px;
  }

  /* Chat header adjustments */
  .chat-header {
    padding: 10px 12px !important;
  }

  .chat-header-info h3 {
    font-size: 14px !important;
  }

  /* Messages area */
  .message-text {
    font-size: 14px;
  }

  /* Sidebar header */
  .sidebar-header {
    padding: 12px 16px !important;
  }

  /* Fix: no overflow on html/body */
  html,
  body {
    overflow: hidden;
    height: 100dvh;
  }

  /* Hide desktop-only nav buttons on mobile */
  .desktop-nav-btn {
    display: none !important;
  }

  /* Chat burger button */
  .chat-burger-btn {
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: none;
    border: none;
    cursor: pointer;
    width: 28px;
    height: 22px;
    position: relative;
    padding: 0;
    gap: 0;
  }

  .chat-burger-btn span {
    display: block;
    position: absolute;
    width: 100%;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    left: 0;
  }

  .chat-burger-btn span:nth-child(1) {
    top: 0;
  }

  .chat-burger-btn span:nth-child(2) {
    top: 10px;
  }

  .chat-burger-btn span:nth-child(3) {
    top: 20px;
  }

  .chat-burger-btn.open span:nth-child(1) {
    transform: rotate(45deg);
    top: 10px;
  }

  .chat-burger-btn.open span:nth-child(2) {
    opacity: 0;
    transform: translateX(10px);
  }

  .chat-burger-btn.open span:nth-child(3) {
    transform: rotate(-45deg);
    top: 10px;
  }

  /* Chat mobile overlay */
  .chat-mobile-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 250;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }

  .chat-mobile-overlay.open {
    opacity: 1;
    pointer-events: auto;
  }

  /* Chat mobile slide-in menu */
  .chat-mobile-menu {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    max-width: 80vw;
    height: 100dvh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    z-index: 300;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
  }

  .chat-mobile-menu.open {
    transform: translateX(0);
  }
}

/* chat burger desktop-hide rules are above, before @media */

/* ==================== Mobile Burger Menu ==================== */
.mobile-admin-bar {
  display: none;
}

.mobile-menu-overlay {
  display: none;
}

.mobile-menu {
  display: none;
}

@media (max-width: 768px) {

  /* Show burger bar on mobile */
  .mobile-admin-bar {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 48px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 200;
  }

  /* Burger button */
  .burger-btn {
    background: none;
    border: none;
    cursor: pointer;
    width: 28px;
    height: 22px;
    position: relative;
    padding: 0;
  }

  .burger-btn span {
    display: block;
    position: absolute;
    width: 100%;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    left: 0;
  }

  .burger-btn span:nth-child(1) {
    top: 0;
  }

  .burger-btn span:nth-child(2) {
    top: 10px;
  }

  .burger-btn span:nth-child(3) {
    top: 20px;
  }

  .burger-btn.open span:nth-child(1) {
    transform: rotate(45deg);
    top: 10px;
  }

  .burger-btn.open span:nth-child(2) {
    opacity: 0;
    transform: translateX(10px);
  }

  .burger-btn.open span:nth-child(3) {
    transform: rotate(-45deg);
    top: 10px;
  }

  /* Overlay */
  .mobile-menu-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 250;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }

  .mobile-menu-overlay.open {
    opacity: 1;
    pointer-events: auto;
  }

  /* Slide-in menu */
  .mobile-menu {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    max-width: 80vw;
    height: 100dvh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    z-index: 300;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
  }

  .mobile-menu.open {
    transform: translateX(0);
  }

  .mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
  }

  .mobile-menu-items {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
  }

  .mobile-menu-item {
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
    color: var(--text-primary);
  }

  .mobile-menu-item:hover,
  .mobile-menu-item:active {
    background: var(--bg-glass-hover);
  }

  .mobile-menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 8px 14px;
  }

  /* Hide desktop sidebar entirely on mobile */
  .admin-sidebar {
    display: none !important;
  }

  .admin-content {
    margin-top: 48px !important;
    padding: 12px !important;
    height: calc(100dvh - 48px) !important;
    overflow-y: auto !important;
  }

  .admin-section .toolbar {
    flex-direction: column !important;
    gap: 8px !important;
  }

  /* Test modal on mobile */
  #testModal>div {
    width: 95vw !important;
    max-height: 90dvh !important;
    padding: 16px !important;
  }

  /* Dashboard cards smaller on mobile */
  .stat-cards {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  /* Admin grids single column on small screens */
  #adminFeedbackList,
  #adminTestsList {
    grid-template-columns: 1fr !important;
  }
}


/* ==================== Loading ==================== */
.loader {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.loader-dots {
  display: flex;
  gap: 6px;
}

.loader-dots span {
  width: 8px;
  height: 8px;
  background: var(--accent-primary);
  border-radius: var(--radius-full);
  animation: bounce 1.4s ease-in-out infinite;
}

.loader-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.loader-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes bounce {

  0%,
  80%,
  100% {
    transform: scale(0.6);
    opacity: 0.4;
  }

  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Group avatar */
.chat-avatar.group {
  background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
}

/* ==================== Reactions ==================== */
.message-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.reaction-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.reaction-badge:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-active);
  transform: scale(1.1);
}

.reaction-badge.own {
  background: rgba(108, 92, 231, 0.15);
  border-color: rgba(108, 92, 231, 0.3);
}

.reaction-badge .reaction-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.reaction-picker {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px;
  box-shadow: var(--shadow-lg);
  z-index: 50;
  gap: 2px;
  flex-wrap: wrap;
  animation: fadeIn 0.15s ease;
}

.reaction-picker.show {
  display: flex;
}

.reaction-picker span {
  font-size: 22px;
  padding: 4px 6px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.reaction-picker span:hover {
  background: var(--bg-glass-hover);
  transform: scale(1.25);
}

/* ==================== Reply Quote ==================== */
.reply-quote {
  background: rgba(108, 92, 231, 0.08);
  border-left: 3px solid var(--accent-secondary);
  padding: 6px 10px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.reply-quote:hover {
  background: rgba(108, 92, 231, 0.15);
}

.reply-quote .reply-author {
  font-weight: 600;
  color: var(--accent-secondary);
  margin-bottom: 2px;
}

.reply-quote .reply-text {
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
}

/* Reply compose bar */
.reply-compose {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border-color);
  animation: slideUp 0.2s ease;
}

.reply-compose.active {
  display: flex;
}

.reply-compose .reply-preview {
  flex: 1;
  border-left: 3px solid var(--accent-secondary);
  padding-left: 10px;
}

.reply-compose .reply-preview-author {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-secondary);
}

.reply-compose .reply-preview-text {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reply-compose .reply-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
}

.reply-compose .reply-close:hover {
  color: var(--text-primary);
}

/* ==================== Pinned Message Banner ==================== */
.pinned-banner {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  background: linear-gradient(135deg, rgba(108, 92, 231, 0.08), rgba(116, 185, 255, 0.08));
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.pinned-banner.visible {
  display: flex;
}

.pinned-banner:hover {
  background: linear-gradient(135deg, rgba(108, 92, 231, 0.15), rgba(116, 185, 255, 0.15));
}

.pinned-banner .pin-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.pinned-banner .pin-content {
  flex: 1;
  min-width: 0;
}

.pinned-banner .pin-author {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-secondary);
}

.pinned-banner .pin-text {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pinned-banner .pin-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
}

.pinned-banner .pin-close:hover {
  color: var(--accent-danger);
}

/* ==================== Search Modal ==================== */
.search-results-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
  z-index: 1000;
}

.search-results-modal.active {
  display: flex;
}

.search-results-container {
  width: 560px;
  max-width: 90vw;
  max-height: 70vh;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s ease;
}

.search-results-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-results-header input {
  flex: 1;
  padding: 12px 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  outline: none;
}

.search-results-header input:focus {
  border-color: var(--accent-primary);
}

.search-results-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.search-result-item {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
  margin-bottom: 4px;
}

.search-result-item:hover {
  background: var(--bg-glass-hover);
}

.search-result-chat {
  font-size: 11px;
  color: var(--accent-secondary);
  font-weight: 600;
  margin-bottom: 4px;
}

.search-result-text {
  font-size: 14px;
  color: var(--text-primary);
}

.search-result-text mark {
  background: rgba(108, 92, 231, 0.3);
  color: var(--text-primary);
  border-radius: 2px;
  padding: 0 2px;
}

.search-result-meta {
  display: flex;
  gap: 8px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ==================== Message Context Menu ==================== */
.msg-context-menu {
  position: fixed;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 200;
  min-width: 180px;
  animation: fadeIn 0.15s ease;
  backdrop-filter: blur(20px);
}

.msg-context-menu .ctx-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary);
  transition: background var(--transition-fast);
}

.msg-context-menu .ctx-item:hover {
  background: var(--bg-glass-hover);
}

.msg-context-menu .ctx-item.danger {
  color: var(--accent-danger);
}

.msg-context-menu .ctx-item .ctx-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.msg-context-menu .ctx-divider {
  height: 1px;
  background: var(--border-color);
  margin: 4px 0;
}

/* ==================== Delivery Status ==================== */
.delivery-status {
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  font-size: 13px;
  vertical-align: middle;
}

.delivery-status .tick {
  color: var(--text-muted);
}

.delivery-status .tick.delivered {
  color: var(--text-secondary);
}

.delivery-status .tick.read {
  color: var(--accent-success);
}

/* ==================== Edited indicator ==================== */
.message-edited-tag {
  display: inline;
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  margin-left: 4px;
}

/* ==================== Message Highlight ==================== */
.message.highlight {
  animation: highlightMsg 2s ease;
}

@keyframes highlightMsg {

  0%,
  30% {
    background: rgba(108, 92, 231, 0.15);
  }

  100% {
    background: transparent;
  }
}

/* ==================== User Status Badge ==================== */
.user-status-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 2px 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(135deg, #6c5ce7, #a29bfe);
  border-radius: 10px;
  vertical-align: middle;
  line-height: 1.6;
  box-shadow: 0 0 8px rgba(108, 92, 231, 0.3);
  animation: statusGlow 3s ease-in-out infinite;
  white-space: nowrap;
}

@keyframes statusGlow {

  0%,
  100% {
    box-shadow: 0 0 6px rgba(108, 92, 231, 0.25);
  }

  50% {
    box-shadow: 0 0 14px rgba(108, 92, 231, 0.5);
  }
}

/* Status badge in chat header */
.chat-header-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(135deg, #6c5ce7, #a29bfe);
  border-radius: 10px;
  margin-left: 8px;
  box-shadow: 0 0 8px rgba(108, 92, 231, 0.3);
}