:root {
    --menu-width: 280px;
    --primary-color: #0088cc;
    --secondary-color: #f0f2f5;
    --sidebar-bg: #ffffff;
    --chat-bg: #e6ebee;
    --message-out-bg: #effdde;
    --message-in-bg: #ffffff;
    --text-color: #333333;
    --text-muted: #707579;
    --border-color: #e9edef;
    --chat-body-bg: #e3dfdf;
}

[data-bs-theme="dark"] {
    --primary-color: #0088cc;
    --secondary-color: #0e1621;
    --sidebar-bg: #17212b;
    --chat-bg: #0e1621;
    --message-out-bg: #2b5278;
    --message-in-bg: #182533;
    --text-color: #e9edef;
    --text-muted: #8696a0;
    --border-color: #2a3942;
    --chat-body-bg: #0e1621;
    --primary-hover: #0066a3;
    --input-bg: rgba(255, 255, 255, 0.08);
}

body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--secondary-color);
    color: var(--text-color);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
    padding-left: 0;
    transition: padding-left 0.3s ease;
}

.app-container.menu-open {
    padding-left: var(--menu-width);
}

.sidebar {
    width: 360px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sidebar-header {
    padding: 12px 16px;
    background-color: var(--sidebar-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 1051;
}

.sidebar-search {
    padding: 8px 16px;
    border-bottom: 1px solid var(--border-color);
}

.input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.search-container {
    position: relative;
    display: flex;
    width: 100%;
}

.search-input {
    background-color: var(--secondary-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 40px 8px 40px;
    color: var(--text-color);
    width: 100%;
    font-size: 14px;
    transition: all 0.3s;
}

.input-group-append {
    display: flex;
    margin-left: -1px;
}

.menu-toggle-btn,
.search-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 0 10px;
    cursor: pointer;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    transition: color 0.2s;
}

.menu-toggle-btn {
    z-index: 1002;
    left: 0;
    right: auto;
}

.menu-toggle-btn:hover,
.search-btn:hover {
    color: var(--primary-color);
}

.menu-toggle-btn i {
    transition: transform 0.3s;
}

.menu-toggle-btn i.fa-times {
    transform: rotate(90deg);
}

.search-btn {
    right: 12px;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 136, 204, 0.2);
}

.search-icons {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    display: flex;
    align-items: center;
    pointer-events: none;
}

.contacts-list {
    flex: 1;
    overflow-y: auto;
}

.contact-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.2s;
}

.contact-actions {
    margin-left: auto;
    padding-left: 10px;
}

.contact-item:hover,
.contact-item.active {
    background-color: var(--secondary-color);
}

.contact-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 12px;
}

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

.contact-name {
    font-weight: 500;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contact-last-message,
.contact-username {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contact-username {
    font-size: 12px;
    margin-top: 2px;
}

.contact-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-left: 8px;
}

.contact-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.unread-badge {
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--chat-bg);
    height: 100%;
    position: relative;
}

.chat-area.active-chat .chat-footer,
.chat-area.active-group .chat-footer,
.chat-area.active-channel .chat-footer {
    display: flex;
}

.chat-header {
    padding: 14.5px 16px;
    background-color: var(--sidebar-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    z-index: 10;
    gap: 12px;
}

.chat-back-btn {
    display: none;
    margin-right: 12px;
    color: var(--text-color);
    font-size: 1.2rem;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.chat-back-btn:active {
    transform: scale(0.95);
}

.chat-user {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.chat-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 90%;
    object-fit: cover;
    flex-shrink: 0;
    margin-right: 10px;
}

.chat-user-info {
    min-width: 0;
}

.chat-user-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.chat-user-status {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-actions {
    display: flex;
    align-items: center;
    position: relative;
}

.chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background-color: var(--chat-body-bg);
    background-image: url('../../src/images/bg-light.png');
    background-size: auto;
    background-position: center;
    background-repeat: repeat;
}

[data-bs-theme="dark"] .chat-body {
    background-image: url('../../src/images/bg-dark.png');
}

.message {
    max-width: 70%;
    padding-bottom: 8px;
    margin-bottom: 8px;
    position: relative;
    cursor: context-menu;
    transition: background-color 0.2s;
    z-index: 1;
	
	
}

/* Фон в сообщениях при наведении */
.message:hover {
    background-color: rgba(0, 136, 204, 0.01);
}

#messages-container {
    position: relative;
    z-index: 1;
}

.message-out {
    margin-left: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    max-width: 80%;
}

.message-out .message-meta,
.message-out .message-actions {
    justify-content: flex-end;
    right: 0;
    left: auto;
}

.message-in {
    margin-right: auto;
}

.message-in .message-meta,
.message-in .message-actions {
    justify-content: flex-start;
    left: 0;
}

.message-bubble {
    padding: 6px 10px;
    border-radius: 8px;
    position: relative;
    word-wrap: break-word;
    white-space: pre-line;
    max-width: fit-content;
    margin: 4px 0;
    color: var(--text-color);
}

.message-out .message-bubble {
    background-color: var(--message-out-bg);
    border-top-right-radius: 0;
    margin-left: auto;
}

.message-in .message-bubble {
    background-color: var(--message-in-bg);
    border-top-left-radius: 0;
}

.message-meta {
    display: flex;
    align-items: center;
    margin-top: 2px;
    font-size: 11px;
    color: var(--text-muted);
    gap: 4px;
}

.message-status {
    display: flex;
}

.message-sender {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.message-actions {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: var(--sidebar-bg);
    border-radius: 18px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 4px;
    transition: all 0.2s ease;
    z-index: 10;
    bottom: -38px;
    width: max-content;
}

.message:hover .message-actions {
    visibility: visible;
    opacity: 1;
}

.message-action-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--text-muted);
    cursor: pointer;
}

