/* =============== КОМПОНЕНТЫ =============== */

/* Кнопки */
.btn-primary {
    width: 100%;
    padding: 16px;
    background: var(--accent-primary);
    border: none;
    border-radius: 14px;
    color: white;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 24px var(--accent-glow);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(110, 68, 255, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-outline {
    width: 100%;
    padding: 14px;
    background: transparent;
    border: 2px solid var(--accent-primary);
    border-radius: 14px;
    color: var(--accent-primary);
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 12px;
}

.btn-outline:hover {
    background: rgba(110, 68, 255, 0.1);
    transform: translateY(-2px);
}

/* ===== ОТВЕТ НА СООБЩЕНИЕ (REPLY) ===== */
.reply-block {
    display: flex;
    align-items: stretch;
    margin-bottom: 6px;
    padding: 4px 8px 4px 0;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    cursor: pointer;
    max-width: 260px;
    transition: background 0.2s ease;
}

.reply-block:hover {
    background: rgba(0, 0, 0, 0.15);
}

.message.own .reply-block {
    background: rgba(255, 255, 255, 0.15);
}

.message.own .reply-block:hover {
    background: rgba(255, 255, 255, 0.25);
}

.reply-bar {
    width: 3px;
    background: var(--accent-primary);
    border-radius: 3px;
    margin-right: 8px;
    flex-shrink: 0;
}

.message.own .reply-bar {
    background: rgba(255, 255, 255, 0.9);
}

.reply-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.reply-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-primary);
    line-height: 1.2;
    margin-bottom: 2px;
}

.message.own .reply-name {
    color: white;
}

.reply-message-preview {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    opacity: 0.9;
}

.message.own .reply-message-preview {
    color: rgba(255, 255, 255, 0.8);
}

/* ===== ПЕРЕСЛАННЫЕ СООБЩЕНИЯ (FORWARD) ===== */
.forwarded-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--accent-primary);
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(110, 68, 255, 0.2);
}

.forwarded-header i {
    font-size: 12px;
}

.message.own .forwarded-header {
    color: rgba(255, 255, 255, 0.9);
    border-bottom-color: rgba(255, 255, 255, 0.2);
}

.forwarded-text {
    opacity: 0.95;
}

/* ===== МОДАЛКА ПЕРЕСЫЛКИ ===== */
.forward-modal .modal-content {
    max-width: 520px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.forward-preview {
    background: var(--bg-primary);
    border-radius: 16px;
    padding: 16px;
    margin: 16px 24px;
    box-shadow: inset 2px 2px 4px var(--shadow-dark), inset -2px -2px 4px var(--shadow-light);
}

.forward-preview-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.forward-preview-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
    font-size: 16px;
}

.forward-preview-info {
    flex: 1;
}

.forward-preview-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.forward-preview-time {
    font-size: 11px;
    color: var(--text-secondary);
}

.forward-preview-content {
    font-size: 14px;
    color: var(--text-primary);
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: 12px;
    word-break: break-word;
}

.forward-preview-content i {
    color: var(--accent-primary);
    margin-right: 8px;
}

.forward-search {
    padding: 0 24px;
    margin-bottom: 16px;
}

.forward-chat-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 24px 24px;
    max-height: 300px;
}

.forward-chat-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 4px;
    position: relative;
}

.forward-chat-item:hover {
    background: var(--bg-secondary);
    transform: translateX(4px);
}

.forward-chat-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
    font-size: 18px;
    flex-shrink: 0;
}

.forward-chat-info {
    flex: 1;
    min-width: 0;
}

.forward-chat-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.forward-chat-preview {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.forward-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-primary);
    border: none;
    color: white;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px var(--accent-glow);
    transition: all 0.3s ease;
    opacity: 0;
    transform: scale(0.8);
}

.forward-chat-item:hover .forward-send-btn {
    opacity: 1;
    transform: scale(1);
}

.forward-send-btn:hover {
    transform: scale(1.1) !important;
    box-shadow: 0 6px 16px rgba(110, 68, 255, 0.5);
}

