/* Chat Themes CSS - Light and Dark Theme Support */

:root {
  /* Primary Colors */
  --primary-color: #007bff;
  --primary-hover: #9fc9f5;
  --primary-rgb: 0, 123, 255;
  
  /* Danger Colors */
  --danger-rgb: 220, 53, 69;
  
  /* Success Colors */
  --success-rgb: 40, 167, 69;
  
  /* Text Secondary Colors */
  --text-secondary-rgb: 108, 117, 125;
  
  /* Background Colors */
  --background-color: #f8f9fa;
  --surface-color: #ffffff;
  --sidebar-background: #ffffff;
  --chat-bg: #f8f9fa;
  
  /* Text Colors */
  --text-primary: #212529;
  --text-secondary: #6c757d;
  --text-muted: #adb5bd;
  --header-text: #ffffff;
  --header-bg: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
  
  /* Border Colors */
  --border-color: #dee2e6;
  --sidebar-border: #dee2e6;
  
  /* State Colors */
  --danger-color: #dc3545;
  --danger-hover: #c82333;
  --success-color: #28a745;
  --warning-color: #ffc107;
  --info-color: #17a2b8;
  
  /* Shadow Colors */
  --shadow-light: rgba(0, 0, 0, 0.1);
  --shadow-medium: rgba(0, 0, 0, 0.15);
  --header-shadow: rgba(0, 123, 255, 0.25);
  
  /* Interactive Elements */
  --button-bg: rgba(0, 123, 255, 0.1);
  --button-border: rgba(0, 123, 255, 0.3);
  --button-text: var(--text-primary);
  --button-hover-bg: var(--primary-color);
  --button-hover-border: var(--primary-color);
  
  /* Chat Specific */
  --user-item-hover: #f8f9fa;
  --user-item-active: #e3f2fd;
  --unread-badge-bg: linear-gradient(135deg, #dc3545, #c82333);
  
  /* Mobile overlay */
  --overlay-bg: rgba(0, 0, 0, 0.4);
}

/* Dark Theme Variables */
[data-theme="dark"] {
  /* Primary Colors */
  --primary-color: #4dabf7;
  --primary-hover: #2762a1;
  --primary-rgb: 77, 171, 247;
  
  /* Danger Colors */
  --danger-rgb: 255, 107, 107;
  
  /* Success Colors */
  --success-rgb: 81, 207, 102;
  
  /* Text Secondary Colors */
  --text-secondary-rgb: 189, 195, 197;
  
  /* Background Colors */
  --background-color: #1a1a1a;
  --surface-color: #2d2d2d;
  --sidebar-background: #2d2d2d;
  --chat-bg: #1a1a1a;
  
  /* Text Colors */
  --text-primary: #ffffff;
  --text-secondary: #bdc3c7;
  --text-muted: #95a5a6;
  --header-text: #ffffff;
  --header-bg: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
  
  /* Border Colors */
  --border-color: #404040;
  --sidebar-border: #404040;
  
  /* State Colors */
  --danger-color: #ff6b6b;
  --danger-hover: #ee5a52;
  --success-color: #51cf66;
  --warning-color: #ffd43b;
  --info-color: #74c0fc;
  
  /* Shadow Colors */
  --shadow-light: rgba(0, 0, 0, 0.3);
  --shadow-medium: rgba(0, 0, 0, 0.5);
  --header-shadow: rgba(0, 0, 0, 0.3);
  
  /* Interactive Elements */
  --button-bg: rgba(255, 255, 255, 0.1);
  --button-border: rgba(255, 255, 255, 0.2);
  --button-text: #ffffff;
  --button-hover-bg: rgba(255, 107, 107, 0.8);
  --button-hover-border: rgba(255, 107, 107, 0.8);
  
  /* Chat Specific */
  --user-item-hover: #3a3a3a;
  --user-item-active: #404040;
  --unread-badge-bg: linear-gradient(135deg, #ff6b6b, #ee5a52);
  
  /* Mobile overlay */
  --overlay-bg: rgba(0, 0, 0, 0.6);
}

/* Base Styles */
.chat-layout {
  height: 100vh;
  display: flex;
  overflow: hidden;
  background-color: var(--background-color);
}

/* Chat Wrapper Styles for Simple Chat */
.container {
  height: 100vh;
  background: var(--background-color);
  color: var(--text-primary);
  margin: 0;
  padding: 0;
  max-width: none;
  position: relative;
  overflow: hidden;
}

.chat-wrapper {
  height: 100vh;
  display: flex;
  flex-direction: column;
  width: 100%;
}

/* Desktop версия - чат по центру с максимальной шириной */
@media (min-width: 768px) {
  .chat-wrapper {
    max-width: 800px;
    margin: 0 auto;
    box-shadow: 0 0 20px var(--shadow-medium);
    border-left: 1px solid var(--sidebar-border);
    border-right: 1px solid var(--sidebar-border);
  }
}

/* Переопределяем Bootstrap container */
@media (min-width: 1200px) {
  .container {
    max-width: none;
  }
}

.chat-sidebar {
  width: 430px;
  min-width: 430px;
  border-right: 1px solid var(--sidebar-border);
  background: var(--sidebar-background);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 2px 0 8px var(--shadow-light);
}

.chat-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--chat-bg);
}

/* Header Styles */
.chat-header,
.simple-chat-header { /* Объединено со стилями .simple-chat-header */
  background: var(--header-bg);
  color: var(--header-text);
  box-shadow: 0 2px 4px var(--header-shadow);
  padding: 1rem; /* Добавлено из .simple-chat-header */
  border-bottom: 1px solid var(--border-color); /* Добавлено из .simple-chat-header */
  flex-shrink: 0; /* Добавлено из .simple-chat-header */
  display: flex; /* Добавлено из .simple-chat-header */
  justify-content: space-between; /* Добавлено из .simple-chat-header */
  align-items: center; /* Добавлено из .simple-chat-header */
}

