:root {
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #2d2d2d;
    --bg-hover: rgba(255, 255, 255, 0.08);
    --bg-active: rgba(255, 255, 255, 0.12);
    
    --text-primary: #ffffff;
    --text-secondary: #8e8e93;
    --text-muted: #6c6c70;
    
    --primary-color: #239508;
    --primary-hover: #239508;
    --success-color: #34c759;
    --warning-color: #ff9500;
    --danger-color: #ff3b30;
    --info-color: #5ac8fa;
    
    --border-color: rgba(255, 255, 255, 0.12);
    --border-light: rgba(255, 255, 255, 0.06);
    
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-circle: 50%;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;
    
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-primary);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    display: flex;
    min-height: 100vh;
    position: relative;
    background: var(--bg-primary);
}

.floating-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

.particle {
    position: absolute;
    background: linear-gradient(45deg, var(--primary-color), transparent);
    border-radius: 50%;
    animation: float 20s infinite ease-in-out;
}

.particle:nth-child(1) { top: 10%; left: 5%; width: 300px; height: 300px; animation-delay: 0s; }
.particle:nth-child(2) { top: 20%; right: 10%; width: 200px; height: 200px; animation-delay: -5s; }
.particle:nth-child(3) { bottom: 15%; left: 15%; width: 150px; height: 150px; animation-delay: -10s; }
.particle:nth-child(4) { bottom: 25%; right: 20%; width: 250px; height: 250px; animation-delay: -15s; }
.particle:nth-child(5) { top: 60%; left: 40%; width: 100px; height: 100px; animation-delay: -2s; }
.particle:nth-child(6) { top: 30%; left: 70%; width: 180px; height: 180px; animation-delay: -8s; }

.gradient-accent {
    position: fixed;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.15;
    pointer-events: none;
    z-index: -1;
}

.gradient-accent-1 {
    top: -100px;
    right: -100px;
    width: 400px;
    height: 400px;
    background: linear-gradient(45deg, var(--primary-color), var(--info-color));
}

.gradient-accent-2 {
    bottom: -150px;
    left: -150px;
    width: 500px;
    height: 500px;
    background: linear-gradient(135deg, var(--success-color), var(--warning-color));
}

.gradient-accent-3 {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    height: 300px;
    background: linear-gradient(225deg, var(--danger-color), var(--primary-color));
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(30px, -50px) rotate(120deg); }
    66% { transform: translate(-20px, 40px) rotate(240deg); }
}

/* ========== SIDEBAR - ИСПРАВЛЕННАЯ ВЕРСИЯ ========== */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh; /* ФИКСИРУЕМ ВЫСОТУ НА ВЕСЬ ЭКРАН */
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    z-index: 100;
    position: fixed; /* ДЕЛАЕМ ФИКСИРОВАННОЙ */
    top: 0;
    left: 0;
    transition: width var(--transition-normal);
    overflow: hidden; /* Скрываем всё, что выходит за пределы */
}

/* ОСНОВНОЙ КОНТЕНТ - ДОБАВЛЯЕМ ОТСТУП */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    margin-left: var(--sidebar-width); /* ОТСТУП РАВНЫЙ ШИРИНЕ САЙДБАРА */
    transition: margin-left var(--transition-normal);
}

/* ПРИ СВЕРНУТОЙ ПАНЕЛИ МЕНЯЕМ ОТСТУП */
.main-content.sidebar-collapsed {
    margin-left: var(--sidebar-collapsed);
}

.sidebar-toggle-btn {
    position: absolute;
    top: 50%;
    right: -12px;
    transform: translateY(-50%);
    width: 24px;
    height: 40px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-left: none;
    border-radius: 0 8px 8px 0;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    z-index: 10;
    opacity: 0;
}

.sidebar:hover .sidebar-toggle-btn {
    opacity: 1;
}

.sidebar-toggle-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.sidebar-toggle-btn i {
    font-size: 12px;
    transition: transform var(--transition-fast);
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar.collapsed .logo h1,
.sidebar.collapsed .nav-item span:not(.badge),
.sidebar.collapsed .user-info,
.sidebar.collapsed .logout-btn,
.sidebar.collapsed .logo .sidebar-toggle-btn i {
    display: none;
}

.sidebar.collapsed .logo {
    justify-content: center;
    padding: 20px 0;
}

.sidebar.collapsed .logo-image {
    width: 32px;
    height: 32px;
    margin: 0;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 12px 0;
}

.sidebar.collapsed .nav-item i {
    font-size: 20px;
    width: auto;
}

.sidebar.collapsed .badge {
    position: absolute;
    top: 8px;
    right: 8px;
    min-width: 16px;
    height: 16px;
    font-size: 10px;
}

.sidebar.collapsed .user-profile {
    justify-content: center;
    padding: 16px 0;
}

.sidebar.collapsed .user-avatar {
    width: 32px;
    height: 32px;
    margin: 0;
}

.sidebar.collapsed .sidebar-toggle-btn i {
    display: block;
    transform: rotate(180deg);
}

.sidebar.collapsed .sidebar-toggle-btn {
    right: -12px;
}

.swipe-indicator {
    position: absolute;
    right: -12px;
    top: 50%;
    transform: translateY(-50%) translateX(100%);
    background: linear-gradient(135deg, var(--primary-color), var(--info-color));
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 101;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    pointer-events: none;
}

.swipe-indicator:hover {
    transform: translateY(-50%) translateX(110%) scale(1.1);
    box-shadow: 0 4px 16px rgba(42, 171, 238, 0.4);
}

.swipe-indicator i {
    font-size: 14px;
    transition: transform 0.2s ease;
}

.swipe-indicator:hover i {
    transform: scale(1.2);
}

/* ЛОГОТИП - ФИКСИРОВАННАЯ ВЕРХНЯЯ ЧАСТЬ */
.logo {
    flex-shrink: 0; /* НЕ СЖИМАЕТСЯ */
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px;
}

.logo-image {
    width: 86px;
    height: 86px;
    border-radius: var(--radius-sm);
    object-fit: cover;
}

@keyframes logo-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.logo h1 {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, #07cc00, #82fa5a94);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* НАВИГАЦИОННОЕ МЕНЮ - ПРОКРУЧИВАЕМАЯ СРЕДНЯЯ ЧАСТЬ */
.nav-menu {
    flex: 1 1 auto; /* ЗАНИМАЕТ ВСЁ ДОСТУПНОЕ ПРОСТРАНСТВО */
    overflow-y: auto; /* ВКЛЮЧАЕМ ПРОКРУТКУ */
    padding: 16px 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* КАСТОМНЫЙ СКРОЛЛБАР ДЛЯ КРАСОТЫ */
.nav-menu::-webkit-scrollbar {
    width: 4px;
}

.nav-menu::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

.nav-menu::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.nav-menu::-webkit-scrollbar-thumb:hover {
    background: var(--primary-hover);
}

.nav-item {
    flex-shrink: 0; /* ОТДЕЛЬНЫЕ ПУНКТЫ НЕ СЖИМАЮТСЯ */
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition-fast);
    position: relative;
    cursor: pointer;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--bg-active);
    color: var(--primary-color);
    font-weight: 500;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 24px;
    background: var(--primary-color);
    border-radius: 0 2px 2px 0;
}

.nav-item i {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.nav-item span:not(.badge) {
    flex: 1;
    font-size: 15px;
}

.badge {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--primary-color);
    color: white;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}

/* ПРОФИЛЬ ПОЛЬЗОВАТЕЛЯ - ПРИЛИПАЕТ К НИЗУ */
.user-profile {
    flex-shrink: 0; /* НЕ СЖИМАЕТСЯ */
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    background: var(--bg-secondary);
    margin-top: auto; /* КЛЮЧЕВОЕ СВОЙСТВО - ПРИЖИМАЕТ К НИЗУ */
}

.user-avatar {
    position: relative;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-circle);
    object-fit: cover;
    border: 2px solid var(--primary-color);
    transition: transform var(--transition-fast);
}