.message-action-btn:hover {
    background: var(--secondary-color);
    color: var(--primary-color);
}

.chat-footer {
    display: none;
	position: relative;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background-color: var(--sidebar-bg);
    border-top: 1px solid var(--border-color);
    min-height: 60px;
}

.message-input-container {
    flex: 1;
    display: flex;
    align-items: center;
    background-color: var(--secondary-color);
    border-radius: 20px;
    padding: 6px 12px;
    min-height: 40px;
    gap: 8px;
    position: relative;
}

.input-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    position: absolute;
    right: 50px; /* Сдвигаем левее кнопки отправки */
    top: 50%;
    transform: translateY(-50%);
}

.message-input {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-color);
    resize: none;
    min-height: 24px;
    max-height: 80px;
    line-height: 1.4;
    outline: none;
    overflow-y: auto;
    transition: all 0.2s ease;
    padding: 8px 100px 8px 0; /* Увеличиваем правый отступ для кнопок */
    font-size: 14px;
    margin: 0;
}

/* Скрываем кнопки справа когда есть текст */
.message-input:not(:placeholder-shown) ~ .input-actions {
    display: none;
}

/* Показываем кнопку отправки когда есть текст */
.message-input:not(:placeholder-shown) ~ .send-btn {
    display: flex;
}

.message-input:focus {
    box-shadow: none;
    background-color: transparent;
}

.message-input-container:focus-within {
    box-shadow: 0 0 0 2px rgba(0, 136, 204, 0.2);
}

.message-input:placeholder-shown ~ .input-actions .send-btn,
.message-input:not(:placeholder-shown) ~ .input-actions .attachment-btn {
    display: none;
}

.send-btn:hover {
    background-color: var(--primary-hover);
    transform: scale(1.05);
}

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

.send-btn.btn-secondary {
    background-color: var(--text-muted);
    opacity: 0.6;
}

.send-btn.btn-secondary:hover {
    opacity: 0.8;
    background-color: var(--text-muted);
}

.input-action-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    background: none;
    border: none;
    border-radius: 50%;
    font-size: 16px;
    padding: 0;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.input-action-btn:hover {
    background-color: rgba(0, 136, 204, 0.1);
    color: var(--primary-color);
}

.emoji-btn {
    color: var(--text-muted);
    font-size: 1.2rem;
    transition: color 0.2s;
}

.emoji-btn:hover,
.emoji-btn.active {
    color: var(--primary-color);
}

.attachment-btn {
    color: var(--text-muted);
    font-size: 1.2rem;
    transition: color 0.2s;
}

.attachment-btn:hover {
    color: var(--primary-color);
}

#sendBtn {
    width: 36px;
    height: 36px;
    background-color: var(--primary-color);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

#sendBtn:hover {
    background-color: var(--primary-hover);
    transform: scale(1.05);
}

#sendBtn:active {
    transform: scale(0.95);
}

#sendBtn.btn-secondary {
    background-color: var(--text-muted);
    opacity: 0.6;
}

#sendBtn.btn-secondary:hover {
    opacity: 0.8;
    background-color: var(--text-muted);
}

/* Мобильные стили - должны быть в конце, но не переопределять основные */
@media (max-width: 768px) {
    body {
        touch-action: pan-y;
    }
    
    .app-container {
        flex-direction: column;
        height: 100vh;
        overflow: hidden;
    }
    
    .app-container.menu-open {
        padding-left: 0;
    }
    
    .sidebar {
        width: 100%;
        height: 100%;
        position: absolute;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
	.sidebar:not(.hidden) {
		transform: translateX(0);
		display: flex !important;
	}

	.sidebar.hidden {
		transform: translateX(-100%);
		display: none !important;
	}

    .chat-area {
        width: 100%;
        height: 100%;
        position: absolute;
        z-index: 90;
        display: none;
    }
    
	.chat-area.active {
		display: flex !important;
		flex-direction: column;
	}

	.chat-area:not(.active) {
		display: none !important;
	}
    
    .chat-back-btn {
        display: flex !important;
    }
    
    .chat-header {
        padding: 12px 16px;
        gap: 8px;
        position: sticky;
        top: 0;
    }
    
    .chat-body {
        padding-bottom: 70px;
        height: calc(100vh - 120px);
    }
    
    .message {
        max-width: 85% !important;
    }
    
    .chat-footer {
        padding: 8px 12px;
        gap: 6px;
    }
    
    .message-input-container {
        padding: 5px 10px;
        gap: 6px;
    }
    
    .message-input {
        min-height: 22px !important;
        max-height: 70px;
        padding: 6px 8px !important;
        font-size: 16px;
    }
    
    .input-action-btn {
        width: 30px;
        height: 30px;
        font-size: 15px;
    }
    
    #sendBtn {
        width: 34px;
        height: 34px;
    }
    
    .side-menu {
        width: 330px;
        transform: translateX(-100%);
    }
    
    .side-menu.open {
        transform: translateX(0);
    }
    
    .menu-footer {
        padding: 8px 16px;
    }
    
    .version-info {
        font-size: 0.6rem;
        justify-content: center;
    }
    
    .menu-toggle {
        margin-right: 8px;
    }
}

