/* ============================================================================
   🇷🇺 ЦУР «Кузя» - Модуль Чатов
   Продакшен-версия с полным интерактивом
   ========================================================================== */

:root {
    /* Цвета */
    --primary: #667eea;
    --primary-dark: #5568d3;
    --secondary: #764ba2;
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #f87171;
    --info: #38bdf8;
    
    /* Фон */
    --bg-dark: #1a1a1a;
    --bg-dark-2: #252525;
    --bg-dark-3: #2d2d2d;
    --bg-dark-4: #333333;
    
    /* Текст */
    --text-primary: #ffffff;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --text-disabled: #64748b;
    
    /* Границы */
    --border: #333333;
    --border-light: #404040;
    
    /* Тени */
    --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);
    
    /* Радиусы */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;
    
    /* Размеры */
    --sidebar-width: 380px;
    --sidebar-right-width: 320px;
    --header-height: 60px;
    
    /* Анимации */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* Шрифты - читаемые, крупные */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Основной контейнер */
#main-content {
    display: flex;
    height: calc(100vh - var(--header-height));
    background: var(--bg-dark);
    overflow: hidden;
}

/* Боковая панель с чатами */
.chat-sidebar {
    width: var(--sidebar-width);
    background: var(--bg-dark-2);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: var(--transition-normal);
}

.sidebar-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
}

.sidebar-title {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-actions {
    display: flex;
    gap: 8px;
}

.sidebar-search {
    position: relative;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-dark-2);
}

.sidebar-search input {
    width: 100%;
    padding: 12px 36px 12px 16px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    background: var(--bg-dark-3);
    color: var(--text-primary);
    font-size: 15px;
    transition: var(--transition-fast);
}

.sidebar-search input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.sidebar-search .search-icon {
    position: absolute;
    right: 32px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 16px;
}

.sidebar-tabs {
    display: flex;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    background: var(--bg-dark-2);
}

.tab-btn {
    flex: 1;
    padding: 10px 8px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    border-bottom: 3px solid transparent;
}

.tab-btn:hover {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
}

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

.chat-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.chat-list::-webkit-scrollbar {
    width: 6px;
}

.chat-list::-webkit-scrollbar-track {
    background: var(--bg-dark-2);
}

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

.chat-list::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Элемент чата */
.chat-item {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    cursor: pointer;
    transition: var(--transition-fast);
    border-left: 3px solid transparent;
    position: relative;
}

.chat-item:hover {
    background: var(--bg-dark-3);
}

.chat-item.unread {
    background: rgba(102, 126, 234, 0.1);
    border-left: 3px solid var(--primary);
}

.chat-item.active {
    background: var(--bg-dark-3);
    border-left: 3px solid var(--primary);
}

.chat-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20px;
    right: 20px;
    height: 1px;
    background: var(--border);
    opacity: 0.3;
}

.chat-avatar {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 16px;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    box-shadow: var(--shadow-sm);
}

.chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-avatar span {
    font-size: 24px;
    font-weight: 700;
    color: white;
}

.chat-avatar-status {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 14px;
    height: 14px;
    border-radius: var(--radius-full);
    border: 2px solid var(--bg-dark-2);
}

.chat-avatar-status.online {
    background: var(--success);
}

.chat-avatar-status.offline {
    background: var(--text-disabled);
}

.unread-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background: var(--danger);
    color: white;
    font-size: 11px;
    width: 22px;
    height: 22px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

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

.chat-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    align-items: center;
}

.chat-name {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
    transition: var(--transition-fast);
}

.chat-time {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    margin-left: 12px;
    font-weight: 500;
}

.chat-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.chat-preview {
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
    transition: var(--transition-fast);
}

.chat-members {
    color: var(--success);
    background: rgba(52, 211, 153, 0.15);
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
}

.chat-type-badge {
    background: var(--info);
    color: white;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
}

/* Основная область чата */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-dark);
    overflow: hidden;
}

.chat-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.2);
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.chat-header-avatar {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    cursor: pointer;
}

.chat-header-avatar span {
    font-size: 26px;
    font-weight: 700;
    color: white;
}

.chat-header-info h1 {
    margin: 0 0 4px 0;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

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

.chat-header-actions {
    display: flex;
    gap: 12px;
}

.chat-header-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    background: var(--bg-dark-3);
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    font-size: 18px;
}

.chat-header-btn:hover {
    background: var(--border);
    transform: translateY(-2px);
}

/* Сообщения */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--bg-dark);
}

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

.chat-messages::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

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

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.message {
    max-width: 75%;
    padding: 14px 18px;
    border-radius: 18px;
    position: relative;
    animation: messageSlide 0.3s ease;
    box-shadow: var(--shadow-sm);
}

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