.header-avatar {
  width: 40px;
  height: 40px;
  font-weight: bold;
  font-size: 1rem;
  background: var(--danger-color);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-user-name {
  color: var(--header-text);
  font-weight: bold;
}

.header-user-status {
  color: var(--text-primary);
}

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

/* Header action buttons */
.header-actions .btn-link {
  color: var(--header-text);
  text-decoration: none;
  border: none;
  background: transparent;
  transition: all 0.2s ease;
}

.header-actions .btn-link:hover {
  color: rgba(255, 255, 255, 0.8);
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

/* Logout Button */
.logout-button {
  background: var(--button-bg);
  border: 1px solid var(--button-border);
  color: var(--button-text);
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 500;
}

.logout-button:hover {
  background: var(--button-hover-bg);
  border-color: var(--button-hover-border);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px var(--shadow-medium);
}

.logout-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px var(--shadow-medium);
}

/* Header Buttons Container - Объединение дубликатов */
.header-buttons-container {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Header Action Button - Base Styles - Объединение дубликатов */
.header-action-btn {
  background: var(--button-bg);
  border: 1px solid var(--button-border);
  color: var(--header-text);
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  flex-shrink: 0;
  white-space: nowrap;
}

.header-action-btn:hover {
  background: var(--primary-color);
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow-medium);
}

.header-action-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px var(--shadow-medium);
}

/* Header Close Button - Special Style - Объединение дубликатов */
.header-close-btn {
  background: var(--danger-color);
  border-color: var(--danger-color);
}

.header-close-btn:hover {
  background: var(--danger-hover);
  border-color: var(--danger-hover);
}

/* Button Text */
.btn-text {
  font-size: 0.8125rem; /* Уменьшен размер шрифта для компактности */
}

/* Mobile Responsive Styles для header-buttons-container и header-action-btn */
@media (max-width: 768px) {
  .header-buttons-container {
    gap: 0.375rem;
  }
  
  .header-action-btn {
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
    min-width: 2.25rem;
    height: 2.25rem;
  }
  
  .header-action-btn i {
    font-size: 1rem;
  }
  
  .btn-text {
    display: none;
  }
}

.logout-text {
  font-size: 0.85rem;
}

/* Burger Button for Mobile */
.burger-button {
  display: none;
  color: var(--header-text);
  background: transparent;
  border: none;
  font-size: 1.25rem;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  position: relative;
}

.burger-button.has-unread {
  animation: burgerPulse 2s infinite;
}

@keyframes burgerPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(var(--danger-rgb, 220, 53, 69), 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(var(--danger-rgb, 220, 53, 69), 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(var(--danger-rgb, 220, 53, 69), 0);
  }
}

.burger-unread-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--unread-badge-bg);
  color: white;
  border-radius: 50%;
  min-width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: bold;
  box-shadow: 0 2px 4px var(--shadow-medium);
  z-index: 10;
}

/* Sidebar Overlay for Mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  z-index: 1040;
}

/* Theme Toggle Button */
.theme-toggle {
  background: var(--button-bg);
  border: 1px solid var(--button-border);
  color: var(--button-text);
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  margin-right: 8px;
}

.theme-toggle:hover {
  background: var(--primary-color);
  border-color: var(--primary-color);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px var(--shadow-medium);
}

.theme-toggle:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px var(--shadow-medium);
}

/* Mobile Responsive Styles */
@media (max-width: 991.98px) {
  .chat-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1050;
    width: 100%;
    min-width: 100%;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 2px 0 16px var(--shadow-medium);
  }

  .chat-sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.show {
    display: block;
  }

  .burger-button {
    display: inline-block;
    position: relative;
  }

  .chat-content {
    width: 100%;
  }

  .logout-button {
    padding: 6px 8px;
    font-size: 0.8rem;
    color: var(--header-text);
  }

  .logout-text {
    display: none;
  }
  
  .theme-toggle {
    padding: 6px 8px;
    font-size: 0.8rem;
  }
  
  .theme-toggle-text {
    display: none;
  }
}

/* Custom Scrollbar for Webkit Browsers */
.chat-sidebar::-webkit-scrollbar {
  width: 6px;
}

.chat-sidebar::-webkit-scrollbar-track {
  background: var(--background-color);
}

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

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