.user-avatar:hover img {
    transform: scale(1.05);
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-circle);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.logout-btn:hover {
    background: var(--danger-color);
    color: white;
    transform: rotate(90deg);
}

/* ОСТАЛЬНЫЕ СТИЛИ ОСТАЮТСЯ БЕЗ ИЗМЕНЕНИЙ... */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0px 0px;
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
    z-index: 90;
    backdrop-filter: blur(20px);
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-circle);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.mobile-menu-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    max-width: 400px;
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    transition: all var(--transition-fast);
}

.search-bar:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(42, 171, 238, 0.2);
}

.search-bar i {
    color: var(--text-muted);
    font-size: 16px;
}

.search-bar input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
}

.search-bar input::placeholder {
    color: var(--text-muted);
}

.quick-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.quick-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-circle);
    background: var(--bg-tertiary);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.quick-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.quick-btn:active {
    transform: translateY(0);
}

.notifications-indicator {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-circle);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.notifications-indicator:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.notifications-indicator.has-notifications {
    color: var(--primary-color);
}

.indicator {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    background: var(--danger-color);
    color: white;
    border-radius: 9px;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-profile-mini {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
}

.user-profile-mini:hover {
    background: var(--bg-hover);
}

.content-area {
    flex: 1;
    overflow: auto;
    position: relative;
}

.panel-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid var(--border-color);
}

.panel-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.chat-container {
    display: flex;
    height: calc(100vh - 65px);
    position: relative;
}

.chat-list-container {
    width: 280px;
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

.chat-list-header {
    padding: 20px 20px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-list-header h3 {
    font-size: 20px;
    font-weight: 700;
    flex: 1;
}

.chat-search {
    padding: 16px 20px;
}

.search-input {
    width: 100%;
    padding: 10px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
    transition: all var(--transition-fast);
}

.search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(42, 171, 238, 0.2);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.chat-list-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.chat-item:hover {
    background: var(--bg-hover);
}

.chat-item.active {
    background: var(--bg-active);
}

.chat-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary-color);
}

.chat-item-avatar {
    position: relative;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
}

.chat-item-avatar img {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-circle);
    object-fit: cover;
    border: 2px solid var(--primary-color);
}

.chat-item-info {
    flex: 1;
    min-width: 0;
}

.chat-item-name {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-item-name i {
    color: var(--text-muted);
    font-size: 12px;
}

.chat-item-last-message {
    font-size: 14px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.chat-item-time {
    font-size: 12px;
    color: var(--text-muted);
}

.chat-item-unread {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--primary-color);
    color: white;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-area-full {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 80;
}

.chat-info {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.chat-avatar-container {
    position: relative;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
}

.chat-avatar {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-circle);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    overflow: hidden;
}

.chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-edit-btn:hover {
    transform: scale(1.1);
}

.chat-details {
    flex: 1;
    min-width: 0;
}

.chat-details h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-status {
    font-size: 14px;
    color: var(--text-muted);
}

.chat-status.online {
    color: var(--success-color);
}

.chat-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-circle);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.chat-action-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.chat-messages-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

.message {
    display: flex;
    gap: 12px;
    animation: messageAppear 0.3s ease;
}

@keyframes messageAppear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.own {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    align-self: flex-start;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-circle);
    object-fit: cover;
    border: 2px solid var(--primary-color);
}