.empty-forward-chats {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.empty-forward-chats i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-forward-chats p {
    font-size: 14px;
}

.forward-actions {
    padding: 16px 24px 24px;
    border-top: 1px solid rgba(255,255,255,0.05);
}

/* ===== ИНДИКАТОР ПЕЧАТИ ===== */
.typing-indicator {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border-radius: 20px;
    width: fit-content;
    margin: 0 32px 16px;
    box-shadow: inset 2px 2px 4px var(--shadow-dark), inset -2px -2px 4px var(--shadow-light);
}

.typing-indicator.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.other-typing {
    background: linear-gradient(145deg, var(--accent-primary), var(--accent-secondary));
    margin-bottom: 16px;
    box-shadow: 0 8px 24px var(--accent-glow);
    border-bottom-left-radius: 4px;
    position: relative;
    animation: slideInLeft 0.3s ease;
}

.other-typing .typing-text {
    color: white;
    font-weight: 500;
}

.other-typing .typing-dots span {
    background: white;
    box-shadow: 0 0 8px rgba(255,255,255,0.5);
}

.other-typing::before {
    content: '';
    position: absolute;
    left: -8px;
    bottom: 8px;
    width: 16px;
    height: 16px;
    background: inherit;
    clip-path: polygon(0 0, 100% 0, 100% 100%);
    border-bottom-left-radius: 4px;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: var(--accent-primary);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }
.typing-dots span:nth-child(3) { animation-delay: 0s; }

/* ===== ИНДИКАТОР ОТВЕТА (в поле ввода) ===== */
.reply-indicator {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border-left: 4px solid var(--accent-primary);
    border-radius: 12px;
    margin: 0 32px 16px;
    box-shadow: 0 4px 12px var(--shadow-dark);
    animation: slideUp 0.3s ease;
}

.reply-indicator.active {
    display: flex;
}

.reply-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.reply-content i {
    color: var(--accent-primary);
    font-size: 14px;
}

.reply-details {
    display: flex;
    flex-direction: column;
}

.reply-name {
    font-size: 12px;
    color: var(--accent-primary);
    font-weight: 600;
}

.reply-text {
    font-size: 13px;
    color: var(--text-secondary);
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.close-reply {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--bg-primary);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 2px 2px 4px var(--shadow-dark), -2px -2px 4px var(--shadow-light);
    transition: all 0.3s ease;
}

.close-reply:hover {
    color: var(--danger);
    transform: rotate(90deg);
}

/* ===== АВАТАРЫ ===== */
.chat-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 18px;
    color: white;
    position: relative;
    flex-shrink: 0;
    box-shadow: 0 4px 12px var(--accent-glow);
}

.chat-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.online-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: var(--success);
    border-radius: 50%;
    border: 2px solid var(--bg-secondary);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* ===== НОВЫЕ СТИЛИ ДЛЯ СЧЕТЧИКА НЕПРОЧИТАННЫХ СООБЩЕНИЙ ===== */
.unread-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--accent-primary);
    border-radius: 10px;
    color: white;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px var(--accent-glow);
    animation: pulse-badge 2s infinite;
}

/* ===== НОВЫЕ СТИЛИ ДЛЯ СТАТУСА СООБЩЕНИЙ (ГАЛОЧКИ) ===== */
.message-status {
    font-size: 12px;
    margin-left: 4px;
    color: rgba(255,255,255,0.7);
}

.message-status i {
    font-size: 12px;
}

.message-status.read i {
    color: var(--success);
}

.message:not(.own) .message-status {
    color: var(--text-secondary);
}

.message:not(.own) .message-status.read i {
    color: var(--accent-primary);
}

/* Анимация для счетчика */
@keyframes pulse-badge {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 8px var(--accent-glow);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 4px 12px var(--accent-glow);
    }
}

/* ===== ФОТО СООБЩЕНИЯ ===== */
.photo-message {
    padding: 8px !important;
    max-width: 300px;
}

.photo-container {
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 8px;
}

.message-photo {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.message-photo:hover {
    transform: scale(1.02);
}

.message-caption {
    font-size: 14px;
    margin-bottom: 6px;
    padding: 0 4px;
    color: var(--text-primary);
}

/* ===== ПРОСМОТРЩИК ФОТО ===== */
.photo-viewer-modal .modal-content {
    background: transparent;
    box-shadow: none;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.photo-viewer-content {
    position: relative;
    background: rgba(0, 0, 0, 0.9);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 90vw;
    max-height: 90vh;
}

.photo-viewer-content .close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    box-shadow: none;
}

.photo-viewer-content .close-btn:hover {
    background: rgba(255, 61, 0, 0.5);
    color: white;
}

.photo-viewer-content .photo-container {
    max-width: 80vw;
    max-height: 70vh;
    overflow: auto;
    margin-bottom: 16px;
}

.photo-viewer-content img {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
}

.photo-actions {
    display: flex;
    gap: 12px;
}

.photo-actions button {
    padding: 12px 24px;
    background: var(--accent-primary);
    border: none;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.photo-actions button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--accent-glow);
}

