/* Виртуализированный список */
.virtual-viewport {
    overflow-y: auto;
    height: 100%;
    position: relative;
}

.virtual-viewport::-webkit-scrollbar {
    width: 6px;
}

.virtual-viewport::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.virtual-viewport::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 3px;
}

/* Индикатор загрузки */
.loading-spinner {
    text-align: center;
    padding: 40px;
    color: #667eea;
    font-size: 18px;
    animation: pulse 1.5s ease-in-out infinite;
}

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

/* Статусы сообщений */
.message-status {
    font-size: 12px;
    margin-left: 5px;
    color: #a0aec0;
}

.own-message .message-status {
    color: #e2e8f0;
}

/* Удаленные сообщения */
.message-deleted {
    padding: 8px 12px;
    background: #f7fafc;
    border-radius: 12px;
    color: #a0aec0;
    font-style: italic;
    text-align: center;
}

/* Действия с сообщением */
.message-actions {
    position: absolute;
    top: 5px;
    right: 5px;
    opacity: 0;
    transition: opacity 0.2s;
}

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

.btn-delete-message {
    padding: 4px 8px;
    background: #fc8181;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.btn-delete-message:hover {
    background: #f56565;
}

/* Модальное окно */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s;
}

.modal-content {
    background: white;
    border-radius: 15px;
    padding: 25px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideUp 0.3s;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
}

.modal-header h3 {
    color: #667eea;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #a0aec0;
}

.modal-close:hover {
    color: #667eea;
}

.modal-body {
    margin-bottom: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid #e2e8f0;
}

/* Адаптивность для модальных окон */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        padding: 15px;
    }
}

/* Уведомления */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    border-left: 4px solid #667eea;
    z-index: 1001;
    animation: slideInRight 0.3s;
}

.notification.error {
    border-left-color: #f56565;
}

.notification.success {
    border-left-color: #48bb78;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Офлайн индикатор */
.offline-indicator {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: #f56565;
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 14px;
    box-shadow: 0 2px 10px rgba(245, 101, 101, 0.3);
    z-index: 1000;
}

/* ========== ОСНОВНЫЕ СТИЛИ ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ========== ШАПКА И НАВИГАЦИЯ ========== */
header {
    background: white;
    padding: 20px 30px;
    border-radius: 15px;
    margin-bottom: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

header h1 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 28px;
    font-weight: 600;
}

nav {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

nav a {
    color: #555;
    text-decoration: none;
    padding: 8px 20px;
    border-radius: 25px;
    transition: all 0.3s;
    font-weight: 500;
    background: #f7fafc;
}

nav a:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.3);
}

/* ========== ОСНОВНОЙ КОНТЕЙНЕР ========== */
main {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    min-height: 500px;
}

/* ========== ПРИВЕТСТВЕННАЯ СТРАНИЦА ========== */
.welcome-section {
    text-align: center;
    padding: 40px 20px;
}

.welcome-section h2 {
    color: #667eea;
    font-size: 32px;
    margin-bottom: 20px;
}

.welcome-section p {
    color: #666;
    font-size: 18px;
    margin-bottom: 40px;
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-top: 40px;
}

.feature-card {
    background: #f7fafc;
    padding: 30px 20px;
    border-radius: 10px;
    transition: all 0.3s;
    border: 1px solid #e2e8f0;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
    border-color: #667eea;
}

.feature-card h3 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 20px;
}

.feature-card p {
    color: #666;
    font-size: 14px;
    margin-bottom: 0;
}

/* ========== ФОРМЫ АВТОРИЗАЦИИ ========== */
.auth-form {
    max-width: 450px;
    margin: 0 auto;
    padding: 20px;
}

.auth-form h2 {
    color: #667eea;
    margin-bottom: 30px;
    text-align: center;
    font-size: 28px;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 600;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s;
    background: #f8fafc;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input:invalid:not(:placeholder-shown) {
    border-color: #fc8181;
}

.form-group input:valid:not(:placeholder-shown) {
    border-color: #48bb78;
}

.hint {
    display: block;
    margin-top: 5px;
    color: #888;
    font-size: 12px;
}

/* ========== КНОПКИ ========== */
.btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    padding: 10px 25px;
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(72, 187, 120, 0.4);
}

