/* ===== MODERN TELEGRAM-LIKE STYLES ===== */

/* ===== GLOBAL RESET & VARIABLES ===== */
:root {
  /* Telegram-like Color Palette */
  --primary-color: #0088cc;
  --primary-hover: #0077b3;
  --primary-light: #e3f2fd;
  --accent-color: #00a884;
  --accent-hover: #009672;
  
  /* Background Colors */
  --bg-color: #ffffff;
  --sidebar-bg: #f8f9fa;
  --chat-bg: #ffffff;
  --surface-color: #ffffff;
  --elevated-bg: #ffffff;
  
  /* Text Colors */
  --text-primary: #1a1a1a;
  --text-secondary: #666666;
  --text-muted: #999999;
  --text-white: #ffffff;
  
  /* Border & Divider Colors */
  --border-color: #e6e6e6;
  --border-light: #f0f0f0;
  --border-focus: #0088cc;
  
  /* State Colors */
  --hover-color: #f5f5f5;
  --active-color: #ebebeb;
  --online-color: #4caf50;
  --away-color: #ff9800;
  --offline-color: #9e9e9e;
  --error-color: #f44336;
  --success-color: #4caf50;
  
  /* Shadows & Effects */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-input: 0 0 0 2px rgba(0, 136, 204, 0.1);
  
  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 18px;
  --radius-full: 50%;
  
  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.3s ease;
  
  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 20px;
  --space-2xl: 24px;
}

/* Dark Theme */
[data-theme="dark"] {
  --bg-color: #0f0f0f;
  --sidebar-bg: #1a1a1a;
  --chat-bg: #0f0f0f;
  --surface-color: #1a1a1a;
  --elevated-bg: #262626;
  --text-primary: #ffffff;
  --text-secondary: #b3b3b3;
  --text-muted: #808080;
  --border-color: #333333;
  --border-light: #2a2a2a;
  --hover-color: #2a2a2a;
  --active-color: #333333;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* ===== BASE STYLES ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
}

.app-container {
  display: flex;
  height: 100vh;
  background: var(--bg-color);
}

/* ===== SIDEBAR STYLES ===== */
.sidebar {
  width: 360px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  transition: var(--transition-normal);
  position: relative;
  z-index: 100;
}

/* Sidebar Header */
.sidebar-header {
  padding: var(--space-lg) var(--space-xl);
  background: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex: 1;
}

.user-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: white;
  overflow: hidden;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}

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

.user-name {
  font-weight: 600;
  font-size: 16px;
  color: white;
  margin-bottom: 2px;
}

.user-status {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.8);
  opacity: 0.9;
}

.header-actions {
  display: flex;
  gap: var(--space-xs);
}

/* Search Container */
.search-container {
  padding: var(--space-lg) var(--space-xl);
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--border-light);
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input {
  width: 100%;
  padding: 12px 16px 12px 44px;
  border-radius: 24px;
  border: 1.5px solid var(--border-color);
  background: var(--surface-color);
  color: var(--text-primary);
  font-size: 15px;
  outline: none;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.search-input:focus {
  border-color: var(--primary-color);
  box-shadow: var(--shadow-input);
  background: var(--surface-color);
}

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

/* Navigation Tabs */
.tabs {
  display: flex;
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--border-light);
  padding: 0 var(--space-xl);
}

.tab-btn {
  flex: 1;
  padding: var(--space-lg) var(--space-md);
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
}

.tab-btn:hover {
  color: var(--text-primary);
  background: var(--hover-color);
}

.tab-btn.active {
  color: var(--primary-color);
  font-weight: 600;
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 3px;
  background: var(--primary-color);
  border-radius: 3px 3px 0 0;
}

.tab-badge {
  background: var(--primary-color);
  color: white;
  border-radius: 10px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 600;
  min-width: 18px;
  text-align: center;
}


.tab-pane {
  display: none;
  height: 100%;
  flex-direction: column;
}

.tab-pane.active {
  display: flex;
}

/* Chat Lists */
.chats-list, .rooms-list, .contacts-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-sm) 0;
}

.chat-item, .room-item, .contact-item {
  display: flex;
  align-items: center;
  padding: var(--space-md) var(--space-xl);
  cursor: pointer;
  transition: var(--transition-fast);
  border-bottom: 1px solid var(--border-light);
  background: var(--sidebar-bg);
  position: relative;
}

.chat-item:hover, .room-item:hover, .contact-item:hover {
  background: var(--hover-color);
}

.chat-item.active, .room-item.active {
  background: var(--primary-light);
  border-left: 3px solid var(--primary-color);
}

.chat-avatar, .room-avatar, .contact-avatar {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);
  background: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-right: var(--space-md);
  flex-shrink: 0;
  overflow: hidden;
  background-size: cover;
  background-position: center;
  color: white;
  box-shadow: var(--shadow-sm);
}

.chat-info, .room-info, .contact-info {
  flex: 1;
  min-width: 0;
}

.chat-name, .room-name, .contact-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-details, .room-details, .contact-details {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-secondary);
}

.chat-last-message {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  margin-right: var(--space-sm);
}

.chat-time {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-muted);
}

.unread-badge {
  background: var(--primary-color);
  color: white;
  border-radius: 10px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.chat-item.active .unread-badge {
  background: var(--primary-color);
  color: white;
}

.online-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--online-color);
  margin-right: 6px;
  box-shadow: 0 0 0 2px var(--sidebar-bg);
}

/* Empty States */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: var(--space-2xl);
  text-align: center;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 64px;
  margin-bottom: var(--space-lg);
  opacity: 0.5;
}

.empty-state h3 {
  margin-bottom: var(--space-md);
  font-weight: 600;
  color: var(--text-primary);
  font-size: 18px;
}

.empty-state p {
  margin-bottom: var(--space-xl);
  font-size: 14px;
  line-height: 1.5;
  max-width: 300px;
}

/* ===== CHAT AREA STYLES ===== */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--chat-bg);
  position: relative;
}

/* Chat Header */
.chat-header {
  padding: var(--space-lg) var(--space-xl);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-color);
  box-shadow: var(--shadow-sm);
  min-height: 72px;
}

.chat-info-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex: 1;
}

.chat-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: white;
  overflow: hidden;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}

.chat-details-header {
  flex: 1;
  min-width: 0;
}

.chat-title {
  font-weight: 600;
  font-size: 16px;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.chat-status {
  font-size: 13px;
  color: var(--text-secondary);
}

.chat-actions {
  display: flex;
  gap: var(--space-xs);
}

/* Back Button */
.back-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
  margin-right: var(--space-sm);
}

.back-btn:hover {
  background: var(--hover-color);
}

/* Mobile Menu Button */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
  margin-right: var(--space-sm);
}

.mobile-menu-btn:hover {
  background: var(--hover-color);
}

/* Messages Container */
.messages-container {
  flex: 1;
  padding: var(--space-xl);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  background: var(--chat-bg);
}