@media (max-width: 360px) {
    .chat-user-name {
        font-size: 14px;
    }
    
    .chat-user-status {
        font-size: 11px;
    }
    
    .message-bubble {
        font-size: 14px;
    }
    
    .input-action-btn {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
    
    #sendBtn {
        width: 32px;
        height: 32px;
        font-size: 13px;
    }
    
    .message-input {
        font-size: 15px;
    }
}

/* Остальные стили (не мобильные) остаются здесь... */
/* [Добавьте сюда остальные стили из предыдущей версии] */

.blocked-message {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    z-index: 5;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    text-align: center;
    padding: 20px;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.theme-toggle {
    cursor: pointer;
    font-size: 20px;
    margin-left: 16px;
}

.profile-modal .modal-content,
.modal-content {
    background-color: var(--sidebar-bg) !important;
    color: var(--text-color) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 10px;
    overflow: hidden;
}

.profile-modal .modal-header,
.profile-modal .modal-footer,
.modal-header,
.modal-footer {
    border-color: var(--border-color) !important;
}

.list-group-item {
    background-color: var(--secondary-color) !important;
    color: var(--text-color) !important;
    border-color: var(--border-color) !important;
}

.btn-close {
    filter: invert(var(--btn-close-filter)) !important;
}

.form-control, .form-control:focus {
    background-color: var(--secondary-color);
    color: var(--text-color);
    border-color: var(--border-color);
}

.form-label {
    color: var(--text-color);
}

.profile-img-preview {
    width: 120px;
    height: 120px;
    margin: 0 auto 20px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--primary-color);
}

.profile-img-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.create-btn {
    margin: 10px 16px;
    width: calc(100% - 32px);
}

.contacts-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
}

.contacts-tab {
    padding: 12px 16px;
    cursor: pointer;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    flex: 1;
    text-align: center;
}

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

.contacts-content {
    display: none;
    height: calc(100% - 49px);
    overflow-y: auto;
}

.contacts-content.active {
    display: block;
}

.badge {
    font-size: 12px;
    font-weight: normal;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 16px;
    text-transform: uppercase;
    user-select: none;
    flex-shrink: 0;
}