.message-content {
    max-width: 65%;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.message.own .message-content {
    align-items: flex-end;
}

.message-sender {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.message.own .message-sender {
    display: none;
}

.message-text {
    background: var(--bg-tertiary);
    padding: 10px 16px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.4;
    word-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
    overflow-wrap: break-word;
    white-space: normal;
    max-width: 100%;
    position: relative;
    border: 1px solid var(--border-light);
}

.message.own .message-text {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.message-text {
    overflow-wrap: anywhere;
}

.message-content {
    max-width: 65%;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.message.own .message-content {
    align-items: flex-end;
}

.message-text:has(> code),
.message-text:has(> pre) {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
}

.message-text.very-long {
    max-width: 90%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

.message-text a {
    color: #000000;
    text-decoration: none;
    word-break: break-all;
}

.message-text a:hover {
    text-decoration: underline;
}

.message-time {
    font-size: 12px;
    color: var(--text-muted);
    padding: 0 8px;
    align-self: flex-end;
    margin-top: 2px;
    white-space: nowrap;
}

.message.own .message-time {
    color: var(--primary-color);
}

@keyframes highlightMessage {
    0% {
        background-color: rgba(42, 171, 238, 0.1);
    }
    100% {
        background-color: transparent;
    }
}

.message.new .message-text {
    animation: highlightMessage 2s ease;
}

.message-text blockquote {
    border-left: 3px solid var(--primary-color);
    margin: 8px 0;
    padding-left: 12px;
    font-style: italic;
    color: var(--text-secondary);
}

.message-text ul,
.message-text ol {
    margin: 8px 0;
    padding-left: 20px;
}

.message-text li {
    margin-bottom: 4px;
}

.message-text {
    font-family: var(--font-primary), "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    line-height: 1.5;
}

.message-text:only-child:has(:global(🎉🎊🎈)) {
    font-size: 24px;
    line-height: 1.2;
    padding: 12px;
}

.message-file, .message-image {
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-light);
}

.message-file {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
}

.message-file i {
    font-size: 24px;
    color: var(--primary-color);
}

.file-info {
    flex: 1;
}

.file-name {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.file-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
}

.download-btn {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.download-btn:hover {
    text-decoration: underline;
}

.message-image {
    position: relative;
    max-width: 400px;
}

.image-container {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-md);
}

.chat-image {
    width: 100%;
    height: auto;
    display: block;
    cursor: pointer;
    transition: transform var(--transition-slow);
}

.chat-image:hover {
    transform: scale(1.02);
}

.image-overlay {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.image-container:hover .image-overlay {
    opacity: 1;
}

.image-download-btn, .image-fullscreen-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-circle);
    background: rgba(0, 0, 0, 0.6);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.image-download-btn:hover, .image-fullscreen-btn:hover {
    background: var(--primary-color);
    transform: scale(1.1);
}

.image-info {
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-tertiary);
}

.image-name, .image-size {
    font-size: 12px;
    color: var(--text-muted);
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    animation: typingPulse 2s infinite;
}

@keyframes typingPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.typing-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-circle);
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.typing-content {
    flex: 1;
}

.typing-text {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-circle);
    background: var(--primary-color);
    animation: typingDot 1.4s infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDot {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

.chat-input-container {
    padding: 0px 0px;
    background: var(--bg-secondary);
    position: sticky;
    bottom: 0;
    z-index: 80;
}

.chat-input {
    display: flex;
    align-items: flex-end;
    gap: 0px;
    border-radius: var(--radius-xl);
    padding: 0px 0px;
    border: 2px solid var(--border-light);
    transition: all var(--transition-fast);
}

.chat-input:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(42, 171, 238, 0.2);
}

.input-actions {
    display: flex;
    align-self: flex-start;
    padding-top: 6px;
}

.input-action-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-circle);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.input-action-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.message-input {
    flex: 1;
    min-height: 40px;
    max-height: 120px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.5;
    resize: none;
    outline: none;
    font-family: var(--font-primary);
    padding: 8px 0;
}

.message-input::placeholder {
    color: var(--text-muted);
}

.send-button {
    width: 43px;
    height: 43px;
    border-radius: var(--radius-circle);
    background: var(--primary-color);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    align-self: flex-end;
}

.send-button:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
}

.send-button:active {
    transform: scale(0.95);
}

.tasks-container {
    padding: 24px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.tasks-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.tasks-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.tasks-filter {
    display: flex;
    gap: 8px;
    background: var(--bg-tertiary);
    padding: 4px;
    border-radius: var(--radius-lg);
}

.filter-btn {
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.filter-btn.active {
    background: var(--primary-color);
    color: white;
}

.filter-btn:hover:not(.active) {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.tasks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.task-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 20px;
    transition: all var(--transition-normal);
    display: flex;
    flex-direction: column;
    gap: 16px;
    cursor: pointer;
    position: relative;
}

.task-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.task-card.priority-high {
    border-left: 4px solid var(--danger-color);
}

.task-card.priority-medium {
    border-left: 4px solid var(--warning-color);
}

.task-card.priority-low {
    border-left: 4px solid var(--success-color);
}

.task-card.priority-urgent {
    border-left: 4px solid var(--danger-color);
    animation: urgentPulse 2s infinite;
}

@keyframes urgentPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(255, 59, 48, 0); }
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.task-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    flex: 1;
    color: var(--text-primary);
}

.task-priority {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}

.priority-high { background: rgba(255, 59, 48, 0.2); color: var(--danger-color); }
.priority-medium { background: rgba(255, 149, 0, 0.2); color: var(--warning-color); }
.priority-low { background: rgba(52, 199, 89, 0.2); color: var(--success-color); }
.priority-urgent { background: rgba(255, 59, 48, 0.3); color: var(--danger-color); }

.task-description {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    margin: 8px 0;
    flex: 1;
}

.task-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.meta-item i {
    width: 16px;
    color: var(--text-muted);
}

.task-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}

.task-status {
    padding: 6px 12px;
    border-radius: var(--radius-md);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-pending { background: rgba(255, 149, 0, 0.2); color: var(--warning-color); }
.status-in_progress { background: rgba(42, 171, 238, 0.2); color: var(--primary-color); }
.status-completed { background: rgba(52, 199, 89, 0.2); color: var(--success-color); }
.status-cancelled { background: rgba(142, 142, 147, 0.2); color: var(--text-muted); }

.task-actions {
    display: flex;
    gap: 8px;
}

.friends-container {
    padding: 24px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.friends-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.friends-header-actions {
    display: flex;
    gap: 12px;
}

.friends-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-tertiary);
    padding: 4px;
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    overflow-x: auto;
}

.friends-tab {
    flex: 1;
    min-width: fit-content;
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
}

.friends-tab:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.friends-tab.active {
    background: var(--primary-color);
    color: white;
}

.tab-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--danger-color);
    color: white;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}