.welcome-message {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.welcome-message i {
  font-size: 80px;
  margin-bottom: var(--space-xl);
  opacity: 0.4;
}

.welcome-message h2 {
  margin-bottom: var(--space-md);
  font-weight: 600;
  color: var(--text-primary);
  font-size: 24px;
}

.welcome-message p {
  margin-bottom: var(--space-xl);
  line-height: 1.6;
  font-size: 16px;
  max-width: 400px;
}

.welcome-actions {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  flex-wrap: wrap;
}

/* Message Bubbles */
.message {
  display: flex;
  margin-bottom: var(--space-sm);
  max-width: 70%;
  animation: messageSlideIn 0.25s ease-out;
}

.message.sent {
  align-self: flex-end;
  margin-left: auto;
}

.message.received {
  align-self: flex-start;
}

.message-content {
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-lg);
  position: relative;
  word-wrap: break-word;
  line-height: 1.4;
  box-shadow: var(--shadow-sm);
}

.message.sent .message-content {
  background: var(--primary-color);
  color: white;
  border-bottom-right-radius: var(--radius-sm);
}

.message.received .message-content {
  background: var(--surface-color);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  border-bottom-left-radius: var(--radius-sm);
}

.message-time {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  margin-top: var(--space-xs);
  text-align: right;
}

.message.received .message-time {
  color: var(--text-muted);
  text-align: left;
}

/* Typing Indicator */
.typing-indicator {
  display: none;
  align-items: center;
  padding: var(--space-md) var(--space-lg);
  margin-bottom: var(--space-sm);
  background: var(--surface-color);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  max-width: 120px;
  box-shadow: var(--shadow-sm);
}

.typing-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--border-color);
  margin-right: var(--space-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  overflow: hidden;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}

.typing-text {
  font-size: 13px;
  color: var(--text-secondary);
  font-style: italic;
}

.typing-dots {
  display: inline-flex;
  margin-left: 4px;
}

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

/* Message Input Area */
.message-input-container {
  display: none;
  align-items: flex-end;
  gap: var(--space-md);
  padding: var(--space-lg) var(--space-xl);
  border-top: 1px solid var(--border-color);
  background: var(--surface-color);
  box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.1);
}

.message-input-actions {
  display: flex;
  gap: var(--space-xs);
  align-self: flex-end;
  margin-bottom: var(--space-md);
}

.message-input-wrapper {
  flex: 1;
  display: flex;
  align-items: flex-end;
  background: var(--surface-color);
  border: 1.5px solid var(--border-color);
  border-radius: 24px;
  padding: var(--space-sm) var(--space-lg);
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.message-input-wrapper:focus-within {
  border-color: var(--primary-color);
  box-shadow: var(--shadow-input);
}

#messageInput {
  flex: 1;
  border: none;
  background: none;
  outline: none;
  color: var(--text-primary);
  font-size: 16px;
  resize: none;
  max-height: 100px;
  min-height: 24px;
  line-height: 1.4;
  font-family: inherit;
  padding: var(--space-xs) 0;
}

#messageInput::placeholder {
  color: var(--text-muted);
}

.send-btn {
  align-self: flex-end;
  margin-bottom: var(--space-md);
  background: var(--primary-color);
  color: white;
  border: none;
  width: 46px;
  height: 46px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-md);
}

.send-btn:hover {
  background: var(--primary-hover);
  transform: scale(1.15);
  box-shadow: var(--shadow-lg);
}

.send-btn:active {
  transform: scale(0.95);
}

/* ===== BUTTON STYLES ===== */
.btn {
  padding: 12px 24px;
  border-radius: var(--radius-md);
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-normal);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  text-decoration: none;
  min-height: 44px;
  font-family: inherit;
  outline: none;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  transition: all 0.3s ease;
  transform: translate(-50%, -50%);
}

.btn:hover::before {
  width: 100%;
  height: 100%;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--primary-color);
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface-color);
  color: var(--text-primary);
  border: 1.5px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: var(--hover-color);
  border-color: var(--text-muted);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-text {
  background: none;
  color: var(--primary-color);
  padding: 10px 16px;
  min-height: auto;
}

.btn-text:hover {
  background: var(--primary-light);
  transform: none;
}

.btn-full {
  width: 100%;
}

/* Icon Buttons */
.icon-btn {
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.icon-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: currentColor;
  opacity: 0.1;
  border-radius: var(--radius-full);
  transition: all 0.3s ease;
  transform: translate(-50%, -50%);
}

.icon-btn:hover::before {
  width: 100%;
  height: 100%;
}

.icon-btn:hover {
  color: var(--primary-color);
  transform: scale(1.05);
}

.header-actions .icon-btn {
  color: white;
}

.header-actions .icon-btn:hover {
  color: white;
  background: rgba(255, 255, 255, 0.15);
  
 
}

.chat-actions .icon-btn {
  color: var(--text-secondary);
  
}

.chat-actions .icon-btn:hover {
  color: var(--primary-color);
  background: var(--hover-color);
  
}

.message-input-actions .icon-btn {
  color: var(--text-muted);
  background: var(--surface-color);
  border: 1.5px solid var(--border-color);
}

.message-input-actions .icon-btn:hover {
  color: var(--primary-color);
  background: var(--hover-color);
  border-color: var(--primary-color);
}

/* ===== MODAL STYLES ===== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  animation: modalFadeIn 0.2s ease-out;
}

.modal-content {
  background: var(--surface-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalSlideUp 0.3s ease-out;
  border: 1px solid var(--border-color);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-xl);
  border-bottom: 1px solid var(--border-light);
  background: var(--elevated-bg);
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-light);
  background: var(--elevated-bg);
}

.modal-tab {
  flex: 1;
  padding: var(--space-lg) var(--space-md);
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
  font-size: 14px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
}

.modal-tab:hover {
  color: var(--text-primary);
  background: var(--hover-color);
}

.modal-tab.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-xl);
}

/* Form Elements */
.form-group {
  margin-bottom: var(--space-xl);
}

.form-group label {
  display: block;
  margin-bottom: var(--space-sm);
  font-weight: 600;
  color: var(--text-primary);
  font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--surface-color);
  color: var(--text-primary);
  font-size: 15px;
  transition: all var(--transition-fast);
  font-family: inherit;
  outline: none;
  box-shadow: var(--shadow-sm);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary-color);
  box-shadow: var(--shadow-input);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.5;
}

/* ===== NOTIFICATION STYLES ===== */
.notification {
  position: fixed;
  top: var(--space-xl);
  right: var(--space-xl);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  color: white;
  font-weight: 500;
  z-index: 10000;
  transform: translateX(400px);
  opacity: 0;
  transition: all 0.3s ease;
  max-width: 320px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.notification.show {
  transform: translateX(0);
  opacity: 1;
}

.notification.success {
  background: var(--success-color);
}

.notification.error {
  background: var(--error-color);
}

.notification.info {
  background: var(--primary-color);
}

.notification.warning {
  background: var(--away-color);
}

/* ===== ANIMATIONS ===== */
@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes typing {
  0%, 80%, 100% { 
    transform: scale(0.8); 
    opacity: 0.5; 
  }
  40% { 
    transform: scale(1); 
    opacity: 1; 
  }
}

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

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ===== SCROLLBAR STYLING ===== */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--sidebar-bg);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ===== MOBILE RESPONSIVE STYLES ===== */
@media (max-width: 768px) {
  .sidebar {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transform: translateX(-100%);
    width: 100%;
    max-width: 400px;
  }
  
  .sidebar.mobile-active {
    transform: translateX(0);
  }
  
  .chat-area.mobile-hidden {
    display: none;
  }
  
  .back-btn {
    display: flex;
  }
  
  .mobile-menu-btn {
    display: flex;
  }
  
      .modal-content {
        margin: 0;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
        max-width: none;
        display: flex;
        flex-direction: column;
    }
    
     .modal-body {
        flex: 1;
        overflow-y: auto;
        padding-bottom: 90px; /* Место для кнопки */
    }
    
  .message {
    max-width: 85%;
  }
  
  .welcome-actions {
    flex-direction: column;
    align-items: center;
  }
  
  .btn-primary,
  .btn-secondary {
    width: 100%;
    max-width: 280px;
  }
  
  /* Mobile Navigation */
  .tabs {
    display: none !important;
  }
  
  .tab-pane {
    display: flex !important;
    height: 100%;
  }
  
  #rooms-tab,
  #contacts-tab {
    display: none !important;
  }
  
  #chats-tab {
    display: flex !important;
    height: calc(100% - 120px);
  }
}