.avatar-color-1 { background-color: #0088cc; }
.avatar-color-2 { background-color: #d33279; }
.avatar-color-3 { background-color: #e67e22; }
.avatar-color-4 { background-color: #2ecc71; }
.avatar-color-5 { background-color: #9b59b6; }
.avatar-color-6 { background-color: #34495e; }
.avatar-color-7 { background-color: #e74c3c; }
.avatar-color-8 { background-color: #1abc9c; }

.group-avatar, .channel-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    margin-right: 12px;
    flex-shrink: 0;
}

.chat-menu-container {
    position: absolute;
    right: 0;
    top: 100%;
    z-index: 1000;
    display: none;
}

.chat-menu-container.show {
    display: block;
}

.chat-menu {
    position: absolute;
    right: 0;
    top: 0;
    background: var(--sidebar-bg);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 8px 0;
    min-width: 220px;
    max-height: 300px;
    overflow-y: auto;
    opacity: 0;
    transform: translateX(20px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.chat-menu.active {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.chat-menu.show {
    display: block;
    animation: slideInRight 0.3s ease;
}

.chat-menu-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
}

.chat-menu-header .back-btn {
    margin-right: 12px;
    color: var(--text-color);
    font-size: 14px;
}

.chat-menu-item {
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background-color 0.2s;
    color: var(--text-color);
}

.chat-menu-item:hover {
    background: var(--secondary-color);
}

.chat-menu-item i:first-child {
    margin-right: 12px;
    width: 20px;
    text-align: center;
    font-size: 16px;
}
.chat-menu-item i:last-child:not(:first-child) {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-muted);
}

.chat-menu-item.text-danger {
    color: #dc3545;
}

.chat-menu-item.text-danger:hover {
    background: rgba(220, 53, 69, 0.1);
}

.chat-menu-item i {
    margin-right: 8px;
    width: 20px;
    text-align: center;
}

.call-btn {
    color: var(--text-color);
    transition: color 0.2s;
}

.call-btn:hover {
    color: var(--primary-color);
}

/* Анимации */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

/* Для мобильных устройств */
@media (max-width: 768px) {
    .chat-menu {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 280px;
        border-radius: 0;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        max-height: none;
    }
    
    .chat-menu.show {
        transform: translateX(0);
        animation: none;
    }
    
    .chat-menu-header {
        padding: 16px;
        font-size: 18px;
    }
}

.side-menu {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 330px;
    z-index: 1100;
    background-color: var(--sidebar-bg);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.side-menu.open {
    transform: translateX(0);
}

.menu-content {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 10px;
}

.menu-items {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.menu-items hr {
    margin: 8px 0;
    border-color: var(--border-color);
    opacity: 0.5;
}

.menu-item {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.menu-item:hover {
    background-color: var(--secondary-color);
}

.menu-item.active {
    background-color: var(--primary-color);
    color: white;
}

.menu-item i {
    width: 24px;
    margin-right: 12px;
    text-align: center;
}

.menu-item[data-bs-toggle="modal"] {
    cursor: pointer;
}

.menu-footer {
    padding: 10px 20px;
    border-top: 1px solid var(--border-color);
    background-color: var(--sidebar-bg);
    flex-shrink: 0;
}

.version-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.65rem;
    color: var(--text-muted);
    opacity: 0.7;
    transition: opacity 0.2s;
    padding: 4px 0;
    align-content: flex-end;
    justify-content: center;
    animation: fadeIn 0.5s ease-out;
}

.version-info:hover {
    opacity: 1;
}

.version-info i {
    font-size: 0.6rem;
}

.profile-header {
    padding: 20px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.profile-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 12px;
}

.profile-info {
    flex: 1;
}

.profile-name {
    font-weight: 500;
    font-size: 16px;
    margin-bottom: 2px;
}

.profile-username {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.profile-id {
    font-size: 12px;
    color: var(--text-muted);
}

.menu-toggle {
    color: var(--text-color);
    font-size: 1.2rem;
    transition: transform 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.menu-toggle:hover {
    color: var(--primary-color);
}

.menu-toggle.active i {
    transform: rotate(90deg);
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
}

.emoji-panel {
    position: relative;
    bottom: 0px;
    left: auto;
    right: auto;
    background: var(--sidebar-bg);
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -5px 15px rgba(0,0,0,0.3);
    transform: translateY(120%);
    transition: transform 0.3s ease;
    z-index: 1000;
    display: none;
    flex-direction: column;
    height: 270px;
    width: 100%;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    font-family: Arial, sans-serif;
    will-change: transform;
}

.emoji-panel.show {
    transform: translateY(0);
    display: flex;
}

.emoji-panel-header {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
    background: var(--header-bg-color);
    border-radius: 12px 12px 0 0;
}

.btn-close-emoji {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.2rem;
    margin-right: 10px;
    cursor: pointer;
    padding: 5px;
}

.btn-close-emoji:hover {
    color: var(--primary-color);
}

.emoji-search {
    position: relative;
    flex-grow: 1;
}

.emoji-search input {
    width: 100%;
    padding: 8px 30px 8px 10px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--input-bg-color);
    color: var(--text-color);
    font-size: 0.9rem;
}

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

.emoji-search i {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary-text-color);
    font-size: 0.9rem;
}

.emoji-categories {
    display: flex;
    overflow-x: auto;
    padding: 10px 15px;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
    background: var(--header-bg-color);
    scrollbar-width: thin;
}

.emoji-category {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 5px 10px;
    border-radius: 8px;
    background: none;
    border: none;
    cursor: pointer;
    min-width: 60px;
    color: var(--text-color);
    transition: all 0.2s;
    flex-shrink: 0;
}

.emoji-category span {
    font-size: 0.75rem;
    margin-top: 3px;
    white-space: nowrap;
}

.emoji-category i {
    font-size: 1.1rem;
}

.emoji-category.active {
    background: var(--primary-color);
    color: white;
}

.emoji-category:hover:not(.active) {
    background: var(--hover-color);
}

.emoji-container {
    flex-grow: 1;
    overflow-y: auto;
    position: relative;
    padding: 5px;
}

.emoji-section {
    display: none;
    padding: 5px;
}

.emoji-section.active {
    display: block;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
    gap: 5px;
    max-height: 250px;
    overflow-y: auto;
}

.emoji-item {
    font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", "Android Emoji", "EmojiSymbols", "EmojiOne", sans-serif;
    font-size: 24px;
    text-align: center;
    padding: 5px;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.2s;
    user-select: none;
}

.emoji-item:hover {
    background: var(--hover-color);
    transform: scale(1.1);
}

.emoji-empty {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--secondary-text-color);
    text-align: center;
    padding: 20px;
}

.emoji-empty i {
    font-size: 2rem;
    margin-bottom: 10px;
}

.emoji-empty p {
    margin: 0;
    font-size: 0.9rem;
}

.emoji-group-header {
    grid-column: 1 / -1;
    font-weight: bold;
    padding: 8px 5px;
    margin-top: 10px;
    border-bottom: 1px solid var(--border-color);
    color: var(--primary-color);
}

.file-previews {
    padding: 10px;
    background: var(--secondary-color);
    border-top: 1px solid var(--border-color);
}

.preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.file-preview {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--sidebar-bg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.file-info {
    padding: 5px;
    text-align: center;
    font-size: 12px;
}

.file-info i {
    font-size: 24px;
    display: block;
    margin-bottom: 5px;
}

.remove-file {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

.message-attachment {
    margin-top: 8px;
    max-width: 100%;
}

.message-attachment img {
    max-width: 300px;
    max-height: 300px;
    border-radius: 12px;
    cursor: pointer;
}

.message-attachment.file {
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    display: inline-block;
}

.file-download {
    display: flex;
    align-items: center;
    color: inherit;
    text-decoration: none;
}

.file-download i {
    margin-right: 8px;
}

/* Индикатор записи */
.recording-indicator {
    display: none;
    position: fixed; /* Изменено с absolute на fixed для мобильных */
    bottom: 80px; /* Располагаем над клавиатурой/полем ввода */
    left: 10px;
    right: 10px;
    background: rgba(220, 53, 69, 0.95);
    color: white;
    padding: 15px;
    align-items: center;
    justify-content: space-between;
    border-radius: 12px;
    z-index: 10000; /* Очень высокий z-index */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
}

/* Мобильные стили */
@media (max-width: 768px) {
    .recording-indicator {
        position: fixed;
        bottom: 70px;
        left: 15px;
        right: 15px;
        padding: 18px 20px;
        flex-direction: column;
        gap: 15px;
    }
    
    .recording-animation {
        width: 100%;
        justify-content: center;
    }
    
    .stop-recording-btn {
        width: 100%;
        padding: 12px;
        font-size: 16px;
    }
    
    /* Убедимся, что индикатор поверх всех элементов */
    .recording-indicator {
        z-index: 10000 !important;
    }
}

/* Для очень маленьких экранов */
@media (max-width: 360px) {
    .recording-indicator {
        bottom: 60px;
        left: 10px;
        right: 10px;
        padding: 15px;
    }
    
    .recording-animation span {
        font-size: 14px;
    }
}

.recording-animation {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

.recording-dot {
    width: 14px;
    height: 14px;
    background: white;
    border-radius: 50%;
    animation: recordingPulse 1s infinite;
}

.stop-recording-btn {
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.stop-recording-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.voice-message {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(0, 136, 204, 0.1);
    border-radius: 20px;
    margin: 4px 0;
}

.play-voice-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.voice-duration {
    font-size: 12px;
    color: var(--text-muted);
    min-width: 35px;
}

.voice-waveform {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 20px;
}

.voice-waveform .wave {
    width: 3px;
    background-color: var(--primary-color);
    border-radius: 2px;
    animation: waveAnimation 1.2s infinite ease-in-out;
    animation-play-state: paused; /* По умолчанию остановлено */
}

.voice-message.playing .voice-waveform .wave {
    animation-play-state: running !important;
}

.voice-message:not(.playing) .voice-waveform .wave {
    animation-play-state: paused !important;
    height: 40% !important; /* Сбрасываем высоту когда не играет */
}

.status-online {
    color: var(--primary-color);
    font-weight: 500;
}

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

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

.swipe-indicator {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    z-index: 10000;
    animation: fadeInOut 3s ease-in-out;
    display: none;
}

.gesture-hint {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #007bff;
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 11px;
    z-index: 1000;
    animation: pulse 2s infinite;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

.message-input::-webkit-scrollbar {
    width: 3px;
}

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

.message-input::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.message-input::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

.emoji-categories::-webkit-scrollbar {
    height: 4px;
}

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

@keyframes fadeInOut {
    0%, 100% { opacity: 0; }
    10%, 90% { opacity: 1; }
}

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

/* Анимация пульсации для кнопки записи */
@keyframes recordingPulse {
    0% { 
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7);
    }
    50% { 
        transform: scale(1.1);
        box-shadow: 0 0 0 10px rgba(220, 53, 69, 0);
    }
    100% { 
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0);
    }
}

/* Стили для активной записи */
#microphoneBtn.recording {
    animation: recordingPulse 2s infinite;
    color: #dc3545 !important;
}

#microphoneBtn i.recording-active {
    color: #dc3545 !important;
    animation: recordingPulse 1s infinite;
}

/* Индикатор записи - анимация появления */
.recording-indicator {
    animation: slideInUp 0.3s ease-out;
}

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

@keyframes waveAnimation {
    0%, 100% { height: 40%; }
    50% { height: 100%; }
}

@keyframes denied-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

/* Анимация появления */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Убедитесь, что начальная высота волны правильная */
.voice-waveform .wave:nth-child(1) { animation-delay: 0s; }
.voice-waveform .wave:nth-child(2) { animation-delay: 0.2s; }
.voice-waveform .wave:nth-child(3) { animation-delay: 0.4s; }
.voice-waveform .wave:nth-child(4) { animation-delay: 0.6s; }
.voice-waveform .wave:nth-child(5) { animation-delay: 0.8s; }

/* Анимация волны */
@keyframes waveAnimation {
    0%, 100% { 
        height: 40%;
        transform: scaleY(0.4);
    }
    50% { 
        height: 100%;
        transform: scaleY(1);
    }
}


.premium-indicator {
    background: linear-gradient(45deg, #FFD700, #FFA500);
    color: #000;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7em;
    font-weight: bold;
    margin-left: 8px;
}

/* Premium user styles */
.premium-badge {
    color: #FFD700;
    margin-left: 5px;
    font-size: 0.8em;
    display: inline-block;
}

.premium-user .contact-name {
    color: #FFD700;
    font-weight: 600;
}

.premium-user .premium-badge {
    animation: pulse 2s infinite;
}

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

/* Для чат-заголовка тоже можно добавить */
.chat-user-name .premium-badge {
    font-size: 0.7em;
    vertical-align: middle;
}




.profile-photos-slider {
    position: relative;
}

.carousel-caption {
    background: rgba(0, 0, 0, 0.5);
    border-radius: 20px;
    padding: 5px 10px;
    right: auto;
    left: 50%;
    transform: translateX(-50%);
    bottom: 10px;
}

.carousel-control-prev, .carousel-control-next {
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
}

#qrCodeContainer canvas {
    border: 10px solid white;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}


/* Анимация для кнопки записи */
#microphoneBtn.recording {
    color: #dc3545 !important;
    animation: pulse 1.5s infinite;
}

#microphoneBtn.recording i {
    color: #dc3545 !important;
}

/* Контейнер чат-футера должен быть relative */
.chat-footer {
    position: relative;
}


/* Стили для историй */
.stories-container {
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
    background: var(--sidebar-bg);
}

.stories-scroll {
    display: flex;
    overflow-x: auto;
    gap: 15px;
    padding: 0 15px;
    scrollbar-width: none;
}

.stories-scroll::-webkit-scrollbar {
    display: none;
}

.story-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    flex-shrink: 0;
    width: 70px;
}

.story-avatar-wrapper {
    position: relative;
    width: 60px;
    height: 60px;
    margin-bottom: 5px;
}

.story-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.story-item.has-unviewed .story-avatar {
    border-color: var(--primary-color);
}

.story-item.viewed .story-avatar {
    border-color: var(--text-muted);
    opacity: 0.7;
}

.my-story .story-avatar {
    border: 2px solid var(--primary-color);
}

.add-story-btn {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border: 2px solid var(--sidebar-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 10px;
}

.story-username {
    font-size: 11px;
    color: var(--text-color);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70px;
}

/* Story Viewer */
.story-viewer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    display: none;
}

.story-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 90vw;
    max-height: 90vh;
}

.story-content img,
.story-content video {
    max-width: 100%;
    max-height: 100%;
    border-radius: 10px;
}

.story-progress {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    gap: 5px;
}

.progress-bar {
    flex: 1;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #fff;
    border-radius: 2px;
    transition: width 0.1s linear !important;
    will-change: width;
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Для мгновенного завершения прогресса */
.progress-fill.completed {
    transition: width 0.2s ease-out !important;
}

.story-actions {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-story {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 24px;
    cursor: pointer;
}

/* Добавьте в CSS */
.story-item.loading .story-avatar {
    opacity: 0.7;
}

.story-item.loading .add-story-btn {
    animation: spin 1s linear infinite;
}

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

.story-item.my-story .story-avatar {
    border: 2px solid var(--primary-color);
}

.story-item.my-story.has-unviewed .story-avatar {
    border-color: #ff6b6b;
}

.story-item.my-story.viewed .story-avatar {
    border-color: var(--text-muted);
    opacity: 0.7;
}

.story-item.has-content .story-avatar {
    border: 2px solid var(--primary-color);
}

.story-item.has-unviewed .story-avatar {
    border-color: #ff6b6b;
    box-shadow: 0 0 10px rgba(255, 107, 107, 0.5);
}

.story-item.viewed .story-avatar {
    border-color: var(--text-muted);
    opacity: 0.7;
}

/* Контекстное меню */
.context-menu {
    position: fixed;
    background: var(--sidebar-bg);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 8px 0;
    min-width: 200px;
    z-index: 2000;
    border: 1px solid var(--border-color);
}

.context-menu-item {
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background-color 0.2s;
    color: var(--text-color);
}

.context-menu-item:hover {
    background: var(--secondary-color);
}

.context-menu-item i {
    width: 20px;
    margin-right: 12px;
    text-align: center;
    font-size: 16px;
}

.context-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    z-index: 1999;
}

/* Просмотрщик своих историй */
.my-stories-viewer {
    max-height: 60vh;
    overflow-y: auto;
}

.stories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.story-preview {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 9/16;
}

.story-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.story-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    padding: 8px;
    color: white;
    font-size: 12px;
}

.views-count, .story-time {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Добавьте эти стили в ваш CSS файл */
/* Стили для модального окна просмотра сторис */
#storyViewerModal .modal-content {
    background: rgba(0, 0, 0, 0.9) !important;
    border: none;
    border-radius: 0;
	transition: all 0.3s ease;
}

#storyViewerModal .modal-header {
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
    z-index: 1050;
}

#storyViewerModal .modal-body {
    background: #000;
}

.story-progress-container {
    height: 3px;
    margin-bottom: 10px;
}

.progress-bar {
    height: 100%;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    overflow: hidden;
    cursor: pointer;
}


.story-content {
    position: relative;
    min-height: 70vh;
    cursor: pointer;
}

.story-navigation {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    cursor: pointer;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.story-navigation.prev {
    left: 20px;
}

.story-navigation.next {
    right: 20px;
}

.story-content:hover .story-navigation {
    opacity: 1;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .story-navigation {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .story-navigation.prev {
        left: 10px;
    }
    
    .story-navigation.next {
        right: 10px;
    }
    
    #storyViewerModal .modal-header {
        padding: 15px;
    }
}

/* Анимации */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Эффекты для интерактивности */
.story-navigation:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) scale(1.1);
}

.progress-bar:hover .progress-fill {
    background: rgba(255, 255, 255, 0.8);
}

.video-controls {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.story-content:hover .video-controls {
    opacity: 1;
}

.sound-toggle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

/* Стили для модального окна описания истории */
#storyDescriptionModal .modal-dialog {
    max-width: 500px;
}

#storyDescriptionModal .emoji-btn-story {
    color: var(--text-muted);
    font-size: 1.2rem;
    transition: color 0.2s;
}

#storyDescriptionModal .emoji-btn-story:hover {
    color: var(--primary-color);
}

/* Панель эмодзи для описания */
#emojiPanelStory {
    z-index: 1060;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* В просмотрщике историй */
.story-caption {
    position: absolute;
    bottom: 60px;
    left: 0;
    right: 0;
    text-align: center;
    color: white;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
}

.story-caption-text {
    font-size: 16px;
    font-weight: 500;
    margin: 0;
    word-wrap: break-word;
}

/* Стили для превью медиа в модальном окне */
.story-media-preview {
    position: relative;
    width: 100%;
    height: 250px;
    border-radius: 10px;
    overflow: hidden;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 3rem;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.video-preview:hover .video-overlay {
    opacity: 1;
}

/* Стили для превью в списке историй */
.story-preview-media {
    position: relative;
    width: 100%;
    height: 150px;
    border-radius: 8px;
    overflow: hidden;
}

.story-preview-media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.story-preview-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.5);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

/* Стили для модального окна описания истории */
#storyDescriptionModal .modal-dialog {
    max-width: 600px;
}