/* Loading States */
.loading-shimmer {
  background: linear-gradient(90deg, 
    var(--surface-color) 25%, 
    var(--user-item-hover) 50%, 
    var(--surface-color) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* Status Indicators */
.status-online {
  color: var(--success-color);
}

.status-offline {
  color: var(--text-muted);
}

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

/* Message Bubbles (if needed for future expansion) */
.message-bubble {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 16px;
  margin: 4px 0;
  max-width: 70%;
  word-wrap: break-word;
}

.message-bubble.own {
  background: var(--primary-color);
  color: white;
  margin-left: auto;
}

.message-bubble.other {
  background: var(--surface-color);
  color: var(--text-primary);
  margin-right: auto;
}

/* Utility Classes */
.text-primary { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-muted { color: var(--text-muted) !important; }
.bg-primary { background-color: var(--primary-color) !important; }
.bg-surface { background-color: var(--surface-color) !important; }
.border-primary { border-color: var(--primary-color) !important; }

/* Focus States for Accessibility */
.logout-button:focus,
.theme-toggle:focus,
.burger-button:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  :root {
    --border-color: #000000;
    --text-secondary: #000000;
  }
  
  [data-theme="dark"] {
    --border-color: #ffffff;
    --text-secondary: #ffffff;
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .burger-button.has-unread {
    animation: none;
  }
  
  .logout-button,
  .theme-toggle,
  .header-action-btn { /* Добавлено */
    transition: none;
  }
  
  .loading-shimmer {
    animation: none;
  }
}

/* User List Styles */
.pulse-animation {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  background: var(--danger-color);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(var(--danger-rgb, 220, 53, 69), 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 10px rgba(var(--danger-rgb, 220, 53, 69), 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(var(--danger-rgb, 220, 53, 69), 0);
  }
}

/* User List Card */
.user-list-card {
  background-color: var(--sidebar-background);
  border: 1px solid var(--sidebar-border);
  border-radius: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.user-list-header {
  background: var(--header-bg);
  color: var(--header-text);
  border-bottom: none;
  padding: 1rem;
  flex-shrink: 0;
}

.user-list-header h5 {
  margin: 0;
  font-weight: 600;
  display: flex;
  align-items: center;
}

.user-list-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  background-color: var(--background-color);
}

.user-list-item {
  background-color: var(--sidebar-background);
  border-bottom: 1px solid var(--sidebar-border);
  transition: all 0.2s ease;
  cursor: pointer;
  position: relative;
}

.user-list-item:hover {
  background-color: var(--user-item-hover);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px var(--shadow-light);
}

.user-list-item.selected {
  background: var(--user-item-active);
  border-bottom: 1px solid var(--sidebar-border);
}

.user-list-item.selected:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 2px 12px var(--shadow-medium);
}

.user-list-item.selected::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--success-color);
}

.user-list-item.loading {
  opacity: 0.7;
  pointer-events: none;
  cursor: not-allowed;
}

/* Loading States */
.loading-indicator {
  position: absolute;
  top: 50%;
  right: 60px;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
  z-index: 10;
}

.loading-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--text-muted);
  border-top: 2px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* User Avatar */
.user-avatar,
.simple-chat-header .user-avatar { /* Объединено со стилями .simple-chat-header .user-avatar */
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: bold;
  margin-right: 12px;
  flex-shrink: 0;
  background: var(--surface-color); /* Обновлено для соответствия Light Theme */
  color: var(--text-secondary); /* Обновлено для соответствия Light Theme */
  border: 1px solid var(--border-color); /* Добавлено для соответствия Light Theme */
}

.user-avatar.client {
  background: var(--primary-color);
  color: white;
}

/* User Info */
.user-info {
  flex: 1;
  min-width: 0;
}

.user-name,
.simple-chat-header .user-name { /* Объединено */
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.95rem;
  margin: 0 0 4px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-details,
.simple-chat-header .user-details { /* Объединено */
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-detail,
.simple-chat-header .connection-status { /* Объединено connection-status */
  color: var(--text-secondary);
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 4px;
}

.user-detail i {
  width: 12px;
  text-align: center;
}

.user-detail .phone-link {
  color: var(--text-secondary);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 4px;
  padding: 2px 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.user-detail .phone-link:hover {
  color: var(--success-color);
  background-color: rgba(var(--success-rgb, 40, 167, 69), 0.1);
  text-decoration: none;
}

.user-detail .phone-link:active {
  transform: scale(0.95);
}

/* User Actions */
.user-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.unread-counter {
  position: relative;
}

.unread-badge {
  background: var(--unread-badge-bg);
  color: white;
  border-radius: 12px;
  padding: 4px 8px;
  font-size: 0.7rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 2px;
  box-shadow: 0 2px 4px var(--shadow-medium);
}

.unread-check {
  color: var(--success-color);
  font-size: 1rem;
}

.dropdown-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 6px;
  border-radius: 4px;
  transition: all 0.2s ease;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dropdown-toggle-btn:hover {
  background-color: rgba(var(--text-secondary-rgb, 108, 117, 125), 0.1);
  color: var(--text-primary);
}

/* Menu Toggle Button */
.menu-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 6px;
  border-radius: 4px;
  transition: all 0.2s ease;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
}

.menu-toggle-btn:hover {
  background-color: rgba(var(--text-secondary-rgb, 108, 117, 125), 0.1);
  color: var(--text-primary);
}

/* User Menu Buttons Container */
.user-menu-buttons {
  position: absolute;
  top: 50%;
  right: 40px;
  transform: translateY(-50%);
  display: flex;
  gap: 4px;
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 4px 12px var(--shadow-medium);
  z-index: 100;
  animation: menuSlideIn 0.2s ease-out;
}

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

/* Individual Menu Buttons */
.user-menu-btn {
  background: transparent;
  border: none;
  padding: 6px;
  border-radius: 4px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-secondary);
}

.user-menu-btn:hover {
  transform: scale(1.1);
  color: var(--text-primary);
}

.user-menu-btn.info:hover {
  background-color: rgba(var(--info-color, 23, 162, 184), 0.1);
  color: var(--info-color);
}

.user-menu-btn.edit:hover {
  background-color: rgba(var(--primary-rgb, 0, 123, 255), 0.1);
  color: var(--primary-color);
}

.user-menu-btn.delete:hover {
  background-color: rgba(var(--danger-rgb, 220, 53, 69), 0.1);
  color: var(--danger-color);
}

/* Mobile responsive for menu buttons */
@media (max-width: 768px) {
  .user-menu-buttons {
    right: 35px;
    padding: 3px;
  }

  .user-menu-btn {
    width: 26px;
    height: 26px;
    padding: 5px;
  }

  .menu-toggle-btn {
    width: 30px;
    height: 30px;
    padding: 5px;
  }
}

/* Call Modal */
.call-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--overlay-bg);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  backdrop-filter: blur(4px);
}