/* Safe area support for modern mobile browsers */
@supports (padding: max(0px)) {
  .mobile-bottom-nav {
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }
  
  .message-input-container {
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }
}

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

.text-center {
  text-align: center;
}

.mt-20 {
  margin-top: 20px;
}

.mb-20 {
  margin-bottom: 20px;
}

.w-full {
  width: 100%;
}

/* ===== FOCUS ACCESSIBILITY ===== */
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* ===== SELECTION STYLES ===== */
::selection {
  background-color: var(--primary-color);
  color: white;
}

/* ===== LOADING STATES ===== */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid var(--border-color);
  border-top: 2px solid var(--primary-color);
  border-radius: var(--radius-full);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ===== HIGH CONTRAST MODE SUPPORT ===== */
@media (prefers-contrast: high) {
  :root {
    --border-color: #000000;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.8);
  }
}

/* ===== REDUCED MOTION SUPPORT ===== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== MISSING ELEMENTS - MODERN STYLES ===== */

/* ===== AVATAR UPLOAD STYLES ===== */
.avatar-upload {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.current-avatar {
    display: flex;
    justify-content: center;
    padding: var(--space-lg);
    background: var(--surface-color);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
}

.current-avatar:hover {
    border-color: var(--primary-color);
    background: var(--hover-color);
}

.avatar-actions {
    display: flex;
    gap: var(--space-sm);
}

.avatar-actions .btn-secondary {
    flex: 1;
    padding: 10px 16px;
    font-size: 13px;
}

/* ===== WALLPAPER UPLOAD STYLES ===== */
.wallpaper-upload {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.current-wallpaper {
    height: 120px;
    background: var(--surface-color);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.current-wallpaper:hover {
    border-color: var(--primary-color);
    background: var(--hover-color);
}

.wallpaper-preview {
    color: var(--text-muted);
    font-size: 14px;
    text-align: center;
    padding: var(--space-md);
}

.wallpaper-actions {
    display: flex;
    gap: var(--space-sm);
}

.wallpaper-actions .btn-secondary {
    flex: 1;
    padding: 10px 16px;
    font-size: 13px;
}

/* ===== THEME SELECTOR STYLES ===== */
.theme-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--space-md);
    margin-top: var(--space-sm);
}

.theme-preview {
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
    background: var(--surface-color);
    position: relative;
    overflow: hidden;
}

.theme-preview::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-color);
    transform: scaleX(0);
    transition: transform var(--transition-fast);
}

.theme-preview:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.theme-preview.active {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.theme-preview.active::before {
    transform: scaleX(1);
}

.theme-colors {
    display: flex;
    justify-content: center;
    gap: var(--space-xs);
    margin-bottom: var(--space-sm);
}

.theme-colors .color {
    width: 20px;
    height: 20px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--surface-color);
    box-shadow: var(--shadow-sm);
}

.theme-preview span {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ===== STATUS SELECTOR STYLES ===== */
.status-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--space-sm);
    margin-top: var(--space-sm);
}

.status-option {
    padding: var(--space-md);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--surface-color);
    position: relative;
    overflow: hidden;
}

.status-option::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-color);
    transform: scaleX(0);
    transition: transform var(--transition-fast);
}

.status-option:hover {
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.status-option.active {
    border-color: var(--primary-color);
    background: var(--primary-light);
    color: var(--primary-color);
}

.status-option.active::before {
    transform: scaleX(1);
}

/* ===== PRIVACY SETTINGS STYLES ===== */
.privacy-settings {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    background: var(--surface-color);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    border: 1.5px solid var(--border-light);
}

.privacy-item {
    display: flex;
    justify-content: between;
    align-items: center;
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--border-light);
}

.privacy-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.privacy-item:first-child {
    padding-top: 0;
}

.privacy-item span {
    flex: 1;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.privacy-item select {
    width: auto;
    min-width: 140px;
    margin-left: var(--space-md);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    cursor: pointer;
    width: 100%;
    padding: var(--space-sm) 0;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--primary-color);
}

.checkbox-label span {
    flex: 1;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

/* ===== SECURITY SETTINGS STYLES ===== */
.security-settings {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    background: var(--surface-color);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    border: 1.5px solid var(--border-light);
}

.security-item {
    display: flex;
    align-items: center;
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--border-light);
}

.security-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.security-item:first-child {
    padding-top: 0;
}

.security-item .checkbox-label {
    padding: 0;
}

/* ===== FILE MESSAGE STYLES ===== */
.file-message {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--surface-color);
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
    max-width: 300px;
}

.file-message:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.file-icon {
    font-size: 24px;
    flex-shrink: 0;
    color: var(--primary-color);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    border-radius: var(--radius-md);
}

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

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

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

.file-download {
    color: var(--primary-color);
    padding: var(--space-sm);
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
    flex-shrink: 0;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--primary-light);
}

.file-download:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.05);
}

/* ===== AUDIO MESSAGE STYLES ===== */
.audio-message {
    padding: var(--space-md) 0;
}

.audio-player {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--surface-color);
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
    max-width: 280px;
}

.audio-player:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.audio-play-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    border: none;
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.audio-play-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
}

.audio-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.audio-waveform {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 20px;
}

.wave-bar {
    width: 3px;
    background: var(--primary-color);
    border-radius: 2px;
    transition: height 0.3s ease;
}

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

/* ===== SELECTED USER INFO STYLES ===== */
.selected-user-info {
    display: none;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--surface-color);
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-md);
    margin-top: var(--space-md);
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== CONNECTION STATUS STYLES ===== */
.connection-status {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-xl);
    font-size: 13px;
    border-top: 1px solid var(--border-light);
    background: var(--surface-color);
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    background-color: var(--online-color);
    position: relative;
}

.status-dot::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: var(--radius-full);
    background: var(--online-color);
    opacity: 0.3;
    animation: pulse 2s infinite;
}

.connection-status.connecting .status-dot {
    background-color: var(--away-color);
}

.connection-status.connecting .status-dot::after {
    background: var(--away-color);
}

.connection-status.error .status-dot {
    background-color: var(--error-color);
}

.connection-status.error .status-dot::after {
    background: var(--error-color);
}

.connection-status.disconnected .status-dot {
    background-color: var(--offline-color);
}

.connection-status.disconnected .status-dot::after {
    background: var(--offline-color);
}