.friends-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.friends-tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.friends-tab-content.active {
    display: block;
}

.friends-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.friend-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    transition: all var(--transition-fast);
}

.friend-item:hover {
    background: var(--bg-hover);
    transform: translateX(4px);
}

.friend-avatar {
    position: relative;
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    cursor: pointer;
}

.friend-avatar img {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-circle);
    object-fit: cover;
    border: 3px solid var(--primary-color);
}

.friend-info {
    flex: 1;
    min-width: 0;
}

.friend-name {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.friend-username {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.friend-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    color: var(--text-muted);
}

.friend-actions {
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.friend-item:hover .friend-actions {
    opacity: 1;
}

.friend-action-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-circle);
    background: var(--bg-tertiary);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.chat-btn:hover { background: var(--primary-color); color: white; }
.group-btn:hover { background: var(--info-color); color: white; }
.remove-btn:hover { background: var(--danger-color); color: white; }

.friend-request-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    margin-bottom: 12px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.friend-request-avatar {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    cursor: pointer;
}

.friend-request-avatar img {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-circle);
    object-fit: cover;
    border: 3px solid var(--primary-color);
}

.friend-request-info {
    flex: 1;
    min-width: 0;
}

.friend-request-name {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.friend-request-message {
    font-size: 14px;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 8px;
    padding-left: 8px;
    border-left: 2px solid var(--primary-color);
}

.friend-request-time {
    font-size: 13px;
    color: var(--text-muted);
}

.friend-request-actions {
    display: flex;
    gap: 12px;
}

.search-users-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.search-users-input {
    display: flex;
    gap: 12px;
}

.search-results {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    transition: all var(--transition-fast);
}

.search-result-item:hover {
    background: var(--bg-hover);
    transform: translateX(4px);
}

.search-result-avatar {
    position: relative;
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    cursor: pointer;
}

.search-result-avatar img {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-circle);
    object-fit: cover;
    border: 3px solid var(--primary-color);
}

.search-result-info {
    flex: 1;
    min-width: 0;
}

.search-result-name {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.friend-status-badge {
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
}

.friend-status-badge.friend { background: rgba(52, 199, 89, 0.2); color: var(--success-color); }
.friend-status-badge.pending { background: rgba(255, 149, 0, 0.2); color: var(--warning-color); }
.friend-status-badge.received { background: rgba(42, 171, 238, 0.2); color: var(--primary-color); }

.search-result-username {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.search-result-status {
    display: flex;
    gap: 8px;
    font-size: 13px;
}

.online-status { color: var(--success-color); }
.offline-status { color: var(--text-muted); }

.search-result-actions {
    display: flex;
    gap: 12px;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(10px);
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
}

.modal-header .close {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-circle);
    background: var(--bg-tertiary);
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.modal-header .close:hover {
    background: var(--danger-color);
    color: white;
    transform: rotate(90deg);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(90vh - 80px);
}

.modal-footer {
    padding: 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: 15px;
    font-family: var(--font-primary);
    transition: all var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(42, 171, 238, 0.2);
}

.form-control::placeholder {
    color: var(--text-muted);
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='https://www.w3.org/2000/svg' width='16' height='16' fill='%238e8e93' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

.form-hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 32px;
}

@keyframes swipeHint {
    0%, 100% { 
        transform: translateY(-50%) translateX(100%);
        background: linear-gradient(135deg, var(--primary-color), var(--info-color));
    }
    50% { 
        transform: translateY(-50%) translateX(120%);
        background: linear-gradient(135deg, var(--info-color), var(--primary-color));
    }
}

.sidebar.mobile-open .swipe-indicator {
    display: none !important;
}

@media (max-width: 1024px) {
    .sidebar:not(.mobile-open) .swipe-indicator {
        display: flex;
        opacity: 1;
        pointer-events: auto;
        animation: swipeHint 2s infinite;
    }
    
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: var(--sidebar-width);
        transform: translateX(-100%);
        transition: transform var(--transition-normal) cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.2);
        z-index: 200;
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 199;
        backdrop-filter: blur(4px);
        transition: opacity var(--transition-normal) ease;
        opacity: 0;
    }
    
    .sidebar.mobile-open + .sidebar-overlay {
        display: block;
        opacity: 1;
    }
    
    .mobile-menu-btn {
        display: flex;
    }
    
    .sidebar-toggle-btn {
        display: none !important;
    }
    
    /* НА МОБИЛЬНОМ УБИРАЕМ ОТСТУП */
    .main-content {
        margin-left: 0 !important;
    }
}

@media (max-width: 768px) {
    .message-content {
        max-width: 85%;
    }
    
    .message-text {
        font-size: 14px;
        padding: 8px 14px;
    }
    
    .message-text:has(> code),
    .message-text:has(> pre) {
        font-size: 13px;
        padding: 10px;
    }
    
    .swipe-indicator {
        width: 28px;
        height: 28px;
        right: -14px;
    }
    
    .swipe-indicator i {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .message-content {
        max-width: 90%;
    }
    
    .message-text {
        font-size: 14px;
        padding: 8px 12px;
    }
    
    .message-text.very-long {
        font-size: 13px;
        padding: 6px 10px;
        border-radius: 14px;
    }
}

@keyframes showSwipeIndicator {
    0%, 80% {
        opacity: 1;
        pointer-events: auto;
    }
    100% {
        opacity: 0;
        pointer-events: none;
    }
}

@media (max-width: 1024px) {
    .sidebar:not(.mobile-open) .swipe-indicator {
        display: flex;
        opacity: 1;
        pointer-events: auto;
        animation: showSwipeIndicator 3s ease forwards, swipeHint 2s infinite 0.5s;
    }
}

.theme-toggle-btn {
    position: relative;
    overflow: hidden;
}

.theme-toggle-btn i {
    transition: transform 0.3s ease, color 0.2s ease;
}

.theme-toggle-btn:hover i {
    transform: rotate(15deg) scale(1.1);
}

.theme-toggle-btn:active i {
    transform: rotate(0deg) scale(0.95);
}

.sidebar .theme-indicator {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sidebar .theme-indicator:hover {
    transform: scale(1.1);
}

/* ====================== РЕАКЦИИ НА СООБЩЕНИЯ ====================== */

.message-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.reaction-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.reaction-badge:hover {
    background: var(--bg-hover);
    transform: scale(1.05);
}

.reaction-badge.user-reacted {
    background: rgba(35, 149, 8, 0.15);
    border-color: var(--primary-color);
}

.reaction-emoji {
    font-size: 14px;
}

.reaction-count {
    font-size: 11px;
    color: var(--text-secondary);
}

.reaction-menu {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
    animation: fadeInUp 0.2s ease;
    max-width: 260px;
    width: auto;
    min-width: 200px;
}

.reaction-menu.mobile {
    width: 90%;
    max-width: 260px;
}

.reaction-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

.reaction-menu-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-muted);
}