#storyDescriptionModal .emoji-btn-story {
    color: var(--text-muted);
    font-size: 1.2rem;
    transition: color 0.2s;
}

#storyDescriptionModal .emoji-btn-story:hover {
    color: var(--primary-color);
}

/* Панель эмодзи для описания */
#emojiPanelStory {
    z-index: 1060;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* В просмотрщике историй */
.story-caption {
    position: absolute;
    bottom: 60px;
    left: 0;
    right: 0;
    text-align: center;
    color: white;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
}

.story-caption-text {
    font-size: 16px;
    font-weight: 500;
    margin: 0;
    word-wrap: break-word;
}

.story-caption-preview {
    font-size: 12px;
    margin-bottom: 5px;
    color: #666;
    word-wrap: break-word;
    max-height: 40px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Адаптивность */
@media (max-width: 768px) {
    .story-media-preview {
        height: 200px;
    }
    
    .story-preview-media {
        height: 120px;
    }
    
    #storyDescriptionModal .modal-dialog {
        margin: 10px;
    }
}

/* Контекстное меню для сообщений */
.message-context-menu {
    position: fixed;
    background: var(--sidebar-bg);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 8px 0;
    min-width: 200px;
    z-index: 9999; /* Очень высокий z-index */
    border: 1px solid var(--border-color);
    animation: fadeIn 0.2s ease;
    max-width: 90vw;	
}