.call-modal {
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 2rem;
  max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: 0 16px 32px var(--shadow-medium);
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.call-modal .phone-icon {
  font-size: 3rem;
  color: var(--success-color);
  margin-bottom: 1rem;
  animation: pulseIcon 2s infinite;
}

@keyframes pulseIcon {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.call-modal .phone-number {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--text-primary);
  margin-bottom: 1rem;
  word-break: break-all;
}

.call-modal .call-instructions {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  line-height: 1.4;
}

.call-modal .modal-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.call-modal .btn-call {
  background: var(--success-color);
  border: none;
  color: white;
  padding: 0.75rem 2rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.call-modal .btn-call:hover {
  background: var(--success-color);
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(var(--success-rgb, 40, 167, 69), 0.3);
}

.call-modal .btn-cancel {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.75rem 2rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.call-modal .btn-cancel:hover {
  background-color: rgba(var(--text-secondary-rgb, 108, 117, 125), 0.1);
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: var(--text-muted);
  text-align: center;
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* Custom Scrollbar */
.user-list-body::-webkit-scrollbar {
  width: 6px;
}

.user-list-body::-webkit-scrollbar-track {
  background: var(--background-color);
}

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

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

/* Mobile Responsive for User List */
@media (max-width: 768px) {
  .user-avatar {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }

  .user-name {
    font-size: 0.9rem;
  }

  .user-detail {
    font-size: 0.7rem;
  }

  .unread-badge {
    font-size: 0.65rem;
    padding: 3px 6px;
  }

  .dropdown-menu-modern {
    min-width: 160px;
    max-width: 180px;
    font-size: 0.85rem;
  }

  .dropdown-item {
    padding: 8px 12px;
    font-size: 0.8rem;
  }

  .user-list-header {
    padding: 0.75rem;
  }

  .user-list-header h5 {
    font-size: 0.95rem;
  }
}

/* Registration Page Styles */
.registration-container {
  min-height: 100vh;
  background: var(--background-color);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
}

.registration-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(0,0,0,0.03)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
  pointer-events: none;
}

.registration-card {
  background: var(--surface-color);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  box-shadow: 0 20px 40px var(--shadow-medium);
  padding: 40px;
  width: 100%;
  max-width: 450px;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.registration-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: var(--primary-color);
}

.registration-header {
  text-align: center;
  margin-bottom: 30px;
}

.registration-header .logo-section {
  margin-bottom: 20px;
}

.registration-header .app-logo {
  width: 60px;
  height: 60px;
  background: var(--primary-color);
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 15px;
  box-shadow: 0 10px 30px var(--shadow-medium);
}

.registration-header .app-logo i {
  color: white;
  font-size: 24px;
}

.registration-header .app-name {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 5px 0;
  background: var(--primary-color);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.registration-header .app-version {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0 0 20px 0;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.registration-header h2 {
  color: var(--text-primary);
  font-weight: 600;
  margin-bottom: 10px;
  font-size: 20px;
}

.registration-header p {
  color: var(--text-secondary);
  font-size: 14px;
  margin: 0;
}

/* Form Controls */
.form-group {
  margin-bottom: 20px;
  position: relative;
}

.form-control {
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 15px 20px;
  font-size: 16px;
  transition: all 0.3s ease;
  background: var(--surface-color);
  color: var(--text-primary);
}

.form-control::placeholder {
  color: var(--text-secondary);
  opacity: 1;
}

.form-control:focus {
  border-color: var(--primary-color);
  background: var(--surface-color);
  box-shadow: 0 0 0 0.2rem rgba(var(--primary-rgb, 0, 123, 255), 0.25);
  color: var(--text-primary);
}

.form-control.is-invalid {
  border-color: var(--danger-color);
  background: var(--surface-color);
  color: var(--text-primary);
}

.input-group {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  z-index: 10;
}

.input-with-icon {
  padding-left: 45px;
}

/* Buttons */
.btn-registration {
  background: var(--primary-color);
  border: none;
  border-radius: 12px;
  padding: 15px 30px;
  font-size: 16px;
  font-weight: 600;
  color: white;
  width: 100%;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.btn-registration:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px var(--shadow-medium);
}

.btn-registration:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-loading {
  position: relative;
  color: transparent;
}

.btn-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border: 2px solid #ffffff;
  border-top: 2px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Alerts */
.alert {
  border-radius: 12px;
  border: none;
  padding: 15px 20px;
  margin-bottom: 20px;
  font-weight: 500;
}

.alert-danger {
  background: var(--danger-color);
  color: white;
}

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

.alert-info {
  background: var(--info-color);
  color: white;
}

/* Phone Display */
.phone-display {
  background: var(--background-color);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 15px 20px;
  margin-bottom: 20px;
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.code-input {
  text-align: center;
  font-size: 24px;
  font-weight: bold;
  letter-spacing: 8px;
  text-transform: uppercase;
}

.code-input::placeholder {
  letter-spacing: normal;
  text-transform: none;
  font-weight: normal;
  color: var(--text-secondary);
}

/* Resend Link */
.resend-code {
  text-align: center;
  margin-top: 15px;
}

.resend-link {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.3s ease;
}

.resend-link:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

.resend-link.disabled {
  color: var(--text-muted);
  cursor: not-allowed;
  text-decoration: none;
}

/* Remember Me */
.remember-me {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
}

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

.remember-me label {
  margin: 0;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
}

/* Timer */
.timer {
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
  margin-top: 10px;
}

/* Step Indicator */
.step-indicator {
  display: flex;
  justify-content: center;
  margin-bottom: 30px;
}

.step {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--background-color);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  margin: 0 10px;
  position: relative;
  transition: all 0.3s ease;
}

.step.active {
  background: var(--primary-color);
  color: white;
  box-shadow: 0 5px 15px var(--shadow-medium);
}

.step.completed {
  background: var(--success-color);
  color: white;
}

.step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 100%;
  width: 30px;
  height: 2px;
  background: var(--background-color);
  transform: translateY(-50%);
}

.step.completed:not(:last-child)::after {
  background: var(--success-color);
}

/* Validation Messages */
.validation-message {
  color: var(--danger-color);
  font-size: 14px;
  margin-top: 5px;
  display: none;
}

.validation-message.show {
  display: block;
}

/* Success Animation */
.success-animation {
  text-align: center;
  padding: 20px 0;
}

.success-icon {
  font-size: 80px;
  color: var(--success-color);
  margin-bottom: 20px;
  animation: bounceIn 0.6s ease-out;
}

@keyframes bounceIn {
  0% { transform: scale(0); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

/* Registration Animations */
.fade-in {
  animation: fadeIn 0.5s ease-in;
}

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

.slide-in {
  animation: slideIn 0.3s ease-out;
}

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

/* Registration Mobile Responsive */
@media (max-width: 576px) {
  .registration-container {
    padding: 10px;
  }

  .registration-card {
    padding: 30px 20px;
    margin: 0;
  }

  .registration-header h2 {
    font-size: 24px;
  }

  .step {
    width: 35px;
    height: 35px;
    font-size: 14px;
    margin: 0 8px;
  }

  .step:not(:last-child)::after {
    width: 20px;
  }
}

/* Chat Messages Styles */
.chat-date {
  border-radius: 20px;
  padding: 5px;
  margin: 5px;
  width: max-content;
  height: auto;
  word-wrap: break-word;
  background: var(--surface-color);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

/* File Attach */
#attach-file {
  height: 100%;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.preview-container {
  margin: 10px 0;
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  display: none;
  background: var(--surface-color);
  color: var(--text-primary);
}

.preview-item {
  display: flex;
  align-items: center;
  margin-bottom: 5px;
  padding: 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--background-color);
}

.preview-image {
  max-width: 100px;
  max-height: 100px;
  margin-right: 10px;
  border-radius: 4px;
  border: 1px solid var(--text-muted);
}

.preview-file {
  display: flex;
  align-items: center;
  flex-grow: 1;
  color: var(--text-primary);
}

.preview-file i {
  margin-right: 10px;
  font-size: 24px;
  color: var(--text-secondary);
}

.remove-file {
  margin-left: 10px;
  cursor: pointer;
  color: var(--danger-color);
  padding: 5px;
  transition: color 0.2s;
}

.remove-file:hover {
  color: var(--danger-hover);
}

.preview-item span {
  color: var(--text-primary);
}

/* Message Bubbles */
.mes {
  margin-bottom: 1rem;
  max-width: 70%;
  word-wrap: break-word;
  position: relative;
}

.message-send {
  align-self: flex-end;
  background-color: var(--primary-color);
  border-radius: 18px 18px 4px 18px;
  padding: 0.75rem;
  margin-left: auto;
  position: relative;
  color: white;
}

.message-send::after {
  content: '';
  position: absolute;
  bottom: 8px;
  right: -8px;
  width: 0;
  height: 0;
  border-left: 8px solid var(--primary-color);
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
}

.message-rescive {
  align-self: flex-start;
  background-color: var(--surface-color);
  border-radius: 18px 18px 18px 4px;
  padding: 0.75rem;
  position: relative;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.message-rescive::after {
  content: '';
  position: absolute;
  bottom: 8px;
  left: -8px;
  width: 0;
  height: 0;
  border-right: 8px solid var(--surface-color);
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
}

.message-from-user {
  align-self: flex-start;
  background-color: var(--surface-color);
  border-radius: 18px 18px 18px 4px;
  padding: 0.75rem;
  position: relative;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.message-from-user::after {
  content: '';
  position: absolute;
  bottom: 8px;
  left: -8px;
  width: 0;
  height: 0;
  border-right: 8px solid var(--surface-color);
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
}

.message-send-file,
.message-rescive-file,
.message-from-user-file {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin-top: 0.5rem;
  cursor: pointer;
  transition: opacity 0.2s;
}

.message-send-file:hover,
.message-rescive-file:hover,
.message-from-user-file:hover {
  opacity: 0.8;
}

.message-text {
  white-space: pre-line;
}

/* Chat Container */
.chat-messages-container {
  padding: 1rem;
  height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background-color: var(--chat-bg);
}

/* Scroll to Bottom Button */
.scroll-to-bottom-btn {
  position: absolute;
  bottom: 20px;
  right: 20px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 4px 12px var(--shadow-medium);
  transition: all 0.3s ease;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scroll-to-bottom-btn:hover {
  background-color: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px var(--shadow-medium);
}

.scroll-to-bottom-btn.hidden {
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
}

/* Chat Container Positioning */
.chat-container {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  width: 100%;
}

.messages-area,
.simple-chat-messages-area { /* Объединено со стилями .simple-chat-messages-area */
  flex: 1;
  overflow-y: auto;
  padding: 1rem; /* Добавлено из .simple-chat-messages-area */
  display: flex;
  flex-direction: column;
  background-color: var(--chat-bg);
  position: relative;
  gap: 0.5rem; /* Добавлено из .simple-chat-messages-area */
}

/* Scrollbar для messages-area */
.messages-area::-webkit-scrollbar {
  width: 6px;
}

.messages-area::-webkit-scrollbar-track {
  background: var(--background-color);
}

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

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

/* Enhanced Input Group */
.enhanced-input-group {
  border: 2px solid var(--border-color);
  border-radius: 25px;
  background-color: var(--surface-color);
  overflow: hidden;
  transition: all 0.3s ease;
}

.enhanced-input-group:focus-within {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15), 0 0 12px var(--shadow-medium);
  transform: translateY(-1px);
}

.message-input-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--surface-color);
}

.message-textarea {
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  padding: 12px 16px;
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.4;
  min-height: 20px;
  max-height: 120px;
  overflow-y: auto;
  border-radius: 0;
  transition: all 0.3s ease;
}

.message-textarea::placeholder {
  color: var(--text-secondary);
  opacity: 1;
}

.message-textarea:focus {
  background-color: rgba(0, 123, 255, 0.05);
  box-shadow: inset 0 0 0 1px rgba(0, 123, 255, 0.3);
  border-radius: 20px;
  margin: 2px;
}

.message-textarea::-webkit-scrollbar {
  width: 4px;
}

.message-textarea::-webkit-scrollbar-track {
  background: transparent;
}

.message-textarea::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 2px;
}

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

.input-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px 8px 16px;
  background-color: var(--surface-color);
}

.character-count {
  font-size: 11px;
  color: var(--text-secondary);
}

.attach-button {
  border: none;
  background-color: transparent;
  color: var(--text-secondary);
  padding: 12px 16px;
  border-radius: 0;
  transition: all 0.2s;
}

.attach-button:hover {
  background-color: rgba(var(--text-secondary-rgb, 108, 117, 125), 0.1);
  color: var(--text-primary);
}

.send-button {
  border-radius: 50%;
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  background: var(--primary-color);
  border: none;
  color: white;
}

.send-button:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 4px 12px var(--shadow-medium);
}

.send-button:disabled {
  background: var(--text-muted);
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.input-group-prepend {
  display: flex;
  align-items: flex-start;
  padding-top: 4px;
}

/* Send Button Animation */
.send-button.has-content {
  animation: pulse 2s infinite;
}

/* File Preview Styles */
/* Minimal File Preview */
.minimal-file-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 4px 0;
  padding: 0;
}

.minimal-file-chip {
  display: inline-flex;
  align-items: center;
  background-color: rgba(var(--primary-rgb, 0, 123, 255), 0.1);
  border: 1px solid rgba(var(--primary-rgb, 0, 123, 255), 0.3);
  border-radius: 12px;
  padding: 2px 6px;
  font-size: 11px;
  color: var(--primary-color);
  transition: all 0.2s ease;
}

.minimal-file-chip:hover {
  background-color: rgba(var(--primary-rgb, 0, 123, 255), 0.2);
  border-color: var(--primary-color);
}

/* Minimal Remove Button */
.minimal-remove {
  background: none;
  border: none;
  color: var(--danger-color);
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  margin-left: 2px;
  padding: 0;
  width: 12px;
  height: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.minimal-remove:hover {
  background-color: rgba(220, 53, 69, 0.1);
  color: var(--danger-hover);
}

/* Compact File Preview - Объединение стилей */
.compact-file-preview {
  margin: 8px 0;
  padding: 0;
  display: flex; /* Добавлено */
  align-items: center; /* Добавлено */
  background-color: var(--surface-color); /* Добавлено */
  border: 1px solid var(--border-color); /* Добавлено */
  border-radius: 20px; /* Добавлено */
  transition: all 0.2s ease; /* Добавлено */
}

.compact-file-preview:hover {
  background-color: var(--background-color);
  border-color: var(--primary-color);
}

.compact-files-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.compact-file-item {
  position: relative;
  display: inline-block;
}

.compact-image-preview {
  position: relative;
  display: inline-block;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid var(--border-color);
  transition: all 0.2s ease;
}

.compact-image-preview:hover {
  border-color: var(--primary-color);
  transform: scale(1.02);
}

.compact-thumbnail {
  width: 60px;
  height: 60px;
  object-fit: cover;
  display: block;
}

.compact-file-icon {
  color: var(--primary-color);
  font-size: 16px;
  margin-right: 8px;
  flex-shrink: 0;
}

.compact-file-name {
  color: var(--text-primary);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  margin-right: 8px;
}

.compact-remove-btn {
  position: absolute;
  top: -4px;
  right: -4px;
  background-color: var(--danger-color);
  color: white;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
  box-shadow: 0 2px 4px var(--shadow-medium);
}

.compact-remove-btn:hover {
  background-color: var(--danger-hover);
  transform: scale(1.1);
}

.compact-file-item:not(.loaded) {
  animation: none;
}

.compact-file-item.loaded {
  animation: slideIn 0.3s ease-out;
}

/* @keyframes slideIn уже определен ранее, повторение удалено */

.compact-file-preview:empty::after {
  content: "Нет прикрепленных файлов";
  color: var(--text-secondary);
  font-style: italic;
  font-size: 12px;
}

/* Mobile Responsive for Messages */
@media (max-width: 768px) {
  .mes {
    max-width: 85%;
  }

  .scroll-to-bottom-btn {
    bottom: 20px;
    right: 15px;
    width: 45px;
    height: 45px;
    font-size: 16px;
  }

  .message-send::after {
    right: -6px;
    border-left-width: 6px;
    border-top-width: 6px;
    border-bottom-width: 6px;
  }

  .message-rescive::after,
  .message-from-user::after {
    left: -6px;
    border-right-width: 6px;
    border-top-width: 6px;
    border-bottom-width: 6px;
  }

  .message-textarea {
    padding: 10px 12px;
    font-size: 16px;
  }

  .input-footer {
    padding: 0 12px 6px 12px;
  }

  .attach-button {
    padding: 10px 12px;
  }

  .enhanced-input-group:focus-within {
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb, 0, 123, 255), 0.15), 0 0 8px var(--shadow-medium);
  }

  .compact-files-container {
    gap: 6px;
  }

  .compact-thumbnail {
    width: 50px;
    height: 50px;
  }

  .compact-file-preview {
    padding: 4px 8px;
    max-width: 150px;
  }

  .compact-file-name {
    font-size: 11px;
  }

  .compact-remove-btn {
    width: 18px;
    height: 18px;
    font-size: 10px;
  }
}

/* Simple Chat Component Styles */
.simple-chat-container {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--chat-bg);
  color: var(--text-primary);
}

/* simple-chat-header был объединен с .chat-header */

.chat-user-info,
.simple-chat-header .chat-user-info { /* Объединено .simple-chat-header .chat-user-info */
  display: flex;
  align-items: center;
  gap: 12px;
}

/* user-avatar был объединен */
/* user-details был объединен */
/* user-name был объединен */
/* connection-status был объединен */

/* messages-area был объединен */
/* scrollbar для messages-area был объединен */

.message,
.simple-chat-message { /* Объединено со стилями .simple-chat-message */
  display: flex;
  margin-bottom: 0.5rem;
}

.message.own-message,
.simple-chat-message.own-message { /* Объединено */
  justify-content: flex-end;
}

.message.other-message,
.simple-chat-message.other-message { /* Объединено */
  justify-content: flex-start;
}

.message-bubble,
.simple-chat-message-bubble { /* Объединено со стилями .simple-chat-message-bubble */
  max-width: 70%;
  padding: 0.75rem;
  border-radius: 18px;
  position: relative;
}

.own-message .message-bubble,
.simple-chat-message.own-message .simple-chat-message-bubble { /* Объединено */
  background: var(--primary-color);
  color: white;
  border-bottom-right-radius: 4px;
}

.other-message .message-bubble,
.simple-chat-message.other-message .simple-chat-message-bubble { /* Объединено */
  background: var(--surface-color);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border-color);
}