.reaction-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px;
    max-width: 100%;
}

.reaction-option {
    width: 44px;
    height: 44px;
    font-size: 24px;
    border: none;
    background: var(--bg-tertiary);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.reaction-option:hover {
    background: var(--bg-hover);
    transform: scale(1.1);
}

.reaction-option.active {
    background: rgba(35, 149, 8, 0.2);
    box-shadow: 0 0 0 2px var(--primary-color);
}

.reaction-menu-footer {
    padding: 8px 12px;
    border-top: 1px solid var(--border-color);
}

.remove-reaction-btn {
    width: 100%;
    padding: 6px;
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 12px;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Подсказка при наведении на реакцию */
.reaction-badge[data-users]:hover::after {
    content: attr(data-users);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    white-space: nowrap;
    box-shadow: var(--shadow-md);
    z-index: 100;
    pointer-events: none;
}

.message-bubble {
    display: inline-block;
    max-width: 100%;
}

/* В ваш основной CSS файл */
.upload-progress-container {
    position: relative;
    width: 200px;
    height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}

.upload-progress-bar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s ease;
    border-radius: 2px;
}

.upload-progress-text {
    position: absolute;
    right: 0;
    top: -18px;
    font-size: 10px;
    color: var(--text-secondary);
}

.message.uploading {
    opacity: 0.7;
}

.message.uploading .message-file {
    background: var(--bg-tertiary);
}

.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

/* ====================== МОДАЛЬНОЕ ОКНО ДЛЯ ИЗОБРАЖЕНИЙ (КАК В TELEGRAM) ====================== */

.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: imageModalFadeIn 0.2s ease;
}

.image-modal.closing {
    animation: imageModalFadeOut 0.2s ease forwards;
}

@keyframes imageModalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes imageModalFadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

.image-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(8px);
}

.image-modal-container {
    position: relative;
    z-index: 1;
    background: transparent;
    border-radius: 28px;
    overflow: hidden;
    animation: imageModalZoom 0.25s cubic-bezier(0.2, 0.9, 0.4, 1.1);
}

@keyframes imageModalZoom {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.image-modal-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), transparent);
    z-index: 2;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-modal-container:hover .image-modal-header,
.image-modal-header:focus-within {
    opacity: 1;
}

.image-modal-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.image-modal-name {
    color: white;
    font-size: 15px;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image-modal-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.image-modal-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.image-modal-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.image-modal-btn:active {
    transform: scale(0.95);
}

.image-modal-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 200px;
    min-height: 200px;
    background: transparent;
}

.image-modal-img {
    display: block;
    border-radius: 8px;
    object-fit: contain;
    cursor: pointer;
    transition: transform 0.2s ease;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.image-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 200px;
    min-height: 200px;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-error {
    color: white;
    text-align: center;
    font-size: 14px;
}

.loading-error i {
    font-size: 32px;
    margin-bottom: 12px;
    display: block;
}

.image-modal-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 20px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.5), transparent);
    text-align: center;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-modal-container:hover .image-modal-footer {
    opacity: 1;
}

.image-modal-size {
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
}

/* Мобильная версия */
@media (max-width: 768px) {
    .image-modal-header {
        padding: 12px 16px;
    }
    
    .image-modal-name {
        font-size: 13px;
        max-width: 180px;
    }
    
    .image-modal-btn {
        width: 32px;
        height: 32px;
    }
    
    .image-modal-footer {
        padding: 10px 16px;
    }
    
    .image-modal-size {
        font-size: 11px;
    }
}

/* Для очень маленьких экранов */
@media (max-width: 480px) {
    .image-modal-name {
        max-width: 120px;
    }
}
/* Поддержка свайпа для закрытия на мобильных */
@media (max-width: 768px) {
    .image-modal-img {
        cursor: default;
        touch-action: pan-y pinch-zoom;
    }
}
.message-menu {
    background: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    border: 1px solid var(--border-color);
    overflow: hidden;
    min-width: 180px;
    max-width: 260px;
    width: auto;
    z-index: 10001;
}

.message-menu.mobile {
    width: 90%;
    max-width: 180px;
}

.message-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
    color: var(--text-secondary);
}

.message-menu-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-muted);
}

.message-menu-actions {
    display: flex;
    flex-direction: column;
}

.message-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
    transition: background 0.2s;
    text-align: left;
}

.message-menu-item:hover {
    background: var(--bg-hover);
}

.message-menu-item i {
    width: 20px;
    color: var(--text-secondary);
}