/* ===== PWA BANNER STYLES ===== */
.pwa-banner {
    position: fixed;
    bottom: var(--space-xl);
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 500px;
    background: var(--surface-color);
    color: var(--text-primary);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    box-shadow: var(--shadow-lg);
    z-index: 10000;
    animation: slideUpBanner 0.3s ease-out;
    border: 1.5px solid var(--border-color);
    backdrop-filter: blur(10px);
}

.pwa-banner-content {
    display: flex;
    gap: var(--space-lg);
    align-items: flex-start;
}

.pwa-banner-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.pwa-banner-text {
    flex: 1;
}

.pwa-banner-text h4 {
    margin-bottom: var(--space-sm);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 16px;
}

.pwa-banner-text p {
    margin-bottom: var(--space-md);
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

.pwa-banner-text ul {
    margin-bottom: var(--space-lg);
    padding-left: var(--space-lg);
    color: var(--text-secondary);
    font-size: 13px;
}

.pwa-banner-text li {
    margin-bottom: var(--space-xs);
    line-height: 1.4;
}

.pwa-banner-actions {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.pwa-install-help details {
    border-top: 1px solid var(--border-light);
    padding-top: var(--space-md);
}

.pwa-install-help summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--primary-color);
    font-size: 14px;
    margin-bottom: var(--space-sm);
}

.install-steps {
    padding: var(--space-md);
    background: var(--hover-color);
    border-radius: var(--radius-md);
    font-size: 13px;
}

.install-steps p {
    margin-bottom: var(--space-sm);
    font-weight: 600;
}

.install-steps ol {
    padding-left: var(--space-lg);
    margin-bottom: var(--space-md);
}

.install-steps li {
    margin-bottom: var(--space-xs);
    line-height: 1.4;
}

/* ===== ROOMS HEADER STYLES ===== */
.rooms-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg) var(--space-xl);
    border-bottom: 1px solid var(--border-light);
    background: var(--surface-color);
}

.rooms-header h3 {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 16px;
}

/* ===== CONTACTS HEADER STYLES ===== */
.contacts-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-lg) var(--space-xl);
    border-bottom: 1px solid var(--border-light);
    background: var(--surface-color);
}

.contacts-header .search-box {
    flex: 1;
}

/* ===== MESSAGE SENDER STYLES ===== */
.message-sender {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--primary-color);
}

/* ===== SCROLLBAR CUSTOMIZATION ===== */
.custom-scrollbar::-webkit-scrollbar {
    width: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: var(--sidebar-bg);
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ===== TEXT UTILITIES ===== */
.selectable-text {
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
}

.no-select {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* ===== VISIBILITY UTILITIES ===== */
.visible {
    display: block !important;
}

.invisible {
    visibility: hidden !important;
}

/* ===== OPACITY UTILITIES ===== */
.opacity-0 { opacity: 0; }
.opacity-50 { opacity: 0.5; }
.opacity-100 { opacity: 1; }

/* ===== Z-INDEX UTILITIES ===== */
.z-0 { z-index: 0; }
.z-10 { z-index: 10; }
.z-50 { z-index: 50; }
.z-100 { z-index: 100; }

/* ===== OVERFLOW UTILITIES ===== */
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.overflow-visible { overflow: visible; }

/* ===== CURSOR UTILITIES ===== */
.cursor-pointer { cursor: pointer; }
.cursor-default { cursor: default; }
.cursor-not-allowed { cursor: not-allowed; }

/* ===== POSITION UTILITIES ===== */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }

/* ===== DISPLAY UTILITIES ===== */
.block { display: block; }
.inline-block { display: inline-block; }
.inline { display: inline; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }

/* ===== RESPONSIVE IMPROVEMENTS ===== */
@media (max-width: 768px) {
    .theme-selector {
        grid-template-columns: 1fr;
    }
    
    .status-selector {
        grid-template-columns: 1fr;
    }
    
    .privacy-item {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-md);
    }
    
    .privacy-item select {
        width: 100%;
        margin-left: 0;
    }
    
    .pwa-banner-actions {
        flex-direction: column;
    }
    
    .avatar-actions,
    .wallpaper-actions {
        flex-direction: column;
    }
    
    .file-message {
        max-width: 100%;
    }
    
    .audio-player {
        max-width: 100%;
    }
}

/* ===== DARK THEME ENHANCEMENTS ===== */
[data-theme="dark"] {
    .theme-preview {
        background: var(--elevated-bg);
    }
    
    .status-option {
        background: var(--elevated-bg);
    }
    
    .privacy-settings,
    .security-settings {
        background: var(--elevated-bg);
        border-color: var(--border-color);
    }
    
    .file-message,
    .audio-player {
        background: var(--elevated-bg);
        border-color: var(--border-color);
    }
    
    .pwa-banner {
        background: var(--elevated-bg);
        border-color: var(--border-color);
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .sidebar,
    .message-input-container,
    .notification,
    .pwa-banner {
        display: none !important;
    }
    
    .chat-area {
        width: 100% !important;
    }
    
    .message-content {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }
}

/* ===== ACCESSIBILITY ENHANCEMENTS ===== */
@media (prefers-reduced-motion: reduce) {
    .theme-preview,
    .status-option,
    .file-message,
    .audio-player,
    .pwa-banner {
        transition: none !important;
        animation: none !important;
    }
}

/* ===== HIGH CONTRAST MODE ===== */
@media (prefers-contrast: high) {
    .theme-preview,
    .status-option,
    .file-message,
    .audio-player {
        border-width: 2px;
    }
    
    .pwa-banner {
        border-width: 2px;
    }
}


/* ===== ADDITIONAL MISSING ELEMENTS ===== */

/* ===== MODAL FOOTER STYLES ===== */
.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-md);
    padding: var(--space-xl);
    border-top: 1px solid var(--border-light);
    background: var(--elevated-bg);
}

.modal-footer .btn {
    min-width: 100px;
}

/* ===== TAB CONTENT IN MODALS ===== */


.tab-content.active {
    display: block;
}

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

/* ===== USER SELECT DROPDOWN ===== */
#userSelect {
    padding: 12px 16px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface-color);
    color: var(--text-primary);
    font-size: 15px;
    transition: all var(--transition-fast);
    outline: none;
    width: 100%;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
}

#userSelect:focus {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-input);
}

/* ===== ROOMS HEADER SPECIFIC STYLES ===== */
.rooms-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg) var(--space-xl);
    border-bottom: 1px solid var(--border-light);
    background: var(--surface-color);
}

.rooms-header h3 {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 16px;
    margin: 0;
}

/* ===== CONTACTS HEADER SPECIFIC STYLES ===== */
.contacts-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-lg) var(--space-xl);
    border-bottom: 1px solid var(--border-light);
    background: var(--surface-color);
}

.contacts-header .search-box {
    flex: 1;
    margin: 0;
}

/* ===== MESSAGE ACTIONS (EDIT, REPLY, DELETE) ===== */
.message-actions {
    display: flex;
    gap: var(--space-xs);
    margin-top: var(--space-sm);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.message:hover .message-actions {
    opacity: 1;
}

.message-action {
    background: rgba(0, 0, 0, 0.1);
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    opacity: 0.7;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 4px;
}

.message-action:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.15);
}

.message.sent .message-action {
    background: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.9);
}