.message-text,
.simple-chat-message-text { /* Объединено */
  white-space: pre-line;
  margin-bottom: 0.25rem;
}

.message-files,
.simple-chat-message-files { /* Объединено */
  margin-top: 0.5rem;
}

.message-image,
.simple-chat-message-image { /* Объединено */
  max-width: 200px;
  max-height: 200px;
  border-radius: 8px;
  margin-top: 0.25rem;
}

.file-link,
.simple-chat-file-link { /* Объединено */
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: var(--background-color);
  border-radius: 8px;
  margin-top: 0.25rem;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--border-color);
}

.message-time,
.simple-chat-message-time { /* Объединено */
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-align: right;
  margin-top: 4px;
}

.no-messages,
.simple-chat-no-messages { /* Объединено состилями .simple-chat-no-messages */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-secondary);
  text-align: center;
}

.no-messages i,
.simple-chat-no-messages i { /* Объединено */
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* Simple Chat Input Area */
.simple-chat-input-area,
.chat-input-area { /* Объединено */
  padding: 1rem;
  background-color: var(--surface-color);
  flex-shrink: 0;
  border-top: 1px solid var(--border-color);
}

.file-preview,
.simple-chat-file-preview { /* Объединено */
  margin-bottom: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.file-item,
.simple-chat-file-item { /* Объединено */
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: var(--background-color);
  border-radius: 8px;
  max-width: 200px;
  border: 1px solid var(--border-color);
}

.file-item img,
.simple-chat-file-item img { /* Объединено */
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 4px;
}

.file-icon,
.simple-chat-file-icon { /* Объединено */
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--background-color);
  border-radius: 4px;
  color: var(--primary-color); /* Добавлено из simple-chat-file-icon */
}

.file-name,
.simple-chat-file-name { /* Объединено */
  flex: 1;
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary); /* Добавлено из simple-chat-file-name */
}