.message-menu-item.delete-btn i {
    color: var(--danger-color);
}
.message-reply-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    border-left: 3px solid var(--primary-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.message-reply-preview:hover {
    background: var(--bg-hover);
}

.reply-preview-avatar {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.reply-preview-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.reply-preview-content {
    flex: 1;
    min-width: 0;
}

.reply-preview-sender {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 2px;
}

.reply-preview-text {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-edited {
    font-size: 10px;
    color: var(--text-muted);
    margin-left: 6px;
}

.message.own .message-edited {
    color: rgba(255, 255, 255, 0.6);
}
/* ====================== ПЕРЕСЛАННЫЕ СООБЩЕНИЯ ====================== */

.message-forward-badge {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding-bottom: 4px;
    border-bottom: 1px dashed var(--border-color);
}

.message-forward-badge i {
    font-size: 10px;
}

.message-forward-preview {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    margin-bottom: 8px;
    border: 1px solid var(--border-light);
}

.forward-preview-header {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.forward-preview-header i {
    font-size: 10px;
}

.forward-preview-content {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* ====================== АНИМАЦИЯ УДАЛЕНИЯ СООБЩЕНИЯ ====================== */

.message.removing {
    animation: messageFadeOut 0.3s ease forwards;
}

@keyframes messageFadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.8);
        display: none;
    }
}

/* ====================== ПАНЕЛЬ ОТВЕТА (REPLY BAR) ====================== */

.reply-bar {
    background: var(--bg-tertiary);
    border-radius: 12px;
    margin-bottom: 8px;
    padding: 8px 12px;
    border-left: 3px solid var(--primary-color);
    animation: slideDown 0.2s ease;
}

.reply-bar-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.reply-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.reply-info i {
    color: var(--primary-color);
}

.reply-preview {
    flex: 1;
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reply-cancel-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    padding: 0 4px;
}

.reply-cancel-btn:hover {
    color: var(--danger-color);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ====================== ПРЕДПРОСМОТР ПЕРЕСЫЛКИ В МОДАЛЬНОМ ОКНЕ ====================== */

.forward-preview {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
}

.forward-preview-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px dashed var(--border-color);
}

.forward-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    overflow: hidden;
}

.forward-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.forward-message {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    word-break: break-word;
    padding: 4px 0;
}

/* ====================== СТИЛИ ДЛЯ СООБЩЕНИЙ С ОТВЕТАМИ ====================== */

.message-reply-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    border-left: 3px solid var(--primary-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.message-reply-preview:hover {
    background: var(--bg-hover);
}

.reply-preview-avatar {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.reply-preview-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.reply-preview-content {
    flex: 1;
    min-width: 0;
}

.reply-preview-sender {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 2px;
}

.reply-preview-text {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ====================== ИНДИКАТОР РЕДАКТИРОВАНИЯ ====================== */

.message-edited {
    font-size: 10px;
    color: var(--text-muted);
    margin-left: 6px;
}

.message.own .message-edited {
    color: rgba(255, 255, 255, 0.6);
}

/* ====================== SCROLL TO BOTTOM БОТТОН ====================== */

.scroll-to-bottom-btn {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.2s ease;
    box-shadow: var(--shadow-md);
    z-index: 90;
}

.scroll-to-bottom-btn.visible {
    opacity: 1;
    transform: translateY(0);
}

.scroll-to-bottom-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
}

/* ====================== EMOJI И ТЕКСТ ====================== */

.message-text a {
    color: var(--text-primary);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    opacity: 0.9;
}

.message-text a:hover {
    opacity: 1;
}

.message.own .message-text a {
    color: white;
}
/* ====================== СТИЛИ ДЛЯ ОТВЕТОВ И ПЕРЕСЫЛОК ====================== */

/* Панель ответа (reply bar) */
.reply-bar {
    background: var(--bg-tertiary);
    border-radius: 12px;
    margin-bottom: 8px;
    padding: 8px 12px;
    border-left: 3px solid var(--primary-color);
    animation: slideDown 0.2s ease;
}

.reply-bar-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.reply-avatar {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.reply-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.reply-info {
    flex: 1;
    min-width: 0;
}

.reply-label {
    font-size: 12px;
    color: var(--primary-color);
    margin-bottom: 2px;
}

.reply-label i {
    margin-right: 4px;
}

.reply-preview {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reply-cancel-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    padding: 0 4px;
    transition: color 0.2s;
}

.reply-cancel-btn:hover {
    color: var(--danger-color);
}

/* Предпросмотр цитаты в сообщении */
.message-reply-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    border-left: 3px solid var(--primary-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.message.own .message-reply-preview {
    background: rgba(255, 255, 255, 0.1);
}

.message-reply-preview:hover {
    background: var(--bg-hover);
    transform: translateX(2px);
}

.reply-preview-avatar {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.reply-preview-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.reply-preview-content {
    flex: 1;
    min-width: 0;
}

.reply-preview-sender {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 2px;
}

.reply-preview-text {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-reply-preview i {
    color: var(--text-muted);
    font-size: 12px;
    opacity: 0.5;
}

/* Пересланные сообщения */
.message-forward-badge {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding-bottom: 4px;
    border-bottom: 1px dashed var(--border-color);
}

.message-forward-badge i {
    font-size: 10px;
}

.message-forward-preview {
    background: rgba(0, 0, 0, 0.03);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
}

.message.own .message-forward-preview {
    background: rgba(255, 255, 255, 0.08);
}

.message-forward-preview i {
    margin-right: 6px;
    font-size: 11px;
    opacity: 0.5;
}

/* Анимации */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

/* Подсветка цитируемого сообщения */
.message.highlight .message-bubble {
    animation: highlightMessage 2s ease;
}

@keyframes highlightMessage {
    0% {
        background-color: rgba(35, 149, 8, 0.2);
    }
    100% {
        background-color: transparent;
    }
}

/* Модальное окно пересылки */
.forward-sender-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
}

.forward-sender-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.forward-sender-name {
    font-weight: 600;
    color: var(--primary-color);
}

.forward-message {
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    font-size: 14px;
    color: var(--text-secondary);
    max-height: 150px;
    overflow-y: auto;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-label i {
    color: var(--text-muted);
}
/* Аватар в пересланном сообщении */
.forward-preview-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.forward-avatar {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    overflow: hidden;
}

.forward-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Аватар в панели ответа */
.reply-bar-content .reply-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.reply-bar-content .reply-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.reply-bar-content .reply-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.reply-bar-content .reply-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Панель редактирования сообщения */
.edit-bar {
    background: var(--bg-tertiary);
    border-radius: 12px;
    margin-bottom: 8px;
    padding: 8px 12px;
    border-left: 3px solid var(--warning-color);
    animation: slideDown 0.2s ease;
}

.edit-bar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.edit-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--warning-color);
}

.edit-info i {
    font-size: 14px;
}

.edit-cancel-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    padding: 0 4px;
}

.edit-cancel-btn:hover {
    color: var(--danger-color);
}

/* Индикатор активного звонка в чате */
.call-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    background: rgba(35, 149, 8, 0.15);
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 6px;
}

.call-indicator:hover {
    background: rgba(35, 149, 8, 0.25);
}

.call-indicator i {
    font-size: 12px;
    color: var(--primary-color);
}

.call-indicator span {
    color: var(--text-secondary);
}

.call-indicator-join-btn {
    background: var(--primary-color);
    border: none;
    border-radius: 16px;
    padding: 4px 10px;
    color: white;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.call-indicator-join-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.02);
}

/* Мини-индикатор в списке чатов */
.chat-item-call-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    background: var(--primary-color);
    border-radius: 12px;
    font-size: 10px;
    color: white;
    margin-left: 8px;
}

.chat-item-call-badge i {
    font-size: 10px;
}

/* Панель редактирования сообщения */
.edit-bar {
    background: var(--bg-tertiary);
    border-radius: 12px;
    margin-bottom: 8px;
    padding: 8px 12px;
    border-left: 3px solid var(--warning-color);
    animation: slideDown 0.2s ease;
}

.edit-bar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.edit-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--warning-color);
}