/* ========== СООБЩЕНИЯ ОБ ОШИБКАХ ========== */
.error-message {
    background: #fff5f5;
    color: #c53030;
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #fc8181;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.error-message::before {
    content: "⚠️";
    font-size: 16px;
}

.message {
    background: #f0fff4;
    color: #22543d;
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #9ae6b4;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.message::before {
    content: "✅";
    font-size: 16px;
}

.auth-link {
    text-align: center;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.auth-link a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.auth-link a:hover {
    text-decoration: underline;
}

/* ========== ПРОФИЛЬ ========== */
.profile-container {
    max-width: 700px;
    margin: 0 auto;
}

.profile-container h2 {
    color: #667eea;
    margin-bottom: 30px;
    font-size: 28px;
    text-align: center;
}

.profile-info {
    display: flex;
    gap: 40px;
    margin-bottom: 40px;
    padding: 30px;
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border-radius: 15px;
    border: 1px solid #e2e8f0;
}

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

.avatar {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #667eea;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    transition: transform 0.3s;
}

.avatar:hover {
    transform: scale(1.05);
}

.info-section {
    flex: 1;
}

.info-section p {
    margin-bottom: 15px;
    font-size: 16px;
    padding: 10px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.info-section strong {
    color: #4a5568;
    width: 130px;
    display: inline-block;
    font-weight: 600;
}

.profile-edit {
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    padding: 30px;
    border-radius: 15px;
    border: 1px solid #e2e8f0;
}

.profile-edit h3 {
    color: #667eea;
    margin-bottom: 25px;
    font-size: 22px;
}

/* ========== ПОИСК ========== */
.search-container {
    max-width: 900px;
    margin: 0 auto;
}

.search-container h2 {
    color: #667eea;
    margin-bottom: 30px;
    font-size: 28px;
    text-align: center;
}

.search-box {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
}

.search-box input {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s;
    background: #f8fafc;
}

.search-box input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: white;
}

.search-filters {
    margin-bottom: 25px;
    padding: 15px 20px;
    background: #f7fafc;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.search-filters label {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #4a5568;
    font-size: 15px;
    cursor: pointer;
}

.search-filters input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #667eea;
}

.search-results {
    margin-bottom: 30px;
}

.search-results h3 {
    color: #4a5568;
    margin-bottom: 20px;
    font-size: 18px;
}

.search-hint, .no-results {
    text-align: center;
    color: #a0aec0;
    padding: 40px;
    font-size: 16px;
    background: #f7fafc;
    border-radius: 10px;
    border: 2px dashed #e2e8f0;
}

/* Карточки пользователей */
.user-search-card {
    display: flex;
    align-items: center;
    padding: 20px;
    margin-bottom: 15px;
    background: white;
    border-radius: 12px;
    transition: all 0.3s;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.user-search-card:hover {
    transform: translateX(8px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.15);
    border-color: #667eea;
}

.user-card-avatar {
    position: relative;
    margin-right: 20px;
}

.user-card-avatar img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #667eea;
}

.user-card-avatar .user-status {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    border: 2px solid white;
}

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

