.chat-page-header {
    background: transparent;
    padding: 12px 24px;
    display: none;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    height: 64px;
}
.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}
.header-left .logo {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}
.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}
.status {
    font-size: 13px;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 500;
}
.status.online {
    background: #DCFCE7;
    color: #166534;
}
.status.offline {
    background: #FEE2E2;
    color: #991B1B;
}

.chat-layout {
    display: flex;
    height: 100vh;
}

/* Сайдбар (40%) */
.chat-sidebar {
    width: 30%;
    min-width: 280px;
    background: #FFFFFF;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}
.chat-sidebar-title {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 30px 16px 10px;
    background: #FFFFFF;
}
.chat-sidebar-title h2 {
    margin: 0;
    color: var(--text);
    font-size: 28px;
    font-weight: 700;
}
.menu-sidebar-btn {
    margin-left: auto;
    flex: 0 0 auto;
    background: var(--primary);
    color: white;
    border-radius: 8px;
    padding: 8px 12px;
}
.menu-sidebar-btn:hover {
    background: var(--primary-dark);
}
.search-bar {
    padding: 15px 16px;
    padding-bottom: 30px;
    display: flex;
    gap: 8px;
    align-items: center;
    background: #FFFFFF;
}
.menu-search-btn {
    flex: 0 0 auto;
    background: var(--primary);
    color: white;
    border-radius: 8px;
    padding: 8px 12px;
}
.menu-search-btn:hover {
    background: var(--primary-dark);
}
.search-bar input {
    flex: 1;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 14px;
    transition: all 0.2s;
}
.search-bar input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.1);
}
.search-bar .btn-icon {
    background: var(--primary);
    color: white;
    border-radius: 8px;
    padding: 8px 14px;
}
.search-bar .btn-icon:hover {
    background: var(--primary-dark);
}

.chat-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
    background: #FFFFFF;
}

.sidebar-security-note {
    flex: 0 0 auto;
    display: flex;
    justify-content: center;
    gap: 4px;
    padding: 14px 18px 18px;
    background: #FFFFFF;
    color: #8a8a8a;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.35;
    text-align: center;
}

.sidebar-security-note a {
    color: #8a8a8a;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.sidebar-security-note a:hover {
    text-decoration: underline;
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid transparent;
}
.chat-item:hover {

}
.chat-item.active {
    background: var(--primary);

}

.chat-item.active .chat-name {
    color: var(--white);
}

.chat-item.active .chat-last {
    color: var(--white);
}

.chat-item.active .chat-time {
    color: var(--white);
}

.chat-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary-light);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    flex-shrink: 0;
}
.chat-info {
    flex: 1;
    min-width: 0;
}
.chat-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text);
}
.chat-last {
    font-size: 13px;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}
.chat-time {
    font-size: 11px;
    color: #9CA3AF;
    flex-shrink: 0;
}

/* Окно чата (60%) */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #FFFFFF;
}
.chat-welcome {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--white);
    margin: 20px;
    border-radius: 16px;
}
.welcome-content {
    text-align: center;
    color: var(--text-light);
}
.welcome-content h2 {
    font-size: 28px;
    color: var(--text);
    margin-bottom: 8px;
}

.chat-window {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: #FFFFFF;
    position: relative;
    overflow: hidden;
}
.current-chat-bar {
    flex: 0 0 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
    background: rgba(255, 255, 255, 0.30);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(14px);
    color: var(--text);
    font-size: 18px;
    font-weight: 700;
    position: relative;
    z-index: 2;
}
.current-chat-bar span {
    overflow: hidden;
    max-width: 100%;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.current-chat-heading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-width: 0;
    max-width: 100%;
}
.current-chat-status {
    flex: 0 0 auto;
    font-size: 12px;
    font-weight: 500;
}
.current-chat-status.online {
    color: #16a34a;
}
.current-chat-status.offline {
    color: #6b7280;
}
.current-chat-status.typing {
    color: #2563eb;
}
.current-chat-bar.is-disconnected {
    color: #ef4444;
}
.chat-messages {
    min-height: 0;
    overflow-y: auto;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    padding: 74px 20px 84px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #FFFFFF;
}

.message {
    max-width: 70%;
    padding: 10px 16px;
    border-radius: 10px;
    background: var(--white);
    animation: fadeIn 0.15s ease;
    word-wrap: break-word;
    line-height: 1.4;
}
.message-sent {
    align-self: flex-end;
    background: linear-gradient(135deg, #5370ff 0%, #6dc7ff 100%);
    color: white;
    border-radius: 15px;
}
.message-received {
    align-self: flex-start;
    background: #f2f2f2;
    color: var(--text);
    border-radius:15px;

}

.message-time {
    font-size: 10px;
    opacity: 0.6;
    margin-top: 4px;
    text-align: right;
}
.message-sent .message-time {
    color: rgba(255,255,255,0.7);
}

.chat-input {
    position: absolute;
    left: 50%;
    bottom: 10px;
    right: auto;
    width: 90%;
    box-sizing: border-box;
    transform: translateX(-50%);
    padding: 12px 20px;
    background: transparent;
    border: 0;
    box-shadow: none;
    display: flex;
    gap: 10px;
    align-items: flex-end;

    z-index: 20;
}

@media (max-width: 768px) {
    .chat-input {
        left: 0;
        width: 100%;
        transform: none;
    }
}

.chat-input textarea {
    flex: 1;
    resize: none;
    border-radius: 20px;
    padding: 10px 16px;
    min-height: 42px;
    max-height: 120px;
    border: 1px solid var(--border);
    background: var(--white);
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s;
}

.chat-input .btn-send {
    background: var(--primary);
    color: white;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    padding: 0;
    font-size: 18px;
}
.chat-input .btn-send:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

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

@media (max-width: 768px) {
    .chat-sidebar {
        width: 100%;
        min-width: unset;
        max-height: 40vh;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .chat-layout {
        flex-direction: column;
    }
    .chat-main {
        height: 60vh;
    }
    .message {
        max-width: 85%;
    }
}

/* Profile Page */
.profile-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #FAFBFC;
    padding: 20px;
}

.profile-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 40px 20px;
}

.profile-content {
    text-align: center;
    max-width: 400px;
}

.profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--primary-light);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 48px;
    flex-shrink: 0;
    margin: 0 auto 24px;
    box-shadow: 0 4px 12px rgba(108, 99, 255, 0.25);
}

.profile-info {
    text-align: center;
}

.profile-username {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 16px 0;
}

.profile-email,
.profile-phone,
.profile-uuid {
    font-size: 15px;
    color: var(--text-light);
    margin: 8px 0;
    word-break: break-all;
    font-family: 'Courier New', monospace;
}