.remove-file,
.simple-chat-remove-file { /* Объединено */
  background: none;
  border: none;
  color: var(--danger-color);
  cursor: pointer;
  padding: 2px;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.remove-file:hover,
.simple-chat-remove-file:hover { /* Объединено */
  background: rgba(var(--danger-rgb, 220, 53, 69), 0.1);
}

.input-row,
.simple-chat-input-row { /* Объединено */
  display: flex;
  gap: 8px;
}

.input-group,
.simple-chat-input-group { /* Объединено */
  flex: 1;
  display: flex;
  background: var(--surface-color); /* Обновлено с var(--background-color) */
  border: 2px solid var(--border-color);
  border-radius: 25px;
  overflow: hidden;
  transition: border-color 0.3s ease;
}

.input-group:focus-within,
.simple-chat-input-group:focus-within { /* Объединено */
  border-color: var(--primary-color);
}

.message-input,
.simple-chat-message-input { /* Объединено */
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  padding: 12px 16px;
  color: var(--text-primary);
  font-size: 14px;
  resize: none;
  min-height: 44px;
  max-height: 120px;
}

.message-input::placeholder,
.simple-chat-message-input::placeholder { /* Объединено */
  color: var(--text-secondary);
}

.input-actions,
.simple-chat-input-actions { /* Объединено */
  display: flex;
  align-items: center;
  padding-right: 8px;
  gap: 4px;
}

.attach-button,
.simple-chat-attach-button { /* Объединено */
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.attach-button:hover,
.simple-chat-attach-button:hover { /* Объединено */
  background-color: rgba(var(--text-secondary-rgb, 108, 117, 125), 0.1);
  color: var(--text-primary);
}

.send-button,
.simple-chat-send-button { /* Объединено */
  background: var(--primary-color);
  border: none;
  color: white;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.send-button:hover:not(:disabled),
.simple-chat-send-button:hover:not(:disabled) { /* Объединено */
  transform: scale(1.05);
  box-shadow: 0 4px 12px var(--shadow-medium);
}

.send-button:disabled,
.simple-chat-send-button:disabled { /* Объединено */
  background: var(--text-muted);
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* simple-chat-loading, simple-chat-no-messages были объединены с .no-messages и .chat-loading */

/* Simple Chat Mobile Responsive */
@media (max-width: 768px) {
  .simple-chat-container {
    height: 100vh;
  }

  .chat-header { /* Используем объединенный класс */
    padding: 0.75rem;
  }

  .message-bubble { /* Используем объединенный класс */
    max-width: 85%;
  }

  .simple-chat-input-area {
    padding: 0.75rem;
  }

  .message-input { /* Используем объединенный класс */
    padding: 10px 12px;
    font-size: 16px;
  }

  .logout-button {
    padding: 6px 8px;
    font-size: 0.8rem;
  }

  .logout-text {
    display: none;
  }
}

/* React Root Container */
#react_root_local {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Chat Messages Specific Styles */
.chat-messages-flex-container {
  flex: 1;
  overflow: hidden;
}

.chat-placeholder-bg {
  background-color: var(--chat-bg);
}

/* Message Text Styles */
.message-text-custom {
  max-width: 40vh;
  height: auto;
}

.message-text-content {
  white-space: pre-line;
}

.message-image-custom {
  width: 100%;
  height: auto;
  max-width: 300px;
}

.messages-end-ref {
  height: 1px;
}

/* Chat Blocked Overlay */
.chat-blocked-overlay {
  position: absolute;
  inset: 0;
  background-color: var(--overlay-bg);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
  animation: fadeIn 0.3s ease-in-out; /* Анимация перемещена сюда */
}

.chat-blocked-overlay .wifi-icon {
  font-size: 2rem;
  opacity: 0.8;
}

.chat-blocked-overlay .connection-text {
  font-weight: 600;
}

.chat-blocked-overlay .small-text {
  opacity: 0.8;
}

.chat-blocked-overlay .reload-button {
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
}

/* Hidden File Input */
#attach-file {
  display: none;
}

/* Message Textarea Disabled State */
.message-textarea-disabled {
  opacity: 0.6;
  pointer-events: none;
}

/* User List Specific Styles */
.user-list-full-height {
  height: 100vh;
  overflow-y: auto;
}

.mobile-close-button {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
}

/* Dropdown Portal Styles */
.dropdown-portal-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}

.dropdown-menu-modern {
  pointer-events: auto;
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 8px 24px var(--shadow-medium);
  padding: 8px 0;
  min-width: 200px;
  max-width: 250px;
}

/* Toast Notification Styles */
.toast-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--success-color);
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  z-index: 10001;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(var(--success-rgb, 40, 167, 69)); 
}