.edit-info i {
    font-size: 14px;
}

.edit-cancel-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    padding: 0 4px;
}

.edit-cancel-btn:hover {
    color: var(--danger-color);
}

/* Анимация для удаления сообщения */
.message.removing {
    animation: messageFadeOut 0.3s ease forwards;
}

@keyframes messageFadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.8);
        display: none;
    }
}

/* Стили для блока пересланного сообщения */
.forward-preview {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 8px;
    border: 1px solid var(--border-light);
}

.forward-preview-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px dashed var(--border-color);
}

.forward-avatar {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    overflow: hidden;
}

.forward-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.forward-message {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
    word-break: break-word;
}

/* Стили для кнопок звонка в хедере чата */
.chat-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-circle);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.chat-action-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

#group-video-call-btn:hover {
    color: var(--primary-color);
}

#group-audio-call-btn:hover {
    color: var(--success-color);
}

/* Кнопка прокрутки вниз */
.scroll-to-bottom-btn {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.2s ease;
    box-shadow: var(--shadow-md);
    z-index: 90;
}

.scroll-to-bottom-btn.visible {
    opacity: 1;
    transform: translateY(0);
}

.scroll-to-bottom-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
}

/* Анимация появления */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
/* ====================== АДМИН-ПАНЕЛЬ ====================== */

.admin-panel {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.admin-header h2 {
    font-size: 24px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.admin-stats .stat-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.admin-stats .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-color);
}

.admin-stats .stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.admin-users-section {
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 12px;
}

.section-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.search-box {
    position: relative;
    width: 250px;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-box input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    color: var(--text-primary);
}

.users-list {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    transition: all 0.2s;
}

.user-item:hover {
    background: var(--bg-hover);
    transform: translateX(4px);
}

.user-avatar {
    position: relative;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.user-status {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--bg-tertiary);
}

.user-status.online {
    background: #34c759;
}

.user-status.offline {
    background: #8e8e93;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 2px;
}

.user-username {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.role-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
}

.role-badge.admin {
    background: linear-gradient(135deg, #34c759, rgba(0, 122, 255, 0.3));
    color: white;
}

.role-badge.technician {
    background: rgba(52, 199, 89, 0.2);
    color: #34c759;
}

.role-badge.user {
    background: rgba(88, 86, 214, 0.2);
    color: #5856d6;
}

.user-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.action-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.action-btn:hover {
    background: var(--primary-color);
    color: white;
}

.delete-btn:hover {
    background: var(--danger-color);
}

.chat-role-badge {
    width: 14px;
    height: 14px;
    margin-left: 6px;
    vertical-align: middle;
    display: inline-block;
}

.chat-item-name {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}

.chat-item-name .chat-role-badge {
    margin-left: 4px;
}

/* ====================== МОБИЛЬНАЯ АДАПТАЦИЯ ====================== */

@media (max-width: 768px) {
    .admin-panel {
        padding: 12px;
    }
    
    .admin-header h2 {
        font-size: 20px;
        margin-bottom: 16px;
    }
    
    .admin-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-bottom: 16px;
    }
    
    .admin-stats .stat-card {
        padding: 12px;
    }
    
    .admin-stats .stat-value {
        font-size: 22px;
    }
    
    .admin-stats .stat-label {
        font-size: 11px;
    }
    
    .section-header {
        flex-direction: column;
        align-items: stretch;
        padding: 12px 16px;
    }
    
    .search-box {
        width: 100%;
    }
    
    .users-list {
        padding: 8px;
    }
    
    .user-item {
        padding: 10px;
        gap: 12px;
    }
    
    .user-avatar {
        width: 44px;
        height: 44px;
    }
    
    .user-name {
        font-size: 14px;
    }
    
    .user-username {
        font-size: 11px;
    }
    
    .action-btn {
        width: 32px;
        height: 32px;
    }
}

@media (max-width: 480px) {
    .admin-stats {
        gap: 8px;
    }
    
    .admin-stats .stat-card {
        padding: 10px;
    }
    
    .admin-stats .stat-value {
        font-size: 18px;
    }
    
    .user-item {
        flex-wrap: wrap;
    }
    
    .user-actions {
        width: 100%;
        justify-content: flex-end;
        padding-top: 8px;
        border-top: 1px solid var(--border-light);
    }
}
/* ====================== МОДАЛЬНОЕ ОКНО ДЛЯ ВЫБОРА РОЛИ ====================== */

#change-role-modal .modal-content {
    max-width: 400px;
}

.role-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.role-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
    background: var(--bg-tertiary);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid var(--border-light);
}

.role-option:hover {
    background: var(--bg-hover);
    border-color: var(--primary-color);
}

.role-option.selected {
    border-color: var(--primary-color);
    background: rgba(35, 149, 8, 0.1);
}