.user-card-name {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.user-card-name strong {
    font-size: 18px;
    color: #2d3748;
}

.user-card-username {
    color: #718096;
    font-size: 14px;
    background: #edf2f7;
    padding: 3px 10px;
    border-radius: 15px;
}

.user-card-status {
    font-size: 13px;
    color: #718096;
    display: flex;
    align-items: center;
    gap: 5px;
}

.user-card-actions {
    display: flex;
    gap: 12px;
}

.btn-chat, .btn-profile {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-chat {
    background: linear-gradient(135deg, #667eea 0%, #5a67d8 100%);
    color: white;
}

.btn-chat:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-profile {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
}

.btn-profile:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(72, 187, 120, 0.4);
}

/* Недавние поиски */
.recent-searches {
    margin-top: 40px;
    padding: 25px;
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border-radius: 15px;
    border: 1px solid #e2e8f0;
}

.recent-searches h3 {
    color: #4a5568;
    margin-bottom: 20px;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.recent-searches h3::before {
    content: "🕒";
    font-size: 20px;
}

.recent-search-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.3s;
    background: white;
    border-radius: 8px;
    margin-bottom: 5px;
}

.recent-search-item:hover {
    background: #667eea;
    color: white;
    transform: translateX(5px);
}

.recent-search-item:hover .recent-search-term,
.recent-search-item:hover .recent-search-time {
    color: white;
}

.recent-search-term {
    color: #667eea;
    font-weight: 500;
    font-size: 15px;
}

.recent-search-time {
    color: #a0aec0;
    font-size: 12px;
}

.no-recent {
    text-align: center;
    color: #a0aec0;
    padding: 20px;
    font-style: italic;
}

/* ========== ЧАТЫ ========== */
.chat-container {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 20px;
    height: 650px;
}

/* Боковая панель чатов */
.chats-sidebar {
    background: #f7fafc;
    border-radius: 15px;
    padding: 20px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    height: 100%;
}

.chats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e2e8f0;
}

.chats-header h3 {
    color: #667eea;
    font-size: 18px;
    font-weight: 600;
}

.btn-clear {
    padding: 8px 15px;
    background: #fc8181;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-clear:hover {
    background: #f56565;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(245, 101, 101, 0.3);
}

.chats-search {
    margin-bottom: 20px;
}

.chats-search input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.3s;
    background: white;
}

.chats-search input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Элемент чата в списке */
.chat-item {
    display: flex;
    padding: 15px;
    margin-bottom: 10px;
    background: white;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    border: 1px solid #e2e8f0;
    position: relative;
}

.chat-item:hover {
    background: #edf2f7;
    transform: translateX(5px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.chat-item.selected {
    background: linear-gradient(135deg, #667eea 0%, #5a67d8 100%);
    color: white;
    border-color: #5a67d8;
}

.chat-item.selected .chat-item-username,
.chat-item.selected .chat-item-last-message,
.chat-item.selected .chat-item-time {
    color: #e2e8f0;
}

.chat-item-avatar {
    position: relative;
    margin-right: 15px;
}

.chat-item-avatar img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #667eea;
}

.chat-item-avatar .user-status {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    border: 2px solid white;
}

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

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

.chat-item-name {
    font-weight: 600;
    font-size: 15px;
}

.unread-badge {
    background: #f56565;
    color: white;
    border-radius: 20px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(245, 101, 101, 0.3);
}

.chat-item-username {
    font-size: 11px;
    color: #a0aec0;
    margin-bottom: 5px;
}

.chat-item-last-message {
    font-size: 12px;
    color: #718096;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
}

.chat-item-time {
    font-size: 10px;
    color: #a0aec0;
    text-align: right;
}

/* Область чата */
.chat-area {
    display: flex;
    flex-direction: column;
    background: #f7fafc;
    border-radius: 15px;
    padding: 20px;
    border: 1px solid #e2e8f0;
    height: 100%;
}

.current-chat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 15px;
}

.current-chat h3 {
    color: #667eea;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.current-chat .user-status {
    width: 12px;
    height: 12px;
}

.btn-clear-chat {
    padding: 8px 15px;
    background: #fc8181;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-clear-chat:hover {
    background: #f56565;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(245, 101, 101, 0.3);
}

/* Сообщения */
.messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: white;
    border-radius: 12px;
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.date-divider {
    text-align: center;
    margin: 15px 0;
    position: relative;
    color: #a0aec0;
    font-size: 12px;
    font-weight: 500;
}

.date-divider::before,
.date-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: calc(50% - 70px);
    height: 1px;
    background: linear-gradient(90deg, transparent, #e2e8f0, transparent);
}

.date-divider::before {
    left: 0;
}

.date-divider::after {
    right: 0;
}

.message-item {
    max-width: 70%;
    margin-bottom: 5px;
    position: relative;
    animation: fadeIn 0.3s ease;
}

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

.message-item.own-message {
    margin-left: auto;
}

.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 12px;
    color: #888;
    padding: 0 5px;
}

.message-sender {
    font-weight: 600;
    color: #4a5568;
}

.own-message .message-sender {
    color: #667eea;
}

.message-time {
    color: #a0aec0;
    font-size: 11px;
}

.message-content {
    padding: 12px 16px;
    background: #f7fafc;
    border-radius: 18px;
    border-top-left-radius: 4px;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    font-size: 14px;
    line-height: 1.5;
}