/* ... остальной код ... */

/* Mobile Close Button Full Width */
.mobile-close-button-full {
  background: var(--danger-color);
  border: 1px solid var(--danger-color);
  color: var(--header-text);
  padding: 10px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 500;
  width: 100%;
  min-height: 44px; /* Минимальный размер для удобства касания */
}

.mobile-close-button-full:hover {
  background: var(--danger-hover);
  border-color: var(--danger-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px var(--shadow-medium);
}

.mobile-close-button-full:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px var(--shadow-medium);
}

/* Unified Scrollbar Styles */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

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

::-webkit-scrollbar-thumb:active {
  background: var(--primary-color);
}

::-webkit-scrollbar-corner {
  background: var(--background-color);
}

/* Firefox Scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) var(--background-color);
}

*:hover {
  scrollbar-color: var(--text-secondary) var(--background-color);
}

/* Specific Scrollbar Styles for Chat Elements */
.chat-sidebar::-webkit-scrollbar,
.user-list-body::-webkit-scrollbar {
  width: 6px;
}

.chat-sidebar::-webkit-scrollbar-track,
.user-list-body::-webkit-scrollbar-track {
  background: var(--background-color);
}

.chat-sidebar::-webkit-scrollbar-thumb,
.user-list-body::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.chat-sidebar::-webkit-scrollbar-thumb:hover,
.user-list-body::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.messages-area::-webkit-scrollbar,
.simple-chat-messages-area::-webkit-scrollbar {
  width: 6px;
}