.message.sent .message-action:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ===== RECORDING INTERFACE ===== */
.recording-interface {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

.recording-container {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl);
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.recording-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.recording-indicator {
    position: relative;
    width: 60px;
    height: 60px;
}

.recording-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    color: var(--error-color);
    z-index: 2;
}

.pulse-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 2px solid var(--error-color);
    border-radius: var(--radius-full);
    animation: pulse-ring 1.5s ease-in-out infinite;
}

@keyframes pulse-ring {
    0% { transform: scale(0.8); opacity: 1; }
    100% { transform: scale(1.4); opacity: 0; }
}

.recording-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.recording-visualizer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 40px;
    margin-bottom: var(--space-xl);
}

.visualizer-bar {
    width: 4px;
    background: var(--primary-color);
    border-radius: 2px;
    transition: height 0.1s ease;
    animation: visualizerPulse 0.5s ease-in-out infinite alternate;
}

@keyframes visualizerPulse {
    from { height: 10px; }
    to { height: 30px; }
}

.recording-actions {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
}

/* ===== CALL INTERFACE STYLES ===== */
.call-interface {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 10000;
    display: none;
    flex-direction: column;
}

.call-interface.active {
    display: flex;
}

.call-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.call-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: var(--space-lg);
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(10px);
}

.video-container {
    flex: 1;
    position: relative;
    background: #000;
    overflow: hidden;
}

#remoteVideo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

#localVideo {
    position: absolute;
    bottom: 80px;
    right: 20px;
    width: 120px;
    height: 190px;
    border: 2px solid white;
    border-radius: var(--radius-md);
    object-fit: cover;
    background: #000;
    transition: all var(--transition-normal);
}

.call-info {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-lg);
}

.caller-avatar {
    font-size: 60px;
    width: 120px;
    height: 120px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.call-controls {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: var(--space-xl);
    padding: var(--space-xl);
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
}

.call-control-btn {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-full);
    border: 2px solid white;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-normal);
}

.call-control-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.call-control-btn.muted {
    background: rgba(255, 0, 0, 0.3);
    border-color: var(--error-color);
}

.call-control-btn.disabled {
    background: rgba(255, 255, 255, 0.1);
    opacity: 0.6;
}

.btn-end-call {
    background: var(--error-color) !important;
    border-color: var(--error-color) !important;
}

.btn-end-call:hover {
    background: #cc0000 !important;
    transform: scale(1.05);
}

/* ===== INCOMING CALL NOTIFICATION ===== */
.incoming-call-notification {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

.call-alert {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl);
    text-align: center;
    max-width: 90vw;
    width: 400px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    animation: scaleIn 0.3s ease-out;
}

@keyframes scaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.caller-info {
    display: flex;
    align-items: center;
    gap: var(--space-xl);
    margin-bottom: var(--space-2xl);
}

.caller-details {
    text-align: left;
    flex: 1;
}

.caller-name {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: var(--space-xs);
    color: var(--text-primary);
}

.call-type {
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
    font-size: 14px;
}

.call-time {
    color: var(--error-color);
    font-weight: bold;
    font-size: 13px;
}

.call-actions {
    display: flex;
    justify-content: center;
    gap: var(--space-xl);
}

.btn-accept-call, .btn-reject-call {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-full);
    border: none;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-md);
}

.btn-accept-call {
    background: var(--success-color);
    color: white;
}

.btn-reject-call {
    background: var(--error-color);
    color: white;
}

.btn-accept-call:hover, .btn-reject-call:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-lg);
}

/* ===== EMOJI PICKER STYLES ===== */
.emoji-picker {
    position: fixed;
    width: 350px;
    max-height: 400px;
    background: var(--surface-color);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 10000;
    overflow: hidden;
    animation: emojiPickerSlideUp 0.2s ease-out;
}

.emoji-picker-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.emoji-categories {
    display: flex;
    padding: var(--space-md);
    border-bottom: 1px solid var(--border-light);
    background: var(--elevated-bg);
    overflow-x: auto;
    gap: var(--space-xs);
}

.emoji-category-btn {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.emoji-category-btn:hover {
    background: var(--hover-color);
}

.emoji-category-btn.active {
    background: var(--primary-color);
    color: white;
}

.emoji-search-container {
    position: relative;
    padding: var(--space-md);
    border-bottom: 1px solid var(--border-light);
}

.emoji-search {
    width: 100%;
    padding: 10px 16px 10px 40px;
    border: 1.5px solid var(--border-color);
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    background: var(--surface-color);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.emoji-search:focus {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-input);
}

.emoji-search-container .fa-search {
    position: absolute;
    left: 25px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
}

.emoji-grid {
    flex: 1;
    padding: var(--space-md);
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    max-height: 250px;
    overflow-y: auto;
}

.emoji-item {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.emoji-item:hover {
    background: var(--hover-color);
    transform: scale(1.1);
}

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

/* ===== MESSAGE EDITING STYLES ===== */
.message-editing {
    background: var(--primary-light) !important;
    border: 2px solid var(--primary-color) !important;
}

.edit-textarea {
    width: 100%;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    background: var(--surface-color);
    color: var(--text-primary);
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
    font-size: 14px;
    outline: none;
    transition: all var(--transition-fast);
}

.edit-textarea:focus {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-input);
}

.edit-actions {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-md);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
    min-height: 36px;
}

/* ===== REPLY SYSTEM STYLES ===== */
.reply-preview {
    background: var(--hover-color);
    border-left: 3px solid var(--primary-color);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    border-radius: var(--radius-md);
    font-size: 13px;
    position: relative;
}

.reply-preview-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.reply-text {
    flex: 1;
    color: var(--text-secondary);
    font-style: italic;
    line-height: 1.4;
}

.cancel-reply {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    margin-left: var(--space-sm);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.cancel-reply:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

/* ===== SYSTEM MESSAGE STYLES ===== */
.system-message {
    text-align: center;
    margin: var(--space-lg) 0;
    padding: var(--space-md);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    color: white;
    border-radius: var(--radius-lg);
    max-width: 90%;
    margin-left: auto;
    margin-right: auto;
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--shadow-sm);
}

/* ===== SELECTED MEMBERS STYLES ===== */
.selected-members {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-top: var(--space-md);
    min-height: 44px;
    padding: var(--space-sm);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface-color);
    transition: all var(--transition-fast);
}

.selected-members:focus-within {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-input);
}

.member-tag {
    display: flex;
    align-items: center;
    background: var(--primary-color);
    color: white;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 13px;
    animation: slideIn 0.2s ease-out;
    gap: var(--space-xs);
}

.member-tag-remove {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 2px;
    border-radius: var(--radius-full);
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all var(--transition-fast);
}

.member-tag-remove:hover {
    background: rgba(255, 255, 255, 0.2);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== MOBILE BOTTOM NAVIGATION ===== */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface-color);
    border-top: 1.5px solid var(--border-color);
    z-index: 1000;
    padding: var(--space-sm) 0;
    backdrop-filter: blur(10px);
}

.bottom-nav-content {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0 var(--space-md);
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 11px;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    flex: 1;
    max-width: 80px;
}

.nav-btn:hover {
    color: var(--primary-color);
    background: var(--hover-color);
}

.nav-btn.active {
    color: var(--primary-color);
    background: var(--primary-light);
}

.nav-btn i {
    font-size: 20px;
}