.own-message .message-content {
    background: linear-gradient(135deg, #667eea 0%, #5a67d8 100%);
    color: white;
    border-top-right-radius: 4px;
    border-top-left-radius: 18px;
}

.message-content a {
    color: inherit;
    text-decoration: underline;
    word-break: break-all;
}

.message-content a:hover {
    text-decoration: none;
}

/* Поле ввода сообщения */
.message-input {
    display: flex;
    gap: 15px;
    background: white;
    padding: 15px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.message-input textarea {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    resize: none;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    transition: all 0.3s;
    max-height: 100px;
}

.message-input textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.message-input button {
    width: 120px;
    padding: 0 20px;
    background: linear-gradient(135deg, #667eea 0%, #5a67d8 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.message-input button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* Статусы */
.user-status {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 5px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(72, 187, 120, 0.7);
    }
    70% {
        box-shadow: 0 0 0 5px rgba(72, 187, 120, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(72, 187, 120, 0);
    }
}

.status-online {
    background: #48bb78;
}

.status-offline {
    background: #cbd5e0;
    animation: none;
}

/* Пустые состояния */
.no-chats, .no-results, .search-hint, .no-recent {
    text-align: center;
    color: #a0aec0;
    padding: 40px 20px;
    background: #f7fafc;
    border-radius: 10px;
    border: 2px dashed #e2e8f0;
    font-size: 15px;
}

/* ========== ГРУППОВЫЕ ЧАТЫ ========== */
.group-chat-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
    height: 650px;
}

.groups-sidebar {
    background: #f7fafc;
    border-radius: 15px;
    padding: 20px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
}

.groups-sidebar h3 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 18px;
}

.groups-list {
    margin-top: 20px;
}

.group-item {
    padding: 15px;
    margin-bottom: 10px;
    background: white;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    border: 1px solid #e2e8f0;
}

.group-item:hover {
    background: #edf2f7;
    transform: translateX(5px);
}

.group-item.selected {
    background: linear-gradient(135deg, #667eea 0%, #5a67d8 100%);
    color: white;
}

.group-item.selected small {
    color: #e2e8f0;
}

.create-group-form {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid #e2e8f0;
}

.create-group-form h4 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 16px;
}

.create-group-form input {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
}

.create-group-form input:focus {
    outline: none;
    border-color: #667eea;
}

.create-group-form button {
    margin-right: 10px;
    padding: 8px 15px;
}

.group-chat-area {
    display: flex;
    flex-direction: column;
    background: #f7fafc;
    border-radius: 15px;
    padding: 20px;
    border: 1px solid #e2e8f0;
}

.current-group {
    padding-bottom: 15px;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 15px;
}

.current-group h3 {
    color: #667eea;
    font-size: 18px;
}

.group-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: white;
    border-radius: 12px;
    margin-bottom: 15px;
}

.group-message-input {
    display: flex;
    gap: 15px;
    background: white;
    padding: 15px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.group-message-input textarea {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    resize: none;
    font-family: inherit;
}

.group-message-input textarea:focus {
    outline: none;
    border-color: #667eea;
}

.group-message-input button {
    width: 120px;
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.group-message-input button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(72, 187, 120, 0.4);
}

/* ========== АДАПТИВНОСТЬ ========== */
@media (max-width: 1024px) {
    .chat-container,
    .group-chat-container {
        grid-template-columns: 280px 1fr;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    header {
        padding: 15px;
    }

    nav {
        flex-direction: column;
        gap: 8px;
    }

    nav a {
        text-align: center;
        padding: 10px;
    }

    .features {
        grid-template-columns: 1fr;
    }

    .profile-info {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 20px;
    }

    .info-section strong {
        width: 100%;
        margin-bottom: 5px;
    }

    .chat-container,
    .group-chat-container {
        grid-template-columns: 1fr;
        height: auto;
    }

    .chats-sidebar,
    .groups-sidebar {
        height: 300px;
    }

    .message-item {
        max-width: 85%;
    }

    .user-search-card {
        flex-direction: column;
        text-align: center;
        padding: 15px;
    }

    .user-card-avatar {
        margin-right: 0;
        margin-bottom: 15px;
    }

    .user-card-actions {
        margin-top: 15px;
        width: 100%;
        justify-content: center;
    }

    .btn-chat, .btn-profile {
        flex: 1;
        justify-content: center;
    }

    .search-box {
        flex-direction: column;
    }

    .search-box button {
        width: 100%;
    }

    .recent-search-item {
        flex-direction: column;
        gap: 5px;
        text-align: center;
    }

    .message-input {
        flex-direction: column;
    }

    .message-input button {
        width: 100%;
        padding: 12px;
    }

    .group-message-input {
        flex-direction: column;
    }

    .group-message-input button {
        width: 100%;
    }

    .current-chat {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .btn-clear-chat {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 24px;
    }

    .auth-form {
        padding: 10px;
    }

    .form-group input {
        padding: 10px;
    }

    .btn-primary,
    .btn-secondary {
        padding: 12px;
    }

    .avatar {
        width: 120px;
        height: 120px;
    }

    .user-card-name {
        flex-direction: column;
        gap: 5px;
    }

    .user-card-actions {
        flex-direction: column;
    }

    .btn-chat, .btn-profile {
        width: 100%;
    }

    .chat-item {
        padding: 10px;
    }

    .chat-item-avatar img {
        width: 40px;
        height: 40px;
    }

    .message-item {
        max-width: 95%;
    }

    .message-content {
        padding: 8px 12px;
        font-size: 13px;
    }

    .date-divider::before,
    .date-divider::after {
        width: calc(50% - 50px);
    }
}

/* ========== АНИМАЦИИ ========== */
@keyframes slideIn {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

.chat-item {
    animation: slideIn 0.3s ease;
}

.message-item {
    animation: slideUp 0.3s ease;
}

/* ========== СКРОЛЛБАР ========== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46a1 100%);
}

/* ========== УТИЛИТЫ ========== */
.text-center {
    text-align: center;
}

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

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

.hidden {
    display: none !important;
}

.flex {
    display: flex;
}

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

.justify-between {
    justify-content: space-between;
}

.gap-10 {
    gap: 10px;
}

.gap-20 {
    gap: 20px;
}

/* ========== ГРУППЫ ========== */
.groups-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.btn-create-group {
    padding: 8px 15px;
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.btn-create-group:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(72, 187, 120, 0.3);
}

.groups-search {
    margin-bottom: 20px;
}

.groups-search input {
    width: 100%;
    padding: 10px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
}

.group-item {
    padding: 15px;
    margin-bottom: 10px;
    background: white;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    border: 1px solid #e2e8f0;
}

.group-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.group-item.selected {
    background: linear-gradient(135deg, #667eea 0%, #5a67d8 100%);
    color: white;
}

.group-item.selected .group-item-members,
.group-item.selected .group-item-footer {
    color: #e2e8f0;
}

.group-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.creator-badge {
    font-size: 16px;
}

.group-item-members {
    font-size: 13px;
    color: #718096;
    margin-bottom: 8px;
}

.member-count {
    display: inline-block;
    margin-right: 10px;
    font-weight: 600;
}

.member-names {
    font-size: 12px;
}

.group-item-footer {
    font-size: 11px;
    color: #a0aec0;
}

.group-header {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.group-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.btn-members, .btn-invite, .btn-leave, .btn-delete {
    padding: 6px 12px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
}

.btn-members {
    background: #4299e1;
    color: white;
}

.btn-invite {
    background: #48bb78;
    color: white;
}

.btn-leave {
    background: #ed8936;
    color: white;
}

.btn-delete {
    background: #f56565;
    color: white;
}

.btn-members:hover, .btn-invite:hover, .btn-leave:hover, .btn-delete:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.no-groups {
    text-align: center;
    color: #a0aec0;
    padding: 30px;
    background: #f7fafc;
    border-radius: 10px;
    border: 2px dashed #e2e8f0;
}

/* Кнопка добавления в группу из поиска */
.btn-group {
    padding: 10px 20px;
    background: linear-gradient(135deg, #9f7aea 0%, #805ad5 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.btn-group:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(159, 122, 234, 0.4);
}

/* Адаптивность для групп */
@media (max-width: 768px) {
    .group-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .group-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .btn-members, .btn-invite, .btn-leave, .btn-delete {
        flex: 1;
        text-align: center;
    }
}