.messages-area::-webkit-scrollbar-track,
.simple-chat-messages-area::-webkit-scrollbar-track {
  background: var(--background-color);
}

.messages-area::-webkit-scrollbar-thumb,
.simple-chat-messages-area::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.messages-area::-webkit-scrollbar-thumb:hover,
.simple-chat-messages-area::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.message-textarea::-webkit-scrollbar {
  width: 4px;
}

.message-textarea::-webkit-scrollbar-track {
  background: transparent;
}

.message-textarea::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 2px;
}

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

/* Enhanced Scrollbar for Dark Theme */
[data-theme="dark"] ::-webkit-scrollbar-track {
  background: var(--surface-color);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: var(--border-color);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

[data-theme="dark"] ::-webkit-scrollbar-corner {
  background: var(--surface-color);
}

/* Firefox Scrollbar for Dark Theme */
[data-theme="dark"] {
  scrollbar-color: var(--border-color) var(--surface-color);
}

[data-theme="dark"] *:hover {
  scrollbar-color: var(--text-muted) var(--surface-color);
}

/* Custom Scrollbar with Gradient */
.gradient-scrollbar::-webkit-scrollbar {
  width: 10px;
}

.gradient-scrollbar::-webkit-scrollbar-track {
  background: var(--background-color);
  border-radius: 5px;
}

.gradient-scrollbar::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, 
    var(--primary-color) 0%, 
    var(--primary-hover) 100%
  );
  border-radius: 5px;
  border: 2px solid var(--background-color);
}

.gradient-scrollbar::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, 
    var(--primary-hover) 0%, 
    var(--primary-color) 100%
  );
}

/* Thin Scrollbar */
.thin-scrollbar::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

.thin-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}

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

.thin-scrollbar::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* Invisible Scrollbar (but still functional) */
.invisible-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.invisible-scrollbar::-webkit-scrollbar {
  display: none;
}