.message.outgoing {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    border-bottom-right-radius: 6px;
}

.message.incoming {
    align-self: flex-start;
    background: var(--bg-dark-3);
    color: var(--text-primary);
    border-bottom-left-radius: 6px;
}

.message-content {
    margin-bottom: 10px;
    line-height: 1.6;
    word-wrap: break-word;
    font-size: 15px;
    font-weight: 400;
}

.message-media {
    margin-top: 12px;
}

/* Аудио сообщение */
.message-audio {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.message-audio:hover {
    background: rgba(0, 0, 0, 0.4);
}

.audio-player {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
}

.audio-controls {
    display: flex;
    align-items: center;
    gap: 14px;
}

.audio-play-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: var(--transition-fast);
}

.audio-play-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

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

.audio-timeline {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    overflow: hidden;
    cursor: pointer;
    position: relative;
}

.audio-progress {
    height: 100%;
    background: var(--primary);
    width: 0%;
    border-radius: var(--radius-full);
    transition: width 0.1s linear;
}

.audio-duration {
    font-size: 13px;
    color: var(--text-secondary);
    min-width: 50px;
    text-align: right;
    font-family: 'SF Mono', 'Monaco', monospace;
    font-weight: 600;
}

/* Видео сообщение */
.message-video {
    max-width: 100%;
    border-radius: 12px;
    overflow: hidden;
    margin-top: 12px;
    box-shadow: var(--shadow-md);
}

.message-video video {
    width: 100%;
    max-height: 450px;
    display: block;
    background: var(--bg-dark-3);
}

/* Файл */
.message-file {
    margin-top: 12px;
}

.file-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition-fast);
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.file-link:hover {
    background: rgba(102, 126, 234, 0.1);
    transform: translateX(6px);
    border-color: var(--primary);
}

.file-link i {
    font-size: 22px;
}

.file-size {
    color: var(--text-muted);
    font-size: 13px;
    margin-left: 8px;
    font-weight: 500;
}

/* Мета информация сообщения */
.message-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 12px;
}

.message-sender {
    color: var(--text-muted);
    font-weight: 600;
}

.message-time {
    color: var(--text-muted);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

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

.message-status {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
}

.message-status.read {
    color: var(--success);
}

/* Поле ввода */
.chat-input-area {
    padding: 18px 24px;
    border-top: 1px solid var(--border);
    background: var(--bg-dark-2);
}

.chat-input-wrapper {
    display: flex;
    gap: 14px;
    align-items: flex-end;
}

.chat-actions {
    display: flex;
    gap: 10px;
}

.chat-action-btn {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    background: var(--bg-dark-3);
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    font-size: 20px;
    position: relative;
}

.chat-action-btn:hover {
    background: var(--border);
    transform: translateY(-3px);
    box-shadow: var(--shadow-sm);
}

.chat-action-btn:active {
    transform: translateY(0);
}

.chat-action-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.5);
}

.chat-input-container {
    flex: 1;
    position: relative;
}

.chat-input {
    width: 100%;
    padding: 16px 60px 16px 20px;
    border-radius: 26px;
    border: 1px solid var(--border);
    background: var(--bg-dark-3);
    color: var(--text-primary);
    font-size: 15px;
    resize: none;
    min-height: 26px;
    max-height: 180px;
    line-height: 1.6;
    transition: var(--transition-fast);
    font-family: inherit;
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.2);
}

.chat-input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

.chat-input-send {
    position: absolute;
    right: 16px;
    bottom: 16px;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    font-size: 20px;
}

.chat-input-send:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

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

.chat-input-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Правая панель */
.chat-sidebar-right {
    width: var(--sidebar-right-width);
    background: var(--bg-dark-2);
    border-left: 1px solid var(--border);
    overflow-y: auto;
    padding: 20px;
}

.sidebar-right-section {
    margin-bottom: 28px;
}

.sidebar-right-section h3 {
    margin: 0 0 16px 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary);
}

/* Статистика */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.stat-card {
    background: var(--bg-dark-3);
    padding: 16px;
    border-radius: var(--radius-md);
    text-align: center;
    border: 1px solid var(--border);
    transition: var(--transition-fast);
}

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

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Системные метрики */
.system-metrics {
    background: var(--bg-dark-3);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.metric-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
}

.metric-row:last-child {
    border-bottom: none;
}

.metric-label {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
}

.metric-value {
    color: var(--success);
    font-weight: 700;
    font-size: 14px;
    font-family: 'SF Mono', 'Monaco', monospace;
}

/* Архивация */
.archive-info {
    background: var(--bg-dark-3);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
}