/* ===== МОДАЛЬНЫЕ ОКНА ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(20px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 24px;
    width: 90%;
    max-width: 480px;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255,255,255,0.05);
    animation: modalSlide 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-header {
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-header h3 i {
    color: var(--accent-primary);
}

.close-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-primary);
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light);
    transition: all 0.3s ease;
}

.close-btn:hover {
    color: var(--text-primary);
    transform: rotate(90deg);
    box-shadow: 4px 4px 8px var(--shadow-dark), -4px -4px 8px var(--shadow-light);
}

/* ===== КОНТЕКСТНОЕ МЕНЮ ===== */
.context-menu {
    position: fixed;
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05);
    display: none;
    z-index: 1100;
    min-width: 200px;
    animation: fadeIn 0.2s ease;
}

.context-menu.show {
    display: block;
}

.context-item {
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s ease;
}

.context-item:hover {
    background: var(--bg-primary);
}

.context-item i {
    color: var(--text-secondary);
    width: 20px;
    font-size: 14px;
}

.context-item.danger {
    color: var(--danger);
}

.context-item.danger i {
    color: var(--danger);
}

/* ===== ГОЛОСОВЫЕ СООБЩЕНИЯ ===== */
.voice-message-player {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: rgba(255,255,255,0.1);
    border-radius: 20px;
    min-width: 220px;
}

.play-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: white;
    border: none;
    color: var(--accent-primary);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.play-btn:hover {
    transform: scale(1.1);
}

.play-btn.playing {
    background: var(--accent-primary);
    color: white;
}

.voice-wave {
    flex: 1;
    height: 24px;
    display: flex;
    align-items: center;
    gap: 3px;
}

.wave-bar {
    width: 3px;
    background: rgba(255,255,255,0.6);
    border-radius: 2px;
    animation: wave 1s infinite ease-in-out;
}

.wave-bar:nth-child(1) { height: 40%; animation-delay: 0s; }
.wave-bar:nth-child(2) { height: 70%; animation-delay: 0.1s; }
.wave-bar:nth-child(3) { height: 100%; animation-delay: 0.2s; }
.wave-bar:nth-child(4) { height: 60%; animation-delay: 0.3s; }
.wave-bar:nth-child(5) { height: 80%; animation-delay: 0.4s; }

.voice-duration {
    font-size: 12px;
    color: rgba(255,255,255,0.8);
    font-weight: 500;
}

/* ===== ГОЛОСОВОЙ РЕКОРДЕР ===== */
.voice-recorder {
    position: fixed;
    bottom: 140px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-secondary);
    border-radius: 24px;
    padding: 24px 32px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.05);
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    min-width: 320px;
    animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 1000;
}

.voice-recorder.active {
    display: flex;
}

.recording-visualizer {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 40px;
}

.rec-bar {
    width: 4px;
    background: var(--danger);
    border-radius: 2px;
    animation: rec-wave 0.5s infinite ease-in-out;
}

.rec-bar:nth-child(1) { height: 20%; animation-delay: 0s; }
.rec-bar:nth-child(2) { height: 60%; animation-delay: 0.1s; }
.rec-bar:nth-child(3) { height: 100%; animation-delay: 0.2s; }
.rec-bar:nth-child(4) { height: 50%; animation-delay: 0.3s; }
.rec-bar:nth-child(5) { height: 80%; animation-delay: 0.4s; }

.recording-timer {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
}

.recording-label {
    color: var(--danger);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.recording-dot {
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    animation: rec-pulse 1s infinite;
}

.recording-controls {
    display: flex;
    gap: 16px;
    width: 100%;
}

.rec-btn {
    flex: 1;
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.cancel-rec {
    background: var(--bg-primary);
    color: var(--text-secondary);
    box-shadow: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light);
}

.cancel-rec:hover {
    color: var(--danger);
    box-shadow: 4px 4px 8px var(--shadow-dark), -4px -4px 8px var(--shadow-light);
}

.send-rec {
    background: var(--accent-primary);
    color: white;
    box-shadow: 0 8px 24px var(--accent-glow);
}

.send-rec:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(110, 68, 255, 0.4);
}

/* ===== ПАНЕЛИ (СТИКЕРЫ, ЭМОДЗИ, ФАЙЛЫ) ===== */
.panel {
    display: none;
    background: var(--bg-primary);
    border-radius: 16px;
    padding: 16px;
    margin-top: 8px;
    box-shadow: inset 2px 2px 4px var(--shadow-dark), inset -2px -2px 4px var(--shadow-light);
    animation: slideUp 0.3s ease;
}

.panel.active {
    display: block;
}