/* ===== QUALITY INDICATOR ===== */
.quality-indicator {
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-weight: 500;
}

.quality-indicator.low { 
    background: rgba(76, 175, 80, 0.3); 
}
.quality-indicator.medium { 
    background: rgba(255, 152, 0, 0.3); 
}
.quality-indicator.high { 
    background: rgba(33, 150, 243, 0.3); 
}

/* ===== MINIMIZED CALL STYLES ===== */
.call-interface.minimized {
    width: 300px;
    height: 200px;
    top: auto;
    bottom: 20px;
    right: 20px;
    left: auto;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.call-interface.minimized .call-header,
.call-interface.minimized .call-controls {
    display: none;
}

.call-interface.minimized .video-container {
    height: 100%;
}

.call-interface.minimized #localVideo {
    width: 80px;
    height: 160px;
    bottom: 10px;
    right: 10px;
}

/* ===== LOADING SPINNER ===== */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--primary-color);
    border-radius: var(--radius-full);
    animation: spin 1s linear infinite;
}

/* ===== RESPONSIVE ENHANCEMENTS ===== */
@media (max-width: 480px) {
    .call-controls {
        gap: var(--space-lg);
        padding: var(--space-lg);
    }
    
    .call-control-btn {
        width: 50px;
        height: 50px;
        font-size: 18px;
    }
    
    .emoji-picker {
        width: calc(100vw - 40px);
        max-height: 350px;
    }
    
    .emoji-grid {
        grid-template-columns: repeat(6, 1fr);
    }
    
    .emoji-item {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .mobile-bottom-nav {
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }
}

/* ===== DARK THEME ADJUSTMENTS ===== */
[data-theme="dark"] {
    .emoji-picker {
        background: var(--elevated-bg);
        border-color: var(--border-color);
    }
    
    .emoji-categories {
        background: var(--surface-color);
    }
    
    .call-alert {
        background: var(--elevated-bg);
    }
    
    .recording-container {
        background: var(--elevated-bg);
    }
    
    .incoming-call-notification {
        background: rgba(0, 0, 0, 0.95);
    }
}

/* ===== FIX FOR TAB CONTENT CONFLICT ===== */

/* ОСНОВНЫЕ ВКЛАДКИ САЙДБАРА - НЕ СКРЫВАТЬ */
.sidebar .tab-content {
    display: flex !important;
    flex: 1;
    overflow: hidden;
    flex-direction: column;
}

/* МОДАЛЬНЫЕ ВКЛАДКИ - СКРЫВАТЬ НЕАКТИВНЫЕ */
.modal .tab-content {
    display: none;
}

.modal .tab-content.active {
    display: block;
    animation: fadeIn 0.2s ease-out;
}

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





/* ===== ULTIMATE FIXES WITH HIGH SPECIFICITY ===== */

/* 1. Fix contacts search input with larger radius */
#contactsSearch {
    border-radius: 24px !important;
    border: 1.5px solid var(--border-color) !important;
    padding: 12px 16px 12px 44px !important;
    width: 100% !important;
    background: var(--surface-color) !important;
    color: var(--text-primary) !important;
    font-size: 15px !important;
    outline: none !important;
    transition: all var(--transition-fast) !important;
    box-shadow: var(--shadow-sm) !important;
    font-family: inherit !important;
}

#contactsSearch:focus {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 2px rgba(0, 136, 204, 0.1) !important;
}

/* 2. Fix wallpaper application - ULTRA SPECIFIC */
body .app-container .chat-area[style*="background"],
body .app-container .chat-area {
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-attachment: fixed !important;
}

/* Force wallpaper on any element with background */
[style*="background"] {
    background-size: cover !important;
    background-position: center !important;
}

/* 3. Fix themes - COMPLETE OVERRIDE */
body[data-theme="sunset"] {
    --primary-color: #FF6B6B !important;
    --primary-hover: #ff5252 !important;
    --bg-color: #2D2D2D !important;
    --sidebar-bg: #3D3D3D !important;
    --chat-bg: #2D2D2D !important;
    --text-primary: #FFFFFF !important;
    --text-secondary: #CCCCCC !important;
    --text-muted: #999999 !important;
    --border-color: #4D4D4D !important;
    --hover-color: #4D4D4D !important;
    --message-sent: #FF6B6B !important;
    --message-received: #3D3D3D !important;
    --surface-color: #3D3D3D !important;
    --elevated-bg: #4D4D4D !important;
}

body[data-theme="forest"] {
    --primary-color: #2E8B57 !important;
    --primary-hover: #267349 !important;
    --bg-color: #1A1F1C !important;
    --sidebar-bg: #2D3B2D !important;
    --chat-bg: #1A1F1C !important;
    --text-primary: #E8F4EA !important;
    --text-secondary: #A0B8A0 !important;
    --text-muted: #7A997A !important;
    --border-color: #3D4B3D !important;
    --hover-color: #3D4B3D !important;
    --message-sent: #2E8B57 !important;
    --message-received: #2D3B2D !important;
    --surface-color: #2D3B2D !important;
    --elevated-bg: #3D4B3D !important;
}

body[data-theme="ocean"] {
    --primary-color: #1E90FF !important;
    --primary-hover: #0d8aff !important;
    --bg-color: #0F1A2A !important;
    --sidebar-bg: #1E2B3A !important;
    --chat-bg: #0F1A2A !important;
    --text-primary: #E6F7FF !important;
    --text-secondary: #A0C8FF !important;
    --text-muted: #7AA8FF !important;
    --border-color: #2E3B4A !important;
    --hover-color: #2E3B4A !important;
    --message-sent: #1E90FF !important;
    --message-received: #1E2B3A !important;
    --surface-color: #1E2B3A !important;
    --elevated-bg: #2E3B4A !important;
}

/* Theme preview active state */
.theme-preview.active,
.theme-preview[data-theme].active,
div.theme-preview.active {
    border: 3px solid var(--primary-color) !important;
    background: var(--primary-light) !important;
    transform: scale(1.05) !important;
}

/* 4. Fix status selector - AGGRESSIVE OVERRIDE */
.status-option.active,
.status-option[data-status].active,
div.status-option.active {
    background: var(--primary-color) !important;
    color: white !important;
    border-color: var(--primary-color) !important;
    font-weight: 600 !important;
}

.status-option.active::before {
    transform: scaleX(1) !important;
}

/* 5. Fix chat action buttons - FORCE VISIBILITY */
.chat-actions,
div.chat-actions {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    gap: 8px !important;
}

#videoCallBtn,
#voiceCallBtn,
#chatInfoBtn,
button#videoCallBtn,
button#voiceCallBtn,
button#chatInfoBtn {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    background: transparent !important;
    border: none !important;
    color: var(--text-secondary) !important;
    cursor: pointer !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
    font-size: 18px !important;
}

#videoCallBtn:hover,
#voiceCallBtn:hover,
#chatInfoBtn:hover {
    background: var(--hover-color) !important;
    color: var(--primary-color) !important;
    transform: scale(1.1) !important;
}

/* 6. Fix message input buttons - FORCE VISIBILITY */
.message-input-actions,
div.message-input-actions {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    gap: 8px !important;
}