.role-option input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.role-option-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.role-option-content i {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: 50%;
    font-size: 16px;
    color: var(--primary-color);
}

.role-option-info {
    flex: 1;
}

.role-option-info strong {
    display: block;
    font-size: 15px;
    margin-bottom: 4px;
}

.role-option-info small {
    font-size: 11px;
    color: var(--text-muted);
}

/* Мобильная версия модального окна */
@media (max-width: 480px) {
    #change-role-modal .modal-content {
        width: 95%;
        margin: 10px;
        border-radius: 16px;
    }
    
    .role-option {
        padding: 10px;
    }
    
    .role-option-content i {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
    
    .role-option-info strong {
        font-size: 14px;
    }
    
    .role-option-info small {
        font-size: 10px;
    }
    
    .modal-footer {
        flex-direction: column;
        gap: 8px;
    }
    
    .modal-footer button {
        width: 100%;
    }
}
/* ====================== МОДАЛЬНОЕ ОКНО ПРОФИЛЯ ПОЛЬЗОВАТЕЛЯ ====================== */

#user-profile-modal .modal-content {
    max-width: 480px;
    padding: 0;
    overflow: hidden;
    border-radius: 24px;
}

.user-profile-modal {
    position: relative;
}

.profile-cover {
    padding: 40px 20px 60px;
    text-align: center;
    position: relative;
}

.profile-avatar-large {
    position: relative;
    display: inline-block;
}

.profile-avatar-large img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid white;
    box-shadow: var(--shadow-md);
}

.profile-status-badge {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: var(--bg-secondary);
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
}

.profile-status-badge i {
    font-size: 8px;
}

.profile-status-badge.online {
    color: var(--success-color);
}

.profile-status-badge.offline {
    color: var(--text-muted);
}

.profile-info-section {
    padding: 20px 24px 24px;
    background: var(--bg-secondary);
}

.profile-name {
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    margin: 0 0 4px;
}

.profile-username {
    font-size: 14px;
    color: var(--text-muted);
    text-align: center;
    margin: 0 0 20px;
}

.profile-stats {
    display: flex;
    justify-content: space-around;
    padding: 16px 0;
    margin-bottom: 20px;
    background: var(--bg-tertiary);
    border-radius: 16px;
}

.profile-stat {
    text-align: center;
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.profile-details {
    margin-bottom: 24px;
}

.detail-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
}

.detail-item:last-child {
    border-bottom: none;
}

.detail-icon {
    width: 36px;
    height: 36px;
    background: var(--bg-tertiary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.detail-icon i {
    font-size: 16px;
    color: var(--primary-color);
}

.detail-content {
    flex: 1;
}

.detail-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 2px;
}

.detail-value {
    font-size: 15px;
    font-weight: 500;
    word-break: break-word;
}

.role-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.role-badge.admin {
    background: linear-gradient(135deg, #34c759, rgba(0, 122, 255, 0.3));
    color: white;
}

.role-badge.technician {
    background: rgba(52, 199, 89, 0.15);
    color: #34c759;
}

.role-badge.user {
    background: rgba(88, 86, 214, 0.15);
    color: #5856d6;
}
.role-badge.senior {
    background: rgba(255, 149, 0, 0.15);
    color: #ff9500;
}

.role-badge.senior i {
    color: #ff9500;
}
.profile-actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.profile-action-group {
    display: flex;
    gap: 12px;
    width: 100%;
}
.role-icon {
    width: 12px;
    height: 12px;
    vertical-align: middle;
    margin-right: 2px;
}

.role-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
}

.role-badge i, 
.role-badge img {
    font-size: 10px;
}
.profile-action-btn {
    flex: 1;
    padding: 12px 16px;
    border-radius: 40px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.profile-action-btn.primary {
    background: var(--primary-color);
    color: white;
}

.profile-action-btn.primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.profile-action-btn.success {
    background: var(--success-color);
    color: white;
}

.profile-action-btn.success:hover {
    background: #2db84c;
}

.profile-action-btn.danger {
    background: var(--danger-color);
    color: white;
}

.profile-action-btn.danger:hover {
    background: #e33c32;
}

.profile-action-btn.pending {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    cursor: not-allowed;
}

.profile-action-btn:active {
    transform: translateY(1px);
}

/* Мобильная адаптация */
@media (max-width: 480px) {
    #user-profile-modal .modal-content {
        width: 95%;
        margin: 10px;
        border-radius: 20px;
    }
    
    .profile-cover {
        padding: 30px 16px 50px;
    }
    
    .profile-avatar-large img {
        width: 80px;
        height: 80px;
    }
    
    .profile-info-section {
        padding: 16px 20px 20px;
    }
    
    .profile-name {
        font-size: 20px;
    }
    
    .profile-stats {
        padding: 12px 0;
    }
    
    .stat-value {
        font-size: 18px;
    }
    
    .profile-actions {
        flex-direction: column;
    }
    
    .profile-action-group {
        flex-direction: column;
    }
    
    .profile-action-btn {
        padding: 10px 14px;
    }
}
/* Бейдж роли в карточке друга */
.friend-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.role-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
}

.role-badge.admin {
    background: linear-gradient(135deg, #34c759, rgba(0, 122, 255, 0.3));
    color: white;
}

.role-badge.senior {
    background: linear-gradient(135deg, #FF9800, #FF5722);
    color: white;
}

.role-badge.technician {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: white;
}

.role-badge.user {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}
.chat-details {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.chat-details h3 {
    margin: 0;
    display: inline-flex;
    align-items: center;
}

.chat-header-role-badge {
    display: inline-flex;
    align-items: center;
    margin-left: 0;
}

.chat-header-role-badge .role-icon {
    width: 14px;
    height: 14px;
    vertical-align: middle;
}
.message-image,
.message-file,
.message-text {
    cursor: pointer;
    position: relative;
}

.message-image:hover,
.message-file:hover,
.message-text:hover {
    filter: brightness(0.98);
}

.message-image .image-container {
    position: relative;
}

@media (max-width: 768px) {
    .message-image,
    .message-file {
        min-height: 44px;
    }
}