.stickers-grid, .emoji-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.sticker-btn, .emoji-item {
    aspect-ratio: 1;
    background: var(--bg-secondary);
    border: none;
    border-radius: 12px;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 2px 2px 4px var(--shadow-dark), -2px -2px 4px var(--shadow-light);
    transition: all 0.2s ease;
}

.sticker-btn:hover, .emoji-item:hover {
    transform: scale(1.1);
    box-shadow: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light);
}

.files-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.file-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light);
    transition: all 0.3s ease;
}

.file-option:hover {
    transform: translateY(-4px);
    box-shadow: 5px 5px 10px var(--shadow-dark), -5px -5px 10px var(--shadow-light);
}

.file-option i {
    font-size: 28px;
    color: var(--accent-primary);
}

.file-option span {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ===== ПРОФИЛЬ ===== */
.profile-content {
    padding: 32px;
    text-align: center;
}

.profile-avatar-large {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: 700;
    color: white;
    margin: 0 auto 24px;
    box-shadow: 0 16px 48px var(--accent-glow);
    position: relative;
}

.profile-avatar-large::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    z-index: -1;
    opacity: 0.5;
    filter: blur(20px);
}

.profile-name {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.profile-status {
    font-size: 15px;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 24px;
}

.profile-info {
    background: var(--bg-primary);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 24px;
    text-align: left;
    box-shadow: inset 2px 2px 4px var(--shadow-dark), inset -2px -2px 4px var(--shadow-light);
}

.info-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.info-row:last-child {
    border-bottom: none;
}

.info-row i {
    color: var(--accent-primary);
    font-size: 18px;
    width: 24px;
}

.info-row div {
    flex: 1;
}

.info-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.info-value {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.profile-actions {
    display: grid;
    gap: 12px;
}

.action-btn {
    width: 100%;
    padding: 16px;
    background: var(--bg-primary);
    border: none;
    border-radius: 14px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: 4px 4px 8px var(--shadow-dark), -4px -4px 8px var(--shadow-light);
    transition: all 0.3s ease;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 6px 6px 12px var(--shadow-dark), -6px -6px 12px var(--shadow-light);
}

.action-btn.danger {
    color: var(--danger);
}

.action-btn.danger:hover {
    background: rgba(255, 61, 0, 0.1);
}

/* ===== УВЕДОМЛЕНИЯ ===== */
.notification {
    position: fixed;
    top: 24px;
    right: 24px;
    padding: 16px 24px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: 16px;
    border-left: 4px solid var(--accent-primary);
    box-shadow: 0 16px 48px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.05);
    transform: translateX(150%);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 1001;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

.notification.show {
    transform: translateX(0);
}

.notification i {
    color: var(--accent-primary);
    font-size: 20px;
}

/* ===== WEBSOCKET СТАТУС ===== */
.ws-status {
    position: fixed;
    top: 24px;
    left: 24px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--danger);
    box-shadow: 0 0 10px var(--danger);
    transition: all 0.3s ease;
    z-index: 1002;
}

.ws-status.connected {
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
}

.ws-status::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid currentColor;
    opacity: 0;
    animation: pulse-ring 2s infinite;
}

/* ===== ПУСТОЕ СОСТОЯНИЕ ===== */
.empty-chats {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-chats i {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.3;
}

.empty-chats p {
    font-size: 15px;
    margin-bottom: 24px;
}

/* ===== ЗАГРУЗКА ===== */
.loading-ring {
    width: 48px;
    height: 48px;
    border: 3px solid var(--bg-tertiary);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ===== ИЗМЕНЕННОЕ СООБЩЕНИЕ ===== */
.edited-badge {
    font-size: 11px;
    opacity: 0.7;
    margin-left: 4px;
    font-style: italic;
}

/* ===== СТАТУС ОНЛАЙН ===== */
.chat-status {
    margin-top: 4px;
    font-size: 12px;
}

.online-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
    margin-right: 6px;
}

.last-seen {
    color: var(--text-secondary);
    font-size: 11px;
    font-style: italic;
}

/* Для аватара */
.chat-avatar {
    position: relative;
}

.chat-avatar .online-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    border: 2px solid var(--bg-secondary);
}

/* ===== НАСТРОЙКИ ТЕМЫ ===== */
.settings-section {
    margin-bottom: 32px;
}

.theme-btn.active {
    border-color: var(--accent-primary) !important;
    color: var(--accent-primary) !important;
}

.color-btn.active {
    transform: scale(1.1);
    box-shadow: 0 0 0 3px var(--bg-secondary), 0 0 0 5px var(--accent-primary);
}

.bg-btn.active {
    border-color: var(--accent-primary) !important;
    background: var(--accent-primary) !important;
    color: white !important;
}