#emojiBtn,
#voiceMessageBtn,
#attachBtn,
button#emojiBtn,
button#voiceMessageBtn,
button#attachBtn {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    background: var(--surface-color) !important;
    border: 1.5px solid var(--border-color) !important;
    color: var(--text-muted) !important;
    cursor: pointer !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
    font-size: 16px !important;
}

#emojiBtn:hover,
#voiceMessageBtn:hover,
#attachBtn:hover {
    background: var(--hover-color) !important;
    border-color: var(--primary-color) !important;
    color: var(--primary-color) !important;
    transform: scale(1.1) !important;
}

/* 7. Fix notifications position */
.notification {
    position: fixed !important;
    top: 100px !important;
    right: 30px !important;
    transform: translateX(400px) !important;
    z-index: 10000 !important;
}

.notification.show {
    transform: translateX(0) !important;
}

/* ===== NUCLEAR OPTION - DIRECT ELEMENT STYLING ===== */

/* If nothing works, style by element type */
button[title*="звонок"],
button[title*="видео"],
button[title*="call"],
button[title*="video"] {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

button[title*="смайл"],
button[title*="emoji"],
button[title*="attach"],
button[title*="прикрепить"] {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* ===== JAVASCRIPT FALLBACK STYLES ===== */
/* These will apply when JS adds data attributes */
[data-wallpaper-applied="true"] {
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
}

[data-theme-applied="true"] {
    /* Theme will be applied via data attributes */
}

/* ===== DEBUG STYLES - Remove after testing ===== */
/* Force show hidden elements for debugging */
.chat-actions * {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.message-input-actions * {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* ===== MOBILE OVERRIDES ===== */
@media (max-width: 768px) {
    .chat-actions {
        gap: 6px !important;
    }
    
    #videoCallBtn,
    #voiceCallBtn {
        width: 36px !important;
        height: 36px !important;
        font-size: 16px !important;
    }
    
    .notification {
        top: 80px !important;
        right: 20px !important;
        max-width: 280px !important;
    }
}



.message-input-container {
    display: flex !important;
    align-items: flex-end !important;
    gap: 8px !important;
    padding: 8px 12px !important; /* УМЕНЬШИЛ отступы */
    border-top: 1px solid var(--border-color) !important;
    background: var(--surface-color) !important;
    width: 100% !important;
    box-sizing: border-box !important;
    position: fixed !important; /* ФИКСИРУЕМ внизу */
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 100 !important;
    /* Безопасные зоны для iPhone */
    padding-bottom: max(8px, env(safe-area-inset-bottom)) !important;
}

.message-input-wrapper {
    flex: 1 !important;
    display: flex !important;
    align-items: flex-end !important;
    background: var(--surface-color) !important;
    border: 1.5px solid var(--border-color) !important;
    border-radius: 20px !important; /* УМЕНЬШИЛ радиус */
    padding: 6px 12px !important; /* УМЕНЬШИЛ отступы */
    transition: all var(--transition-fast) !important;
    min-width: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
}

#messageInput {
    flex: 1 !important;
    border: none !important;
    background: none !important;
    outline: none !important;
    color: var(--text-primary) !important;
    font-size: 16px !important;
    resize: none !important;
    max-height: 60px !important; /* УМЕНЬШИЛ максимальную высоту */
    min-height: 20px !important;
    line-height: 1.4 !important;
    font-family: inherit !important;
    padding: 4px 0 !important; /* УМЕНЬШИЛ отступы */
    margin: 0 !important;
    min-width: 0 !important;
}

/* Кнопки действий */
.message-input-actions {
    display: flex !important;
    gap: 4px !important; /* УМЕНЬШИЛ расстояние */
    align-self: center !important;
    margin-bottom: 0 !important;
    flex-shrink: 0 !important;
}

#emojiBtn,
#voiceMessageBtn,
#attachBtn {
    width: 36px !important; /* УМЕНЬШИЛ размер */
    height: 36px !important;
    font-size: 16px !important;
}

/* Кнопка отправки */
.send-btn {
    align-self: center !important;
    margin-bottom: 0 !important;
    background: var(--primary-color) !important;
    color: white !important;
    border: none !important;
    width: 38px !important; /* УМЕНЬШИЛ размер */
    height: 38px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all var(--transition-fast) !important;
    flex-shrink: 0 !important;
}

/* ===== MOBILE FIXES ===== */
@media (max-width: 768px) {
    .message-input-container {
        padding: 6px 10px !important; /* ЕЩЕ МЕНЬШЕ отступы */
        gap: 6px !important;
        padding-bottom: max(6px, env(safe-area-inset-bottom)) !important;
    }
    
    .message-input-wrapper {
        padding: 5px 10px !important;
        border-radius: 18px !important;
    }
    
    #messageInput {
        font-size: 16px !important;
        max-height: 50px !important; /* ЕЩЕ МЕНЬШЕ высота */
        padding: 3px 0 !important;
    }
    
    .message-input-actions {
        gap: 3px !important;
    }
    
    #emojiBtn,
    #voiceMessageBtn,
    #attachBtn {
        width: 34px !important;
        height: 34px !important;
        font-size: 15px !important;
    }
    
    .send-btn {
        width: 36px !important;
        height: 36px !important;
        font-size: 15px !important;
    }
    
    /* КРИТИЧЕСКИ ВАЖНО: корректируем контейнер сообщений */
    .messages-container {
        padding-bottom: 70px !important; /* Место для input контейнера */
        max-height: calc(100vh - 70px) !important;
        overflow-y: auto !important;
    }
    
    /* Гарантируем что чат область не перекрывает input */
    .chat-area {
        padding-bottom: 0 !important;
    }
}

/* Для очень маленьких экранов */
@media (max-width: 380px) {
    .message-input-container {
        padding: 5px 8px !important;
        gap: 4px !important;
        padding-bottom: max(5px, env(safe-area-inset-bottom)) !important;
    }
    
    .message-input-wrapper {
        padding: 4px 8px !important;
        border-radius: 16px !important;
    }
    
    #messageInput {
        font-size: 16px !important;
        max-height: 45px !important;
        padding: 2px 0 !important;
    }
    
    .message-input-actions {
        gap: 2px !important;
    }
    
    #emojiBtn,
    #voiceMessageBtn,
    #attachBtn {
        width: 32px !important;
        height: 32px !important;
        font-size: 14px !important;
    }
    
    .send-btn {
        width: 34px !important;
        height: 34px !important;
        font-size: 14px !important;
    }
    
    .messages-container {
        padding-bottom: 60px !important;
        max-height: calc(100vh - 60px) !important;
    }
}



/* Перемещение экранов во время видеозвонка */
/* Стили для перетаскивания и свапа */
.position-top-right {
    top: 20px !important;
    right: 20px !important;
    bottom: auto !important;
    left: auto !important;
}

.position-top-left {
    top: 20px !important;
    left: 20px !important;
    bottom: auto !important;
    right: auto !important;
}

.position-bottom-right {
    bottom: 180px !important;
    right: 20px !important;
    top: auto !important;
    left: auto !important;
}

.position-bottom-left {
    bottom: 80px !important;
    left: 20px !important;
    top: auto !important;
    right: auto !important;
}

.position-center {
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 150px !important;
    height: 112px !important;
}

/* Режим свапа */
#localVideo.swap-mode {
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    border-radius: 0 !important;
    z-index: 20 !important;
}