.message-context-menu .context-menu-item {
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background-color 0.2s;
    color: var(--text-color);
    font-size: 14px;
}

.message-context-menu .context-menu-item:hover {
    background: var(--secondary-color);
}

.message-context-menu .context-menu-item i {
    width: 20px;
    margin-right: 12px;
    text-align: center;
    font-size: 16px;
    flex-shrink: 0;
}

/* Блок цитирования */
.reply-preview {
    background: var(--secondary-color);
    border-left: 4px solid var(--primary-color);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
    position: relative;
}

.reply-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    font-size: 12px;
    color: var(--text-muted);
}

.btn-close-reply {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 5px;
}

.reply-content {
    font-size: 14px;
    color: var(--text-color);
    max-height: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Выделение сообщений */
.message.selected {
    background-color: rgba(0, 136, 204, 0.1);
    border-radius: 8px;
}

.message.selected .message-bubble {
    background-color: rgba(0, 136, 204, 0.2);
}

.select-checkbox {
    position: absolute;
    top: 5px;
    left: 5px;
    z-index: 10;
}

/* Преview пересылаемых сообщений */
.forward-preview-item {
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 5px;
    background: var(--secondary-color);
}

.forward-preview-item .message-sender {
    font-weight: 500;
    font-size: 12px;
    color: var(--primary-color);
}

.forward-preview-item .message-content {
    font-size: 13px;
    margin-top: 3px;
}

/* Анимации */
@keyframes messageSelect {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.message.selecting {
    animation: messageSelect 0.3s ease;
}

/* Для мобильных устройств */
@media (max-width: 768px) {
    .message-context-menu {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        border-radius: 12px 12px 0 0;
        max-height: 70vh;
        overflow-y: auto;
    }
    
    .message-context-menu .context-menu-item {
        padding: 16px 20px;
    }
}

/* Добавить в style.css */
.contact-item.selected {
    background-color: rgba(0, 136, 204, 0.1) !important;
    border-left: 3px solid var(--primary-color);
}

.forward-preview {
    background: var(--secondary-color);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 15px;
}

.forward-preview h6 {
    margin-bottom: 10px;
    color: var(--text-color);
    font-weight: 600;
}

.forward-preview-item {
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 5px;
    background: var(--sidebar-bg);
}

.forward-preview-item .message-sender {
    font-weight: 500;
    font-size: 12px;
    color: var(--primary-color);
    margin-bottom: 3px;
}

.forward-preview-item .message-content {
    font-size: 13px;
    color: var(--text-color);
    word-wrap: break-word;
}

.selected-count {
    padding: 10px;
    background: var(--secondary-color);
    border-radius: 6px;
    text-align: center;
    font-weight: 500;
    color: var(--primary-color);
}

/* Стили для пересланных сообщений */
.forwarded-message-header {
    margin-bottom: 5px;
    padding: 2px 0;
}

.forwarded-from {
    display: flex;
    align-items: center;
    font-size: 11px;
    color: var(--text-muted);
    gap: 4px;
    transition: color 0.2s ease;
}

.forwarded-avatar {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    object-fit: cover;
}

.forwarded-name {
    font-weight: 500;
}

.forwarded-from:hover {
    color: var(--primary-color);
}

/* Для мобильных устройств */
@media (max-width: 768px) {
    .forwarded-from {
        font-size: 10px;
    }
    
    .forwarded-avatar {
        width: 14px;
        height: 14px;
    }
}

/* Стили для избранного чата */
.favorite-chat {
    background: linear-gradient(135deg, rgba(0, 136, 204, 0.15) 0%, rgba(13, 108, 156, 0.1) 100%) !important;
    border-left: 3px solid #0088cc !important;
}

.favorite-chat:hover {
    background: linear-gradient(135deg, rgba(0, 136, 210, 0.15) 0%, rgba(13, 108, 170, 0.1) 100%) !important;
}

.favorite-chat .contact-name {
    color: var(--text-color) !important;
    font-weight: 600 !important;
}

.favorite-indicator {
    position: absolute;
    top: 8px;
    left: 8px;
    color: #0088cc;
    font-size: 12px;
    z-index: 2;
}

/* Звездочка в заголовке чата */
.chat-user-name .favorite-star {
    color: #0088cc;
    margin-left: 5px;
    font-size: 0.8em;
}

/* Добавьте в style.css */
.in-app-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--sidebar-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 15px;
    margin: 10px;
    max-width: 350px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    cursor: pointer;
    backdrop-filter: blur(10px);
}

.in-app-notification.show {
    transform: translateX(0);
}

.notification-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.notification-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.notification-text {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    color: var(--text-color);
}

.notification-body {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.4;
    word-wrap: break-word;
}

.notification-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}