/* ===== СВЕТЛАЯ ТЕМА ===== */
body.light-theme {
    --bg-primary: #f5f5f5;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e8e8e8;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --text-muted: #999999;
    --shadow-dark: rgba(0,0,0,0.1);
    --shadow-light: rgba(255,255,255,0.8);
}

body.light-theme .message.own .message-bubble {
    color: white;
}

body.light-theme .reply-block {
    background: rgba(0, 0, 0, 0.05);
}

body.light-theme .message.own .reply-block {
    background: rgba(255, 255, 255, 0.2);
}

/* ===== ФОН ЧАТА ===== */
.main-chat {
    background: var(--chat-bg, transparent);
}

/* ===== РЕАКЦИИ ===== */
.message-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
    padding: 4px 0;
}

.message-reaction {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: var(--bg-tertiary);
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    box-shadow: 2px 2px 4px var(--shadow-dark), -2px -2px 4px var(--shadow-light);
}

.message-reaction:hover {
    transform: scale(1.05);
    box-shadow: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light);
}

.message-reaction.user-reacted {
    background: var(--accent-primary);
    color: white;
    box-shadow: 0 2px 8px var(--accent-glow);
}

.message-reaction .reaction-emoji {
    font-size: 14px;
}

.message-reaction .reaction-count {
    font-size: 11px;
    font-weight: 600;
    min-width: 16px;
    text-align: center;
}

.message-reaction.add-reaction {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 4px 8px;
    opacity: 0.7;
}

.message-reaction.add-reaction:hover {
    opacity: 1;
    color: var(--accent-primary);
}

.message.own .message-reaction:not(.user-reacted) {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.message.own .message-reaction.add-reaction {
    background: rgba(255, 255, 255, 0.1);
}

/* Панель реакций */
.reactions-panel {
    position: fixed;
    background: var(--bg-secondary);
    border-radius: 24px;
    padding: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.05);
    z-index: 1200;
    min-width: 300px;
    animation: slideUp 0.3s ease;
}

.reactions-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.reactions-panel-header span {
    font-weight: 600;
    color: var(--text-primary);
}

.close-reactions {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-primary);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-reactions:hover {
    color: var(--text-primary);
    transform: rotate(90deg);
}

.reactions-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.reaction-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px;
    background: var(--bg-primary);
    border: none;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 2px 2px 4px var(--shadow-dark), -2px -2px 4px var(--shadow-light);
}

.reaction-btn:hover {
    transform: translateY(-2px);
    box-shadow: 4px 4px 8px var(--shadow-dark), -4px -4px 8px var(--shadow-light);
}

.reaction-btn.active {
    background: var(--accent-primary);
    box-shadow: 0 4px 12px var(--accent-glow);
}

.reaction-btn.active .reaction-emoji {
    transform: scale(1.1);
}

.reaction-btn.active .reaction-count {
    color: white;
}

.reaction-btn .reaction-emoji {
    font-size: 24px;
    transition: transform 0.2s ease;
}

.reaction-btn .reaction-count {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.reactions-panel-footer {
    text-align: center;
}

.more-reactions {
    width: 100%;
    padding: 12px;
    background: var(--bg-primary);
    border: none;
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: inset 2px 2px 4px var(--shadow-dark), inset -2px -2px 4px var(--shadow-light);
}

.more-reactions:hover {
    background: var(--bg-tertiary);
    color: var(--accent-primary);
}

/* Анимация для реакций */
@keyframes reactionAppear {
    from {
        opacity: 0;
        transform: scale(0);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.message-reaction {
    animation: reactionAppear 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Адаптивность для реакций */
@media (max-width: 768px) {
    .reactions-panel {
        left: 16px !important;
        right: 16px !important;
        width: auto !important;
    }
    
    .reactions-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 480px) {
    .reactions-panel {
        padding: 12px;
    }
    
    .reaction-btn {
        padding: 8px;
    }
    
    .reaction-btn .reaction-emoji {
        font-size: 20px;
    }
}

/* ===== АНИМАЦИИ ===== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes slideInLeft {
    from { transform: translateX(-20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes modalSlide {
    from { transform: scale(0.9) translateY(20px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-10px); }
}

@keyframes wave {
    0%, 100% { transform: scaleY(0.5); }
    50% { transform: scaleY(1); }
}

@keyframes rec-wave {
    0%, 100% { transform: scaleY(0.3); }
    50% { transform: scaleY(1); }
}

@keyframes rec-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse-dot {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; }
}

@keyframes pulse-ring {
    0% { transform: scale(1); opacity: 0.5; }
    100% { transform: scale(1.5); opacity: 0; }
}