#remoteVideo.swap-mode {
    width: 120px !important;
    height: 90px !important;
    border: 2px solid white !important;
    border-radius: 8px !important;
    z-index: 15 !important;
}

/* Индикатор перетаскивания */
#localVideo.dragging {
    opacity: 0.8;
    transform: scale(1.05);
    border-color: #25D366 !important;
    cursor: grabbing !important;
}

/* Кнопка свапа */
.swap-btn {
    transition: all 0.3s ease !important;
}

.swap-btn:hover {
    background: rgba(0, 0, 0, 0.8) !important;
    transform: scale(1.1) !important;
}

/* Мобильная адаптация */
@media (max-width: 768px) {
    .swap-btn {
        width: 40px !important;
        height: 40px !important;
        top: 15px !important;
        left: 15px !important;
    }
    
    #localVideo {
        width: 100px !important;
        height: 175px !important;
    }
    
    #localVideo.swap-mode {
        width: 100% !important;
        height: 100% !important;
    }
    
    #remoteVideo.swap-mode {
        width: 100px !important;
        height: 75px !important;
    }
}

/* Стили для разных размеров видео */
.position-full {
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    border-radius: 0 !important;
    top: 0 !important;
    left: 0 !important;
    right: auto !important;
    bottom: auto !important;
    z-index: 25 !important;
    cursor: default !important;
}

/* Анимация изменения размера */
#localVideo {
    transition: all 0.3s ease;
}

/* Для среднего размера */
#localVideo.medium-size {
    width: 240px !important;
    height: 180px !important;
}

/* Для полного экрана в режиме свапа */
#localVideo.swap-mode.position-full,
#remoteVideo.swap-mode {
    width: 120px !important;
    height: 90px !important;
    border: 2px solid white !important;
    border-radius: 12px !important;
    z-index: 15 !important;
}

localVideo {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* эмодзи пикер */
.emoji-picker {
    position: fixed;
    bottom: 76px;
    right: 20px;
    background: white;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 10px;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 5px;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.emoji-btn {
        width: 54px;
        height: 54px;
        font-size: 26px;
    }

.emoji-btn:hover {
    background: #f0f0f0;
}


/* игры и боты */
.games-bots-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.game-bot-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: var(--surface-color);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    gap: 15px;
}

.game-bot-item:hover {
    border-color: var(--primary-color);
    background: var(--hover-color);
    transform: translateY(-2px);
}

.game-icon {
    font-size: 24px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    border-radius: var(--radius-md);
}

.game-info {
    flex: 1;
}

.game-info h4 {
    margin: 0 0 4px 0;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 16px;
}

.game-info p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.game-arrow {
    color: var(--text-muted);
    font-size: 18px;
    font-weight: bold;
}

/* Мобильная адаптация */
@media (max-width: 768px) {
    .game-bot-item {
        padding: 12px;
        gap: 12px;
    }
    
    .game-icon {
        font-size: 20px;
        width: 36px;
        height: 36px;
    }
}


/* Стили для модального окна игр */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.modal-overlay.active {
    display: flex !important;
}

.modal-content {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-xl);
    border-bottom: 1px solid var(--border-light);
    background: var(--elevated-bg);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

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

.close-modal:hover {
    background: var(--hover-color);
    color: var(--text-primary);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-xl);
}

/* Для мобильных */
@media (max-width: 768px) {
    .modal-overlay {
        padding: 10px;
    }
    
    .modal-content {
        max-height: 90vh;
    }
    
    .modal-header {
        padding: var(--space-lg);
    }
    
    .modal-body {
        padding: var(--space-lg);
    }
}



/* Индикатор группы */
.group-indicator {
    font-size: 12px;
    margin-right: 5px;
}

/* Индикатор оффлайн */
.offline-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #ccc;
    margin-right: 5px;
}

/* Индикатор чата в контактах */
.chat-indicator {
    font-size: 10px;
    margin-left: 5px;
    opacity: 0.7;
}



/* WHATSAPP стили */
.contact-actions {
    display: flex;
    gap: 5px;
    margin-top: 5px;
}

.btn-call, .btn-video {
    background: none;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
}

.btn-call:hover, .btn-video:hover {
    background: var(--hover-color);
}

.private-badge {
    font-size: 10px;
    opacity: 0.7;
}

.chat-indicator {
    font-size: 10px;
    margin-left: 5px;
    opacity: 0.7;
}

.offline-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #ccc;
    margin-right: 5px;
}

.group-indicator {
    font-size: 12px;
    margin-right: 5px;
}


/* Стили для управления участниками */
.members-management {
    max-height: 60vh;
    overflow-y: auto;
}

.management-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 15px;
}

.management-tabs .tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
}

.management-tabs .tab-btn.active {
    border-bottom-color: var(--primary-color);
    color: var(--primary-color);
}

.managed-member-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
}

.member-main-info {
    display: flex;
    align-items: center;
    flex: 1;
}

.member-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    background: var(--hover-color);
}

.member-details {
    flex: 1;
}

.member-name {
    font-weight: bold;
    margin-bottom: 5px;
}

.member-meta {
    display: flex;
    gap: 10px;
    font-size: 12px;
    color: var(--text-muted);
}

.member-actions {
    display: flex;
    gap: 5px;
    align-items: center;
}

.role-select {
    padding: 5px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    color: var(--text-color);
}

.you-badge {
    color: var(--primary-color);
    font-size: 12px;
}

.owner-badge {
    background: gold;
    color: black;
    padding: 2px 5px;
    border-radius: 10px;
    font-size: 10px;
    margin-left: 5px;
}

/* Стили для приглашений */
.invite-link-item {
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 10px;
}

.invite-link {
    display: flex;
    gap: 5px;
    margin-bottom: 5px;
}

.invite-input {
    flex: 1;
    padding: 5px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-color);
    color: var(--text-color);
}

.btn-copy-invite, .btn-revoke-invite {
    padding: 5px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.btn-copy-invite {
    background: var(--primary-color);
    color: white;
}

.btn-revoke-invite {
    background: #dc3545;
    color: white;
}

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

.no-invites {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
}

/* Настройки разрешений */
.permissions-settings {
    padding: 15px;
}

.permission-item {
    margin-bottom: 15px;
}

.permission-item label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

/* Стили для управления группами */
.group-management-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 15px;
}

.group-management-tabs .tab-btn {
    flex: 1;
    padding: 10px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
}

.group-management-tabs .tab-btn.active {
    border-bottom-color: var(--primary-color);
    color: var(--primary-color);
}

.members-list {
    max-height: 300px;
    overflow-y: auto;
}

.member-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
}

.member-info {
    display: flex;
    align-items: center;
    flex: 1;
}

.member-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--hover-color);
    margin-right: 10px;
}

.member-details {
    flex: 1;
}

.member-name {
    font-weight: bold;
}

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

.member-status.online {
    color: #4CAF50;
}

.member-actions {
    display: flex;
    align-items: center;
    gap: 5px;
}

.admin-badge {
    color: #FFC107;
}

.you-badge {
    color: var(--primary-color);
    font-size: 12px;
}

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

.invite-link-container,
.invite-user-container {
    display: flex;
    gap: 10px;
}

.invite-link-container input {
    flex: 1;
}





/* отправка файлов и голосовых сообщений */