.archive-info p {
    margin: 8px 0;
}

.archive-info strong {
    color: var(--primary);
}

.archive-stats {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-muted);
}

.archive-stats strong {
    color: var(--success);
}

/* Онлайн пользователи */
.online-users {
    background: var(--bg-dark-3);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.online-user-item {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
}

.online-user-item:last-child {
    border-bottom: none;
}

.online-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    margin-right: 12px;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    color: white;
}

.online-user-info {
    flex: 1;
}

.online-user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

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

.online-user-status {
    width: 10px;
    height: 10px;
    border-radius: var(--radius-full);
    background: var(--success);
    margin-left: 8px;
}

/* Модальные окна */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    animation: modalFadeIn 0.3s ease;
}

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

.modal-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--bg-dark-2);
    margin: 5% auto;
    padding: 0;
    border-radius: var(--radius-lg);
    max-width: 650px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    overflow: hidden;
    animation: modalSlideUp 0.4s ease;
}

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

.chat-modal {
    max-width: 600px;
}

.chat-info-modal {
    max-width: 500px;
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.1);
}

.modal-header h2 {
    margin: 0;
    color: var(--text-primary);
    font-size: 24px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 36px;
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.modal-close:hover {
    color: var(--text-primary);
    transform: rotate(90deg);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: 70vh;
}

/* Формы */
.form-group {
    margin-bottom: 24px;
}

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

.required {
    color: var(--danger);
    margin-left: 4px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-dark-3);
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    transition: var(--transition-fast);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.2);
}

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

.form-hint {
    display: block;
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 13px;
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-checkbox input {
    width: auto;
    margin: 0;
}

.form-checkbox label {
    margin: 0;
    font-weight: 500;
    font-size: 14px;
    color: var(--text-secondary);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 14px;
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

/* Участники чата */
.participants-container {
    background: var(--bg-dark-3);
    border-radius: var(--radius-md);
    padding: 18px;
    border: 1px solid var(--border);
}

.participants-selected {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
    min-height: 48px;
}

.participant-item {
    background: var(--border);
    padding: 8px 14px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-primary);
    transition: var(--transition-fast);
}

.participant-item.self {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
}

.participant-item button {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 16px;
    padding: 0;
    line-height: 1;
    opacity: 0.7;
    transition: var(--transition-fast);
}

.participant-item button:hover {
    opacity: 1;
    transform: scale(1.2);
}

.participants-search {
    position: relative;
}

.participants-search input {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-dark-2);
    color: var(--text-primary);
    font-size: 15px;
    transition: var(--transition-fast);
}

.participants-search input:focus {
    outline: none;
    border-color: var(--primary);
}

.search-results {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 10px);
    background: var(--bg-dark-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    display: none;
    box-shadow: var(--shadow-md);
}

.search-result-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-result-item:hover {
    background: var(--bg-dark-3);
}

.search-result-item img {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    object-fit: cover;
}

/* Пустые состояния */
.empty-state, .chat-empty, .loading {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}

.empty-icon, .loading-icon {
    font-size: 80px;
    margin-bottom: 24px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.empty-state h2, .chat-empty h2 {
    color: var(--text-primary);
    font-size: 26px;
    margin-bottom: 12px;
    font-weight: 700;
}

.empty-state p, .chat-empty p {
    margin-bottom: 24px;
    font-size: 16px;
    line-height: 1.6;
}

.loading {
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 500;
}

/* Анимации */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}

/* Адаптивность */
@media (max-width: 1280px) {
    .chat-sidebar {
        width: 320px;
    }
    
    .chat-sidebar-right {
        width: 280px;
    }
}

@media (max-width: 1024px) {
    .chat-sidebar {
        width: 280px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    #main-content {
        flex-direction: column;
    }
    
    .chat-sidebar {
        width: 100%;
        height: auto;
        max-height: 45vh;
    }
    
    .chat-main {
        height: auto;
    }
    
    .chat-sidebar-right {
        width: 100%;
        max-height: 55vh;
    }
    
    .chat-item {
        padding: 12px 16px;
    }
    
    .chat-avatar {
        width: 48px;
        height: 48px;
    }
    
    .chat-name {
        font-size: 16px;
    }
    
    .message {
        max-width: 90%;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .chat-sidebar {
        max-height: 40vh;
    }
    
    .sidebar-title {
        font-size: 22px;
    }
    
    .modal-content {
        margin: 10% auto;
        width: 95%;
    }
    
    .sidebar-tabs {
        overflow-x: auto;
        padding: 8px;
    }
    
    .tab-btn {
        min-width: 100px;
        padding: 10px;
        font-size: 13px;
    }
}