.notification-close:hover {
    background: var(--secondary-color);
    color: var(--text-color);
}

/* Настройки уведомлений */
.notification-settings {
    padding: 20px;
}

.notification-setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.notification-setting-item:last-child {
    border-bottom: none;
}

.setting-label {
    flex: 1;
}

.setting-description {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Для мобильных устройств */
@media (max-width: 768px) {
    .in-app-notification {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .notification-permission-request {
        position: fixed;
        bottom: 20px;
        left: 20px;
        right: 20px;
        background: var(--sidebar-bg);
        border-radius: 12px;
        padding: 15px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
        z-index: 10001;
    }
}

.notification-status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: auto;
    margin-right: 10px;
}

.notification-status-indicator.granted {
    background-color: #28a745;
}

.notification-status-indicator.denied {
    background-color: #dc3545;
}

.notification-status-indicator.default {
    background-color: #ffc107;
}

/* Стили для модального окна запроса разрешения */
#permissionRequestModal .modal-content {
    text-align: center;
}

#permissionRequestModal .fa-bell {
    animation: ring 2s infinite;
}

@keyframes ring {
    0%, 100% { transform: rotate(0); }
    25% { transform: rotate(15deg); }
    75% { transform: rotate(-15deg); }
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
    #permissionRequestModal .modal-dialog {
        margin: 20px;
    }
    
    .notification-status-indicator {
        margin-right: 5px;
    }
}

/* Для уведомлений */
.browser-steps {
    padding: 15px 0;
}

.step {
    display: flex;
    align-items: flex-start;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--secondary-color);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.step-number {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 15px;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
    color: var(--text-color);
}

.step-image {
    text-align: center;
    margin-top: 15px;
    padding: 10px;
    background: var(--secondary-color);
    border-radius: 8px;
}

.step-image img {
    max-width: 100%;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.browser-guide {
    max-height: 60vh;
    overflow-y: auto;
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
    .browser-steps {
        padding: 10px 0;
    }
    
    .step {
        flex-direction: column;
        padding: 12px;
        margin-bottom: 15px;
    }
    
    .step-number {
        margin-right: 0;
        margin-bottom: 10px;
    }
    
    #browserSettingsGuideModal .modal-dialog {
        margin: 10px;
    }
}